From 3b15899c2cca2144d80bd442b03d0810b0ca8a12 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Mon, 14 Oct 2024 17:28:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=AF=A5=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=8C=87=E6=A0=87=E5=B7=B2=E8=B6=85=E8=BF=87?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E4=B8=8D=E9=9C=80=E8=A6=81=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=9C=88=E7=BB=93=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgzb/material/mapper/CalMonthlyMapper.java | 6 ++++++ .../com/bonus/sgzb/material/remind/Inform.java | 4 ++-- .../remind/service/CalcMonthlyServiceImp.java | 18 ++++++++++++++++-- .../mapper/material/CalMonthlyMapper.xml | 12 ++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/CalMonthlyMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/CalMonthlyMapper.java index f17cd44..4631805 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/CalMonthlyMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/CalMonthlyMapper.java @@ -41,4 +41,10 @@ public interface CalMonthlyMapper { List getMonthCosts(AgreementInfo agreementInfo); List getMonthDetails(SltAgreementInfo monthCost); + + void deleteCostByProjectIdAndMonth(ProjectMonthCosts projectMonthCosts); + + List selectIdByProjectIdAndMonth(ProjectMonthCosts projectMonthCosts); + + void deleteDetailsByProMonthCostId(String proMonthCostId); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/Inform.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/Inform.java index 59b41a1..7142666 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/Inform.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/Inform.java @@ -17,8 +17,8 @@ public class Inform { @Value("${sgzb.job.settlementJobDay}") private String settlementJobDay; - @Scheduled(cron = "0 */5 * * * ? ") // 间隔5分钟执行 -// @Scheduled(cron = "${sgzb.job.settlementJobCron}") // 结算日次日凌晨执行 +// @Scheduled(cron = "0 */5 * * * ? ") // 间隔5分钟执行 + @Scheduled(cron = "${sgzb.job.settlementJobCron}") // 结算日次日凌晨执行 @Async public void taskCycle() { System.out.println("===springMVC定时器启动===="); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java index 3767413..268655e 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java @@ -53,7 +53,7 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService { List list = agreementInfoService.getAllAgreementId(); List projectLots = agreementInfoService.getAllprojectId(); // 如果该工程费用指标已超过,则不需要记录月结记录 - for (BmProjectLot bmProjectLot : projectLots) { + /* for (BmProjectLot bmProjectLot : projectLots) { BigDecimal costIndicatorsByLotId = agreementInfoService.getCostIndicatorsByLotId(bmProjectLot); BigDecimal costByLotId = agreementInfoService.getCostByLotId(bmProjectLot); if (costByLotId.compareTo(costIndicatorsByLotId) > 0) { @@ -61,7 +61,7 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService { List agreementIds = agreementInfoService.getprojectIdByLotId(bmProjectLot); agreementIds.forEach(t -> list.remove(t)); } - } + }*/ list.forEach(t -> { t.setStartTime(startTime); t.setEndTime(endTime); @@ -115,6 +115,20 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService { List leaseListOneMonth = addProjectMonthDetail(agreementInfo, sltAgreementInfo, pmcId); projectMonthCosts.setCosts(sltAgreementInfo.getCosts()); calMonthlyMapper.updateProMonCosts(projectMonthCosts); + + // 如果该工程费用指标已超过,则不需要记录月结记录 + BmProjectLot bmProjectLot = new BmProjectLot(); + bmProjectLot.setLotId(projectMonthCosts.getProjectId()); + BigDecimal costByLotId = agreementInfoService.getCostByLotId(bmProjectLot); + BigDecimal costIndicatorsByLotId = agreementInfoService.getCostIndicatorsByLotId(bmProjectLot); + if (costByLotId.compareTo(costIndicatorsByLotId) > 0) { + List proMonthCostIds = calMonthlyMapper.selectIdByProjectIdAndMonth(projectMonthCosts); + calMonthlyMapper.deleteCostByProjectIdAndMonth(projectMonthCosts); + for (String proMonthCostId : proMonthCostIds) { + calMonthlyMapper.deleteDetailsByProMonthCostId(proMonthCostId); + } + break; + } sltAgreementInfo.setNode(leaseListOneMonth); } leaseList.addAll(monthList); diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/CalMonthlyMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/CalMonthlyMapper.xml index 010e2ef..047493b 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/CalMonthlyMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/CalMonthlyMapper.xml @@ -78,6 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE pmc.id = #{id} + delete from slt_project_month @@ -95,5 +99,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from project_month_costs where task_id = #{id} + + delete from project_month_costs + where project_id = #{projectId} and month = #{month} and cost_bearing_party = #{costBearingParty} + + + delete from project_month_detail + where pro_month_cost_id = #{proMonthCostId} + \ No newline at end of file