From c3253543ce44eb3810782b79fc334358d9fa162c Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Thu, 4 Sep 2025 16:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=B2=E8=B4=A6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E5=8C=BA=E9=97=B4=E8=B4=B9?= =?UTF-8?q?=E7=94=A8=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 PeriodCostResultVo 中添加 markTime 字段,用于冲账日期- 在 SltAgreementInfoMapper 中添加 selectPeriodCostListForCharge 方法,用于查询冲账记录- 更新 SltAgreementInfoMapper.xml,添加新的 SQL 查询语句 - 修改 SltAgreementInfoServiceImpl 中的查询逻辑,加入冲账数据处理 - 优化区间费用汇总功能,增加对未填写协议编号的校验 --- .../domain/vo/PeriodCostResultVo.java | 3 +++ .../mapper/SltAgreementInfoMapper.java | 7 +++++++ .../impl/SltAgreementInfoServiceImpl.java | 19 +++++++++++++++++- .../settlement/SltAgreementInfoMapper.xml | 20 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/PeriodCostResultVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/PeriodCostResultVo.java index 20843287..19d1e08e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/PeriodCostResultVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/PeriodCostResultVo.java @@ -59,6 +59,9 @@ public class PeriodCostResultVo { @ApiModelProperty(value = "采购单价 原值") private BigDecimal buyPrice; + @ApiModelProperty(value = "冲账日期,必须区间计算开始日期与冲账日期一致才冲账") + private Date markTime; + @ApiModelProperty(value = "计算开始时间") @JsonFormat(pattern = "yyyy-MM-dd") private Date calcStartTime; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index 5e34f11d..e3098509 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -281,4 +281,11 @@ public interface SltAgreementInfoMapper { * @return 区间费用计算结果列表 */ List selectLeasePeriodCostList(PeriodCostQueryDto queryDto); + + /** + * 查询区间费用-- 冲账记录表 + * @param queryDto 查询条件 + * @return 冲账记录 + */ + List selectPeriodCostListForCharge(PeriodCostQueryDto queryDto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index c5ba5d52..3b5bcaef 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -1148,11 +1148,20 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { // 从数据库查询基础数据 List rawResults = sltAgreementInfoMapper.selectLeasePeriodCostList(queryDto); + // 从数据库查询冲账数据,冲账查询的时候直接过滤了协议和限制具体日期,所以不需要再进行范围过滤 + List markResults = sltAgreementInfoMapper.selectPeriodCostListForCharge(queryDto); + // 先过滤掉不在查询范围内的数据 List filteredResults = filterDataInRange(rawResults, queryDto.getStartDate(), queryDto.getEndDate()); // 进行时间及费用计算统计 - return calculatePeriodCosts(filteredResults, queryDto.getStartDate(), queryDto.getEndDate()); + List periodCostResultVos = calculatePeriodCosts(filteredResults, queryDto.getStartDate(), queryDto.getEndDate()); + + // 添加冲账数据 + periodCostResultVos.addAll(markResults); + + // 返回结果 + return periodCostResultVos; } catch (Exception e) { throw new ServiceException("查询区间费用失败:" + e.getMessage()); } @@ -1447,6 +1456,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { // 按协议ID分组汇总 return aggregateByAgreement(detailList, queryDto.getStartDate(), queryDto.getEndDate()); } catch (Exception e) { + System.err.println(e); throw new ServiceException("查询区间费用汇总失败:" + e.getMessage()); } } @@ -1546,6 +1556,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { summaryList.add(summary); } + if (!summaryList.isEmpty()) { + List collect = summaryList.stream().filter(item -> Objects.isNull(item.getAgreementCode())).collect(Collectors.toList()); + if (!collect.isEmpty()) { + throw new ServiceException("存在未填写协议编号的协议"); + } + } + // 按协议编号排序 summaryList.sort(Comparator.comparing(PeriodCostSummaryVo::getAgreementCode)); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index a856918f..949f490f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -49,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -1241,4 +1244,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY bai.create_time DESC + +