Browse Source

待建产品问题处理

yzc 1 năm trước cách đây
mục cha
commit
19cd489952

+ 40 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationProductServiceImpl.java

@@ -22,11 +22,17 @@ import com.fjhx.sale.entity.ext.po.ExtQuotationProductCustomInfo;
 import com.fjhx.sale.entity.ext.vo.ExtQuotationProductBomVo;
 import com.fjhx.sale.entity.ext.vo.ExtQuotationProductCustomInfoVo;
 import com.fjhx.sale.entity.ext.vo.ExtQuotationProductVo;
+import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import com.fjhx.sale.entity.quotation.po.QuotationProductCustomInfo;
 import com.fjhx.sale.mapper.ext.ExtQuotationProductMapper;
 import com.fjhx.sale.service.ext.ExtQuotationProductBomService;
 import com.fjhx.sale.service.ext.ExtQuotationProductCustomInfoService;
 import com.fjhx.sale.service.ext.ExtQuotationProductService;
 import com.fjhx.sale.service.ext.ExtQuotationService;
+import com.fjhx.sale.service.quotation.QuotationProductBomService;
+import com.fjhx.sale.service.quotation.QuotationProductCustomInfoService;
+import com.fjhx.sale.service.quotation.QuotationProductService;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
@@ -61,6 +67,12 @@ public class ExtQuotationProductServiceImpl extends ServiceImpl<ExtQuotationProd
     private ExtQuotationProductService extQuotationProductService;
     @Autowired
     private ExtQuotationService extQuotationService;
+    @Autowired
+    private QuotationProductService quotationProductService;
+    @Autowired
+    private QuotationProductBomService quotationProductBomService;
+    @Autowired
+    private QuotationProductCustomInfoService quotationProductCustomInfoService;
 
     @Override
     public Page<ExtQuotationProductVo> waitCreateProductPage(ExtQuotationProductSelectDto dto) {
@@ -76,6 +88,8 @@ public class ExtQuotationProductServiceImpl extends ServiceImpl<ExtQuotationProd
         wrapper.in("eq.company_id", SecurityUtils.getCompanyIds());
         wrapper.eq("eq.company_id", dto.getCompanyId());
 
+        wrapper.groupBy("eqp.id");
+
         Page<ExtQuotationProductVo> page = baseMapper.waitCreateProductPage(dto.getPage(), wrapper);
         List<ExtQuotationProductVo> records = page.getRecords();
         if (ObjectUtil.isEmpty(records)) {
@@ -148,6 +162,8 @@ public class ExtQuotationProductServiceImpl extends ServiceImpl<ExtQuotationProd
         ExtQuotationProduct extQuotationProduct = this.getById(extQuotationProductId);
         Assert.notEmpty(extQuotationProduct, "查询不到对外报价单产品信息");
 
+
+        //更新对外产品信息
         this.update(q -> q
                 .eq(ExtQuotationProduct::getId, extQuotationProductId)
                 .set(ExtQuotationProduct::getProductId, productInfoDto.getId())
@@ -169,6 +185,30 @@ public class ExtQuotationProductServiceImpl extends ServiceImpl<ExtQuotationProd
                 .set(BasePo::getUpdateTime, new Date())
         );
 
+        //更新对内报价单产品信息
+        Long quotationProductId = extQuotationProduct.getQuotationProductId();
+
+        quotationProductService.update(q -> q
+                .eq(QuotationProduct::getId, quotationProductId)
+                .set(QuotationProduct::getProductId, productInfoDto.getId())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                .set(BasePo::getUpdateTime, new Date())
+        );
+
+        quotationProductBomService.update(q -> q
+                .eq(QuotationProductBom::getQuotationProductId, quotationProductId)
+                .set(QuotationProductBom::getProductId, productInfoDto.getId())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                .set(BasePo::getUpdateTime, new Date())
+        );
+
+        quotationProductCustomInfoService.update(q -> q
+                .eq(QuotationProductCustomInfo::getQuotationProductId, quotationProductId)
+                .set(QuotationProductCustomInfo::getProductId, productInfoDto.getId())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                .set(BasePo::getUpdateTime, new Date())
+        );
+
         //更新状态
         List<ExtQuotationProduct> list = extQuotationProductService.list(q -> q
                 .eq(ExtQuotationProduct::getSaleQuotationId, extQuotationProduct.getSaleQuotationId())