From f025e103233bb51188e026e5ee57c8f1ced3d22b Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 25 Sep 2024 16:50:34 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=AE=9E=E4=BD=93=E7=9A=84=E6=8A=A5=E4=BB=B7=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=BAyyyy-MM-dd=20HH:mm:ss=E8=BF=99=E7=A7=8D?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=9B=20=E6=96=B0=E5=A2=9E=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=AE=A1=E6=A0=B8=E5=90=8E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=BC=A0=E5=85=A5=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=BAmaterialCode=E5=92=8CcustomerCode=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=8E=A5=E5=8F=A3=EF=BC=9A=E5=9C=A8=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=80=9A=E8=BF=87=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?= =?UTF-8?q?=EF=BC=8C=E5=8C=B9=E9=85=8D=E4=B8=8A=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E6=98=AF=E6=9C=80=E6=96=B0=E6=8A=A5=E4=BB=B7=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E7=9A=84?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=A9=E6=96=99=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E7=94=B1=E5=8F=AA=E8=83=BD=E6=B7=BB=E5=8A=A0=E5=8D=95=E6=9D=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=B9=E4=B8=BA=E5=8F=AF=E4=BB=A5=E9=81=8D?= =?UTF-8?q?=E5=8E=86=E6=B7=BB=E5=8A=A0=E5=A4=9A=E6=9D=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysCustomerQuoteController.java | 6 + .../domain/SysCustomerQuoteHistory.java | 4 +- .../mapper/SysCustomerQuoteHistoryMapper.java | 10 ++ .../ISysCustomerQuoteHistoryService.java | 6 + .../SysCustomerQuoteHistoryServiceImpl.java | 48 +++++++- .../system/SysCustomerQuoteHistoryMapper.xml | 60 +++++++++- .../templates/system/customerQuote/add.html | 104 +++++++++++------- .../customerQuote/recentQuotationHistory.html | 4 +- 8 files changed, 192 insertions(+), 50 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java index 3edd45cf..516c4671 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java @@ -269,6 +269,8 @@ public class SysCustomerQuoteController extends BaseController if(!approvedFlag){ // 审核状态-审核拒绝 sysCustomerQuoteVo.setAuditStatus("2"); + //客户报价审核后,修改客户报价历史数据 + quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo); } // 如果任务已结束更新业务表状态 方法中传入的值为原来的instanceId,只是做了调整 boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); @@ -276,6 +278,10 @@ public class SysCustomerQuoteController extends BaseController // 审核通过 sysCustomerQuoteVo.setAuditStatus("1"); + //客户报价审核后,修改客户报价历史数据 + quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo); + + // 提交 if("submit".equals(instanceType)){ // 使用状态-是 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java index 60b50b93..19f4ed7a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java @@ -50,8 +50,8 @@ public class SysCustomerQuoteHistory extends BaseEntity private BigDecimal materialUsd; /** 报价时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date quoteTime; /** 审核状态(0待审核、1审核通过、2审核拒绝) */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java index 955cd98f..bac4756e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java @@ -77,4 +77,14 @@ public interface SysCustomerQuoteHistoryMapper int insertSysCustomerQuoteHistoryListBatch(List sysCustomerQuoteHistoryList); + + int updateSysCustomerQuoteHistoryByCode(SysCustomerQuoteHistory sysCustomerQuoteHistory); + + /** + * 根据供应商编码查询最新一条记录 + * */ + SysCustomerQuoteHistory findLatestQuoteHistory(SysCustomerQuoteHistory sysCustomerQuoteHistory); + + + int updateOtherQuoteHistoryByCode(SysCustomerQuoteHistory sysCustomerQuoteHistory); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java index b16572ca..494c76c3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java @@ -81,4 +81,10 @@ public interface ISysCustomerQuoteHistoryService * @param sysCustomerQuote */ int generateSysCustomerQuoteHistory(SysCustomerQuote sysCustomerQuote); + + /** + * 客户报价审核后更新客户报价历史 + * @param sysCustomerQuoteVo + */ + void updateSysCustomerQuoteHistoryByCustomerQuote(SysCustomerQuoteVo sysCustomerQuoteVo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java index 6c06892b..86efdfea 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java @@ -1,8 +1,7 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; + import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.system.domain.SysCustomerQuote; @@ -54,7 +53,18 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist @Override public List selectSysCustomerQuoteHistoryList(SysCustomerQuoteHistory sysCustomerQuoteHistory) { - return sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory); + //最新的报价 + SysCustomerQuoteHistory latestQuoteHistory = sysCustomerQuoteHistoryMapper.findLatestQuoteHistory(sysCustomerQuoteHistory); + List sysCustomerQuoteHistories = sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory); + sysCustomerQuoteHistories.forEach(customerQuoteHistory -> { + if (Objects.equals(customerQuoteHistory.getQuoteHistoryId(), latestQuoteHistory.getQuoteHistoryId())) { + customerQuoteHistory.setIsLatest("1"); + } else { + customerQuoteHistory.setIsLatest("0"); + } + }); + + return sysCustomerQuoteHistories; } /** @@ -90,6 +100,7 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) { SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory(); sysCustomerQuoteHistory.setCustomerCode(sysCustomerQuote.getCustomerCode()); + sysCustomerQuoteHistory.setSupplierCode(supplierCode); sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode()); sysCustomerQuoteHistory.setMaterialRmb(sysCustomerQuoteChild.getMaterialRmb()); sysCustomerQuoteHistory.setMaterialNoRmb(sysCustomerQuoteChild.getMaterialNoRmb()); @@ -108,6 +119,35 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist } + + /** + * 根据客户报价信息更新客户最新报价记录 + * @param sysCustomerQuoteVo + */ + @Override + public void updateSysCustomerQuoteHistoryByCustomerQuote(SysCustomerQuoteVo sysCustomerQuoteVo) { + String loginName = ShiroUtils.getLoginName(); + String supplierCode = sysCustomerQuoteVo.getSupplierCode(); + String auditStatus = sysCustomerQuoteVo.getAuditStatus(); + + // 获取所有的子项 + List sysCustomerQuoteChildren = quoteChildMapper.selectSysCustomerQuoteChildByQuoteId(supplierCode); + for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) { + SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory(); + + // 设置审核状态 + sysCustomerQuoteHistory.setAuditStatus(auditStatus.equals("1") ? "1" : "2"); + sysCustomerQuoteHistory.setSupplierCode(supplierCode); + // 设置其他字段 + sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode()); + sysCustomerQuoteHistory.setUpdateBy(loginName); + sysCustomerQuoteHistory.setUpdateTime(new Date()); + // 更新报价历史记录 + sysCustomerQuoteHistoryMapper.updateSysCustomerQuoteHistoryByCode(sysCustomerQuoteHistory); + } + } + + /** * 修改客户报价历史 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml index 30573101..75540eb2 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml @@ -38,7 +38,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where quote_history_id = #{quoteHistoryId} - + + + + insert into sys_customer_quote_history @@ -78,11 +86,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into sys_customer_quote_history - (customer_code, materialCode, materialRmb, materialNoRmb, materialNoUsd, materialUsd, quote_time, create_by, + (customer_code, materialCode, supplierCode ,materialRmb, materialNoRmb, materialNoUsd, materialUsd, quote_time, create_by, create_time, audit_status, is_latest) values - #{item.customerCode},#{item.materialCode}, #{item.materialRmb}, #{item.materialNoRmb}, + #{item.customerCode},#{item.materialCode}, #{item.supplierCode}, #{item.materialRmb}, #{item.materialNoRmb}, #{item.materialNoUsd}, #{item.materialUsd}, #{item.quoteTime}, #{item.createBy}, #{item.createTime},#{item.auditStatus}, #{item.isLatest} @@ -110,6 +118,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where quote_history_id = #{quoteHistoryId} + + + update sys_customer_quote_history + + customer_code = #{customerCode}, + supplierCode = #{supplierCode}, + materialCode = #{materialCode}, + materialRmb = #{materialRmb}, + materialNoRmb = #{materialNoRmb}, + materialNoUsd = #{materialNoUsd}, + materialUsd = #{materialUsd}, + quote_time = #{quoteTime}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + audit_status = #{auditStatus}, + is_latest = #{isLatest}, + + where supplierCode = #{supplierCode} and materialCode = #{materialCode} + + + + + + update sys_customer_quote_history + + customer_code = #{customerCode}, + supplierCode = #{supplierCode}, + materialCode = #{materialCode}, + materialRmb = #{materialRmb}, + materialNoRmb = #{materialNoRmb}, + materialNoUsd = #{materialNoUsd}, + materialUsd = #{materialUsd}, + quote_time = #{quoteTime}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + audit_status = #{auditStatus}, + is_latest = #{isLatest}, + + where supplierCode = #{supplierCode} and materialCode != #{materialCode} + + + delete from sys_customer_quote_history where quote_history_id = #{quoteHistoryId} diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html index 3591f71a..92ccc328 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html @@ -642,53 +642,79 @@ } }); } - function doSubmit(index, layero,uniqueId){ + function doSubmit(index, layero, uniqueId) { console.log(uniqueId); var iframeWin = window[layero.find('iframe')[0]['name']]; - var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; - console.log("rowData: "+rowData); - //判断是否重复 - var rows = $("#bootstrap-sub-table-1").bootstrapTable('getData').length; - for(var i=0;i 0) { + for (var k = 0; k < newRows.length; k++) { + $("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', { index: 1, row: newRows[k] }); } - }) + } + layer.close(index); } + function insertRow() { if ($("#customerCode").val() == null || $("#customerCode").val() == '') { $.modal.alertWarning("请先选择客户"); diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html index 07a88fed..d27fcc3e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html @@ -15,7 +15,7 @@