Răsfoiți Sursa

增加报价单
外销合同 暂存功能

caozj 1 an în urmă
părinte
comite
e79fc1adf7

+ 7 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/sale/SaleQuotationController.java

@@ -45,6 +45,13 @@ public class SaleQuotationController {
     public SaleQuotationVo detail(@RequestBody BaseSelectDto dto) {
         return saleQuotationService.detail(dto.getId());
     }
+    /**
+     * 报价表新增
+     */
+    @PostMapping("/add")
+    public void detail(@RequestBody SaleQuotationDto saleQuotationDto) {
+        saleQuotationService.add(saleQuotationDto);
+    }
 
     /**
      * 报价单的复制功能

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java

@@ -309,6 +309,11 @@ public class Contract extends BasePo {
     private Long oldContractId;
 
     /**
+     * 数据JSON
+     */
+    private String dataJson;
+
+    /**
      * 版本号
      */
     @TableField(fill = FieldFill.INSERT)

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/sale/po/SaleQuotation.java

@@ -179,4 +179,9 @@ public class SaleQuotation extends BasePo {
      * 尔弘时代扩展json字段
      */
     private String ehsdJson;
+
+    /**
+     * 数据JSON
+     */
+    private String dataJson;
 }

+ 15 - 5
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -518,15 +518,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         if (StringUtils.isEmpty(contract.getCurrency())) {
             throw new ServiceException("币种不能为空");
         }
-        //赋值合同号
-        contract.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract.getBuyCorporationId()));
+        if(ObjectUtil.isEmpty(contract.getId())){
+            //赋值合同号
+            contract.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract.getBuyCorporationId()));
+        }
         // 保存合同产品
         List<ContractProduct> contractProductList = contract.getContractProductList();
         // 赋值待处理数量
         if (CollectionUtils.isNotEmpty(contractProductList)) {
             contractProductList.forEach(item -> item.setExpendQuantity(item.getQuantity()));
         }
-        contract = commStart(contract, 0);
+        contract = commStart(contract);
         return contract.getId();
     }
     /**
@@ -534,7 +536,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
      *
      * @param opType 操作类型 0直接发起 1重新发起
      */
-    public ContractDto commStart(ContractDto contract, Integer opType) {
+    public ContractDto commStart(ContractDto contract) {
         // 赋值城市省份信息
         CustomizeAreaUtil.setAreaId(contract);
         contract.setUserName(SecurityUtils.getUsername());
@@ -547,6 +549,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         // 保存合同产品
         List<ContractProduct> contractProductList = contract.getContractProductList();
         if (CollectionUtils.isNotEmpty(contractProductList)) {
+            if (ObjectUtil.isNotEmpty(contract.getId())) {
+                contractProductService.editLinked(contractProductList, ContractProduct::getContractId, contract.getId());
+            }
             for (ContractProduct c : contractProductList) {
                 c.setContractId(contract.getId());
             }
@@ -555,6 +560,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         // 保存收费项目
         List<ContractProject> contractProjectList = contract.getContractProjectList();
         if (CollectionUtils.isNotEmpty(contractProjectList)) {
+            if (ObjectUtil.isNotEmpty(contract.getId())) {
+                contractProjectService.editLinked(contractProjectList, ContractProject::getContractId, contract.getId());
+            }
             for (ContractProject c : contractProjectList) {
                 c.setContractId(contract.getId());
             }
@@ -563,6 +571,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         // 保存自定义出货
         List<ContractShipment> contractShipmentList = contract.getContractShipmentList();
         if (CollectionUtils.isNotEmpty(contractShipmentList)) {
+            if (ObjectUtil.isNotEmpty(contract.getId())) {
+                contractShipmentService.editLinked(contractShipmentList, ContractShipment::getContractId, contract.getId());
+            }
             for (ContractShipment c : contractShipmentList) {
                 c.setContractId(contract.getId());
             }
@@ -1607,5 +1618,4 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     public List<AccountRunningWaterVo> getAccountRunningWaterByContractId(Long contractId) {
         return baseMapper.getAccountRunningWaterByContractId(contractId);
     }
-
 }

+ 11 - 1
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -24,6 +24,7 @@ import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.fjhx.customer.service.customer.CustomerService;
 import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.item.service.product.ProductInfoService;
+import com.fjhx.sale.entity.contract.po.ContractProduct;
 import com.fjhx.sale.entity.contract.vo.ContractVo;
 import com.fjhx.sale.entity.quotation.po.QuotationPay;
 import com.fjhx.sale.entity.quotation.po.QuotationProduct;
@@ -179,18 +180,27 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         saleQuotation.setBuyCountryId(saleQuotation.getCountryId());
         saleQuotation.setBuyProvinceId(saleQuotation.getProvinceId());
         //添加报价编码
-        saleQuotation.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(),saleQuotation.getBuyCorporationId()));
+        if(ObjectUtil.isEmpty(saleQuotation.getId())){
+            saleQuotation.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(),saleQuotation.getBuyCorporationId()));
+        }
+
         //添加报价状态
         saleQuotation.setStatus(SaleQuotationEnum.DRAFT.getKey());
         //添加报价单信息
         this.saveOrUpdate(saleQuotation);
         List<QuotationProduct> quotationProductList = saleQuotation.getQuotationProductList();
         if(CollectionUtils.isNotEmpty(quotationProductList)){//保存报价产品信息
+            if (ObjectUtil.isNotEmpty(saleQuotation.getId())) {
+                quotationProductService.editLinked(quotationProductList, QuotationProduct::getSaleQuotationId, saleQuotation.getId());
+            }
             quotationProductList.forEach(quotationProduct -> quotationProduct.setSaleQuotationId(saleQuotation.getId()));
             quotationProductService.saveOrUpdateBatch(quotationProductList);
         }
         List<QuotationPay> quotationPayList = saleQuotation.getQuotationPayList();
         if(CollectionUtils.isNotEmpty(quotationPayList)){//保存报价项目信息
+            if (ObjectUtil.isNotEmpty(saleQuotation.getId())) {
+                quotationPayService.editLinked(quotationPayList, QuotationPay::getSaleQuotationId, saleQuotation.getId());
+            }
             quotationPayList.forEach(quotationPay -> quotationPay.setSaleQuotationId(saleQuotation.getId()));
             quotationPayService.saveOrUpdateBatch(quotationPayList);
         }