From 1a354c7b97a790982e41fc43b8fbbab241a218db Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Wed, 10 Sep 2025 09:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SltAgreementInfoServiceImpl.java | 12 +++++++++++- .../com/bonus/material/task/mapper/TmTaskMapper.java | 2 ++ .../resources/mapper/material/task/TmTaskMapper.xml | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) 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 4fd882e3..64b9c003 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 @@ -142,9 +142,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { public List getSltAgreementInfo4Project(SltAgreementInfo bean) { Long userId = SecurityUtils.getLoginUser().getUserid(); List list = sltAgreementInfoMapper.getSltAgreementInfo4Project(bean); + // 删除 null 对象 list.removeIf(Objects::isNull); - + list.removeIf(info -> info.getSltStatus() != null && info.getSltStatus().equals("2")); // 遍历列表,设置默认值 list.forEach(obj -> { if (obj.getIsSlt() == null) { obj.setIsSlt("0");} @@ -634,6 +635,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { if (agreementId == null || agreementId <= 0) { throw new ServiceException("协议id错误"); } + + + int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId); if (sltInfoVo.getAgreementIds().length <= 1) { // 如果不是批量提交,已结算的费用类型就直接提示已结算 @@ -654,6 +658,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { SltAgreementInfo info = new SltAgreementInfo(); info.setAgreementId(agreementId); + //获取该协议下的所有维修任务 + List repairList = taskMapper.getTaskIdByAgreementId(info); + if(repairList != null && !repairList.isEmpty()){ + throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!"); + } + // 获取各项成本并累加 totalCost = totalCost.add(getLeaseList(info).stream() .map(SltAgreementInfo::getCosts) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index 489f8fa9..da02583c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -181,4 +181,6 @@ public interface TmTaskMapper { * @return */ List selectBackApplyInfoById(BackApplyInfo backApplyInfo); + + List getTaskIdByAgreementId(SltAgreementInfo info); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index 6df55ecd..65bb4a6d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -270,4 +270,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE back_id = #{id} + \ No newline at end of file