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 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=B2=E8=B4=A6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E8=B4=B9=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 + + From 0aa12bd997fda36b5fd201ce6676013e265cb239 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Thu, 4 Sep 2025 18:26:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=A3=80=E4=BF=AE?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/material/push/ProDataUseInfoMapper.xml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml index 845c4838..b3e7bddf 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml @@ -192,13 +192,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ELSE NULL END) AS TimeoutNum FROM ma_machine mm - LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id and sai.`status`='0' and sai.end_time is null + LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id LEFT JOIN ma_type mt ON sai.type_id = mt.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id left join sys_dept sd ON sd.dept_id = bp.imp_unit where mm.next_check_time is not null and mt.`level` = '4' + and sai.`status`='0' and sai.end_time is null + and bp.external_id is not null + and mm.ma_status = 2 AND sd.dept_id = #{deptId} @@ -221,13 +224,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ELSE NULL END AS daysDiff FROM ma_machine mm - LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id and sai.`status`='0' and sai.end_time is null + LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id LEFT JOIN ma_type mt ON sai.type_id = mt.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id WHERE mm.next_check_time is not null AND mt.`level`=4 + and bp.external_id is not null + and sai.`status`='0' and sai.end_time is null + and mm.ma_status = 2 AND bp.pro_id = #{proId} @@ -255,6 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY bp.pro_id + order by mt.jiju_type desc