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