浏览代码

销售合同添加产品价格提示

yzc 1 年之前
父节点
当前提交
65d783edd4

+ 0 - 87
hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfoEhsdJson.java

@@ -20,18 +20,6 @@ public class ProductInfoEhsdJson {
      * 产品成本价
      */
     private BigDecimal costPrice;
-//    /**
-//     * 材质英文
-//     */
-//    private String material;
-//    /**
-//     * 材质中文
-//     */
-//    private String materialChinese;
-//    /**
-//     * 产品型号 英文
-//     */
-//    private String productModelEn;
     /**
      * 产品尺寸 长
      */
@@ -44,18 +32,6 @@ public class ProductInfoEhsdJson {
      * 产品尺寸 高
      */
     private String productHigh;
-//    /**
-//     * 装箱尺寸 长
-//     */
-//    private String packagLong;
-//    /**
-//     * 装箱尺寸 宽
-//     */
-//    private String packagWide;
-//    /**
-//     * 装箱尺寸 高
-//     */
-//    private String packagHigh;
     /**
      * 内包装方式
      */
@@ -68,64 +44,10 @@ public class ProductInfoEhsdJson {
      * 净重(单位g)
      */
     private Double netWeight;
-
-//    /**
-//     * 毛重(单位g)
-//     */
-//    private Double grossWeight;
-
     /**
      * 海关编码
      */
     private String hsCode;
-//    /**
-//     * MOQ(最低订购量)
-//     */
-//    private Integer moq;
-//    /**
-//     * 销售单位
-//     */
-//    private String salesUnit;
-//    /**
-//     * 出入库单位
-//     */
-//    private String issueReceiptUnit;
-//    /**
-//     * 换算比例
-//     */
-//    private Double conversionScale;
-//    /**
-//     * 安全库存
-//     */
-//    private BigDecimal safetyStock;
-//    /**
-//     * 采购周期(单位:天)
-//     */
-//    private Integer procurementCycle;
-//    /**
-//     * 质检合格率
-//     */
-//    private BigDecimal qualityQualifiedRate;
-//    /**
-//     * (云仓)出入库规则:0、不启用;1、一物一码;2、一物一码&先入先出
-//     */
-//    private Integer firstInFirstOut;
-//    /**
-//     * 状态
-//     */
-//    private Integer status;
-//    /**
-//     * 评估状态
-//     */
-//    private Integer assessStatus;
-//    /**
-//     * 产品分类英文名
-//     */
-//    private String categoryEnName;
-//    /**
-//     * 分类中文名
-//     */
-//    private String categoryCnName;
     /**
      * 客户id
      */
@@ -134,15 +56,6 @@ public class ProductInfoEhsdJson {
      * 客户名称
      */
     private String customerName;
-//    /**
-//     * 图片列表
-//     */
-//    private List<ObsFile> imgList;
-//    /**
-//     * 附件列表
-//     */
-//    private List<ObsFile> attachmentList;
-
     /**
      * 产品类型 1公司产品 2客户产品
      */

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractProductVo.java

@@ -202,4 +202,9 @@ public class ContractProductVo extends ContractProduct {
      */
     private Integer purchaseStatus;
 
+    /**
+     * 币种
+     */
+    private String currency;
+
 }

+ 13 - 7
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -2383,14 +2383,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
                     customerContractProductList.stream().collect(Collectors.groupingBy(ContractProduct::getProductId));
         }
 
-        //获取产品近条销售价格信息
-        List<ContractProduct> contractProductList = contractProductService.list(q -> q
-                .in(ContractProduct::getProductId, pIds)
-                .orderByDesc(ContractProduct::getCreateTime)
-                .orderByDesc(ContractProduct::getId)
-                .last("LIMIT 20")
+        //获取产品近20条销售价格信息
+        List<ContractProductVo> contractProductList = baseMapper.getProductPriceInfo(IWrapper.getWrapper()
+                .in("cp.product_id", pIds)
+                .orderByDesc("c.create_time")
+                .orderByDesc("c.id")
+                .last("LIMIT 3")
         );
-        Map<Long, List<ContractProduct>> contractProductMap =
+        Map<Long, List<ContractProductVo>> contractProductMap =
                 contractProductList.stream().collect(Collectors.groupingBy(ContractProduct::getProductId));
 
 
@@ -2402,9 +2402,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             Long productInfoId = productInfo.getId();
 
             Map<String, Object> data = new HashMap<>();
+            //销售指导价和币种
             data.put("price", ehsdJson.getPrice());
+            data.put("currency", ehsdJson.getCurrency());
+            //成本价和币种
             data.put("costPrice", ehsdJson.getCostPrice());
+            data.put("costCurrency", ehsdJson.getCostCurrency());
+            //销售给指定客户近3条产品价格
             data.put("customerContractProductList", customerContractProductMap.get(productInfoId));
+            //该产品近20条销售价格
             data.put("contractProductList", contractProductMap.get(productInfoId));
 
             reData.put(productInfoId, data);

+ 2 - 1
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -518,7 +518,8 @@
             ${ew.customSqlSegment}
     </select>
     <select id="getProductPriceInfo" resultType="com.fjhx.sale.entity.contract.vo.ContractProductVo">
-        SELECT cp.*
+        SELECT cp.*,
+               c.currency
         FROM contract_product cp
                  LEFT JOIN contract c ON cp.contract_id = c.id
             ${ew.customSqlSegment}