yzc 1 rok pred
rodič
commit
c8a360584d

+ 9 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSales.java

@@ -92,5 +92,14 @@ public class AfterSales extends BasePo {
      */
     private String accountOpening;
 
+    /**
+     * 售后新合同id
+     */
+    private Long newContractId;
+    /**
+     * 打款id
+     */
+    private Long paymentId;
+
 
 }

+ 13 - 8
hx-sale/src/main/java/com/fjhx/sale/flow/AfterSalesFlow.java

@@ -81,7 +81,6 @@ public class AfterSalesFlow extends FlowDelegate {
     public void end(Long flowId, Long businessId, JSONObject submitData) {
         AfterSales afterSales = afterSalesService.getById(businessId);
         afterSales.setStatus(FlowStatusEnum1.PASS.getKey());
-        afterSalesService.updateById(afterSales);
 
 
         Long contractProductId = afterSales.getContractProductId();
@@ -116,22 +115,28 @@ public class AfterSalesFlow extends FlowDelegate {
             accountPayment.setCompanyId(afterSales.getCompanyId());
 
             accountPaymentService.save(accountPayment);
+
+            afterSales.setPaymentId(accountPayment.getId());
         }
         //如果售后类型=补发10/换货20。审批通过后,生成一条销售订单,与原销售订单信息基本一致:商品清单只有这一条,数量=售后数量,价格=0。默认审批通过
         if (ObjectUtil.equals(afterSales.getType(), "10") || ObjectUtil.equals(afterSales.getType(), "20")) {
-            Contract contract = contractService.getById(contractProduct.getContractId());
-            Assert.notEmpty(contract, "查询不到合同信息!");
-            contract.setId(null);
-            contract.setAmount(BigDecimal.ZERO);
-            contract.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract.getBuyCorporationId()));
-            contractService.save(contract);
+            Contract contract1 = contractService.getById(contractProduct.getContractId());
+            Assert.notEmpty(contract1, "查询不到合同信息!");
+            contract1.setId(null);
+            contract1.setAmount(BigDecimal.ZERO);
+            contract1.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract1.getBuyCorporationId()));
+            contractService.save(contract1);
+
+            afterSales.setNewContractId(contract1.getId());
 
             ContractProduct contractProduct1 = contractProductService.getById(contractProductId);
             contractProduct1.setId(null);
-            contractProduct1.setContractId(contract.getId());
+            contractProduct1.setContractId(contract1.getId());
             contractProduct1.setPrice(BigDecimal.ZERO);
             contractProduct1.setQuantity(afterSales.getQuantity());
             contractProductService.save(contractProduct1);
         }
+
+        afterSalesService.updateById(afterSales);
     }
 }