|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -12,7 +13,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.account.controller.utils.DateUtils;
|
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
|
import com.fjhx.account.service.account.AccountManagementService;
|
|
|
-import com.fjhx.area.utils.AreaUtil;
|
|
|
+import com.fjhx.area.service.SetCustomizeAreaId;
|
|
|
+import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
import com.fjhx.common.entity.documentary.bo.DocumentaryData;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum;
|
|
@@ -23,7 +25,6 @@ import com.fjhx.customer.entity.customer.po.Customer;
|
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
-import com.fjhx.sale.entity.commission.dto.CommissionDto;
|
|
|
import com.fjhx.sale.entity.contract.bo.ContractDocumentaryBo;
|
|
|
import com.fjhx.sale.entity.contract.dto.ContractDto;
|
|
|
import com.fjhx.sale.entity.contract.dto.ContractSelectDto;
|
|
@@ -91,9 +92,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Autowired
|
|
|
private AccountManagementService accountManagementService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ContractService contractService;
|
|
|
-
|
|
|
/**
|
|
|
* 分页
|
|
|
*
|
|
@@ -117,7 +115,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
Page<ContractVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<ContractVo> list = page.getRecords();
|
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
|
- List<Long> companyIds = list.stream().map(Contract::getSellCorporationId).collect(Collectors.toList());
|
|
|
List<Long> customerIds = list.stream().map(Contract::getBuyCorporationId).collect(Collectors.toList());
|
|
|
List<Customer> customerList = customerService.list(Wrappers.<Customer>query().lambda().in(Customer::getId,customerIds));
|
|
|
Map<Long,List<Customer>> cusMap = customerList.stream().distinct().collect(Collectors.groupingBy(Customer::getId));
|
|
@@ -138,13 +135,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @DSTransactional
|
|
|
@Override
|
|
|
public void add(ContractDto contractDto) {
|
|
|
+ setAreaId(contractDto);
|
|
|
this.save(contractDto);
|
|
|
}
|
|
|
|
|
|
+ @DSTransactional
|
|
|
@Override
|
|
|
public void edit(ContractDto contractDto) {
|
|
|
+ setAreaId(contractDto);
|
|
|
this.updateById(contractDto);
|
|
|
}
|
|
|
|
|
@@ -504,16 +505,19 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
*/
|
|
|
private void setArea(ContractPdfInfoVo contractPdfInfoVo, Contract contract) {
|
|
|
|
|
|
- List<String> areaIdList = Arrays.asList(
|
|
|
+ List<Long> areaIdList = Arrays.asList(
|
|
|
contract.getBuyCountryId(),
|
|
|
contract.getBuyProvinceId(),
|
|
|
- contract.getBuyCityId()
|
|
|
+ contract.getBuyCityId(),
|
|
|
+ contract.getSellCountryId(),
|
|
|
+ contract.getSellProvinceId(),
|
|
|
+ contract.getSellCityId()
|
|
|
);
|
|
|
|
|
|
- Map<String, String> areaMap = AreaUtil.getAreaMapByIds(areaIdList);
|
|
|
- contractPdfInfoVo.setSellCountryName(contract.getSellCountryId());
|
|
|
- contractPdfInfoVo.setSellProvinceName(contract.getSellProvinceId());
|
|
|
- contractPdfInfoVo.setSellCityName(contract.getSellCityId());
|
|
|
+ Map<Long, String> areaMap = CustomizeAreaUtil.getAreaMapByIds(areaIdList);
|
|
|
+ contractPdfInfoVo.setSellCountryName(areaMap.get(contract.getSellCountryId()));
|
|
|
+ contractPdfInfoVo.setSellProvinceName(areaMap.get(contract.getSellProvinceId()));
|
|
|
+ contractPdfInfoVo.setSellCityName(areaMap.get(contract.getSellCityId()));
|
|
|
contractPdfInfoVo.setSellDetailedAddress(contract.getSellAddress());
|
|
|
contractPdfInfoVo.setBuyCountryName(areaMap.get(contract.getBuyCountryId()));
|
|
|
contractPdfInfoVo.setBuyProvinceName(areaMap.get(contract.getBuyProvinceId()));
|
|
@@ -585,10 +589,92 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
contractPdfInfoVo.setBeneficiaryAddress(accountManagement.getBeneficiaryAddress());
|
|
|
}
|
|
|
|
|
|
- //添加时间的查询条件
|
|
|
- private void selectTime(QueryWrapper<Contract> query,ContractDto dto){
|
|
|
- query.ge("DATE_FORMAT(create_time,'%Y-%m')",dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(create_time,'%Y-%m')",dto.getEndTime());
|
|
|
+ // 添加时间的查询条件
|
|
|
+ private void selectTime(QueryWrapper<Contract> query, ContractDto dto) {
|
|
|
+ query.ge("DATE_FORMAT(create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
+ query.le("DATE_FORMAT(create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setAreaId(ContractDto contractDto) {
|
|
|
+
|
|
|
+ SetCustomizeAreaId setCustomizeAreaId1 = new SetCustomizeAreaId() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setProvinceId(Long provinceId) {
|
|
|
+ contractDto.setBuyProvinceId(provinceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setCityId(Long cityId) {
|
|
|
+ contractDto.setBuyCityId(cityId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getCountryId() {
|
|
|
+ return contractDto.getBuyCountryId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getProvinceId() {
|
|
|
+ return contractDto.getBuyProvinceId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getProvinceName() {
|
|
|
+ return contractDto.getBuyProvinceName();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getCityId() {
|
|
|
+ return contractDto.getBuyCityId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getCityName() {
|
|
|
+ return contractDto.getBuyCityName();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ SetCustomizeAreaId setCustomizeAreaId2 = new SetCustomizeAreaId() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setProvinceId(Long provinceId) {
|
|
|
+ contractDto.setSellProvinceId(provinceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setCityId(Long cityId) {
|
|
|
+ contractDto.setSellCityId(cityId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getCountryId() {
|
|
|
+ return contractDto.getSellCountryId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getProvinceId() {
|
|
|
+ return contractDto.getSellProvinceId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getProvinceName() {
|
|
|
+ return contractDto.getSellProvinceName();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getCityId() {
|
|
|
+ return contractDto.getSellCityId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getCityName() {
|
|
|
+ return contractDto.getSellCityName();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ CustomizeAreaUtil.setAreaId(Arrays.asList(setCustomizeAreaId1, setCustomizeAreaId2));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|