From 9042c13c4ce9c0f83fe0df85f55136b037148a7a Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Thu, 15 Jan 2026 18:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E4=B9=A6=E7=BC=96=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/push/task/IwsCostPushTask.java | 11 +-- .../SltAgreementInfoController.java | 11 +++ .../settlement/domain/SltAgreementInfo.java | 3 + .../settlement/domain/SltHistoryReport.java | 14 +++ .../settlement/domain/vo/SltInfoVo.java | 5 ++ .../mapper/SltAgreementInfoMapper.java | 5 ++ .../service/ISltAgreementInfoService.java | 5 ++ .../impl/SltAgreementInfoServiceImpl.java | 13 +++ .../impl/SltHistoryReportServiceImpl.java | 17 +++- .../settlement/SltAgreementInfoMapper.xml | 89 ++++++++++++------- 10 files changed, 132 insertions(+), 41 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java index 940157ea..23497206 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java @@ -64,7 +64,7 @@ public class IwsCostPushTask { /** - * 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点00分执行 + * 定时任务 -- 保存未结算报表记录(工器具) -- 每月最后一天的23点00分执行 */ @Scheduled(cron = "0 00 23 L * ?", zone = "Asia/Shanghai") public void saveUnSltHistoryReport() { @@ -234,10 +234,8 @@ public class IwsCostPushTask { } catch (Exception e) { log.error("保存未结算报表记录到数据库失败,记录数量:{}", validRecords.size(), e); // 打印所有记录的关键信息用于排查 - validRecords.forEach(vo -> { - log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}", - vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName()); - }); + validRecords.forEach(vo -> log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}", + vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName())); throw e; } } else { @@ -247,7 +245,6 @@ public class IwsCostPushTask { log.error("保存未结算报表记录失败", e); throw e; } finally { - // 在整个批量处理完成后清理缓存,而不是在每次循环中清理 sltAgreementInfoService.clearCache(); log.info("缓存已清理"); } @@ -257,7 +254,7 @@ public class IwsCostPushTask { /** - * 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点10分执行 + * 定时任务 -- 保存未结算报表记录(安全工器具) -- 每月最后一天的23点10分执行 */ @Scheduled(cron = "0 10 23 L * ?", zone = "Asia/Shanghai") public void saveUnSltSafetyHistoryReport() { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index 05b34bd6..81b574b1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -2018,6 +2018,17 @@ public class SltAgreementInfoController extends BaseController { return getDataTable(list); } + /** + * 修改结算协议书编号 + * @param sltAgreementInfo 编号 + * @return 结果 + */ + @ApiOperation(value = "修改结算协议书编号") + @PostMapping("/updateSltBookCodeById") + public AjaxResult updateSltBookCodeById(@RequestBody SltAgreementInfo sltAgreementInfo) { + int result = sltAgreementInfoService.updateSltBookCodeById(sltAgreementInfo); + return result > 0 ? success("修改成功") : error(); + } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java index 78241b2e..31bc7b3b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java @@ -322,4 +322,7 @@ public class SltAgreementInfo extends BaseEntity { @ApiModelProperty(value = "任务状态列表") private List statusList; + + @ApiModelProperty(value = "结算协议书编号") + private String bookCode; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltHistoryReport.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltHistoryReport.java index 58d788ec..cae49723 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltHistoryReport.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltHistoryReport.java @@ -1,9 +1,12 @@ package com.bonus.material.settlement.domain; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Date; /** * 结算历史报表对象 slt_history_report @@ -30,4 +33,15 @@ public class SltHistoryReport { private LocalDateTime createTime; private Long companyId; + /** + * 0未竣工 1竣工 2未竣工并且未绑定i8工程 + */ + private Integer isFinish; + + /** + * 竣工日期 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date actualEndDate; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java index f20a96aa..d49f5ea9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java @@ -192,4 +192,9 @@ public class SltInfoVo { private List signUrlList; private Long companyId; + + /** + * 协议书编号 + */ + private String bookCode; } 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 0d9eb26b..e14fd7bb 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 @@ -84,6 +84,11 @@ public interface SltAgreementInfoMapper { */ public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo); + /** + * 修改结算协议书编号 + */ + int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo); + /** * 修改结算信息 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java index 9ef3714c..786cd5c9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java @@ -184,6 +184,11 @@ public interface ISltAgreementInfoService { */ List selectPeriodCostSummary(PeriodCostQueryDto queryDto); + /** + * 修改结算协议书编号 + */ + int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo); + List getRepairCodeList(SltAgreementInfo bean); 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 c1f05561..a9c68229 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 @@ -1884,6 +1884,16 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } } + /** + * 修改结算协议书编号 + * + * @param sltAgreementInfo ID及协议书编号 + */ + @Override + public int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo) { + return sltAgreementInfoMapper.updateSltBookCodeById(sltAgreementInfo); + } + @Override public List getRepairCodeList(SltAgreementInfo bean) { return sltAgreementInfoMapper.getRepairCodeList(bean); @@ -1928,6 +1938,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { summary.setQueryStartDate(queryStartDate); summary.setQueryEndDate(queryEndDate); summary.setRemark(firstDetail.getRemark()); + summary.setActualEndDate(firstDetail.getActualEndDate()); + summary.setIsFinish(firstDetail.getIsFinish()); + summary.setProStatus((firstDetail.getIsFinish() != null && firstDetail.getIsFinish().equals("1")) ? "已竣工" : "未竣工"); // 计算汇总数据 int equipmentTypeCount = agreementDetails.size(); // 设备种类数量 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltHistoryReportServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltHistoryReportServiceImpl.java index 2b516ae3..f6b56cc5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltHistoryReportServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltHistoryReportServiceImpl.java @@ -4,10 +4,13 @@ import com.bonus.material.settlement.domain.SltHistoryReport; import com.bonus.material.settlement.domain.SltHistoryReportDetail; import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; import com.bonus.material.settlement.service.SltHistoryReportService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.List; +import java.util.Objects; @Service public class SltHistoryReportServiceImpl implements SltHistoryReportService { @@ -19,7 +22,19 @@ public class SltHistoryReportServiceImpl implements SltHistoryReportService { @Override public List selectHistoryReportList(SltHistoryReport report) { - return sltAgreementInfoMapper.selectSltHistoryReportList(report); + List sltHistoryReports = sltAgreementInfoMapper.selectSltHistoryReportList(report); + + sltHistoryReports.removeIf(Objects::isNull); + + if (CollectionUtils.isEmpty(sltHistoryReports)) { + return Collections.emptyList(); + } + + + + + + return sltHistoryReports; } @Override 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 e07c118d..9d4480b5 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 @@ -2173,6 +2173,12 @@ SELECT - agreementId, + agreementId, res.bookCode, bai.agreement_code as agreementCode, LEFT(createTime,10) as applyTime, bui.unit_name AS unitName, @@ -2364,20 +2375,21 @@ FROM ( SELECT - saa.agreement_id AS agreementId, - saa.create_time AS createTime, - IF - ( sad.slt_type = 1, sad.money, 0 ) AS leaseCost, - IF - ( sad.slt_type = 2, sad.money, 0 ) AS loseCost, - IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost, - IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost, - 0 AS aqLeaseCost, - 0 AS aqLoseCost, - 0 AS aqRepairCost, - 0 AS aqScrapCost + saa.book_code as bookCode, + saa.agreement_id AS agreementId, + saa.create_time AS createTime, + IF + ( sad.slt_type = 1, sad.money, 0 ) AS leaseCost, + IF + ( sad.slt_type = 2, sad.money, 0 ) AS loseCost, + IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost, + IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost, + 0 AS aqLeaseCost, + 0 AS aqLoseCost, + 0 AS aqRepairCost, + 0 AS aqScrapCost FROM - slt_agreement_apply saa + slt_agreement_apply saa LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id WHERE saa.agreement_id = #{agreementId} @@ -2385,21 +2397,22 @@ GROUP BY sad.id UNION ALL SELECT - saa.agreement_id AS agreementId, - saa.create_time AS createTime, - 0 AS leaseCost, - 0 AS loseCost, - 0 AS repairCost, - 0 AS scrapCost, - IF - ( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost, - IF - ( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost, - IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS aqRepairCost, - IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS aqScrapCost + saa.book_code as bookCode, + saa.agreement_id AS agreementId, + saa.create_time AS createTime, + 0 AS leaseCost, + 0 AS loseCost, + 0 AS repairCost, + 0 AS scrapCost, + IF + ( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost, + IF + ( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost, + IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS aqRepairCost, + IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS aqScrapCost FROM - slt_agreement_apply saa - LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id + slt_agreement_apply saa + LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id WHERE saa.agreement_id = #{agreementId} AND saa.settlement_type = 2 @@ -2590,4 +2603,14 @@ + + + update + slt_agreement_apply + set + book_code = #{bookCode} + where + id = #{id} + and book_code is null +