Browse Source

溢价流程

yzc 1 year ago
parent
commit
d0b3b5633c

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/quotation/po/QuotationProduct.java

@@ -147,4 +147,9 @@ public class QuotationProduct extends BasePo {
      */
     private Long technologyId;
 
+    /**
+     * 议价价格
+     */
+    private BigDecimal discussPrice;
+
 }

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

@@ -1,5 +1,6 @@
 package com.fjhx.sale.entity.sale.dto;
 
+import com.fjhx.file.entity.ObsFile;
 import com.fjhx.sale.entity.quotation.dto.QuotationProductDto;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
 import lombok.Getter;
@@ -22,6 +23,12 @@ public class SaleQuotationDto extends SaleQuotation {
      */
     private List<QuotationProductDto> quotationProductList;
 
+    /**
+     * 议价
+     */
+    private List<ObsFile> discussFileList;
+
+
 //    /**
 //     *报价 -收费项目表
 //     */

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

@@ -132,4 +132,9 @@ public class SaleQuotation extends BasePo {
      * 归属部门id
      */
     private Long ofDeptId;
+
+    /**
+     * 议价备注
+     */
+    private String discussRemark;
 }

+ 63 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/DiscussPriceFlow.java

@@ -0,0 +1,63 @@
+package com.fjhx.sale.flow;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.fjhx.file.entity.ObsFile;
+import com.fjhx.file.utils.ObsFileUtil;
+import com.fjhx.flow.core.FlowDelegate;
+import com.fjhx.sale.entity.quotation.dto.QuotationProductDto;
+import com.fjhx.sale.entity.quotation.po.QuotationProduct;
+import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
+import com.fjhx.sale.service.quotation.QuotationProductService;
+import com.fjhx.sale.service.sale.SaleQuotationService;
+import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+
+@Component
+public class DiscussPriceFlow extends FlowDelegate {
+
+    @Autowired
+    private SaleQuotationService saleQuotationService;
+    @Autowired
+    private QuotationProductService quotationProductService;
+
+    @Override
+    public String getFlowKey() {
+        return "discuss_price_flow";
+    }
+
+    @Override
+    public Long start(Long flowId, JSONObject submitData) {
+        SaleQuotationDto saleQuotationDto = submitData.toJavaObject(SaleQuotationDto.class);
+        List<QuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
+        for (QuotationProductDto quotationProductDto : quotationProductList) {
+            //复制议价格信息
+            quotationProductDto.setDiscussPrice(quotationProductDto.getPrice());
+        }
+
+        //议价附件
+        List<ObsFile> discussFileList = saleQuotationDto.getDiscussFileList();
+        ObsFileUtil.editFile(discussFileList, saleQuotationDto.getId(), 10);
+
+        saleQuotationService.updateById(saleQuotationDto);
+        quotationProductService.updateBatchById(BeanUtil.copyToList(quotationProductList, QuotationProduct.class));
+
+        return saleQuotationDto.getId();
+    }
+
+    @Override
+    public void end(Long flowId, Long businessId, JSONObject submitData) {
+        quotationProductService.update(q -> q
+                .eq(QuotationProduct::getSaleQuotationId, businessId)
+                .setSql("price = discuss_price")
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                .set(BasePo::getUpdateTime, new Date())
+        );
+    }
+
+}