yzc il y a 1 an
Parent
commit
b8996f7d6b

+ 8 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/contract/ContractProductController.java

@@ -60,6 +60,14 @@ public class ContractProductController {
     }
 
     /**
+     * 外销合同-合同id集合查询产品
+     */
+    @PostMapping("/getListDetailByContractId")
+    public List<ContractProductVo> getListDetailByContractId(@RequestBody List<Long> contractIds) {
+        return contractProductService.getListDetailByContractId(contractIds);
+    }
+
+    /**
      * 外销合同-产品明细
      */
     @PostMapping("/detail")

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

@@ -26,7 +26,7 @@ public class AfterSales extends BasePo {
     /**
      * 销售合同id
      */
-    private Long contractId;
+    private String contractIds;
 
     /**
      * 售后类型 字典

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

@@ -60,4 +60,9 @@ public class AfterSalesDetail extends BasePo {
      */
     private Integer status;
 
+    /**
+     * 合同id
+     */
+    private Long contractId;
+
 }

+ 2 - 3
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesDetailServiceImpl.java

@@ -10,7 +10,6 @@ import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.sale.entity.after.dto.AfterSalesDetailDto;
 import com.fjhx.sale.entity.after.dto.AfterSalesDetailSelectDto;
-import com.fjhx.sale.entity.after.po.AfterSales;
 import com.fjhx.sale.entity.after.po.AfterSalesDetail;
 import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
 import com.fjhx.sale.entity.contract.po.ContractProduct;
@@ -179,14 +178,14 @@ public class AfterSalesDetailServiceImpl extends ServiceImpl<AfterSalesDetailMap
         Assert.notEmpty(afterSalesDetailDto.getId(), "售后id不能为空");
         AfterSalesDetail afterSalesDetail = this.getById(afterSalesDetailDto.getId());
         Assert.notEmpty(afterSalesDetail, "查询不到售后信息");
-        AfterSales afterSales = afterSalesService.getById(afterSalesDetail.getAfterSalesId());
+//        AfterSales afterSales = afterSalesService.getById(afterSalesDetail.getAfterSalesId());
 
         //创建交接单
         ContractProduct contractProduct = new ContractProduct();
         contractProduct.setProductId(afterSalesDetail.getProductId());
         contractProduct.setQuantity(afterSalesDetail.getQuantity());
         contractProduct.setExpendQuantity(afterSalesDetail.getQuantity());
-        contractProduct.setContractId(afterSales.getContractId());
+        contractProduct.setContractId(afterSalesDetailDto.getContractId());
         contractProduct.setPrice(afterSalesDetail.getPrice());
         contractProduct.setAmount(afterSalesDetail.getAmount());
         contractProduct.setRemark(afterSalesDetail.getRemark());

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

@@ -43,7 +43,7 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
         this.save(afterSalesDto);
         List<AfterSalesDetail> afterSalesDetailList = afterSalesDto.getAfterSalesDetailList();
         afterSalesDetailList.forEach(item -> item.setAfterSalesId(afterSalesDto.getId()));
-        //赋值dan
+        //赋值单价信息
         List<Long> contractProductIds = afterSalesDetailList.stream().distinct().map(AfterSalesDetail::getContractProductId).collect(Collectors.toList());
         Map<Long, ContractProduct> longContractProductMap = new HashMap<>();
         if (ObjectUtil.isNotEmpty(contractProductIds)) {

+ 2 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/ContractProductService.java

@@ -35,6 +35,8 @@ public interface ContractProductService extends BaseService<ContractProduct> {
      */
     List<ContractProductVo> getListDetail(List<Long> ids);
 
+    List<ContractProductVo> getListDetailByContractId(List<Long> contractIds);
+
     /**
      * 外销合同-产品明细
      */

+ 15 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractProductServiceImpl.java

@@ -395,6 +395,21 @@ public class ContractProductServiceImpl extends ServiceImpl<ContractProductMappe
         return list;
     }
 
+
+    @Override
+    public List<ContractProductVo> getListDetailByContractId(List<Long> contractIds) {
+        List<ContractProduct> list = this.list(q -> q.in(ContractProduct::getContractId, contractIds));
+        List<ContractProductVo> contractProductVos = BeanUtil.copyToList(list, ContractProductVo.class);
+        // 赋值产品属性
+        productInfoService.attributeAssign(contractProductVos, ContractProductVo::getProductId, (item, product) -> {
+            item.setProductCode(product.getCode());
+            item.setProductName(product.getName());
+            item.setProductSpec(product.getSpec());
+            item.setProductUnit(product.getUnit());
+        });
+        return contractProductVos;
+    }
+
     @Override
     public ContractProductVo detail(Long id) {
         ContractProduct ContractProduct = this.getById(id);

+ 3 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -220,6 +220,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             wrapper.keyword(dto.getKeyword(), new SqlField("t1", Contract::getCode));
         }
 
+        //根据客户id关联
+        wrapper.eq(ContractVo::getBuyCorporationId, dto.getCustomerId());
+
         //过滤合同类型
         wrapper.eq("t1.contract_type", dto.getContractType());