xuhy
2025-04-03 12179b24c0381fec330588686954621050847131
xiugai
1个文件已修改
14 ■■■■■ 已修改文件
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
                                        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());