Your Name
2023-08-25 45c39c4deba8f37d6152793efc3b271c352fac89
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
@@ -951,44 +951,7 @@
        return getFeePrice(feeDto, null);
    }
    /**
     * //计算周期
     * //                    Map<String, Object> cycleResults = dateDiff(feeDto.getEndTime(), feeDto.getCustEndTime());
     * //                    //月份大于0
     * //                    Integer months = Integer.valueOf(cycleResults.get("months").toString());
     * //                    Integer days = Integer.valueOf(cycleResults.get("days").toString());
     * //                    Integer startMonthDays = Integer.valueOf(cycleResults.get("startMonthDays").toString());
     * //                    Integer endMonthDays = Integer.valueOf(cycleResults.get("endMonthDays").toString());
     * //                    String isOneMonth = cycleResults.get("isOneMonth").toString();
     * //                    //整数月
     * //                    if (months > 0 && days == 0) {
     * //                        BigDecimal cycle = new BigDecimal(months);
     * //                        feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
     * //                    }
     * //                    //几个月几天   (单价*面积+附加费)*月份+((单价*面积+附加费)/总天数)*实际天数
     * //                    if (months > 0 && days > 0) {
     * //                        BigDecimal cycle = new BigDecimal(months);
     * //                        BigDecimal endMonthDayss = new BigDecimal(endMonthDays);
     * //                        BigDecimal dayss = new BigDecimal(days);
     * //                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
     * //                        feeTotalPrice = (monthPrice).multiply(cycle).add(monthPrice.divide(endMonthDayss).multiply(dayss)).setScale(3, BigDecimal.ROUND_HALF_UP);
     * //                    }
     * //                    //跨月份 不足一月  ((单价*面积+附加费)/开始月份总天数)*实际天数+((单价*面积+附加费)/结束月份总天数)*实际天数
     * //                    if (months == 0 && days > 0 && "true".equals(isOneMonth)) {
     * //                        BigDecimal startEndOfMonth = new BigDecimal(cycleResults.get("startEndOfMonth").toString());
     * //                        BigDecimal endBeginningOfMonth = new BigDecimal(cycleResults.get("endBeginningOfMonth").toString());
     * //                        BigDecimal endMonthDayss = new BigDecimal(endMonthDays);
     * //                        BigDecimal startMonthDayss = new BigDecimal(startMonthDays);
     * //                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
     * //                        feeTotalPrice = monthPrice.divide(startMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(startEndOfMonth).add(monthPrice.divide(endMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(endBeginningOfMonth)).setScale(3, BigDecimal.ROUND_HALF_UP);
     * //                    }
     * //                    //不跨月份 不足一月  (单价*面积+附加费/开始月份总天数)*实际天数
     * //                    if (months == 0 && days > 0 && "false".equals(isOneMonth)) {
     * //                        BigDecimal cycle = new BigDecimal(days);
     * //                        BigDecimal startMonthDayss = new BigDecimal(startMonthDays);
     * //                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
     * //                        feeTotalPrice = monthPrice.divide(startMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
     * //                    }
    /*
     *
     * @param feeDto
     * @param roomDto
@@ -1035,12 +998,6 @@
                BigDecimal cycle = null;
                if (!StringUtil.isEmpty(feeDto.getCycle())) {
                    cycle = new BigDecimal(feeDto.getCycle());
                }
                /*if (!StringUtil.isEmpty(feeDto.getPaymentCycle())) {
                    cycle = new BigDecimal(feeDto.getPaymentCycle());
                }*/
                if (!StringUtil.isEmpty(feeDto.getCustEndTime())) {
                    cycle = new BigDecimal(dayCompare(feeDto.getEndTime(), DateUtil.getDateFromStringB(feeDto.getCustEndTime())));
                }
                if (cycle == null) {
                    feeTotalPrice = new BigDecimal(0);
@@ -1733,14 +1690,23 @@
        double oweMonth = 0.0;
        Map<String, Object> targetEndDateAndOweMonth = new HashMap<>();
        //判断当前费用是否已结束
        //todo 判断当前费用是否已结束
        if (FeeDto.STATE_FINISH.equals(feeDto.getState())) {
            targetEndDate = feeDto.getEndTime();
            targetEndDateAndOweMonth.put("oweMonth", oweMonth);
            targetEndDateAndOweMonth.put("targetEndDate", targetEndDate);
            return targetEndDateAndOweMonth;
        }
        //当前费用为一次性费用
        //todo 考虑费用项 费用提前生成
        Calendar preEndTimeCal = Calendar.getInstance();
        preEndTimeCal.setTime(feeDto.getEndTime());
        if (StringUtil.isNumber(feeDto.getPrepaymentPeriod())) {
            preEndTimeCal.add(Calendar.DAY_OF_MONTH, Integer.parseInt(feeDto.getPrepaymentPeriod()) * -1);
        }
        Date preEndTime = preEndTimeCal.getTime();
        //todo 当前费用为一次性费用
        Date maxEndTime = feeDto.getConfigEndTime();
        if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
            //先取 deadlineTime
@@ -1779,7 +1745,16 @@
            }
            // 轮数 * 周期 * 30 + 开始时间 = 目标 到期时间
            targetEndDate = getTargetEndTime(round * paymentCycle, startDate);//目标结束时间
            //费用项的结束时间<缴费的结束时间  费用快结束了   取费用项的结束时间
            //todo 如果 到了 预付期 产生下个周期的费用
            if (DateUtil.getFormatTimeStringB(targetEndDate).equals(DateUtil.getFormatTimeStringB(endDate))
                    && DateUtil.getCurrentDate().getTime() > preEndTime.getTime()
            ) {
                targetEndDate = getTargetEndTime((round + 1) * paymentCycle, startDate);//目标结束时间
            }
            //todo 费用项的结束时间<缴费的结束时间  费用快结束了   取费用项的结束时间
            if (maxEndTime.getTime() < targetEndDate.getTime()) {
                targetEndDate = maxEndTime;
            }
@@ -1814,6 +1789,14 @@
            }
            // 轮数 * 周期 * 30 + 开始时间 = 目标 到期时间
            targetEndDate = getTargetEndTime(round * paymentCycle, endDate);//目标结束时间
            //todo 如果 到了 预付期 产生下个周期的费用
            if (DateUtil.getFormatTimeStringB(targetEndDate).equals(DateUtil.getFormatTimeStringB(endDate))
                    && DateUtil.getCurrentDate().getTime() > preEndTime.getTime()
            ) {
                targetEndDate = getTargetEndTime((round + 1) * paymentCycle, startDate);//目标结束时间
            }
            //费用项的结束时间<缴费的结束时间  费用快结束了   取费用项的结束时间
            if (maxEndTime.getTime() < targetEndDate.getTime()) {
                targetEndDate = maxEndTime;