Преглед изворни кода

对外报价单 对外报价单跟进

yzc пре 1 година
родитељ
комит
b7d2842f10
39 измењених фајлова са 1517 додато и 44 уклоњено
  1. 88 0
      hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationController.java
  2. 61 0
      hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationFollowController.java
  3. 20 0
      hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationProductBomController.java
  4. 20 0
      hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationProductController.java
  5. 24 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationDto.java
  6. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationFollowDto.java
  7. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationFollowSelectDto.java
  8. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductBomDto.java
  9. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductBomSelectDto.java
  10. 24 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductDto.java
  11. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductSelectDto.java
  12. 51 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationSelectDto.java
  13. 124 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotation.java
  14. 38 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationFollow.java
  15. 68 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationProduct.java
  16. 73 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationProductBom.java
  17. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationFollowVo.java
  18. 27 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationProductBomVo.java
  19. 32 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationProductVo.java
  20. 57 0
      hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationVo.java
  21. 5 0
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationSelectDto.java
  22. 1 2
      hx-sale/src/main/java/com/fjhx/sale/entity/sale/vo/SaleQuotationVo.java
  23. 17 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationFollowMapper.java
  24. 26 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationMapper.java
  25. 17 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationProductBomMapper.java
  26. 17 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationProductMapper.java
  27. 39 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationFollowService.java
  28. 17 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationProductBomService.java
  29. 17 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationProductService.java
  30. 49 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationService.java
  31. 95 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationFollowServiceImpl.java
  32. 21 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationProductBomServiceImpl.java
  33. 21 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationProductServiceImpl.java
  34. 311 0
      hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationServiceImpl.java
  35. 9 42
      hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java
  36. 4 0
      hx-sale/src/main/resources/mapper/ext/ExtQuotationFollowMapper.xml
  37. 34 0
      hx-sale/src/main/resources/mapper/ext/ExtQuotationMapper.xml
  38. 4 0
      hx-sale/src/main/resources/mapper/ext/ExtQuotationProductBomMapper.xml
  39. 4 0
      hx-sale/src/main/resources/mapper/ext/ExtQuotationProductMapper.xml

+ 88 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationController.java

@@ -0,0 +1,88 @@
+package com.fjhx.sale.controller.ext;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationDto;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationSelectDto;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationVo;
+import com.fjhx.sale.service.ext.ExtQuotationService;
+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;
+
+
+/**
+ * <p>
+ * 对外报价单 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@RestController
+@RequestMapping("/extQuotation")
+public class ExtQuotationController {
+
+    @Autowired
+    private ExtQuotationService extQuotationService;
+
+    /**
+     * 对外报价单分页
+     */
+    @PostMapping("/page")
+    public Page<ExtQuotationVo> page(@RequestBody ExtQuotationSelectDto dto) {
+        return extQuotationService.getPage(dto);
+    }
+
+    /**
+     * 对外报价单明细
+     */
+    @PostMapping("/detail")
+    public ExtQuotationVo detail(@RequestBody BaseSelectDto dto) {
+        return extQuotationService.detail(dto.getId());
+    }
+
+    /**
+     * 对外报价单新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody ExtQuotationDto extQuotationDto) {
+        extQuotationService.add(extQuotationDto);
+    }
+
+    /**
+     * 对外报价单编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody ExtQuotationDto extQuotationDto) {
+        extQuotationService.edit(extQuotationDto);
+    }
+
+    /**
+     * 对外报价单删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        extQuotationService.delete(dto.getId());
+    }
+
+    /**
+     * 对外报价单变更
+     */
+    @PostMapping("/change")
+    public void change(@RequestBody ExtQuotationDto dto) {
+        extQuotationService.changeSaleQuotation(dto);
+    }
+
+    /**
+     * 报价表作废
+     */
+    @PostMapping("/cancellation")
+    public void cancellation(@RequestBody BaseSelectDto dto) {
+        extQuotationService.cancellation(dto.getId());
+    }
+
+
+}

+ 61 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationFollowController.java

