From 880ea25de076baaefaf4babf0c8c571d8105332b Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 8 Nov 2024 16:02:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[fix]=E5=9F=BA=E7=A1=80=E8=B5=84=E6=96=99?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=B1=87=E7=8E=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=EF=BC=9A?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E5=92=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA=EF=BC=9A?= =?UTF-8?q?=E6=B1=87=E7=8E=87=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E6=B1=87=E7=8E=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E7=AB=AF=E4=BF=AE=E6=94=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9A=E5=AE=9E=E7=8E=B0=EF=BC=8C=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=89=8D=E4=BC=9A=E8=BF=9B=E8=A1=8C=E6=97=B6=E9=97=B4=E4=BA=A4?= =?UTF-8?q?=E5=8F=89=E5=92=8C=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E4=B8=8E?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E7=9A=84=E5=AF=B9=E6=AF=94?= =?UTF-8?q?=EF=BC=9B=E5=B9=B6=E4=B8=94=E4=BF=AE=E6=94=B9=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E8=A6=81=E6=8E=92=E9=99=A4=E6=AD=A4=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=95=B0=E6=8D=AE=E7=9A=84id=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E4=BF=AE=E6=94=B9=E4=B8=8D=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=97=B6=E9=97=B4=E4=BA=A4=E5=8F=89,?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E6=8E=92=E9=99=A4=E5=BD=93=E5=89=8Did?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/mapper/BaseExchangeRateMapper.java | 12 +++++++ .../impl/BaseExchangeRateServiceImpl.java | 36 ++++++++++++------- .../mapper/system/BaseExchangeRateMapper.xml | 6 ++++ .../system/exchangeRate/exchangeRate.html | 6 ++-- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java index e276830d..0ff81b8a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java @@ -43,6 +43,15 @@ public interface BaseExchangeRateMapper */ public List selectExchangeRateByTimeRange(BaseExchangeRate baseExchangeRate); + /** + * 查询时间交叉,并且排除当前id + * + * @param baseExchangeRate 基础资料汇率管理 + * @return 基础资料汇率管理集合 + */ + List selectExchangeRateByTimeRangeAndExcludeId(BaseExchangeRate baseExchangeRate); + + /** * 新增基础资料汇率管理 * @@ -90,4 +99,7 @@ public interface BaseExchangeRateMapper * @return 结果 */ public int restoreBaseExchangeRateById(Long exchangeRateId); + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java index 329114f2..247431ec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java @@ -113,23 +113,33 @@ public class BaseExchangeRateServiceImpl implements IBaseExchangeRateService String loginName = ShiroUtils.getLoginName(); baseExchangeRate.setUpdateBy(loginName); baseExchangeRate.setUpdateTime(DateUtils.getNowDate()); - Date startTime = baseExchangeRate.getStartTime(); - Date endTime = baseExchangeRate.getEndTime(); + Long exchangeRateId = baseExchangeRate.getExchangeRateId(); - if (startTime.after(endTime)){ - throw new BusinessException("新增汇率失败!开始时间不能大于结束时间!"); - } + BaseExchangeRate oldExchangeRate = baseExchangeRateMapper.selectBaseExchangeRateById(exchangeRateId); + // 检查时间字段是否发生变化 + boolean timeFieldsChanged = !baseExchangeRate.getStartTime().equals(oldExchangeRate.getStartTime()) || + !baseExchangeRate.getEndTime().equals(oldExchangeRate.getEndTime()); - List exchangeRates = baseExchangeRateMapper.selectExchangeRateByTimeRange(baseExchangeRate); - if (!CollectionUtils.isEmpty(exchangeRates)){ - throw new BusinessException("新增汇率失败!该时间段内已存在汇率数据!"); + if (timeFieldsChanged) { + Date startTime = baseExchangeRate.getStartTime(); + Date endTime = baseExchangeRate.getEndTime(); + + if (startTime.after(endTime)) { + throw new BusinessException("修改汇率失败!开始时间不能大于结束时间!"); + } + + List exchangeRates = baseExchangeRateMapper.selectExchangeRateByTimeRangeAndExcludeId(baseExchangeRate); + + // List exchangeRates = baseExchangeRateMapper.selectExchangeRateByTimeRange(baseExchangeRate); + if (!CollectionUtils.isEmpty(exchangeRates)) { + throw new BusinessException("修改汇率失败!该时间段内已存在汇率数据!"); + } } - Long exchangeRateId = baseExchangeRate.getExchangeRateId(); - BaseExchangeRate oldExchangeRate = baseExchangeRateMapper.selectBaseExchangeRateById(exchangeRateId); + List compare = FieldCompareUtil.compare(BaseExchangeRate.class, baseExchangeRate, oldExchangeRate); - if (!CollectionUtils.isEmpty(compare)){ - int updateSysDiffLog = diffLogService.updateSysDiffLogByBusiness(exchangeRateId,BusinessKeysConstants.SYS_EXCHANGE_RATE,compare); - if (updateSysDiffLog <= 0){ + if (!CollectionUtils.isEmpty(compare)) { + int updateSysDiffLog = diffLogService.updateSysDiffLogByBusiness(exchangeRateId, BusinessKeysConstants.SYS_EXCHANGE_RATE, compare); + if (updateSysDiffLog <= 0) { throw new BusinessException("修改汇率数据修改记录失败"); } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml index fc2c8fed..4f0c19d7 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml @@ -45,6 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE start_time <= #{endTime} AND end_time >= #{startTime} + + insert into base_exchange_rate diff --git a/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html b/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html index b0ae01c8..4bfb13fa 100644 --- a/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html +++ b/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html @@ -11,11 +11,13 @@
  • - +
  • - + - +
  • +
  • From 64f4bdbe4b10b5f0032d60cabbb25b63794c41f9 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 8 Nov 2024 17:00:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[fix]=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=EF=BC=8C=E5=87=BA=E5=BA=93=E5=8D=95=E5=8F=B7=E5=92=8C=E5=85=B3?= =?UTF-8?q?=E8=81=94=E9=94=80=E5=94=AE=E5=8D=95=E5=8F=B7=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/system/SysSalesShippingInformMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml index ad3fd959..a5a150db 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml @@ -45,9 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - and shipping_information_code = #{shippingInformationCode} - and sales_order_code = #{salesOrderCode} - and out_order_code = #{outOrderCode} + and shipping_information_code like concat('%', #{shippingInformationCode}, '%') + and sales_order_code like concat('%', #{salesOrderCode}, '%') + and out_order_code like concat('%', #{outOrderCode}, '%') and shipping_information_type = #{shippingInformationType} and warehouse_order_type = #{warehouseOrderType} and warehouse_out_type = #{warehouseOutType} - and business_members = #{businessMembers} + and business_members like concat('%', #{businessMembers}, '%') and create_time between #{params.beginCreateTime} and #{params.endCreateTime} diff --git a/ruoyi-admin/src/main/resources/templates/sales/salesShippingInformation/salesShippingInformation.html b/ruoyi-admin/src/main/resources/templates/sales/salesShippingInformation/salesShippingInformation.html index 19fa20bd..0b00efc4 100644 --- a/ruoyi-admin/src/main/resources/templates/sales/salesShippingInformation/salesShippingInformation.html +++ b/ruoyi-admin/src/main/resources/templates/sales/salesShippingInformation/salesShippingInformation.html @@ -63,7 +63,7 @@