Procházet zdrojové kódy

报价单功能开发

yzc před 1 rokem
rodič
revize
98f89a2c14
29 změnil soubory, kde provedl 997 přidání a 502 odebrání
  1. 0 17
      code/src/test/java/JxstDataSource.java
  2. 3 3
      code/src/test/java/SaleDataSource.java
  3. 0 17
      code/src/test/java/ehsdDataSource.java
  4. 0 17
      code/src/test/java/victoriatouristDataSource.java
  5. 5 1
      hx-common/src/main/java/com/fjhx/common/enums/PushBusinessTypeEnum.java
  6. 15 0
      hx-common/src/main/java/com/fjhx/common/utils/Utils.java
  7. 3 0
      hx-item/src/main/java/com/fjhx/item/controller/product/ProductBomInfoController.java
  8. 6 0
      hx-item/src/main/java/com/fjhx/item/entity/product/vo/ProductBomDetailVo.java
  9. 20 0
      hx-sale/src/main/java/com/fjhx/sale/controller/quotation/QuotationProductBomController.java
  10. 53 6
      hx-sale/src/main/java/com/fjhx/sale/controller/sale/SaleQuotationController.java
  11. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductBomDto.java
  12. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductBomSelectDto.java
  13. 7 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductDto.java
  14. 3 8
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/po/QuotationProduct.java
  15. 68 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/po/QuotationProductBom.java
  16. 27 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/vo/QuotationProductBomVo.java
  17. 10 0
      hx-sale/src/main/java/com/fjhx/sale/entity/quotation/vo/QuotationProductVo.java
  18. 35 37
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationDto.java
  19. 33 4
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationSelectDto.java
  20. 135 100
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/po/SaleQuotation.java
  21. 14 2
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/vo/SaleQuotationVo.java
  22. 183 183
      hx-sale/src/main/java/com/fjhx/sale/flow/SaleQuotationFlow.java
  23. 17 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/quotation/QuotationProductBomMapper.java
  24. 3 5
      hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java
  25. 17 0
      hx-sale/src/main/java/com/fjhx/sale/service/quotation/QuotationProductBomService.java
  26. 21 0
      hx-sale/src/main/java/com/fjhx/sale/service/quotation/impl/QuotationProductBomServiceImpl.java
  27. 14 4
      hx-sale/src/main/java/com/fjhx/sale/service/sale/SaleQuotationService.java
  28. 267 98
      hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java
  29. 4 0
      hx-sale/src/main/resources/mapper/quotation/QuotationProductBomMapper.xml

+ 0 - 17
code/src/test/java/JxstDataSource.java

