|
@@ -3,10 +3,7 @@ package com.fjhx.sale.flow;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.*;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
@@ -16,6 +13,7 @@ import com.fjhx.sale.entity.contract.po.Contract;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractProduct;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractProject;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractShipment;
|
|
|
+import com.fjhx.sale.entity.sample.po.Sample;
|
|
|
import com.fjhx.sale.service.contract.ContractProductService;
|
|
|
import com.fjhx.sale.service.contract.ContractProjectService;
|
|
|
import com.fjhx.sale.service.contract.ContractService;
|
|
@@ -103,6 +101,7 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
code = code.substring(0, code.lastIndexOf("("));
|
|
|
}
|
|
|
contract.setCode(code + "(" + index + ")");
|
|
|
+ contract.setStatus(FlowStatusEnum1.UPDATE_LOADING.getKey());
|
|
|
|
|
|
* 计算新合同的剩余数量
|
|
|
*/
|
|
@@ -151,13 +150,25 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
if (oldContract == null) {
|
|
|
throw new ServiceException("原合同不存在");
|
|
|
}
|
|
|
+ long temOldId = IdWorker.getId();
|
|
|
+ long temNewId = IdWorker.getId();
|
|
|
+ Contract temOldUpContract = new Contract();
|
|
|
+ temOldUpContract.setId(temOldId);
|
|
|
+ temOldUpContract.setUpId(oldContractId);
|
|
|
+ Contract temNewUpContract = new Contract();
|
|
|
+ temNewUpContract.setId(temNewId);
|
|
|
+ temNewUpContract.setUpId(businessId);
|
|
|
+
|
|
|
+ contractService.updateContract(temOldUpContract);
|
|
|
+ contractService.updateContract(temNewUpContract);
|
|
|
|
|
|
* 处理新合同---
|
|
|
*/
|
|
|
newContract.setId(oldContractId);
|
|
|
newContract.setStatus(FlowStatusEnum1.PASS.getKey());
|
|
|
newContract.setApprovedDate(new Date());
|
|
|
- contractService.update(newContract,Wrappers.<Contract>query().lambda().eq(Contract::getId,businessId));
|
|
|
+ newContract.setUpId(businessId);
|
|
|
+ contractService.updateContract(newContract);
|
|
|
|
|
|
contractProductService.update(Wrappers.<ContractProduct>update().lambda().set(ContractProduct::getContractId,oldContractId).eq(ContractProduct::getContractId,businessId));
|
|
|
|
|
@@ -170,7 +181,8 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
oldContract.setId(businessId);
|
|
|
oldContract.setStatus(FlowStatusEnum1.UPDATE.getKey());
|
|
|
oldContract.setIsChange("1");
|
|
|
- contractService.update(oldContract,Wrappers.<Contract>query().lambda().eq(Contract::getId,oldContractId));
|
|
|
+ newContract.setUpId(oldContractId);
|
|
|
+ contractService.updateContract(oldContract);
|
|
|
|
|
|
contractProductService.update(Wrappers.<ContractProduct>update().lambda().set(ContractProduct::getContractId,businessId).eq(ContractProduct::getContractId,oldContractId));
|
|
|
|