无关风月
2025-03-21 67e17cafb91f746eebd40df7facdd1b7adb15dbd
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
@@ -291,7 +291,6 @@
                    }
                    List<TContractRentType> contractRentTypes = contractRentTypeService.list();
                    TContractRentType tContractRentType = contractRentTypes.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null);
                    // 生成第一笔账单
                    // 第一次应缴费日期
                    LocalDateTime firstPayTime = contract.getStartTime().plusDays(10).withHour(0).withMinute(0).withSecond(0);
@@ -453,15 +452,17 @@
                                rentBill.setPayableFeesMoney(money);
                                rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney());
                            }else{
                                LocalDateTime localDateTime = rentBill.getStartTime().plusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
//                                LocalDateTime localDateTime = rentBill.getStartTime().plusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
                                LocalDateTime localDateTime = rentBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth()).plusDays(1);
                                while (true){
                                    if (localDateTime.isBefore(rentBill.getEndTime())){
                                        localDateTime = localDateTime.plusMonths(1);
                                        money = money.add(contract.getMonthRent());
                                    }else{
                                        money = money.add(contract.getMonthRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(ChronoUnit.DAYS.between(rentBill.getEndTime(),localDateTime.with(TemporalAdjusters.firstDayOfMonth()))+1)));
                                        break;
                                    }
                                    localDateTime = localDateTime.plusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
                                }
                                rentBill.setPayableFeesMoney(money);
                                rentBill.setOutstandingMoney(rentBill.getPayableFeesMoney());
@@ -948,9 +949,9 @@
                            // 不需要涨租金的时间段
                            long originalDays = 0;
                            if (tBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth()).isBefore(tBill.getEndTime())){
                                originalDays = Math.abs(ChronoUnit.DAYS.between(tBill.getStartTime(), tBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth())));
                                originalDays = Math.abs(ChronoUnit.DAYS.between(tBill.getStartTime(), tBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth())))+1;
                            }else{
                                originalDays = Math.abs(ChronoUnit.DAYS.between(tBill.getStartTime(), tBill.getEndTime()));
                                originalDays = Math.abs(ChronoUnit.DAYS.between(tBill.getStartTime(), tBill.getEndTime()))+1;
                            }
                            originalMoney = originalMoney.add(contract.getChangeRent().divide(new BigDecimal(30), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(originalDays)));
                            LocalDateTime originalTime = tBill.getStartTime().with(TemporalAdjusters.lastDayOfMonth()).plusDays(1);