@@ -1,17 +0,0 @@
-import fly.generator.GeneratorApplication;
-
-public class JxstDataSource {
-
-    public static void main(String[] args) {
-        GeneratorApplication.builder()
-                .url("jdbc:mysql://36.134.91.96:17330/bytesailing_jxst?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
-                .username("fjhx2012mysql")
-                .password("3PN-Mzn#vnP&q6d")
-                .port(9989)
-                .module("hx-jxst")
-                .parent("com.fjhx.jxst")
-                .superServiceClass("com.ruoyi.common.core.service.BaseService")
-                .build();
-    }
-
-}

+ 3 - 3
code/src/test/java/SaleDataSource.java

@@ -4,9 +4,9 @@ public class SaleDataSource {
 
     public static void main(String[] args) {
         GeneratorApplication.builder()
-                .url("jdbc:mysql://36.134.91.96:12333/bytesailing_sale?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
-                .username("root")
-                .password("Fjhx@pwd123")
+                .url(DataSourceInfo.URL)
+                .username(DataSourceInfo.USER_NAME)
+                .password(DataSourceInfo.PASSWORD)
                 .port(9989)
                 .module("hx-sale")
                 .parent("com.fjhx.sale")

+ 0 - 17
code/src/test/java/ehsdDataSource.java

@@ -1,17 +0,0 @@
-import fly.generator.GeneratorApplication;
-
-public class ehsdDataSource {
-
-    public static void main(String[] args) {
-        GeneratorApplication.builder()
-                .url("jdbc:mysql://36.134.91.96:12333/bytesailing_ehsd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
-                .username("root")
-                .password("Fjhx@pwd123")
-                .port(9989)
-                .module("hx-ehsd")
-                .parent("com.fjhx.ehsd")
-                .superServiceClass("com.ruoyi.common.core.service.BaseService")
-                .build();
-    }
-
-}

+ 0 - 17
code/src/test/java/victoriatouristDataSource.java

@@ -1,17 +0,0 @@
-import fly.generator.GeneratorApplication;
-
-public class victoriatouristDataSource {
-
-    public static void main(String[] args) {
-        GeneratorApplication.builder()
-                .url("jdbc:mysql://36.134.91.96:17330/bytesailing_victoriatourist?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
-                .username("fjhx2012mysql")
-                .password("3PN-Mzn#vnP&q6d")
-                .port(9989)
-                .module("hx-victoriatourist")
-                .parent("com.fjhx.victoriatourist")
-                .superServiceClass("com.ruoyi.common.core.service.BaseService")
-                .build();
-    }
-
-}

+ 5 - 1
hx-common/src/main/java/com/fjhx/common/enums/PushBusinessTypeEnum.java

@@ -41,7 +41,11 @@ public enum PushBusinessTypeEnum {
     /**
      * 单证被删除
      */
-    DOCUMENTS_DEL(7);
+    DOCUMENTS_DEL(7),
+    /**
+     * 新报价单
+     */
+    NEW_QUOTATION(8);
 
     private final int type;
 

+ 15 - 0
hx-common/src/main/java/com/fjhx/common/utils/Utils.java

@@ -12,6 +12,8 @@ import org.apache.http.impl.client.HttpClients;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 @Slf4j
 public class Utils {
@@ -31,4 +33,17 @@ public class Utils {
         }
         return JSONObject.parseObject(responseStr);
     }
+
+    /**
+     * 赋值新的变更编号
+     */
+    public static String getNewCode(String code) {
+        Matcher matcher = Pattern.compile(".*\\((.*?)\\)$").matcher(code);
+        int index = 2;
+        if (matcher.find()) {
+            index = (Integer.parseInt(matcher.group(1)) + 1);
+            code = code.substring(0, code.lastIndexOf("("));
+        }
+        return code + "(" + index + ")";
+    }
 }

+ 3 - 0
hx-item/src/main/java/com/fjhx/item/controller/product/ProductBomInfoController.java

@@ -54,6 +54,9 @@ public class ProductBomInfoController {
         productInfoService.attributeAssign(productBomDetailVos, ProductBomDetail::getMaterialId, (item, material) -> {
             item.setMaterialName(material.getName());
             item.setMaterialCode(material.getCustomCode());
+            item.setMaterialLength(material.getLength());
+            item.setMaterialWidth(material.getWidth());
+            item.setMaterialHeight(material.getHeight());
         });
 
         ProductBomInfoVo productBomInfoVo = new ProductBomInfoVo();

+ 6 - 0
hx-item/src/main/java/com/fjhx/item/entity/product/vo/ProductBomDetailVo.java

@@ -4,6 +4,8 @@ import com.fjhx.item.entity.product.po.ProductBomDetail;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * item_产品BOM明细列表查询返回值实体
  *
@@ -23,4 +25,8 @@ public class ProductBomDetailVo extends ProductBomDetail {
      */
     private String materialCode;
 
+    private BigDecimal materialLength;
+    private BigDecimal materialWidth;
+    private BigDecimal materialHeight;
+
 }

+ 20 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/quotation/QuotationProductBomController.java

@@ -0,0 +1,20 @@
+package com.fjhx.sale.controller.quotation;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * s报价产品配件 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@RestController
+@RequestMapping("/quotationProductBom")
+public class QuotationProductBomController {
+
+
+}

+ 53 - 6
hx-sale/src/main/java/com/fjhx/sale/controller/sale/SaleQuotationController.java

@@ -1,15 +1,18 @@
 package com.fjhx.sale.controller.sale;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
-import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
 import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
-import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
+import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
 import com.fjhx.sale.service.sale.SaleQuotationService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
 
@@ -47,10 +50,54 @@ public class SaleQuotationController {
     }
 
     /**
+     * 报价表明细
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody SaleQuotationDto dto) {
+        saleQuotationService.add(dto);
+    }
+
+
+    /**
+     * 报价表明细
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody SaleQuotationDto dto) {
+        saleQuotationService.edit(dto);
+    }
+
+
+    /**
+     * 报价表删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        saleQuotationService.delete(dto.getId());
+    }
+
+
+    /**
+     * 报价表变更
+     */
+    @PostMapping("/change")
+    public void change(@RequestBody SaleQuotationDto dto) {
+        saleQuotationService.changeSaleQuotation(dto);
+    }
+
+    /**
+     * 报价表作废
+     */
+    @PostMapping("/cancellation")
+    public void cancellation(@RequestBody BaseSelectDto dto) {
+        saleQuotationService.cancellation(dto.getId());
+    }
+
+
+    /**
      * 报价单的复制功能
      */
     @PostMapping("/copy")
-    public void copy(SaleQuotationDto saleQuotationDto){
+    public void copy(SaleQuotationDto saleQuotationDto) {
         saleQuotationService.copy(saleQuotationDto);
     }
 

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductBomDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.quotation.dto;
+
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * s报价产品配件新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@Getter
+@Setter
+public class QuotationProductBomDto extends QuotationProductBom {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductBomSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.quotation.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * s报价产品配件列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@Getter
+@Setter
+public class QuotationProductBomSelectDto extends BaseSelectDto {
+
+}

+ 7 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/dto/QuotationProductDto.java

@@ -4,6 +4,8 @@ import com.fjhx.sale.entity.quotation.po.QuotationProduct;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * 商品-报价单关联表新增编辑入参实体
  *
@@ -14,4 +16,9 @@ import lombok.Setter;
 @Setter
 public class QuotationProductDto extends QuotationProduct {
 
+    /**
+     * 报价产品配件列表
+     */
+    private List<QuotationProductBomDto> quotationProductBomList;
+
 }

+ 3 - 8
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/po/QuotationProduct.java

@@ -1,12 +1,12 @@
 package com.fjhx.sale.entity.quotation.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 商品-报价单关联表
@@ -59,9 +59,4 @@ public class QuotationProduct extends BasePo {
      * 付款条件
      */
     private String remark;
-
-    /**
-     * 尔弘时代扩展json字段
-     */
-    private String ehsdJson;
 }

+ 68 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/po/QuotationProductBom.java

@@ -0,0 +1,68 @@
+package com.fjhx.sale.entity.quotation.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * s报价产品配件
+ * </p>
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@Getter
+@Setter
+@TableName("quotation_product_bom")
+public class QuotationProductBom extends BasePo {
+
+    /**
+     * 报价表ID
+     */
+    private Long quotationProductId;
+
+    /**
+     * 商品ID
+     */
+    private Long productId;
+
+    /**
+     * 物料id
+     */
+    private Long materialId;
+
+    /**
+     * 商品名称
+     */
+    private String productName;
+
+    /**
+     * 商品型号
+     */
+    private String productModel;
+
+    /**
+     * 商品数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 商品单价
+     */
+    private BigDecimal price;
+
+    /**
+     * 商品金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 付款条件
+     */
+    private String remark;
+
+}

+ 27 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/vo/QuotationProductBomVo.java

@@ -0,0 +1,27 @@
+package com.fjhx.sale.entity.quotation.vo;
+
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * s报价产品配件列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@Getter
+@Setter
+public class QuotationProductBomVo extends QuotationProductBom {
+
+    private String productCode;
+
+    private String productName;
+
+    private BigDecimal productLength;
+    private BigDecimal productWidth;
+    private BigDecimal productHeight;
+
+}

+ 10 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/vo/QuotationProductVo.java

@@ -4,6 +4,9 @@ import com.fjhx.sale.entity.quotation.po.QuotationProduct;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * 商品-报价单关联表列表查询返回值实体
  *
@@ -14,4 +17,11 @@ import lombok.Setter;
 @Setter
 public class QuotationProductVo extends QuotationProduct {
 
+    List<QuotationProductBomVo> quotationProductBomList;
+    private String productCode;
+    private String productName;
+    private BigDecimal productLength;
+    private BigDecimal productWidth;
+    private BigDecimal productHeight;
+
 }

+ 35 - 37
hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationDto.java

@@ -1,8 +1,6 @@
 package com.fjhx.sale.entity.sale.dto;
 
-import com.fjhx.area.service.SetCustomizeAreaId;
-import com.fjhx.sale.entity.quotation.po.QuotationPay;
-import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+import com.fjhx.sale.entity.quotation.dto.QuotationProductDto;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
 import lombok.Getter;
 import lombok.Setter;
@@ -17,43 +15,43 @@ import java.util.List;
  */
 @Getter
 @Setter
-public class SaleQuotationDto extends SaleQuotation implements SetCustomizeAreaId {
+public class SaleQuotationDto extends SaleQuotation {
 
     /**
      * 商品-报价单关联表信息
      */
-    private List<QuotationProduct> quotationProductList;
-
-    /**
-     *报价 -收费项目表
-     */
-    private List<QuotationPay> quotationPayList;
-
-
-    /**
-     * 省 州ID
-     */
-    private Long provinceId;
-
-    /**
-     * 省州名称
-     */
-    private String provinceName;
-
-
-    /**
-     * 城市ID
-     */
-    private Long cityId;
-
-    /**
-     * 城市名称
-     */
-    private String cityName;
-
-    /**
-     * 国家ID
-     */
-    private Long countryId;
+    private List<QuotationProductDto> quotationProductList;
+
+//    /**
+//     *报价 -收费项目表
+//     */
+//    private List<QuotationPay> quotationPayList;
+//
+//
+//    /**
+//     * 省 州ID
+//     */
+//    private Long provinceId;
+//
+//    /**
+//     * 省州名称
+//     */
+//    private String provinceName;
+//
+//
+//    /**
+//     * 城市ID
+//     */
+//    private Long cityId;
+//
+//    /**
+//     * 城市名称
+//     */
+//    private String cityName;
+//
+//    /**
+//     * 国家ID
+//     */
+//    private Long countryId;
 
 }

+ 33 - 4
hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationSelectDto.java

@@ -1,9 +1,12 @@
 package com.fjhx.sale.entity.sale.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.core.domain.BaseSelectDto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
+
 /**
  * 报价表列表查询入参实体
  *
@@ -13,14 +16,40 @@ import lombok.Setter;
 @Getter
 @Setter
 public class SaleQuotationSelectDto extends BaseSelectDto {
+//    /**
+//     * 审批状态。10:发起。20 驳回。30通过
+//     */
+//    private String status;
+//
+//
+//    /**
+//     * 卖方公司ID
+//     */
+//    private Long sellCorporationId;
+
+    /**
+     * 报价状态 0未报价 1报价中 2已报价
+     */
+    private Integer quotationStatus;
+
     /**
-     * 审批状态。10:发起。20 驳回。30通过
+     * 归属公司Id
      */
-    private String status;
+    private Long companyId;
 
+    /**
+     * 报价时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date quotationTimeSta;
+    /**
+     * 报价时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date quotationTimeEnd;
 
     /**
-     * 卖方公司ID
+     * 报价单类型
      */
-    private Long sellCorporationId;
+    private Integer type;
 }

+ 135 - 100
hx-sale/src/main/java/com/fjhx/sale/entity/sale/po/SaleQuotation.java

@@ -1,12 +1,13 @@
 package com.fjhx.sale.entity.sale.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
  * <p>
  * 报价表
@@ -21,69 +22,19 @@ import lombok.Setter;
 public class SaleQuotation extends BasePo {
 
     /**
-     * 合同模版ID
-     */
-    private Long contractTemplateId;
-
-    /**
-     * 卖方公司ID
-     */
-    private Long sellCorporationId;
-
-    /**
-     * 卖方联系人名称
+     * 报价单编号
      */
     private String code;
 
     /**
-     * 审批状态。10:发起。20 驳回。30通过
-     */
-    private String status;
-
-    /**
-     * 卖方联系人名称
-     */
-    private String sellContactName;
-
-    /**
-     * 卖方联系人电话
+     * 报价单类型
      */
-    private String sellContactNumber;
+    private Integer type;
 
     /**
-     * 卖方国家表id
+     * 归属公司Id
      */
-    private String sellCountryId;
-
-    /**
-     * 卖方省份id
-     */
-    private String sellProvinceId;
-
-    /**
-     * 卖方城市id
-     */
-    private String sellCityId;
-
-    /**
-     * 卖方国家表名称
-     */
-    private String sellCountryName;
-
-    /**
-     * 卖方省份名称
-     */
-    private String sellProvinceName;
-
-    /**
-     * 卖方城市名称
-     */
-    private String sellCityName;
-
-    /**
-     * 卖方详细地址
-     */
-    private String sellAddress;
+    private Long companyId;
 
     /**
      * 买方公司ID
@@ -126,57 +77,141 @@ public class SaleQuotation extends BasePo {
     private String buyPostalCode;
 
     /**
-     * 币种(字典account_currency)
-     */
-    private String currency;
-
-    /**
-     * 付款金额(打款中的实际打款金额)
+     * 报价金额
      */
     private BigDecimal amount;
 
     /**
-     * 付款方式(字典funds_payment_method(多余的业务字段)
+     * 报价时间
      */
-    private String paymentMethod;
+    private Date quotationTime;
 
     /**
-     * 贸易方式(字典trade_methods)
+     * 报价状态 0未报价 1报价中 2已报价
      */
-    private String tradeMethods;
+    private Integer quotationStatus;
 
     /**
-     * 预付比例
-     */
-    private String advanceRatio;
-
-    /**
-     * 运输方式(字典  shipping_method)
-     */
-    private String transportMethod;
-
-    /**
-     * 运输备注
-     */
-    private String transportRemark;
-
-    /**
-     * 有效期
-     */
-    private Integer effective;
-
-    /**
-     * 质保期
-     */
-    private Integer warranty;
-
-    /**
-     * 付款条件
-     */
-    private String remark;
-
-    /**
-     * 尔弘时代扩展json字段
+     * 审批状态。10:发起。20 驳回。30通过
      */
-    private String ehsdJson;
+    private Integer status;
+
+    /**
+     * 数据分组id
+     */
+    private Long groupId;
+
+    /**
+     * 上一版本id
+     */
+    private Long oldQuotationId;
+
+
+//
+//
+//    /**
+//     * 合同模版ID
+//     */
+//    private Long contractTemplateId;
+//
+//    /**
+//     * 卖方公司ID
+//     */
+//    private Long sellCorporationId;
+//
+//
+//
+//    /**
+//     * 卖方联系人名称
+//     */
+//    private String sellContactName;
+//
+//    /**
+//     * 卖方联系人电话
+//     */
+//    private String sellContactNumber;
+//
+//    /**
+//     * 卖方国家表id
+//     */
+//    private String sellCountryId;
+//
+//    /**
+//     * 卖方省份id
+//     */
+//    private String sellProvinceId;
+//
+//    /**
+//     * 卖方城市id
+//     */
+//    private String sellCityId;
+//
+//    /**
+//     * 卖方国家表名称
+//     */
+//    private String sellCountryName;
+//
+//    /**
+//     * 卖方省份名称
+//     */
+//    private String sellProvinceName;
+//
+//    /**
+//     * 卖方城市名称
+//     */
+//    private String sellCityName;
+//
+//    /**
+//     * 卖方详细地址
+//     */
+//    private String sellAddress;
+//
+//
+//
+//    /**
+//     * 币种(字典account_currency)
+//     */
+//    private String currency;
+//
+//
+//
+//    /**
+//     * 付款方式(字典funds_payment_method(多余的业务字段)
+//     */
+//    private String paymentMethod;
+//
+//    /**
+//     * 贸易方式(字典trade_methods)
+//     */
+//    private String tradeMethods;
+//
+//    /**
+//     * 预付比例
+//     */
+//    private String advanceRatio;
+//
+//    /**
+//     * 运输方式(字典  shipping_method)
+//     */
+//    private String transportMethod;
+//
+//    /**
+//     * 运输备注
+//     */
+//    private String transportRemark;
+//
+//    /**
+//     * 有效期
+//     */
+//    private Integer effective;
+//
+//    /**
+//     * 质保期
+//     */
+//    private Integer warranty;
+//
+//    /**
+//     * 付款条件
+//     */
+//    private String remark;
 }

+ 14 - 2
hx-sale/src/main/java/com/fjhx/sale/entity/sale/vo/SaleQuotationVo.java

@@ -1,7 +1,7 @@
 package com.fjhx.sale.entity.sale.vo;
 
 import com.fjhx.sale.entity.quotation.po.QuotationPay;
-import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+import com.fjhx.sale.entity.quotation.vo.QuotationProductVo;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
 import lombok.Getter;
 import lombok.Setter;
@@ -32,7 +32,7 @@ public class SaleQuotationVo extends SaleQuotation {
     /**
      * 商品-报价单关联表信息
      */
-    private List<QuotationProduct> quotationProductList;
+    private List<QuotationProductVo> quotationProductList;
 
     /**
      *报价 -收费项目表
@@ -109,5 +109,17 @@ public class SaleQuotationVo extends SaleQuotation {
      */
     private String contractTemplateName;
 
+    /**
+     * 买方名称
+     */
+    private String companyName;
+
+
+    /**
+     * 报价趋势
+     */
+
+    private List<SaleQuotation> quotationTrendList;
+
 
 }

+ 183 - 183
hx-sale/src/main/java/com/fjhx/sale/flow/SaleQuotationFlow.java

@@ -1,183 +1,183 @@
-package com.fjhx.sale.flow;
-
-import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.fjhx.area.utils.CustomizeAreaUtil;
-import com.fjhx.common.constant.SourceConstant;
-import com.fjhx.common.enums.CodingRuleEnum;
-import com.fjhx.common.enums.FlowStatusEnum1;
-import com.fjhx.common.service.coding.CodingRuleService;
-import com.fjhx.flow.core.FlowDelegate;
-import com.fjhx.flow.core.FlowThreadLocalUtil;
-import com.fjhx.flow.enums.FlowStatusEnum;
-import com.fjhx.flow.enums.HandleTypeEnum;
-import com.fjhx.sale.entity.quotation.po.QuotationPay;
-import com.fjhx.sale.entity.quotation.po.QuotationProduct;
-import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
-import com.fjhx.sale.entity.sale.po.SaleQuotation;
-import com.fjhx.sale.enums.SaleQuotationEnum;
-import com.fjhx.sale.service.quotation.QuotationPayService;
-import com.fjhx.sale.service.quotation.QuotationProductService;
-import com.fjhx.sale.service.sale.SaleQuotationService;
-import com.ruoyi.common.annotation.LogicIgnore;
-import com.ruoyi.common.core.domain.BasePo;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.SecurityUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 报价单流程
- */
-//@DS(SourceConstant.SALE)
-@Component
-public class SaleQuotationFlow extends FlowDelegate {
-    @Autowired
-    private CodingRuleService codingRuleService;
-
-    @Autowired
-    private SaleQuotationService saleQuotationService;
-
-    @Autowired
-    private QuotationPayService quotationPayService;
-
-    @Autowired
-    private QuotationProductService quotationProductService;
-
-    @Override
-    public String getFlowKey() {
-        return "sale_quotation_flow";
-    }
-
-    /**
-     * 发起流程
-     * @param flowId 流程ID
-     * @param submitData 采购付款数据
-     * @return
-     */
-    @Override
-    public Long start(Long flowId, JSONObject submitData) {
-        SaleQuotationDto saleQuotation = submitData.toJavaObject(SaleQuotationDto.class);
-
-        //添加报价编码
-        saleQuotation.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(),saleQuotation.getBuyCorporationId()));
-//        saleQuotation.setCode(CodeEnum.SALE_QUOTATION.getCode());
-        return connStart(saleQuotation);
-    }
-
-    /**
-     * 添加/修改报价单   公众代码
-     * @param saleQuotation
-     */
-    public Long connStart(SaleQuotationDto saleQuotation){
-        //赋值城市省份信息
-        CustomizeAreaUtil.setAreaId(saleQuotation);
-        saleQuotation.setBuyCityId(saleQuotation.getCityId());
-        saleQuotation.setBuyCountryId(saleQuotation.getCountryId());
-        saleQuotation.setBuyProvinceId(saleQuotation.getProvinceId());
-        //添加报价状态
-        saleQuotation.setStatus(SaleQuotationEnum.UNDER_REVIEW.getKey());
-        //添加报价单信息
-        saleQuotationService.saveOrUpdate(saleQuotation);
-        List<QuotationProduct> quotationProductList = saleQuotation.getQuotationProductList();
-        if(CollectionUtils.isNotEmpty(quotationProductList)){//保存报价产品信息
-            quotationProductList.forEach(quotationProduct -> quotationProduct.setSaleQuotationId(saleQuotation.getId()));
-            quotationProductService.saveOrUpdateBatch(quotationProductList);
-        }
-        List<QuotationPay> quotationPayList = saleQuotation.getQuotationPayList();
-        if(CollectionUtils.isNotEmpty(quotationPayList)){//保存报价项目信息
-            quotationPayList.forEach(quotationPay -> quotationPay.setSaleQuotationId(saleQuotation.getId()));
-            quotationPayService.saveOrUpdateBatch(quotationPayList);
-        }
-        return saleQuotation.getId();
-    }
-    /**
-     * 重新发起
-     * @param flowId
-     * @param businessId
-     * @param flowStatus
-     * @param submitData
-     */
-    @Override
-    @LogicIgnore
-    @Transactional(rollbackFor = Exception.class)
-    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
-        //删除采购合同
-        SaleQuotationDto saleQuotationDto = submitData.toJavaObject(SaleQuotationDto.class);
-        if(ObjectUtils.isEmpty(saleQuotationDto)){
-            throw new ServiceException("报价单数据不能为空");
-        }
-        connStart(saleQuotationDto);
-    }
-
-    /**
-     * 驳回
-     * @param flowId
-     * @param businessId
-     * @param flowStatus
-     */
-    @Override
-    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
-            saleQuotationService.update(q -> q
-                    .eq(SaleQuotation::getId, businessId)
-                    .set(SaleQuotation::getStatus, 20)//20为驳回
-                    .set(SaleQuotation::getUpdateTime, new Date())
-                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-            );
-
-    }
-    /**
-     * 结束流程
-     * @param flowId 流程ID
-     * @param businessId 业务ID
-     * @param submitData 数据
-     */
-    @Override
-    public void end(Long flowId, Long businessId, JSONObject submitData) {
-        SaleQuotationService saleQuotationService = SpringUtil.getBean(SaleQuotationService.class);
-        //通过业务ID查询合同数据
-        SaleQuotation contract = saleQuotationService.getById(businessId);
-        if(ObjectUtils.isEmpty(contract)){
-            throw new ServiceException("报价单不存在");
-        }
-        //修改采购状态为审批通过
-        contract.setStatus(SaleQuotationEnum.PASS.getKey());
-        saleQuotationService.updateById(contract);
-    }
-
-    /**
-     * 驳回方法
-     */
-    public void reject() {
-        if (HandleTypeEnum.REJECT.equals(FlowThreadLocalUtil.getHandleTypeEnum())) {
-            saleQuotationService.update(q -> q
-                    .eq(SaleQuotation::getId, FlowThreadLocalUtil.getBusinessId())
-                    .set(SaleQuotation::getStatus, 20)//20为驳回
-                    .set(SaleQuotation::getUpdateTime, new Date())
-                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-            );
-        }
-    }
-
-    /**
-     * 作废
-     */
-    @Override
-    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
-        super.cancellation(flowId, businessId, flowStatus);
-
-        saleQuotationService.update(q -> q
-                .eq(SaleQuotation::getId, businessId)
-                .set(SaleQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
-                .set(BasePo::getUpdateTime, new Date())
-                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-        );
-    }
-}
+//package com.fjhx.sale.flow;
+//
+//import cn.hutool.extra.spring.SpringUtil;
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.dynamic.datasource.annotation.DS;
+//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+//import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+//import com.fjhx.area.utils.CustomizeAreaUtil;
+//import com.fjhx.common.constant.SourceConstant;
+//import com.fjhx.common.enums.CodingRuleEnum;
+//import com.fjhx.common.enums.FlowStatusEnum1;
+//import com.fjhx.common.service.coding.CodingRuleService;
+//import com.fjhx.flow.core.FlowDelegate;
+//import com.fjhx.flow.core.FlowThreadLocalUtil;
+//import com.fjhx.flow.enums.FlowStatusEnum;
+//import com.fjhx.flow.enums.HandleTypeEnum;
+//import com.fjhx.sale.entity.quotation.po.QuotationPay;
+//import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+//import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
+//import com.fjhx.sale.entity.sale.po.SaleQuotation;
+//import com.fjhx.sale.enums.SaleQuotationEnum;
+//import com.fjhx.sale.service.quotation.QuotationPayService;
+//import com.fjhx.sale.service.quotation.QuotationProductService;
+//import com.fjhx.sale.service.sale.SaleQuotationService;
+//import com.ruoyi.common.annotation.LogicIgnore;
+//import com.ruoyi.common.core.domain.BasePo;
+//import com.ruoyi.common.exception.ServiceException;
+//import com.ruoyi.common.utils.SecurityUtils;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//import org.springframework.transaction.annotation.Transactional;
+//
+//import java.util.Date;
+//import java.util.List;
+//
+///**
+// * 报价单流程
+// */
+////@DS(SourceConstant.SALE)
+//@Component
+//public class SaleQuotationFlow extends FlowDelegate {
+//    @Autowired
+//    private CodingRuleService codingRuleService;
+//
+//    @Autowired
+//    private SaleQuotationService saleQuotationService;
+//
+//    @Autowired
+//    private QuotationPayService quotationPayService;
+//
+//    @Autowired
+//    private QuotationProductService quotationProductService;
+//
+//    @Override
+//    public String getFlowKey() {
+//        return "sale_quotation_flow";
+//    }
+//
+//    /**
+//     * 发起流程
+//     * @param flowId 流程ID
+//     * @param submitData 采购付款数据
+//     * @return
+//     */
+//    @Override
+//    public Long start(Long flowId, JSONObject submitData) {
+//        SaleQuotationDto saleQuotation = submitData.toJavaObject(SaleQuotationDto.class);
+//
+//        //添加报价编码
+//        saleQuotation.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(),saleQuotation.getBuyCorporationId()));
+////        saleQuotation.setCode(CodeEnum.SALE_QUOTATION.getCode());
+//        return connStart(saleQuotation);
+//    }
+//
+//    /**
+//     * 添加/修改报价单   公众代码
+//     * @param saleQuotation
+//     */
+//    public Long connStart(SaleQuotationDto saleQuotation){
+//        //赋值城市省份信息
+//        CustomizeAreaUtil.setAreaId(saleQuotation);
+//        saleQuotation.setBuyCityId(saleQuotation.getCityId());
+//        saleQuotation.setBuyCountryId(saleQuotation.getCountryId());
+//        saleQuotation.setBuyProvinceId(saleQuotation.getProvinceId());
+//        //添加报价状态
+//        saleQuotation.setStatus(SaleQuotationEnum.UNDER_REVIEW.getKey());
+//        //添加报价单信息
+//        saleQuotationService.saveOrUpdate(saleQuotation);
+//        List<QuotationProduct> quotationProductList = saleQuotation.getQuotationProductList();
+//        if(CollectionUtils.isNotEmpty(quotationProductList)){//保存报价产品信息
+//            quotationProductList.forEach(quotationProduct -> quotationProduct.setSaleQuotationId(saleQuotation.getId()));
+//            quotationProductService.saveOrUpdateBatch(quotationProductList);
+//        }
+//        List<QuotationPay> quotationPayList = saleQuotation.getQuotationPayList();
+//        if(CollectionUtils.isNotEmpty(quotationPayList)){//保存报价项目信息
+//            quotationPayList.forEach(quotationPay -> quotationPay.setSaleQuotationId(saleQuotation.getId()));
+//            quotationPayService.saveOrUpdateBatch(quotationPayList);
+//        }
+//        return saleQuotation.getId();
+//    }
+//    /**
+//     * 重新发起
+//     * @param flowId
+//     * @param businessId
+//     * @param flowStatus
+//     * @param submitData
+//     */
+//    @Override
+//    @LogicIgnore
+//    @Transactional(rollbackFor = Exception.class)
+//    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
+//        //删除采购合同
+//        SaleQuotationDto saleQuotationDto = submitData.toJavaObject(SaleQuotationDto.class);
+//        if(ObjectUtils.isEmpty(saleQuotationDto)){
+//            throw new ServiceException("报价单数据不能为空");
+//        }
+//        connStart(saleQuotationDto);
+//    }
+//
+//    /**
+//     * 驳回
+//     * @param flowId
+//     * @param businessId
+//     * @param flowStatus
+//     */
+//    @Override
+//    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+//            saleQuotationService.update(q -> q
+//                    .eq(SaleQuotation::getId, businessId)
+//                    .set(SaleQuotation::getStatus, 20)//20为驳回
+//                    .set(SaleQuotation::getUpdateTime, new Date())
+//                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//            );
+//
+//    }
+//    /**
+//     * 结束流程
+//     * @param flowId 流程ID
+//     * @param businessId 业务ID
+//     * @param submitData 数据
+//     */
+//    @Override
+//    public void end(Long flowId, Long businessId, JSONObject submitData) {
+//        SaleQuotationService saleQuotationService = SpringUtil.getBean(SaleQuotationService.class);
+//        //通过业务ID查询合同数据
+//        SaleQuotation contract = saleQuotationService.getById(businessId);
+//        if(ObjectUtils.isEmpty(contract)){
+//            throw new ServiceException("报价单不存在");
+//        }
+//        //修改采购状态为审批通过
+//        contract.setStatus(SaleQuotationEnum.PASS.getKey());
+//        saleQuotationService.updateById(contract);
+//    }
+//
+//    /**
+//     * 驳回方法
+//     */
+//    public void reject() {
+//        if (HandleTypeEnum.REJECT.equals(FlowThreadLocalUtil.getHandleTypeEnum())) {
+//            saleQuotationService.update(q -> q
+//                    .eq(SaleQuotation::getId, FlowThreadLocalUtil.getBusinessId())
+//                    .set(SaleQuotation::getStatus, 20)//20为驳回
+//                    .set(SaleQuotation::getUpdateTime, new Date())
+//                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//            );
+//        }
+//    }
+//
+//    /**
+//     * 作废
+//     */
+//    @Override
+//    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
+//        super.cancellation(flowId, businessId, flowStatus);
+//
+//        saleQuotationService.update(q -> q
+//                .eq(SaleQuotation::getId, businessId)
+//                .set(SaleQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
+//                .set(BasePo::getUpdateTime, new Date())
+//                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//        );
+//    }
+//}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/quotation/QuotationProductBomMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.mapper.quotation;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+
+
+/**
+ * <p>
+ * s报价产品配件 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-13
+ */
+public interface QuotationProductBomMapper extends BaseMapper<QuotationProductBom> {
+
+}

+ 3 - 5
hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java

@@ -1,12 +1,10 @@
 package com.fjhx.sale.mapper.sale;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.fjhx.customer.entity.customer.dto.CustomerDto;
-import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
-import com.fjhx.sale.entity.sale.po.SaleQuotation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.customer.entity.customer.dto.CustomerDto;
+import com.fjhx.sale.entity.sale.po.SaleQuotation;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
@@ -27,7 +25,7 @@ public interface SaleQuotationMapper extends BaseMapper<SaleQuotation> {
     /**
      * 报价表分页
      */
-    Page<SaleQuotationVo> getPage(@Param("page") Page<Object> page, @Param("ew") LambdaQueryWrapper<SaleQuotation> wrapper);
+    Page<SaleQuotationVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<SaleQuotation> wrapper);
 
     /**
      * 查询这个客户的报价次数

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/service/quotation/QuotationProductBomService.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.service.quotation;
+
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * s报价产品配件 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-13
+ */
+public interface QuotationProductBomService extends BaseService<QuotationProductBom> {
+
+}

+ 21 - 0
hx-sale/src/main/java/com/fjhx/sale/service/quotation/impl/QuotationProductBomServiceImpl.java

@@ -0,0 +1,21 @@
+package com.fjhx.sale.service.quotation.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import com.fjhx.sale.mapper.quotation.QuotationProductBomMapper;
+import com.fjhx.sale.service.quotation.QuotationProductBomService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * s报价产品配件 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-13
+ */
+@Service
+public class QuotationProductBomServiceImpl extends ServiceImpl<QuotationProductBomMapper, QuotationProductBom> implements QuotationProductBomService {
+
+}

+ 14 - 4
hx-sale/src/main/java/com/fjhx/sale/service/sale/SaleQuotationService.java

@@ -1,13 +1,13 @@
 package com.fjhx.sale.service.sale;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
+import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
+import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
-import com.ruoyi.common.core.service.BaseService;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
-import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
-import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
+import com.ruoyi.common.core.service.BaseService;
 
 import java.util.List;
 import java.util.Map;
@@ -29,6 +29,16 @@ public interface SaleQuotationService extends BaseService<SaleQuotation> {
     Page<SaleQuotationVo> getPage(SaleQuotationSelectDto dto);
 
     /**
+     * 变更
+     */
+    void changeSaleQuotation(SaleQuotationDto saleQuotationDto);
+
+    /**
+     * 作废
+     */
+    void cancellation(Long id);
+
+    /**
      * 报价表明细
      */
     SaleQuotationVo detail(Long id);

+ 267 - 98
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -3,30 +3,37 @@ package com.fjhx.sale.service.sale.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.controller.utils.DateUtils;
-import com.fjhx.account.entity.write.vo.WriteOffRecordsVo;
 import com.fjhx.area.utils.CustomizeAreaUtil;
 import com.fjhx.common.constant.SourceConstant;
-import com.fjhx.common.entity.contract.po.ContractTemplate;
-import com.fjhx.common.entity.corporation.po.Corporation;
+import com.fjhx.common.enums.CodingRuleEnum;
 import com.fjhx.common.enums.FlowStatusEnum1;
-import com.fjhx.common.service.contract.ContractTemplateService;
+import com.fjhx.common.enums.PushBusinessTypeEnum;
+import com.fjhx.common.service.coding.CodingRuleService;
 import com.fjhx.common.service.corporation.CorporationService;
+import com.fjhx.common.utils.Utils;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.customer.entity.customer.po.Customer;
 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.vo.ContractVo;
+import com.fjhx.sale.entity.quotation.dto.QuotationProductBomDto;
+import com.fjhx.sale.entity.quotation.dto.QuotationProductDto;
 import com.fjhx.sale.entity.quotation.po.QuotationPay;
 import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
+import com.fjhx.sale.entity.quotation.vo.QuotationProductBomVo;
+import com.fjhx.sale.entity.quotation.vo.QuotationProductVo;
 import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
 import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
@@ -34,16 +41,21 @@ import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
 import com.fjhx.sale.mapper.sale.SaleQuotationMapper;
 import com.fjhx.sale.service.contract.ContractService;
 import com.fjhx.sale.service.quotation.QuotationPayService;
+import com.fjhx.sale.service.quotation.QuotationProductBomService;
 import com.fjhx.sale.service.quotation.QuotationProductService;
 import com.fjhx.sale.service.sale.SaleQuotationService;
 import com.fjhx.sale.util.code.CodeEnum;
+import com.fjhx.socket.core.PushTypeEnum;
+import com.fjhx.socket.core.WebSocketPush;
 import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
 import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -79,12 +91,16 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
     private DictTenantDataService dictTenantDataService;
 
     @Autowired
-    private FlowExampleService flowExampleService;
+    private CodingRuleService codingRuleService;
 
     @Autowired
     private CorporationService corporationService;
     @Autowired
-    private ContractTemplateService contractTemplateService;
+    private QuotationProductBomService quotationProductBomService;
+    @Autowired
+    private ISysDeptService sysDeptService;
+    @Autowired
+    private ProductInfoService productInfoService;
 
     /**
      * 报价表分页
@@ -92,88 +108,241 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
     @Override
     public Page<SaleQuotationVo> getPage(SaleQuotationSelectDto dto) {
 
-        List<Long> authIdList = customerService.getAuthIdList();
+//        List<Long> authIdList = customerService.getAuthIdList();
+//
+//        if (authIdList.size() == 0) {
+//            return new Page<>();
+//        }
 
-        if (authIdList.size() == 0) {
-            return new Page<>();
-        }
+        IWrapper<SaleQuotation> wrapper = IWrapper.getWrapper();
+//        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), SaleQuotation::getStatus, dto.getStatus());
+//        wrapper.orderByDesc(SaleQuotation::getCreateTime);
+//        wrapper.in(SaleQuotation::getBuyCorporationId, authIdList);
+
+
+        //报价状态
+        wrapper.eq(SaleQuotation::getQuotationStatus, dto.getQuotationStatus());
+        //报价公司
+        wrapper.eq(SaleQuotation::getCompanyId, dto.getCompanyId());
+        //报价单类型
+        wrapper.eq(SaleQuotation::getType, dto.getType());
 
-        LambdaQueryWrapper<SaleQuotation> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getSellCorporationId()),
-                SaleQuotation::getSellCorporationId, dto.getSellCorporationId());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), SaleQuotation::getStatus, dto.getStatus());
-        wrapper.orderByDesc(SaleQuotation::getCreateTime);
-        wrapper.in(SaleQuotation::getBuyCorporationId, authIdList);
+        //报价时间-时间范围过滤
+        wrapper.ge("sq", SaleQuotation::getQuotationTime, dto.getQuotationTimeSta());
+        wrapper.le("sq", SaleQuotation::getQuotationTime, dto.getQuotationTimeEnd());
+        //创建时间-时间范围过滤
+        wrapper.ge("sq", SaleQuotation::getCreateTime, dto.getBeginTime());
+        wrapper.le("sq", SaleQuotation::getCreateTime, dto.getEndTime());
+
+        wrapper.ne("sq", SaleQuotation::getStatus, FlowStatusEnum1.UPDATE);
 
         Page<SaleQuotationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
-        List<SaleQuotationVo> saleQuotationVoList = page.getRecords();
+        List<SaleQuotationVo> records = page.getRecords();
+
+        if (ObjectUtil.isEmpty(records)) {
+            return page;
+        }
 
         // 赋值用户名称
-        UserUtil.assignmentNickName(saleQuotationVoList, BasePo::getCreateUser, SaleQuotationVo::setUserName);
+        UserUtil.assignmentNickName(records, BasePo::getCreateUser, SaleQuotationVo::setUserName);
         // 赋值买方公司名称(客户)
-        customerService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getBuyCorporationId, (item, customer) -> {
+        customerService.attributeAssign(records, SaleQuotationVo::getBuyCorporationId, (item, customer) -> {
             item.setBuyCorporationName(customer.getName());
-            item.setTag(customer.getTag());
         });
-        // 赋值卖方公司名称
-        corporationService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getSellCorporationId, (item, corporation) -> {
-            item.setSellCorporationName(corporation.getName());
+
+
+        List<Long> companyIds = records.stream().map(SaleQuotation::getCompanyId).collect(Collectors.toList());
+        List<SysDept> companyList = sysDeptService.list(Wrappers.<SysDept>query().in("dept_id", companyIds));
+        Map<Long, String> companyMap = companyList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
+
+        List<Long> ids = records.stream().map(SaleQuotationVo::getId).collect(Collectors.toList());
+        List<QuotationProduct> pList = quotationProductService.list(q -> q.in(QuotationProduct::getSaleQuotationId, ids));
+        List<QuotationProductVo> quotationPayVos = BeanUtil.copyToList(pList, QuotationProductVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationPayVos, QuotationProductVo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
         });
-        //  赋值流程id
-        flowExampleService.setFlowId(saleQuotationVoList, SaleQuotationVo::setFlowId);
+        Map<Long, List<QuotationProductVo>> pMap = quotationPayVos.stream().collect(Collectors.groupingBy(QuotationProduct::getSaleQuotationId));
+
+        for (SaleQuotationVo saleQuotationVo : records) {
+            //赋值报价公司名称
+            saleQuotationVo.setCompanyName(companyMap.get(saleQuotationVo.getCompanyId()));
+
+            //赋值产品列表
+            saleQuotationVo.setQuotationProductList(pMap.get(saleQuotationVo.getId()));
+        }
+
 
         return page;
     }
 
+    @Override
+    @DSTransactional
+    public void add(SaleQuotationDto saleQuotationDto) {
+        //添加报价编码
+        if (ObjectUtil.isEmpty(saleQuotationDto.getCode())) {
+            saleQuotationDto.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(), saleQuotationDto.getBuyCorporationId()));
+        }
+
+        long id = IdWorker.getId();
+        saleQuotationDto.setId(id);
+        saleQuotationDto.setGroupId(id);//赋值数据分组id
+        if (ObjectUtil.isEmpty(saleQuotationDto.getStatus())) {
+            saleQuotationDto.setStatus(30);//默认审批通过
+        }
+        saleQuotationDto.setQuotationStatus(0);//报价状态未报价
+        saveOrEdit(saleQuotationDto);
+
+        //消息推送 给归属公司的 总经理
+        JSONObject meassage = new JSONObject();
+        meassage.put("msg", "您有新的报价单待报价,请尽快处理!");
+        meassage.put("business_id", saleQuotationDto.getId());
+        List<Long> generalManagerIds = UserUtil.getUserIdsByRoleKey("general_manager", saleQuotationDto.getCompanyId());
+        WebSocketPush.byUsers(PushTypeEnum.MESSAGE, generalManagerIds, meassage.toString(), PushBusinessTypeEnum.NEW_QUOTATION.getType());
+    }
+
+    @Override
+    @DSTransactional
+    public void edit(SaleQuotationDto saleQuotationDto) {
+        if (Objects.equals(saleQuotationDto.getQuotationStatus(), 2)) {
+            saleQuotationDto.setQuotationTime(new Date());
+        }
+        saveOrEdit(saleQuotationDto);
+    }
+
     /**
-     * 报价表明细
+     * 变更
      */
     @Override
-    public SaleQuotationVo detail(Long id) {
-        //查询报价表详情
-        SaleQuotation SaleQuotation = this.getById(id);
-        SaleQuotationVo result = BeanUtil.toBean(SaleQuotation, SaleQuotationVo.class);
-        if (ObjectUtil.isNotEmpty(result)) {
-            //赋值合同模板名称
-            ContractTemplate contractTemplate = contractTemplateService.getById(result.getContractTemplateId());
-            if (ObjectUtil.isNotEmpty(contractTemplate)) {
-                result.setContractTemplateName(contractTemplate.getTemplateName());
-            }
-            //赋值买方公司名称(客户)
-            Customer customer = customerService.getById(result.getBuyCorporationId());
-            if (ObjectUtil.isNotEmpty(customer)) {
-                result.setBuyCorporationName(customer.getName());
+    public void changeSaleQuotation(SaleQuotationDto saleQuotationDto) {
+        SaleQuotation saleQuotation = this.getById(saleQuotationDto.getId());
+        if (ObjectUtil.isEmpty(saleQuotation)) {
+            throw new ServiceException("查询不到原报价单信息");
+        }
+        saleQuotation.setStatus(FlowStatusEnum1.UPDATE.getKey());
+        this.updateById(saleQuotation);
+
+        saleQuotationDto.setOldQuotationId(saleQuotation.getId());
+
+        //变更清除id信息
+        saleQuotationDto.setId(null);
+        saleQuotationDto.setStatus(30);
+        saleQuotationDto.setQuotationStatus(0);
+        saleQuotationDto.setCode(Utils.getNewCode(saleQuotation.getCode()));//赋值新合同号
+        List<QuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
+        for (QuotationProductDto quotationProductDto : quotationProductList) {
+            quotationProductDto.setId(null);
+            List<QuotationProductBomDto> quotationProductBomList = quotationProductDto.getQuotationProductBomList();
+            for (QuotationProductBomDto quotationProductBomDto : quotationProductBomList) {
+                quotationProductBomDto.setId(null);
             }
-            //赋值卖方公司名称(多公司)
-            Corporation corporation = corporationService.getById(result.getSellCorporationId());
-            if (ObjectUtil.isNotEmpty(corporation)) {
-                result.setSellCorporationName(corporation.getName());
+            quotationProductDto.setQuotationProductBomList(quotationProductBomList);
+        }
+        saleQuotationDto.setQuotationProductList(quotationProductList);
+        //调用创建方法
+        saveOrEdit(saleQuotationDto);
+    }
+
+    /**
+     * 作废
+     */
+    @Override
+    public void cancellation(Long id) {
+        SaleQuotation saleQuotation = this.getById(id);
+        saleQuotation.setStatus(FlowStatusEnum1.CANCELLATION.getKey());
+        this.updateById(saleQuotation);
+    }
+
+    /**
+     * 添加修改公共方法
+     */
+    private void saveOrEdit(SaleQuotationDto saleQuotationDto) {
+        this.saveOrUpdate(saleQuotationDto);
+
+        List<QuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
+        for (QuotationProductDto quotationProductDto : quotationProductList) {
+            //手动创建id
+            if (ObjectUtil.isEmpty(quotationProductDto.getId())) {
+                quotationProductDto.setId(IdWorker.getId());
             }
+            quotationProductDto.setSaleQuotationId(saleQuotationDto.getId());
 
-            //赋值买方公司地址
-            setArea(result);
-            //查询报价-商品表的详情
-            List<QuotationProduct> quotationProductList = quotationProductService.list(Wrappers.<QuotationProduct>lambdaQuery()
-                    .eq(QuotationProduct::getSaleQuotationId, result.getId()));
-            result.setQuotationProductList(quotationProductList);
-
-            //查询报价-收费项目表的详情
-            List<QuotationPay> quotationPayList = quotationPayService.list(Wrappers.<QuotationPay>lambdaQuery()
-                    .eq(QuotationPay::getSaleQuotationId, result.getId()));
-            result.setQuotationPayList(quotationPayList);
+            //保存配件
+            List<QuotationProductBom> quotationProductBomList = BeanUtil.copyToList(quotationProductDto.getQuotationProductBomList(), QuotationProductBom.class);
+            for (QuotationProductBom quotationProductBom : quotationProductBomList) {
+                quotationProductBom.setProductId(quotationProductDto.getProductId());
+                quotationProductBom.setQuotationProductId(quotationProductDto.getId());
+            }
+            quotationProductBomService.editLinked(quotationProductBomList, QuotationProductBom::getQuotationProductId, quotationProductDto.getId());
         }
 
-        return result;
+        List<QuotationProduct> quotationProducts = BeanUtil.copyToList(quotationProductList, QuotationProduct.class);
+        quotationProductService.editLinked(quotationProducts, QuotationProduct::getSaleQuotationId, saleQuotationDto.getId());
     }
 
+    /**
+     * 报价表明细
+     */
     @Override
-    public void add(SaleQuotationDto saleQuotationDto) {
-        this.save(saleQuotationDto);
-    }
+    public SaleQuotationVo detail(Long id) {
+        //查询报价表详情
+        SaleQuotation saleQuotation = this.getById(id);
+        SaleQuotationVo result = BeanUtil.toBean(saleQuotation, SaleQuotationVo.class);
+        if (ObjectUtil.isEmpty(result)) {
+            throw new ServiceException("查询不到明细信息请检查");
+        }
+        //赋值买方公司名称(客户)
+        Customer customer = customerService.getById(result.getBuyCorporationId());
+        if (ObjectUtil.isNotEmpty(customer)) {
+            result.setBuyCorporationName(customer.getName());
+        }
 
-    @Override
-    public void edit(SaleQuotationDto saleQuotationDto) {
-        this.updateById(saleQuotationDto);
+        //赋值买方公司地址
+        setArea(result);
+        //查询报价-商品表的详情
+        List<QuotationProduct> quotationProductList = quotationProductService.list(Wrappers.<QuotationProduct>lambdaQuery()
+                .eq(QuotationProduct::getSaleQuotationId, result.getId()));
+
+        List<QuotationProductVo> quotationProductVos = BeanUtil.copyToList(quotationProductList, QuotationProductVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationProductVos, QuotationProductVo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
+            item.setProductLength(productInfo.getLength());
+            item.setProductWidth(productInfo.getWidth());
+            item.setProductHeight(productInfo.getHeight());
+        });
+
+        //获取配件列表
+        List<Long> ids = quotationProductVos.stream().map(QuotationProduct::getId).collect(Collectors.toList());
+        List<QuotationProductBom> list = quotationProductBomService.list(q -> q.in(QuotationProductBom::getQuotationProductId, ids));
+        List<QuotationProductBomVo> quotationProductBomVos = BeanUtil.copyToList(list, QuotationProductBomVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationProductBomVos, QuotationProductBom::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
+            item.setProductLength(productInfo.getLength());
+            item.setProductWidth(productInfo.getWidth());
+            item.setProductHeight(productInfo.getHeight());
+        });
+
+        Map<Long, List<QuotationProductBomVo>> qpbMap = quotationProductBomVos.stream().collect(Collectors.groupingBy(QuotationProductBom::getQuotationProductId));
+
+        for (QuotationProductVo quotationProductVo : quotationProductVos) {
+            quotationProductVo.setQuotationProductBomList(qpbMap.get(quotationProductVo.getId()));
+        }
+        result.setQuotationProductList(quotationProductVos);
+
+        //赋值报价金额趋势
+        List<SaleQuotation> quotationTrendList = this.list(q -> q
+                .eq(SaleQuotation::getGroupId, result.getGroupId())
+                .ne(SaleQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
+                .orderByAsc(SaleQuotation::getCreateTime)
+        );
+        result.setQuotationTrendList(quotationTrendList);
+
+        return result;
     }
 
     @Override
@@ -266,7 +435,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         //查询这个客户的销售额(合同总金额)及成交合同数量
         ContractVo contractVo = contractService.getSalesTotal(dto.getId());
         map.put("contractVo", contractVo);
-        Page<ContractVo> page = contractService.getSalesTotalList(dto.getPage(),dto.getId());
+        Page<ContractVo> page = contractService.getSalesTotalList(dto.getPage(), dto.getId());
         List<ContractVo> contractVoList = page.getRecords();
         // 赋值用户名称
         UserUtil.assignmentNickName(contractVoList, BasePo::getCreateUser, ContractVo::setUserName);
@@ -278,7 +447,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         corporationService.attributeAssign(contractVoList, ContractVo::getSellCorporationId, (item, corporation) -> {
             item.setSellCorporationName(corporation.getName());
         });
-        map.put("contractList",page);
+        map.put("contractList", page);
         //查询这个客户的报价次数
         Integer count = this.getCount(dto.getId());
 //        DynamicDataSourceContextHolder.poll();
@@ -349,9 +518,9 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
     @Override
     public Page<SaleQuotationVo> saleDetail(CustomerSelectDto dto) {
         IWrapper<SaleQuotation> wrapper = IWrapper.getWrapper();
-        wrapper.eq("t1",SaleQuotation::getBuyCorporationId,dto.getId());
+        wrapper.eq("t1", SaleQuotation::getBuyCorporationId, dto.getId());
         wrapper.eq("t1.status", FlowStatusEnum1.PASS.getKey());
-        wrapper.orderByDesc("t1",SaleQuotation::getCreateTime);
+        wrapper.orderByDesc("t1", SaleQuotation::getCreateTime);
         Page<SaleQuotationVo> saleQuotationVoPage = baseMapper.saleDetail(dto.getPage(), wrapper);
         List<SaleQuotationVo> records = saleQuotationVoPage.getRecords();
         // 赋值用户名称
@@ -466,25 +635,25 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         query.eq(ObjectUtil.isNotEmpty(dto.getProvinceId()), "c.province_id", dto.getProvinceId());
         query.eq(ObjectUtil.isNotEmpty(dto.getCityId()), "c.city_id", dto.getCityId());
         query.eq("sq.status", 30);
-        //类型询盘统计(报价)
-        List<SaleQuotationVo> saleStatisticsList = baseMapper.saleStatistics(query);
-        Map<String, List<SaleQuotationVo>> saleStatisticsMap = saleStatisticsList.stream().collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
-
-        //查询成交单统计(合同)
-        List<SaleQuotationVo> contractStatisticsList = contractService.contractStatistics(query);
-        Map<String, List<SaleQuotationVo>> contractStatisticsMap = contractStatisticsList.stream()
-                .collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
-
-        //获取询盘总计
-        Integer saleAmount = saleStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
-                .reduce(Integer::sum).orElse(0);
-
-        //获取成交单总计
-        Integer contractAmount = contractStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
-                .reduce(Integer::sum).orElse(0);
-
-        map.put("saleAmount", saleAmount);
-        map.put("contractAmount", contractAmount);
+//        //类型询盘统计(报价)
+//        List<SaleQuotationVo> saleStatisticsList = baseMapper.saleStatistics(query);
+//        Map<String, List<SaleQuotationVo>> saleStatisticsMap = saleStatisticsList.stream().collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
+//
+//        //查询成交单统计(合同)
+//        List<SaleQuotationVo> contractStatisticsList = contractService.contractStatistics(query);
+//        Map<String, List<SaleQuotationVo>> contractStatisticsMap = contractStatisticsList.stream()
+//                .collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
+
+//        //获取询盘总计
+//        Integer saleAmount = saleStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
+//                .reduce(Integer::sum).orElse(0);
+//
+//        //获取成交单总计
+//        Integer contractAmount = contractStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
+//                .reduce(Integer::sum).orElse(0);
+
+//        map.put("saleAmount", saleAmount);
+//        map.put("contractAmount", contractAmount);
 
         //获取类型的字典数据
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
@@ -503,17 +672,17 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
             saleMap.put("contractAmount", 0);
             saleMap.put("saleAmount", 0);
 
-            //赋值询盘数据
-            List<SaleQuotationVo> saleQuotationVoList = saleStatisticsMap.get(dictTenantDataVo.getDictKey());
-            if (ObjectUtil.isNotEmpty(saleQuotationVoList)) {
-                saleMap.put("saleAmount", saleQuotationVoList.get(0).getCount());
-            }
-
-            //赋值成交单数据
-            List<SaleQuotationVo> saleQuotationList = contractStatisticsMap.get(dictTenantDataVo.getDictKey());
-            if (ObjectUtil.isNotEmpty(saleQuotationList)) {
-                saleMap.put("contractAmount", saleQuotationList.get(0).getCount());
-            }
+//            //赋值询盘数据
+//            List<SaleQuotationVo> saleQuotationVoList = saleStatisticsMap.get(dictTenantDataVo.getDictKey());
+//            if (ObjectUtil.isNotEmpty(saleQuotationVoList)) {
+//                saleMap.put("saleAmount", saleQuotationVoList.get(0).getCount());
+//            }
+//
+//            //赋值成交单数据
+//            List<SaleQuotationVo> saleQuotationList = contractStatisticsMap.get(dictTenantDataVo.getDictKey());
+//            if (ObjectUtil.isNotEmpty(saleQuotationList)) {
+//                saleMap.put("contractAmount", saleQuotationList.get(0).getCount());
+//            }
             saleList.add(saleMap);
         }
         map.put("saleList", saleList);

+ 4 - 0
hx-sale/src/main/resources/mapper/quotation/QuotationProductBomMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.sale.mapper.quotation.QuotationProductBomMapper">
+</mapper>