From df1d9db9ee62cd95633739738bcc980194ab9ec1 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 03 四月 2025 18:27:20 +0800 Subject: [PATCH] 修改bug --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java index 685686b..d76f7f8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java @@ -428,27 +428,41 @@ // 第一个月计算天 int dayOfMonth = rentBill.getStartTime().getDayOfMonth(); if (dayOfMonth == 1) { + System.err.println("第一笔账单 1号计算整月:"); money = money.add(contract.getMonthRent()); } else { long allDays = Math.abs(ChronoUnit.DAYS.between(rentBill.getStartTime(), rentBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth())) + 1); + System.err.println("第一笔账单 计算天数"+allDays); money =money.add(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(allDays))); + System.err.println("第一笔账单 计算天数金额"+money); } // 后续 if (contract.getStartPayTime().getMonthValue()==3||contract.getStartPayTime().getMonthValue()==6||contract.getStartPayTime().getMonthValue()==9||contract.getStartPayTime().getMonthValue()==12){ + System.err.println("后续账单 月为3 6 9 12金额"+money); rentBill.setPayableFeesMoney(money); rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney()); }else{ + LocalDateTime localDateTime = rentBill.getStartTime().plusMonths(1).with(TemporalAdjusters.lastDayOfMonth()); + System.err.println("后续账单逻辑时间"+localDateTime); while (true){ if (localDateTime.toLocalDate().isBefore(rentBill.getEndTime().toLocalDate())){ + System.err.println("后续while 在结束之前"); money = money.add(contract.getMonthRent()); }else if(localDateTime.toLocalDate().equals(rentBill.getEndTime().toLocalDate())){ + System.err.println("后续while 结束"); money = money.add(contract.getMonthRent()); break; }else { - money = money.add(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply( - new BigDecimal(ChronoUnit.DAYS.between(localDateTime.with(TemporalAdjusters.firstDayOfMonth()),rentBill.getEndTime())+1)) - ); + System.err.println("后续while 加一个月大于结束时间"); + if (localDateTime.with(TemporalAdjusters.firstDayOfMonth()).isBefore(rentBill.getEndTime())){ + long a = ChronoUnit.DAYS.between(localDateTime.with(TemporalAdjusters.firstDayOfMonth()),rentBill.getEndTime())+1; + System.err.println("后续while 加一个月大于结束时间 计算天数"+a); + money = money.add(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply( + new BigDecimal(ChronoUnit.DAYS.between(localDateTime.with(TemporalAdjusters.firstDayOfMonth()),rentBill.getEndTime())+1)) + ); + } + break; } localDateTime = localDateTime.plusMonths(1).with(TemporalAdjusters.lastDayOfMonth()); @@ -511,6 +525,8 @@ depositBill.setBillType("2"); contractService.updateById(contract); + rentBill.setBusinessDeptId(contract.getBusinessDeptId()); + depositBill.setBusinessDeptId(contract.getBusinessDeptId()); billService.save(rentBill); billService.save(depositBill); // 生成后续账单 @@ -730,6 +746,7 @@ tBill.setContractNumber(contract.getContractNumber()); tBill.setPayFeesStatus("1"); tBill.setBillType("1"); + tBill.setBusinessDeptId(contract.getBusinessDeptId()); billService.save(tBill); beforeBill.setEndTime(beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1") ? 1 : contract.getPayType().equals("2") ? 3 : 12).with(TemporalAdjusters.lastDayOfMonth())); @@ -1000,6 +1017,7 @@ // } else { tBill.setPayableFeesTime(tBill.getStartTime().withDayOfMonth(15).toLocalDate()); // } + tBill.setBusinessDeptId(contract.getBusinessDeptId()); billService.save(tBill); } } @@ -1014,6 +1032,10 @@ //更新合同结束时间 contract.setEndTime(contract.getTerminateTime()); contractService.updateById(contract); + // 修改房屋状态 + THouse house = houseService.getById(contract.getHouseId()); + house.setLeaseStatus("1"); + houseService.updateById(house); TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord(); tCheckAcceptRecord.setContractId(contract.getId()); -- Gitblit v1.7.1