如果该工程费用指标已超过,则不需要记录月结记录

This commit is contained in:
liang.chao 2024-10-14 17:28:30 +08:00
parent c13a827cda
commit 3b15899c2c
4 changed files with 36 additions and 4 deletions

View File

@ -41,4 +41,10 @@ public interface CalMonthlyMapper {
List<SltAgreementInfo> getMonthCosts(AgreementInfo agreementInfo);
List<SltAgreementInfo> getMonthDetails(SltAgreementInfo monthCost);
void deleteCostByProjectIdAndMonth(ProjectMonthCosts projectMonthCosts);
List<String> selectIdByProjectIdAndMonth(ProjectMonthCosts projectMonthCosts);
void deleteDetailsByProMonthCostId(String proMonthCostId);
}

View File

@ -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定时器启动====");

View File

@ -53,7 +53,7 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
List<AgreementInfo> list = agreementInfoService.getAllAgreementId();
List<BmProjectLot> 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<AgreementInfo> 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<SltAgreementInfo> 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<String> proMonthCostIds = calMonthlyMapper.selectIdByProjectIdAndMonth(projectMonthCosts);
calMonthlyMapper.deleteCostByProjectIdAndMonth(projectMonthCosts);
for (String proMonthCostId : proMonthCostIds) {
calMonthlyMapper.deleteDetailsByProMonthCostId(proMonthCostId);
}
break;
}
sltAgreementInfo.setNode(leaseListOneMonth);
}
leaseList.addAll(monthList);

View File

@ -78,6 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
pmc.id = #{id}
</select>
<select id="selectIdByProjectIdAndMonth" resultType="java.lang.String">
select id from project_month_costs
where project_id = #{projectId} and month = #{month} and cost_bearing_party = #{costBearingParty}
</select>
<delete id="deleteCalcRecord" parameterType="com.bonus.sgzb.material.domain.CalMonthlyBean">
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>
<delete id="deleteCostByProjectIdAndMonth">
delete from project_month_costs
where project_id = #{projectId} and month = #{month} and cost_bearing_party = #{costBearingParty}
</delete>
<delete id="deleteDetailsByProMonthCostId">
delete from project_month_detail
where pro_month_cost_id = #{proMonthCostId}
</delete>
</mapper>