|
@@ -3,11 +3,11 @@ package com.fjhx.sale.flow;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
-import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.*;
|
|
|
-import com.fjhx.common.constant.SourceConstant;
|
|
|
+import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
+import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
|
import com.fjhx.item.entity.product.po.ProductInfoEhsdJson;
|
|
|
import com.fjhx.sale.entity.contract.dto.ContractDto;
|
|
@@ -24,7 +24,9 @@ import com.fjhx.sale.service.contract.ContractProjectService;
|
|
|
import com.fjhx.sale.service.contract.ContractService;
|
|
|
import com.fjhx.sale.service.contract.ContractShipmentService;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -42,7 +44,6 @@ import java.util.stream.Collectors;
|
|
|
* 合同变更流程
|
|
|
*/
|
|
|
@Component
|
|
|
-@DS(SourceConstant.SALE)
|
|
|
public class ContractUpdateFlow extends FlowDelegate {
|
|
|
|
|
|
@Autowired
|
|
@@ -137,7 +138,7 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return contractFlow.start(contract);
|
|
|
+ return update(contract);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -228,4 +229,58 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
contractShipmentService.update(Wrappers.<ContractShipment>update().lambda().set(ContractShipment::getContractId,businessId).in(ContractShipment::getId,oldContractShipmentIds));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 变更
|
|
|
+ * @param contract
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Long update(ContractDto contract) {
|
|
|
+
|
|
|
+ CustomizeAreaUtil.setAreaId(contract);
|
|
|
+ SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
|
|
+ contract.setUserName(loginUser.getNickName());
|
|
|
+ contract.setBuyCityId(contract.getCityId());
|
|
|
+ contract.setBuyCountryId(contract.getCountryId());
|
|
|
+ contract.setBuyProvinceId(contract.getProvinceId());
|
|
|
+ contract.setStatus(FlowStatusEnum1.UNDER_REVIEW.getKey());
|
|
|
+
|
|
|
+ contractService.save(contract);
|
|
|
+
|
|
|
+
|
|
|
+ List<ContractProduct> contractProductList = contract.getContractProductList();
|
|
|
+ if (CollectionUtils.isNotEmpty(contractProductList)) {
|
|
|
+ for (ContractProduct c : contractProductList) {
|
|
|
+ c.setContractId(contract.getId());
|
|
|
+
|
|
|
+ }
|
|
|
+ contractProductService.saveBatch(contractProductList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ContractProject> contractProjectList = contract.getContractProjectList();
|
|
|
+ if (CollectionUtils.isNotEmpty(contractProjectList)) {
|
|
|
+ for (ContractProject c : contractProjectList) {
|
|
|
+ c.setContractId(contract.getId());
|
|
|
+ }
|
|
|
+ contractProjectService.saveBatch(contractProjectList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ContractShipment> contractShipmentList = contract.getContractShipmentList();
|
|
|
+ if (CollectionUtils.isNotEmpty(contractShipmentList)) {
|
|
|
+ for (ContractShipment c : contractShipmentList) {
|
|
|
+ c.setContractId(contract.getId());
|
|
|
+ }
|
|
|
+ contractShipmentService.saveBatch(contractShipmentList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ObsFileUtil.saveFile(contract.getFileList(), contract.getId(), 1);
|
|
|
+
|
|
|
+
|
|
|
+ ObsFileUtil.saveFile(contract.getPackageFileList(), contract.getId(), 2);
|
|
|
+
|
|
|
+ return contract.getId();
|
|
|
+ }
|
|
|
}
|