Переглянути джерело

售后明细添加合同号

yzc 1 рік тому
батько
коміт
09032fff0b

+ 12 - 3
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesServiceImpl.java

@@ -13,10 +13,12 @@ import com.fjhx.sale.entity.after.dto.AfterSalesDto;
 import com.fjhx.sale.entity.after.dto.AfterSalesSelectDto;
 import com.fjhx.sale.entity.after.po.AfterSales;
 import com.fjhx.sale.entity.after.vo.AfterSalesVo;
+import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.po.ContractProduct;
 import com.fjhx.sale.mapper.after.AfterSalesMapper;
 import com.fjhx.sale.service.after.AfterSalesService;
 import com.fjhx.sale.service.contract.ContractProductService;
+import com.fjhx.sale.service.contract.ContractService;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
@@ -39,12 +41,14 @@ import java.util.List;
 @Service
 public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSales> implements AfterSalesService {
 
+    private final ContractService contractService;
     private final ContractProductService contractProductService;
     private final ProductInfoService productInfoService;
     private final CodingRuleService codingRuleService;
 
     @Autowired
-    public AfterSalesServiceImpl(ContractProductService contractProductService, ProductInfoService productInfoService, CodingRuleService codingRuleService) {
+    public AfterSalesServiceImpl(ContractService contractService, ContractProductService contractProductService, ProductInfoService productInfoService, CodingRuleService codingRuleService) {
+        this.contractService = contractService;
         this.contractProductService = contractProductService;
         this.productInfoService = productInfoService;
         this.codingRuleService = codingRuleService;
@@ -85,8 +89,8 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
 
     @Override
     public AfterSalesVo detail(Long id) {
-        AfterSales AfterSales = this.getById(id);
-        AfterSalesVo result = BeanUtil.toBean(AfterSales, AfterSalesVo.class);
+        AfterSales afterSales = this.getById(id);
+        AfterSalesVo result = BeanUtil.toBean(afterSales, AfterSalesVo.class);
         //赋值产品信息
         ProductInfo productInfo = productInfoService.getById(result.getProductId());
         result.setProductName(productInfo.getName());
@@ -96,6 +100,11 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
         result.setProductHeight(productInfo.getHeight());
         result.setProductColor(productInfo.getColor());
 
+        Contract contract = contractService.getById(afterSales.getContractId());
+        if (ObjectUtil.isNotEmpty(contract)) {
+            result.setContractCode(contract.getCode());
+        }
+
         //赋值用户名称
         UserUtil.assignmentNickName(Arrays.asList(result), AfterSalesVo::getUserId, AfterSalesVo::setUserName);