@@ -0,0 +1,61 @@
+package com.fjhx.sale.controller.ext;
+
+import com.fjhx.sale.entity.ext.dto.ExtQuotationFollowDto;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationFollowVo;
+import com.fjhx.sale.service.ext.ExtQuotationFollowService;
+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;
+
+
+/**
+ * <p>
+ * 对外报价单跟进记录 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@RestController
+@RequestMapping("/extQuotationFollow")
+public class ExtQuotationFollowController {
+
+    @Autowired
+    private ExtQuotationFollowService extQuotationFollowService;
+
+    /**
+     * 对外报价单跟进记录明细
+     */
+    @PostMapping("/detail")
+    public ExtQuotationFollowVo detail(@RequestBody BaseSelectDto dto) {
+        return extQuotationFollowService.detail(dto.getId());
+    }
+
+    /**
+     * 对外报价单跟进记录新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody ExtQuotationFollowDto extQuotationFollowDto) {
+        extQuotationFollowService.add(extQuotationFollowDto);
+    }
+
+    /**
+     * 对外报价单跟进记录编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody ExtQuotationFollowDto extQuotationFollowDto) {
+        extQuotationFollowService.edit(extQuotationFollowDto);
+    }
+
+    /**
+     * 对外报价单跟进记录删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        extQuotationFollowService.delete(dto.getId());
+    }
+
+}

+ 20 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationProductBomController.java

@@ -0,0 +1,20 @@
+package com.fjhx.sale.controller.ext;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 对外报价单产品BOM 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@RestController
+@RequestMapping("/extQuotationProductBom")
+public class ExtQuotationProductBomController {
+
+
+}

+ 20 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/ext/ExtQuotationProductController.java

@@ -0,0 +1,20 @@
+package com.fjhx.sale.controller.ext;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 对外报价单产品 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@RestController
+@RequestMapping("/extQuotationProduct")
+public class ExtQuotationProductController {
+
+
+}

+ 24 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationDto.java

@@ -0,0 +1,24 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 对外报价单新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationDto extends ExtQuotation {
+
+    /**
+     * 商品-报价单关联表信息
+     */
+    private List<ExtQuotationProductDto> quotationProductList;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationFollowDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单跟进记录新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationFollowDto extends ExtQuotationFollow {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationFollowSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单跟进记录列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationFollowSelectDto extends BaseSelectDto {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductBomDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单产品BOM新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductBomDto extends ExtQuotationProductBom {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductBomSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单产品BOM列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductBomSelectDto extends BaseSelectDto {
+
+}

+ 24 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductDto.java

@@ -0,0 +1,24 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 对外报价单产品新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductDto extends ExtQuotationProduct {
+
+    /**
+     * 报价产品配件列表
+     */
+    private List<ExtQuotationProductBomDto> quotationProductBomList;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationProductSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单产品列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductSelectDto extends BaseSelectDto {
+
+}

+ 51 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationSelectDto.java

@@ -0,0 +1,51 @@
+package com.fjhx.sale.entity.ext.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 对外报价单列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationSelectDto extends BaseSelectDto {
+
+    /**
+     * 报价状态 0未报价 1报价中 2已报价
+     */
+    private Integer quotationStatus;
+
+    /**
+     * 归属公司Id
+     */
+    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;
+
+    /**
+     * 报价单类型
+     */
+    private Integer type;
+
+    /**
+     * 审批状态。10:发起。20 驳回。30通过
+     */
+    private Integer status;
+
+}

+ 124 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotation.java

@@ -0,0 +1,124 @@
+package com.fjhx.sale.entity.ext.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * <p>
+ * 对外报价单
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+@TableName("ext_quotation")
+public class ExtQuotation extends BasePo {
+
+    /**
+     * 报价单编码
+     */
+    private String code;
+
+    /**
+     * 买方公司ID
+     */
+    private Long buyCorporationId;
+
+    /**
+     * 买方联系人名称
+     */
+    private String buyContactName;
+
+    /**
+     * 买方联系人电话
+     */
+    private String buyContactNumber;
+
+    /**
+     * 买方国家表id
+     */
+    private Long buyCountryId;
+
+    /**
+     * 买方省份id
+     */
+    private Long buyProvinceId;
+
+    /**
+     * 买方城市id
+     */
+    private Long buyCityId;
+
+    /**
+     * 买方详细地址
+     */
+    private String buyAddress;
+
+    /**
+     * 买方邮编
+     */
+    private String buyPostalCode;
+
+    /**
+     * 币种(字典account_currency)
+     */
+    private String currency;
+
+    /**
+     * 报价金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 审批状态。10:发起。20 审批。30通过
+     */
+    private Integer status;
+
+    /**
+     * 报价类型 1内销2外销
+     */
+    private String type;
+
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
+    /**
+     * 数据分组id
+     */
+    private Long groupId;
+
+    /**
+     * 报价时间
+     */
+    private Date quotationTime;
+
+    /**
+     * 报价状态 0未报价 1报价中 2已报价
+     */
+    private Integer quotationStatus;
+
+    /**
+     * 上一版本id
+     */
+    private Long oldQuotationId;
+
+    /**
+     * 对内报价单id
+     */
+    private Long saleQuotationId;
+
+    /**
+     * 最后一次跟进时间
+     */
+    private Date lastFollowTime;
+
+}

+ 38 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationFollow.java

@@ -0,0 +1,38 @@
+package com.fjhx.sale.entity.ext.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BaseIdPo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 对外报价单跟进记录
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+@TableName("ext_quotation_follow")
+public class ExtQuotationFollow extends BaseIdPo {
+
+    /**
+     * 对外报价单id
+     */
+    private Long quotationId;
+
+    /**
+     * 跟进时间
+     */
+    private Date followTime;
+
+    /**
+     * 跟进 备注
+     */
+    private String remark;
+
+}

+ 68 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationProduct.java

@@ -0,0 +1,68 @@
+package com.fjhx.sale.entity.ext.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>
+ * 对外报价单产品
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+@TableName("ext_quotation_product")
+public class ExtQuotationProduct extends BasePo {
+
+    /**
+     * 对外报价表ID
+     */
+    private Long saleQuotationId;
+
+    /**
+     * 商品ID
+     */
+    private Long productId;
+
+    /**
+     * 商品名称
+     */
+    private String productName;
+
+    /**
+     * 商品型号
+     */
+    private String productModel;
+
+    /**
+     * 商品数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 商品单价
+     */
+    private BigDecimal price;
+
+    /**
+     * 商品金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 付款条件
+     */
+    private String remark;
+
+    /**
+     * 对内报价单物品表ID
+     */
+    private Long quotationProductId;
+
+}

+ 73 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/po/ExtQuotationProductBom.java

@@ -0,0 +1,73 @@
+package com.fjhx.sale.entity.ext.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>
+ * 对外报价单产品BOM
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+@TableName("ext_quotation_product_bom")
+public class ExtQuotationProductBom extends BasePo {
+
+    /**
+     * 对外报价产品表id
+     */
+    private Long quotationProductId;
+
+    /**
+     * 产品id
+     */
+    private Long productId;
+
+    /**
+     * 商品名称
+     */
+    private String productName;
+
+    /**
+     * 商品型号
+     */
+    private String productModel;
+
+    /**
+     * 商品数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 商品单价
+     */
+    private BigDecimal price;
+
+    /**
+     * 商品金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 付款条件
+     */
+    private String remark;
+
+    /**
+     * 物料id
+     */
+    private Long materialId;
+
+    /**
+     * 对内产品BOM表id
+     */
+    private Long quotationProductBomId;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationFollowVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.ext.vo;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对外报价单跟进记录列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationFollowVo extends ExtQuotationFollow {
+
+}

+ 27 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationProductBomVo.java

@@ -0,0 +1,27 @@
+package com.fjhx.sale.entity.ext.vo;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 对外报价单产品BOM列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductBomVo extends ExtQuotationProductBom {
+
+    private String productCode;
+
+    private String productName;
+
+    private BigDecimal productLength;
+    private BigDecimal productWidth;
+    private BigDecimal productHeight;
+
+}

+ 32 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationProductVo.java

@@ -0,0 +1,32 @@
+package com.fjhx.sale.entity.ext.vo;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 对外报价单产品列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationProductVo extends ExtQuotationProduct {
+
+    List<ExtQuotationProductBomVo> quotationProductBomList;
+    private String productCode;
+    private String productName;
+    private BigDecimal productLength;
+    private BigDecimal productWidth;
+    private BigDecimal productHeight;
+
+    /**
+     * 生产图片地址
+     */
+    private String productProdImgPath;
+
+}

+ 57 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationVo.java

@@ -0,0 +1,57 @@
+package com.fjhx.sale.entity.ext.vo;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 对外报价单列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Getter
+@Setter
+public class ExtQuotationVo extends ExtQuotation {
+
+    /**
+     * 跟进记录列表
+     */
+    List<ExtQuotationFollow> extQuotationFollowList;
+    /**
+     * 买方公司名称
+     */
+    private String buyCorporationName;
+    /**
+     * 归属公司名称
+     */
+    private String companyName;
+    /**
+     * 商品列表
+     */
+    private List<ExtQuotationProductVo> quotationProductList;
+    /**
+     * 买方公司国家
+     */
+    private String buyCountryName;
+    /**
+     * 买方公司省
+     */
+    private String buyProvinceName;
+    /**
+     * 买方公司市
+     */
+    private String buyCityName;
+    /**
+     * 卖方公司详细地址
+     */
+    private String buyDetailedAddress;
+    /**
+     * 报价趋势
+     */
+    private List<ExtQuotation> quotationTrendList;
+
+}

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/sale/dto/SaleQuotationSelectDto.java

@@ -52,4 +52,9 @@ public class SaleQuotationSelectDto extends BaseSelectDto {
      * 报价单类型
      */
     private Integer type;
+
+    /**
+     * 审批状态。10:发起。20 驳回。30通过
+     */
+    private Integer status;
 }

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

@@ -110,7 +110,7 @@ public class SaleQuotationVo extends SaleQuotation {
     private String contractTemplateName;
 
     /**
-     * 买方名称
+     * 公司名称
      */
     private String companyName;
 
@@ -118,7 +118,6 @@ public class SaleQuotationVo extends SaleQuotation {
     /**
      * 报价趋势
      */
-
     private List<SaleQuotation> quotationTrendList;
 
 

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationFollowMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.mapper.ext;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+
+
+/**
+ * <p>
+ * 对外报价单跟进记录 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationFollowMapper extends BaseMapper<ExtQuotationFollow> {
+
+}

+ 26 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.sale.mapper.ext;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 对外报价单 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationMapper extends BaseMapper<ExtQuotation> {
+
+    /**
+     * 对外报价单分页
+     */
+    Page<ExtQuotationVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<ExtQuotation> wrapper);
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationProductBomMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.mapper.ext;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+
+
+/**
+ * <p>
+ * 对外报价单产品BOM Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationProductBomMapper extends BaseMapper<ExtQuotationProductBom> {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/ext/ExtQuotationProductMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.mapper.ext;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+
+
+/**
+ * <p>
+ * 对外报价单产品 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationProductMapper extends BaseMapper<ExtQuotationProduct> {
+
+}

+ 39 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationFollowService.java

@@ -0,0 +1,39 @@
+package com.fjhx.sale.service.ext;
+
+import com.fjhx.sale.entity.ext.dto.ExtQuotationFollowDto;
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationFollowVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 对外报价单跟进记录 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationFollowService extends BaseService<ExtQuotationFollow> {
+
+    /**
+     * 对外报价单跟进记录明细
+     */
+    ExtQuotationFollowVo detail(Long id);
+
+    /**
+     * 对外报价单跟进记录新增
+     */
+    void add(ExtQuotationFollowDto extQuotationFollowDto);
+
+    /**
+     * 对外报价单跟进记录编辑
+     */
+    void edit(ExtQuotationFollowDto extQuotationFollowDto);
+
+    /**
+     * 对外报价单跟进记录删除
+     */
+    void delete(Long id);
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationProductBomService.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.service.ext;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 对外报价单产品BOM 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationProductBomService extends BaseService<ExtQuotationProductBom> {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationProductService.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.service.ext;
+
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 对外报价单产品 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationProductService extends BaseService<ExtQuotationProduct> {
+
+}

+ 49 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/ExtQuotationService.java

@@ -0,0 +1,49 @@
+package com.fjhx.sale.service.ext;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationDto;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationSelectDto;
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 对外报价单 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+public interface ExtQuotationService extends BaseService<ExtQuotation> {
+
+    /**
+     * 对外报价单分页
+     */
+    Page<ExtQuotationVo> getPage(ExtQuotationSelectDto dto);
+
+    /**
+     * 对外报价单明细
+     */
+    ExtQuotationVo detail(Long id);
+
+    /**
+     * 对外报价单新增
+     */
+    void add(ExtQuotationDto extQuotationDto);
+
+    /**
+     * 对外报价单编辑
+     */
+    void edit(ExtQuotationDto extQuotationDto);
+
+    /**
+     * 对外报价单删除
+     */
+    void delete(Long id);
+
+    void changeSaleQuotation(ExtQuotationDto saleQuotationDto);
+
+    void cancellation(Long id);
+}

+ 95 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationFollowServiceImpl.java

@@ -0,0 +1,95 @@
+package com.fjhx.sale.service.ext.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationFollowDto;
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationFollowVo;
+import com.fjhx.sale.mapper.ext.ExtQuotationFollowMapper;
+import com.fjhx.sale.service.ext.ExtQuotationFollowService;
+import com.fjhx.sale.service.ext.ExtQuotationService;
+import com.ruoyi.common.exception.ServiceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+
+/**
+ * <p>
+ * 对外报价单跟进记录 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Service
+public class ExtQuotationFollowServiceImpl extends ServiceImpl<ExtQuotationFollowMapper, ExtQuotationFollow> implements ExtQuotationFollowService {
+
+    @Autowired
+    private ExtQuotationService extQuotationService;
+
+    @Override
+    public ExtQuotationFollowVo detail(Long id) {
+        ExtQuotationFollow ExtQuotationFollow = this.getById(id);
+        ExtQuotationFollowVo result = BeanUtil.toBean(ExtQuotationFollow, ExtQuotationFollowVo.class);
+        return result;
+    }
+
+    @Override
+    @DSTransactional
+    public void add(ExtQuotationFollowDto extQuotationFollowDto) {
+        if (ObjectUtil.isEmpty(extQuotationFollowDto.getQuotationId())) {
+            throw new ServiceException("报价单id不能为空!");
+        }
+        this.save(extQuotationFollowDto);
+
+        updateLastFollowTime(extQuotationFollowDto.getQuotationId());
+    }
+
+    @Override
+    @DSTransactional
+    public void edit(ExtQuotationFollowDto extQuotationFollowDto) {
+        Long id = extQuotationFollowDto.getId();
+        ExtQuotationFollow extQuotationFollow = getById(id);
+        if (ObjectUtil.isEmpty(extQuotationFollow)) {
+            throw new ServiceException("查询不到跟进信息!");
+        }
+        this.updateById(extQuotationFollowDto);
+
+        updateLastFollowTime(extQuotationFollow.getQuotationId());
+    }
+
+    @Override
+    @DSTransactional
+    public void delete(Long id) {
+        ExtQuotationFollow extQuotationFollow = getById(id);
+        if (ObjectUtil.isEmpty(extQuotationFollow)) {
+            throw new ServiceException("查询不到跟进信息!");
+        }
+        this.removeById(id);
+        updateLastFollowTime(extQuotationFollow.getQuotationId());
+    }
+
+    /**
+     * 更新客户最后一次跟进时间
+     */
+    private synchronized void updateLastFollowTime(Long extQuotationId) {
+        //获取跟进时间最新的一条
+        ExtQuotationFollow extQuotationFollow = this.getOne(q -> q
+                .eq(ExtQuotationFollow::getQuotationId, extQuotationId)
+                .orderByDesc(ExtQuotationFollow::getFollowTime)
+                .orderByDesc(ExtQuotationFollow::getId)
+        );
+        Date lastFollowTime = ObjectUtil.isNotEmpty(extQuotationFollow) ? extQuotationFollow.getFollowTime() : null;
+        extQuotationService.update(q -> q
+                .eq(ExtQuotation::getId, extQuotationId)
+                .set(ExtQuotation::getLastFollowTime, lastFollowTime)
+        );
+
+    }
+
+}

+ 21 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationProductBomServiceImpl.java

@@ -0,0 +1,21 @@
+package com.fjhx.sale.service.ext.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+import com.fjhx.sale.mapper.ext.ExtQuotationProductBomMapper;
+import com.fjhx.sale.service.ext.ExtQuotationProductBomService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 对外报价单产品BOM 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Service
+public class ExtQuotationProductBomServiceImpl extends ServiceImpl<ExtQuotationProductBomMapper, ExtQuotationProductBom> implements ExtQuotationProductBomService {
+
+}

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

@@ -0,0 +1,21 @@
+package com.fjhx.sale.service.ext.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+import com.fjhx.sale.mapper.ext.ExtQuotationProductMapper;
+import com.fjhx.sale.service.ext.ExtQuotationProductService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 对外报价单产品 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Service
+public class ExtQuotationProductServiceImpl extends ServiceImpl<ExtQuotationProductMapper, ExtQuotationProduct> implements ExtQuotationProductService {
+
+}

+ 311 - 0
hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationServiceImpl.java

@@ -0,0 +1,311 @@
+package com.fjhx.sale.service.ext.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+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.area.utils.CustomizeAreaUtil;
+import com.fjhx.common.enums.FlowStatusEnum1;
+import com.fjhx.common.utils.Utils;
+import com.fjhx.customer.entity.customer.po.Customer;
+import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.item.service.product.ProductInfoService;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationDto;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationProductBomDto;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationProductDto;
+import com.fjhx.sale.entity.ext.dto.ExtQuotationSelectDto;
+import com.fjhx.sale.entity.ext.po.ExtQuotation;
+import com.fjhx.sale.entity.ext.po.ExtQuotationFollow;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProduct;
+import com.fjhx.sale.entity.ext.po.ExtQuotationProductBom;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationProductBomVo;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationProductVo;
+import com.fjhx.sale.entity.ext.vo.ExtQuotationVo;
+import com.fjhx.sale.entity.sale.po.SaleQuotation;
+import com.fjhx.sale.mapper.ext.ExtQuotationMapper;
+import com.fjhx.sale.service.ext.ExtQuotationFollowService;
+import com.fjhx.sale.service.ext.ExtQuotationProductBomService;
+import com.fjhx.sale.service.ext.ExtQuotationProductService;
+import com.fjhx.sale.service.ext.ExtQuotationService;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.system.service.ISysDeptService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 对外报价单 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-14
+ */
+@Service
+public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, ExtQuotation> implements ExtQuotationService {
+
+    @Autowired
+    private CustomerService customerService;
+    @Autowired
+    private ProductInfoService productInfoService;
+    @Autowired
+    private ISysDeptService sysDeptService;
+    @Autowired
+    private ExtQuotationProductService extQuotationProductService;
+    @Autowired
+    private ExtQuotationProductBomService extQuotationProductBomService;
+    @Autowired
+    private ExtQuotationFollowService extQuotationFollowService;
+
+    @Override
+    public Page<ExtQuotationVo> getPage(ExtQuotationSelectDto dto) {
+        IWrapper<ExtQuotation> wrapper = getWrapper();
+        wrapper.orderByDesc("eq", ExtQuotation::getId);
+
+        //报价状态
+        wrapper.eq(SaleQuotation::getQuotationStatus, dto.getQuotationStatus());
+        //报价公司
+        wrapper.eq(SaleQuotation::getCompanyId, dto.getCompanyId());
+        //报价单类型
+        wrapper.eq(SaleQuotation::getType, dto.getType());
+
+        //报价时间-时间范围过滤
+        wrapper.ge("eq", ExtQuotation::getQuotationTime, dto.getQuotationTimeSta());
+        wrapper.le("eq", ExtQuotation::getQuotationTime, dto.getQuotationTimeEnd());
+        //创建时间-时间范围过滤
+        wrapper.ge("eq", ExtQuotation::getCreateTime, dto.getBeginTime());
+        wrapper.le("eq", ExtQuotation::getCreateTime, dto.getEndTime());
+
+        wrapper.ne("eq", ExtQuotation::getStatus, FlowStatusEnum1.UPDATE);
+        wrapper.ne("eq", ExtQuotation::getStatus, dto.getStatus());
+
+        Page<ExtQuotationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<ExtQuotationVo> records = page.getRecords();
+
+        if (ObjectUtil.isEmpty(records)) {
+            return page;
+        }
+
+        // 赋值买方公司名称(客户)
+        customerService.attributeAssign(records, ExtQuotationVo::getBuyCorporationId, (item, customer) -> {
+            item.setBuyCorporationName(customer.getName());
+        });
+
+        List<Long> companyIds = records.stream().map(ExtQuotation::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(ExtQuotationVo::getId).collect(Collectors.toList());
+        List<ExtQuotationProduct> pList = extQuotationProductService.list(q -> q.in(ExtQuotationProduct::getSaleQuotationId, ids));
+        List<ExtQuotationProductVo> quotationProductVos = BeanUtil.copyToList(pList, ExtQuotationProductVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationProductVos, ExtQuotationProductVo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
+        });
+        Map<Long, List<ExtQuotationProductVo>> pMap = quotationProductVos.stream().collect(Collectors.groupingBy(ExtQuotationProduct::getSaleQuotationId));
+
+        //获取跟进记录Map
+        Map<Long, List<ExtQuotationFollow>> followMap = extQuotationFollowService.mapKGroup(ExtQuotationFollow::getQuotationId, q -> q
+                .in(ExtQuotationFollow::getQuotationId, ids)
+                .orderByDesc(ExtQuotationFollow::getFollowTime)
+        );
+
+        for (ExtQuotationVo saleQuotationVo : records) {
+            //赋值报价公司名称
+            saleQuotationVo.setCompanyName(companyMap.get(saleQuotationVo.getCompanyId()));
+
+            //赋值产品列表
+            saleQuotationVo.setQuotationProductList(pMap.get(saleQuotationVo.getId()));
+
+            //赋值跟进信息
+            List<ExtQuotationFollow> extQuotationFollows = followMap.get(saleQuotationVo.getId());
+            saleQuotationVo.setExtQuotationFollowList(extQuotationFollows);
+        }
+
+        return page;
+    }
+
+    @Override
+    public ExtQuotationVo detail(Long id) {
+        //查询报价表详情
+        ExtQuotation extQuotation = this.getById(id);
+        ExtQuotationVo result = BeanUtil.toBean(extQuotation, ExtQuotationVo.class);
+        if (ObjectUtil.isEmpty(result)) {
+            throw new ServiceException("查询不到明细信息请检查");
+        }
+        //赋值买方公司名称(客户)
+        Customer customer = customerService.getById(result.getBuyCorporationId());
+        if (ObjectUtil.isNotEmpty(customer)) {
+            result.setBuyCorporationName(customer.getName());
+        }
+
+        //赋值买方公司地址
+        setArea(result);
+        //查询报价-商品表的详情
+        List<ExtQuotationProduct> quotationProductList = extQuotationProductService.list(Wrappers.<ExtQuotationProduct>lambdaQuery()
+                .eq(ExtQuotationProduct::getSaleQuotationId, result.getId()));
+
+        List<ExtQuotationProductVo> quotationProductVos = BeanUtil.copyToList(quotationProductList, ExtQuotationProductVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationProductVos, ExtQuotationProductVo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
+            item.setProductLength(productInfo.getLength());
+            item.setProductWidth(productInfo.getWidth());
+            item.setProductHeight(productInfo.getHeight());
+            item.setProductProdImgPath(productInfo.getProdImgPath());
+        });
+
+        //获取配件列表
+        List<Long> ids = quotationProductVos.stream().map(ExtQuotationProduct::getId).collect(Collectors.toList());
+        List<ExtQuotationProductBom> list = extQuotationProductBomService.list(q -> q.in(ExtQuotationProductBom::getQuotationProductId, ids));
+        List<ExtQuotationProductBomVo> quotationProductBomVos = BeanUtil.copyToList(list, ExtQuotationProductBomVo.class);
+        //赋值产品信息
+        productInfoService.attributeAssign(quotationProductBomVos, ExtQuotationProductBom::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<ExtQuotationProductBomVo>> qpbMap = quotationProductBomVos.stream().collect(Collectors.groupingBy(ExtQuotationProductBom::getQuotationProductId));
+
+        for (ExtQuotationProductVo quotationProductVo : quotationProductVos) {
+            quotationProductVo.setQuotationProductBomList(qpbMap.get(quotationProductVo.getId()));
+        }
+        result.setQuotationProductList(quotationProductVos);
+
+        //赋值报价金额趋势
+        List<ExtQuotation> quotationTrendList = this.list(q -> q
+                .eq(ExtQuotation::getGroupId, result.getGroupId())
+                .ne(ExtQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
+                .orderByAsc(ExtQuotation::getCreateTime)
+        );
+        result.setQuotationTrendList(quotationTrendList);
+
+        return result;
+    }
+
+    @Override
+    @DSTransactional
+    public void add(ExtQuotationDto saleQuotationDto) {
+        long id = IdWorker.getId();
+        saleQuotationDto.setId(id);
+        saleQuotationDto.setGroupId(id);//赋值数据分组id
+        saleQuotationDto.setStatus(30);
+        saveOrEdit(saleQuotationDto);
+    }
+
+    @Override
+    @DSTransactional
+    public void edit(ExtQuotationDto saleQuotationDto) {
+        if (Objects.equals(saleQuotationDto.getQuotationStatus(), 2)) {
+            saleQuotationDto.setQuotationTime(new Date());
+        }
+        saveOrEdit(saleQuotationDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+    /**
+     * 变更
+     */
+    @Override
+    public void changeSaleQuotation(ExtQuotationDto saleQuotationDto) {
+        ExtQuotation 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<ExtQuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
+        for (ExtQuotationProductDto quotationProductDto : quotationProductList) {
+            quotationProductDto.setId(null);
+            List<ExtQuotationProductBomDto> quotationProductBomList = quotationProductDto.getQuotationProductBomList();
+            for (ExtQuotationProductBomDto quotationProductBomDto : quotationProductBomList) {
+                quotationProductBomDto.setId(null);
+            }
+            quotationProductDto.setQuotationProductBomList(quotationProductBomList);
+        }
+        saleQuotationDto.setQuotationProductList(quotationProductList);
+        //调用创建方法
+        saveOrEdit(saleQuotationDto);
+    }
+
+
+    /**
+     * 作废
+     */
+    @Override
+    public void cancellation(Long id) {
+        ExtQuotation saleQuotation = this.getById(id);
+        saleQuotation.setStatus(FlowStatusEnum1.CANCELLATION.getKey());
+        this.updateById(saleQuotation);
+    }
+
+    /**
+     * 赋值买卖公司地址
+     */
+    private void setArea(ExtQuotationVo saleQuotationVo) {
+
+        List<Long> areaIdList = Arrays.asList(
+                saleQuotationVo.getBuyCountryId(),
+                saleQuotationVo.getBuyProvinceId(),
+                saleQuotationVo.getBuyCityId()
+        );
+        Map<Long, String> areaMap = CustomizeAreaUtil.getAreaMapByIds(areaIdList);
+        saleQuotationVo.setBuyCountryName(areaMap.get(saleQuotationVo.getBuyCountryId()));
+        saleQuotationVo.setBuyProvinceName(areaMap.get(saleQuotationVo.getBuyProvinceId()));
+        saleQuotationVo.setBuyCityName(areaMap.get(saleQuotationVo.getBuyCityId()));
+        saleQuotationVo.setBuyDetailedAddress(saleQuotationVo.getBuyAddress());
+    }
+
+    /**
+     * 添加修改公共方法
+     */
+    private void saveOrEdit(ExtQuotationDto saleQuotationDto) {
+        this.saveOrUpdate(saleQuotationDto);
+
+        List<ExtQuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
+        for (ExtQuotationProductDto quotationProductDto : quotationProductList) {
+            //手动创建id
+            if (ObjectUtil.isEmpty(quotationProductDto.getId())) {
+                quotationProductDto.setId(IdWorker.getId());
+            }
+            quotationProductDto.setSaleQuotationId(saleQuotationDto.getId());
+
+            //保存配件
+            List<ExtQuotationProductBom> quotationProductBomList = BeanUtil.copyToList(quotationProductDto.getQuotationProductBomList(), ExtQuotationProductBom.class);
+            for (ExtQuotationProductBom quotationProductBom : quotationProductBomList) {
+                quotationProductBom.setProductId(quotationProductDto.getProductId());
+                quotationProductBom.setQuotationProductId(quotationProductDto.getId());
+            }
+            extQuotationProductBomService.editLinked(quotationProductBomList, ExtQuotationProductBom::getQuotationProductId, quotationProductDto.getId());
+        }
+
+        List<ExtQuotationProduct> quotationProducts = BeanUtil.copyToList(quotationProductList, ExtQuotationProduct.class);
+        extQuotationProductService.editLinked(quotationProducts, ExtQuotationProduct::getSaleQuotationId, saleQuotationDto.getId());
+    }
+
+}

+ 9 - 42
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -47,9 +47,9 @@ 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.fjhx.tenant.utils.DictUtils;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.exception.ServiceException;
@@ -135,6 +135,8 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         wrapper.le("sq", SaleQuotation::getCreateTime, dto.getEndTime());
 
         wrapper.ne("sq", SaleQuotation::getStatus, FlowStatusEnum1.UPDATE);
+        wrapper.ne("eq", SaleQuotation::getStatus, dto.getStatus());
+
 
         Page<SaleQuotationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<SaleQuotationVo> records = page.getRecords();
@@ -185,6 +187,10 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
             saleQuotationDto.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(), saleQuotationDto.getBuyCorporationId()));
         }
 
+        if (ObjectUtil.isEmpty(saleQuotationDto.getCompanyId())) {
+            saleQuotationDto.setCompanyId(SecurityUtils.getCompanyId());
+        }
+
         long id = IdWorker.getId();
         saleQuotationDto.setId(id);
         saleQuotationDto.setGroupId(id);//赋值数据分组id
@@ -568,7 +574,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         //切换数据源
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         //获取来源的字典数据
-        List<DictTenantDataVo> dictTenantDataVos = getDict("customer_source");
+        List<DictTenantDataVo> dictTenantDataVos = DictUtils.getDictList("customer_source");
         DynamicDataSourceContextHolder.poll();
         //获取来源增量总计
         Integer incrementAmount = sourceIncrementList.stream().map(customerVo -> customerVo.getCount())
@@ -635,29 +641,10 @@ 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);
 
         //获取类型的字典数据
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
-        List<DictTenantDataVo> dictTenantDataVoList = getDict("customer_status");
+        List<DictTenantDataVo> dictTenantDataVoList = DictUtils.getDictList("customer_status");
 
         if (dictTenantDataVoList.size() == 0) {
             throw new ServiceException("数据有误:该租户没有配客户类型字典");
@@ -671,18 +658,6 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
             saleMap.put("status", dictTenantDataVo.getDictValue());
             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());
-//            }
             saleList.add(saleMap);
         }
         map.put("saleList", saleList);
@@ -827,12 +802,4 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
     }
 
 
-    //根据字典编码获取字典的数据
-    private List<DictTenantDataVo> getDict(String code) {
-        DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
-        dto.setDictCode(code);
-        return dictTenantDataService.getList(dto);
-    }
-
-
 }

+ 4 - 0
hx-sale/src/main/resources/mapper/ext/ExtQuotationFollowMapper.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.ext.ExtQuotationFollowMapper">
+</mapper>

+ 34 - 0
hx-sale/src/main/resources/mapper/ext/ExtQuotationMapper.xml

@@ -0,0 +1,34 @@
+<?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.ext.ExtQuotationMapper">
+       <select id="getPage" resultType="com.fjhx.sale.entity.ext.vo.ExtQuotationVo">
+              select eq.id,
+                     eq.code,
+                     eq.buy_corporation_id,
+                     eq.buy_contact_name,
+                     eq.buy_contact_number,
+                     eq.buy_country_id,
+                     eq.buy_province_id,
+                     eq.buy_city_id,
+                     eq.buy_address,
+                     eq.buy_postal_code,
+                     eq.currency,
+                     eq.amount,
+                     eq.status,
+                     eq.create_user,
+                     eq.create_time,
+                     eq.update_user,
+                     eq.update_time,
+                     eq.type,
+                     eq.company_id,
+                     eq.group_id,
+                     eq.quotation_time,
+                     eq.quotation_status,
+                     eq.old_quotation_id,
+                     eq.sale_quotation_id,
+                     eq.last_follow_time
+              from ext_quotation eq
+                     ${ew.customSqlSegment}
+       </select>
+
+</mapper>

+ 4 - 0
hx-sale/src/main/resources/mapper/ext/ExtQuotationProductBomMapper.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.ext.ExtQuotationProductBomMapper">
+</mapper>

+ 4 - 0
hx-sale/src/main/resources/mapper/ext/ExtQuotationProductMapper.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.ext.ExtQuotationProductMapper">
+</mapper>