Browse Source

变更导致流程业务id异常问题处理

yzc 1 year ago
parent
commit
d644b7922f
1 changed files with 15 additions and 0 deletions
  1. 15 0
      hx-sale/src/main/java/com/fjhx/sale/flow/ContractUpdateFlow.java

+ 15 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/ContractUpdateFlow.java

@@ -14,7 +14,9 @@ import com.fjhx.common.utils.Assert;
 import com.fjhx.common.utils.ExchangeRateUtil;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.fjhx.flow.core.FlowDelegate;
+import com.fjhx.flow.entity.flow.po.FlowExample;
 import com.fjhx.flow.enums.FlowStatusEnum;
+import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.sale.entity.claim.po.Claim;
 import com.fjhx.sale.entity.claim.po.ClaimContract;
 import com.fjhx.sale.entity.contract.dto.ContractDto;
@@ -75,6 +77,8 @@ public class ContractUpdateFlow extends FlowDelegate {
 
     @Autowired
     private ContractShipmentService contractShipmentService;
+    @Autowired
+    private FlowExampleService flowExampleService;
 
     @Override
     public String getFlowKey() {
@@ -240,6 +244,17 @@ public class ContractUpdateFlow extends FlowDelegate {
         if (oldContract == null) {
             throw new ServiceException("原合同不存在");
         }
+
+        //交换流程表中的业务id
+        FlowExample newFlowExample = flowExampleService.getById(flowId);
+        newFlowExample.setBusinessId(oldContractId);
+        flowExampleService.updateById(newFlowExample);
+
+        FlowExample oldFlowExample = flowExampleService.getById(oldContract.getFlowId());
+        oldFlowExample.setBusinessId(businessId);
+        flowExampleService.updateById(oldFlowExample);
+
+
         //替换新数据ID为临时ID
         long temNewId = IdWorker.getId();
         Contract temNewUpContract = new Contract();