From 7958f1dddb8a7f4e70d232b07a7703955ecedae0 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期六, 26 八月 2023 12:45:33 +0800
Subject: [PATCH] 优化diamante

---
 service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java |  419 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 257 insertions(+), 162 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
index 89aa01b..8e92b02 100644
--- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
+++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
@@ -1,15 +1,16 @@
 package com.java110.fee.feeMonth;
 
+import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.fee.FeeAttrDto;
 import com.java110.dto.fee.FeeDetailDto;
 import com.java110.dto.fee.FeeDto;
-import com.java110.dto.fee.MonthFeeDetailDto;
-import com.java110.dto.payFeeDetailMonth.PayFeeMonthOwnerDto;
+import com.java110.dto.payFee.PayFeeDetailMonthDto;
+import com.java110.dto.payFee.PayFeeMonthOwnerDto;
 import com.java110.intf.community.IRoomInnerServiceSMO;
-import com.java110.utils.util.BeanConvertUtil;
+import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO;
+import com.java110.po.payFee.PayFeeDetailMonthPo;
 import com.java110.utils.util.DateUtil;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,6 +25,9 @@
 
     @Autowired
     private IComputeFeeSMO computeFeeSMOImpl;
+
+    @Autowired
+    private IPayFeeDetailMonthInnerServiceSMO payFeeDetailMonthInnerServiceSMOImpl;
 
 
     public PayFeeMonthOwnerDto generatorOwnerRoom(FeeDto feeDto) {
@@ -48,38 +52,19 @@
 
         Double feePrice = Double.parseDouble(feePriceAll.get("feePrice").toString());
         //todo 濡傛灉鏄竴娆℃�ц垂鐢� 闄や互
-        if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) {
-            return feePrice;
-        }
-        List<String> months = DateUtil.getMonthBetweenDate(feeDto.getStartTime(), feeDto.getEndTime());
-        //double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime()));
-        if (months == null || months.size() <= 0) {
-            return feePrice;
-
-        }
-        BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(months.size()), 4, BigDecimal.ROUND_HALF_UP);
-        feePrice = feePriceDec.doubleValue();
+//        if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) {
+//            return feePrice;
+//        }
+//        double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime()));
+//        if (maxMonth <= 0) {
+//            return feePrice;
+//
+//        }
+//        BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_UP);
+//        feePrice = feePriceDec.doubleValue();
         return feePrice;
     }
 
-
-    public Double getReceivableAmount(List<FeeDetailDto> feeDetailDtos, Map<String, MonthFeeDetailDto> monthFeeDetailDtos, Double feePrice, Date curDate, FeeDto feeDto) {
-        MonthFeeDetailDto monthFeeDetailDto = getCurMonthFeeDetail(monthFeeDetailDtos, curDate);
-        if (monthFeeDetailDto == null && curDate.getTime() < feeDto.getEndTime().getTime()) {
-            return 0.00;
-        }
-        return feePrice;
-    }
-
-
-    @Override
-    public Double getReceivedAmount(List<FeeDetailDto> feeDetailDtos, Map<String, MonthFeeDetailDto> monthFeeDetailDtos, Double feePrice, Date curDate, FeeDto feeDto) {
-        MonthFeeDetailDto monthFeeDetailDto = getCurMonthFeeDetail(monthFeeDetailDtos, curDate);
-        if (monthFeeDetailDto == null) {
-            return 0.0;
-        }
-        return monthFeeDetailDto.getReceivedAmount();
-    }
 
     @Override
     public Double getDiscountAmount(Double feePrice, double receivedAmount, Date curDate, FeeDto feeDto) {
@@ -93,152 +78,262 @@
         return discountAmountDec.doubleValue();
     }
 
-    @Override
-    public String getFeeDetailId(List<FeeDetailDto> feeDetailDtos, Date curDate) {
-        FeeDetailDto feeDetailDto = getCurFeeDetail(feeDetailDtos, curDate);
-
-        if (feeDetailDto == null) {
-            return "-1";
-        }
-        return feeDetailDto.getDetailId();
-    }
-
-    @Override
-    public String getFeeFeeTime(List<FeeDetailDto> feeDetailDtos, String detailId) {
-
-        if (feeDetailDtos == null || feeDetailDtos.size() < 1) {
-            return null;
-        }
-        for (FeeDetailDto feeDetailDto : feeDetailDtos) {
-            if (feeDetailDto.getDetailId().equals(detailId)) {
-                return DateUtil.getFormatTimeStringA(feeDetailDto.getCreateTime());
-            }
-        }
-        return null;
-    }
-
 
     /**
-     * 鑾峰彇褰撳墠缂磋垂璁板綍
+     * 澶勭悊宸茬粡浜よ繃璐圭殑璁板綍澶勭悊
      *
-     * @param feeDetailDtos
-     * @param curDate
-     * @return
+     * @param feeDto
+     * @param payFeeMonthOwnerDto
      */
-    private FeeDetailDto getCurFeeDetail(List<FeeDetailDto> feeDetailDtos, Date curDate) {
-        if (feeDetailDtos == null || feeDetailDtos.size() < 1) {
-            return null;
-        }
-        List<FeeDetailDto> tFeeDetailDtos = new ArrayList<>();
-        for (FeeDetailDto feeDetailDto : feeDetailDtos) {
-            if (feeDetailDto.getStartTime().getTime() <= curDate.getTime() && feeDetailDto.getEndTime().getTime() > curDate.getTime()) {
-                tFeeDetailDtos.add(BeanConvertUtil.covertBean(feeDetailDto, FeeDetailDto.class));
-            }
-        }
-
-        if (tFeeDetailDtos.size() < 1) {
-            return null;
-        }
-        if (tFeeDetailDtos.size() == 1) {
-            return tFeeDetailDtos.get(0);
-        }
-        //todo 杩欑搴旇鏄暟鎹紓甯� 涔熷氨鏄竴涓湀璐圭敤鍙樻洿鍚庨噸澶嶇即璐�
-        BigDecimal cReceivedAmount = new BigDecimal(0.00);
-        for (FeeDetailDto feeDetailDto : tFeeDetailDtos) {
-            cReceivedAmount = cReceivedAmount.add(new BigDecimal(Double.parseDouble(feeDetailDto.getReceivedAmount()))).setScale(4, BigDecimal.ROUND_HALF_UP);
-        }
-
-        tFeeDetailDtos.get(0).setReceivedAmount(cReceivedAmount.doubleValue() + "");
-
-        return tFeeDetailDtos.get(0);
-    }
-
-
     @Override
-    public Map<String, MonthFeeDetailDto> analysisMonthFeeDetail(List<FeeDetailDto> feeDetailDtos) {
+    public void waitDispersedFeeDetail(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto) {
+        PayFeeDetailMonthDto payFeeDetailMonthDto = new PayFeeDetailMonthDto();
+        payFeeDetailMonthDto.setCommunityId(feeDto.getCommunityId());
+        payFeeDetailMonthDto.setFeeId(feeDto.getFeeId());
+        List<FeeDetailDto> feeDetailDtos = payFeeDetailMonthInnerServiceSMOImpl.getWaitDispersedFeeDetail(payFeeDetailMonthDto);
 
         if (feeDetailDtos == null || feeDetailDtos.size() < 1) {
-            return null;
-        }
-
-        Map<String, MonthFeeDetailDto> monthFeeDetailDtos = new HashMap<>();
-
-        for (FeeDetailDto feeDetailDto : feeDetailDtos) {
-            Date endTime =  feeDetailDto.getEndTime();
-            Calendar calendar = Calendar.getInstance();
-            calendar.setTime(endTime);
-            calendar.add(Calendar.DAY_OF_MONTH,-1);
-            if(feeDetailDto.getStartTime().getTime()< calendar.getTime().getTime()){
-                endTime = calendar.getTime();
-            }
-            //璁$畻涓や釜鏃ユ湡鍖呭惈鐨勬湀浠�
-            List<String> months = DateUtil.getMonthBetweenDate(feeDetailDto.getStartTime(), endTime);
-
-            if (months == null || months.size() < 1) {
-                putReceivedAmountToMonthFeeDetailDtos(monthFeeDetailDtos,
-                        DateUtil.getFormatTimeString(feeDetailDto.getStartTime(), DateUtil.DATE_FORMATE_STRING_Q),
-                        Double.parseDouble(feeDetailDto.getReceivedAmount()),
-                        feeDetailDto);
-                continue;
-            }
-
-            BigDecimal totalRecDec = new BigDecimal(feeDetailDto.getReceivedAmount());
-            //姣忔湀骞冲潎鍊�
-            BigDecimal priRecDec = totalRecDec.divide(new BigDecimal(months.size()), 4, BigDecimal.ROUND_HALF_UP);
-
-            for (String month : months) {
-                putReceivedAmountToMonthFeeDetailDtos(monthFeeDetailDtos,
-                        month,
-                        priRecDec.doubleValue(),
-                        feeDetailDto);
-            }
-
-        }
-        return monthFeeDetailDtos;
-    }
-
-
-    /**
-     * 鏈堜唤瀛樻斁璧锋潵
-     *
-     * @param monthFeeDetailDtos
-     * @param month
-     * @param receivedAmount
-     */
-    private void putReceivedAmountToMonthFeeDetailDtos(Map<String, MonthFeeDetailDto> monthFeeDetailDtos,
-                                                       String month,
-                                                       double receivedAmount,
-                                                       FeeDetailDto feeDetailDto) {
-
-        if (!monthFeeDetailDtos.containsKey(month)) {
-            monthFeeDetailDtos.put(month, new MonthFeeDetailDto(receivedAmount, feeDetailDto));
             return;
         }
 
-        MonthFeeDetailDto monthFeeDetailDto = monthFeeDetailDtos.get(month);
-        BigDecimal recDec = new BigDecimal(monthFeeDetailDto.getReceivedAmount()).add(new BigDecimal(receivedAmount)).setScale(4, BigDecimal.ROUND_HALF_UP);
-        monthFeeDetailDto.setReceivedAmount(recDec.doubleValue());
-        monthFeeDetailDto.getFeeDetailDtos().add(feeDetailDto);
-        monthFeeDetailDtos.put(month, monthFeeDetailDto);
+
+        for (FeeDetailDto feeDetailDto : feeDetailDtos) {
+            // todo 閫愭潯鍘荤鏁�
+            doDispersedFeeDetail(feeDetailDto, feeDto, payFeeMonthOwnerDto);
+        }
+    }
+
+
+    /**
+     * 澶勭悊 娆犺垂 绂绘暎
+     *
+     * @param feeDto
+     * @param payFeeMonthOwnerDto
+     * @param feePrice
+     * @param deadlineTime
+     */
+    @Override
+    public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime) {
+
+
+        // todo 娓呯悊 detailId 涓�-1 鐨勬暟鎹�
+        PayFeeDetailMonthPo payFeeDetailMonthPo = new PayFeeDetailMonthPo();
+        payFeeDetailMonthPo.setCommunityId(feeDto.getCommunityId());
+        payFeeDetailMonthPo.setFeeId(feeDto.getFeeId());
+        payFeeDetailMonthPo.setDetailId("-1");
+        payFeeDetailMonthInnerServiceSMOImpl.deletePayFeeDetailMonth(payFeeDetailMonthPo);
+
+        // todo 璐圭敤宸茬粡缁撴潫
+        if (FeeDto.STATE_FINISH.equals(feeDto.getState())) {
+            return;
+        }
+
+        List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>();
+        // todo 澶勭悊 寮�濮嬫椂闂村拰缁撴潫鏃堕棿
+        Date startTime = DateUtil.timeToDate(feeDto.getEndTime());
+        Date endTime = DateUtil.timeToDate(deadlineTime);
+
+        BigDecimal receivableAmount = new BigDecimal(feePrice);
+
+        BigDecimal dayReceivableAmount = null;
+
+        //todo 涓�娆℃�ц垂鐢� 鏃ュ簲鏀惰绠�
+        if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+            int day = DateUtil.daysBetween(endTime, startTime);
+            if (day < 1) {
+                day = 1;
+            }
+            dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 鏃� 搴旀敹
+        }
+
+        // todo 瀵绘壘绗竴涓嚜鐒舵湀 涓�鏃�
+        Calendar firstMonthDayCal = Calendar.getInstance();
+        firstMonthDayCal.setTime(startTime);
+        firstMonthDayCal.add(Calendar.MONTH, 1);
+        firstMonthDayCal.set(Calendar.DAY_OF_MONTH, 1);
+        Date firstMonthDayTime = firstMonthDayCal.getTime();
+
+        Date startMonthDayTime = startTime;
+        // todo  寰幆锛屽彧鍒� firstMonthDayTime 澶т簬 endTime
+        int curDay = 0;
+        int curMonthMaxDay = 30;
+        BigDecimal curMonthReceivableAmount = null;
+
+        while (firstMonthDayTime.getTime() < endTime.getTime()) {
+            curDay = DateUtil.daysBetween(firstMonthDayTime, startMonthDayTime);
+            // todo 璁$畻褰撴湀澶╂暟
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(startMonthDayTime);
+            curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+
+            // todo 濡傛灉涓嶆槸鏁存湀锛屽垯杞崲涓烘寜澶╄绠�
+//            if (curDay != curMonthMaxDay) {
+                //todo 鍛ㄦ湡鎬ц垂鐢� 鏃ュ簲鏀堕噸鏂扮畻
+                if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+                    dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+                }
+                // todo 璁$畻 搴旀敹
+                curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+//            } else { // todo 濡傛灉鏄暣鏈� 閭e氨鎸夋湀璁$畻锛屼互鍏� 杞崲鎴愬ぉ鍐� 涔樹互澶╂暟鍚庣殑璇樊
+//                curMonthReceivableAmount = receivableAmount;
+//            }
+            // todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
+            toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime);
+
+            // todo 灏唖tartTime 淇敼涓� 涓嬫湀1鏃ユ椂闂�
+            startMonthDayTime = firstMonthDayTime;
+            firstMonthDayCal.add(Calendar.MONTH, 1);
+            firstMonthDayTime = firstMonthDayCal.getTime();
+        }
+
+        //todo 鏈�鍚庡鐞� 鏈�鍚� startMonthDayTime 鍒癳ndTime 鐨�
+        if (startMonthDayTime.getTime() >= endTime.getTime()) {
+            payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+            return;
+        }
+
+        curDay = DateUtil.daysBetween(endTime, startMonthDayTime);
+        // todo 璁$畻褰撴湀澶╂暟
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(startMonthDayTime);
+        curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+        // todo 濡傛灉涓嶆槸鏁存湀锛屽垯杞崲涓烘寜澶╄绠�
+        if (curDay != curMonthMaxDay) {
+            //todo 鍛ㄦ湡鎬ц垂鐢� 鏃ュ簲鏀堕噸鏂扮畻
+            if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+                dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+            }
+            // todo 璁$畻 搴旀敹
+            curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+        } else { // todo 濡傛灉鏄暣鏈� 閭e氨鎸夋湀璁$畻锛屼互鍏� 杞崲鎴愬ぉ鍐� 涔樹互澶╂暟鍚庣殑璇樊
+            curMonthReceivableAmount = receivableAmount;
+        }
+        // todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
+        toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime);
+        payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+
+    }
+
+    private void doDispersedFeeDetail(FeeDetailDto feeDetailDto, FeeDto feeDto, PayFeeMonthOwnerDto
+            payFeeMonthOwnerDto) {
+        List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>();
+
+        // todo 鍘婚櫎 寮�濮嬫椂闂村拰 缁撴潫鏃堕棿鐨� 灏忔椂 鍒嗛挓 绉�
+        Date startTime = DateUtil.timeToDate(feeDetailDto.getStartTime());
+        Date endTime = DateUtil.timeToDate(feeDetailDto.getEndTime());
+
+        int day = DateUtil.daysBetween(endTime, startTime);
+        if (day < 1) {
+            day = 1;
+        }
+
+        BigDecimal receivableAmount = new BigDecimal(Double.parseDouble(feeDetailDto.getReceivableAmount()));
+        BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(feeDetailDto.getReceivedAmount()));
+
+        BigDecimal dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 鏃� 搴旀敹
+        BigDecimal dayReceivedAmount = receivedAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+
+        // todo 瀵绘壘绗竴涓嚜鐒舵湀 涓�鏃�
+        Calendar firstMonthDayCal = Calendar.getInstance();
+        firstMonthDayCal.setTime(startTime);
+        firstMonthDayCal.add(Calendar.MONTH, 1);
+        firstMonthDayCal.set(Calendar.DAY_OF_MONTH, 1);
+        Date firstMonthDayTime = firstMonthDayCal.getTime();
+
+        Date startMonthDayTime = startTime;
+        // todo  寰幆锛屽彧鍒� firstMonthDayTime 澶т簬 endTime
+        int curDay = 0;
+        BigDecimal curMonthReceivableAmount = null;
+        BigDecimal curMonthReceivedAmount = null;
+        while (firstMonthDayTime.getTime() < endTime.getTime()) {
+            curDay = DateUtil.daysBetween(firstMonthDayTime, startMonthDayTime);
+            // todo 璁$畻 搴旀敹
+            curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+            // todo 璁$畻 瀹炴敹
+            curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+
+            // todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
+            toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, endTime);
+
+            // todo 灏唖tartTime 淇敼涓� 涓嬫湀1鏃ユ椂闂�
+            startMonthDayTime = firstMonthDayTime;
+            firstMonthDayCal.add(Calendar.MONTH, 1);
+            firstMonthDayTime = firstMonthDayCal.getTime();
+        }
+
+        //todo 鏈�鍚庡鐞� 鏈�鍚� startMonthDayTime 鍒癳ndTime 鐨�
+        if (startMonthDayTime.getTime() >= endTime.getTime()) {
+            payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+            return;
+        }
+
+        curDay = DateUtil.daysBetween(endTime, startMonthDayTime);
+        // todo 璁$畻 搴旀敹
+        curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+        // todo 璁$畻 瀹炴敹
+        curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
+
+        // todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
+        toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, endTime);
+        payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+
     }
 
     /**
-     * 鏈堢鏁f暟鎹�
+     * 淇濆瓨鏁版嵁
      *
-     * @param monthFeeDetailDtos
-     * @param curDate
-     * @return
+     * @param receivableAmount
+     * @param receivedAmount
+     * @param feeDetailDto
+     * @param feeDto
      */
-    private MonthFeeDetailDto getCurMonthFeeDetail(Map<String, MonthFeeDetailDto> monthFeeDetailDtos, Date curDate) {
-        String month = DateUtil.getFormatTimeString(curDate, DateUtil.DATE_FORMATE_STRING_M);
-        if (monthFeeDetailDtos == null) {
-            return null;
+    private void toSavePayFeeDetailMonth(double receivableAmount,
+                                         double receivedAmount,
+                                         FeeDetailDto feeDetailDto,
+                                         FeeDto feeDto,
+                                         PayFeeMonthOwnerDto payFeeMonthOwnerDto,
+                                         List<PayFeeDetailMonthPo> payFeeDetailMonthPos,
+                                         Date curTime,
+                                         Date deadlineTime) {
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(curTime);
+        PayFeeDetailMonthPo tmpPayFeeDetailMonthPo = new PayFeeDetailMonthPo();
+        tmpPayFeeDetailMonthPo.setFeeId(feeDto.getFeeId());
+        tmpPayFeeDetailMonthPo.setCommunityId(feeDto.getCommunityId());
+        if (feeDetailDto == null) {
+            tmpPayFeeDetailMonthPo.setDetailId("-1");
+        } else { // todo 浜よ垂璁板綍 淇濆瓨鏃�
+            tmpPayFeeDetailMonthPo.setDetailId(feeDetailDto.getDetailId());
         }
-        if (!monthFeeDetailDtos.containsKey(month)) {
-            return null;
+        tmpPayFeeDetailMonthPo.setDetailYear(calendar.get(Calendar.YEAR) + "");
+        tmpPayFeeDetailMonthPo.setDetailMonth((calendar.get(Calendar.MONTH) + 1) + "");
+
+        tmpPayFeeDetailMonthPo.setReceivableAmount(receivableAmount + "");
+        tmpPayFeeDetailMonthPo.setReceivedAmount(receivedAmount + "");
+        tmpPayFeeDetailMonthPo.setDiscountAmount(
+                getDiscountAmount(Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivableAmount()),
+                        Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivedAmount()),
+                        calendar.getTime(), feeDto) + "");
+        tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId, true));
+        tmpPayFeeDetailMonthPo.setRemark("绋嬪簭璁$畻鐢熸垚");
+        tmpPayFeeDetailMonthPo.setObjName(payFeeMonthOwnerDto.getObjName());
+        tmpPayFeeDetailMonthPo.setObjId(payFeeMonthOwnerDto.getObjId());
+        tmpPayFeeDetailMonthPo.setOwnerId(payFeeMonthOwnerDto.getOwnerId());
+        tmpPayFeeDetailMonthPo.setOwnerName(payFeeMonthOwnerDto.getOwnerName());
+        tmpPayFeeDetailMonthPo.setLink(payFeeMonthOwnerDto.getLink());
+        tmpPayFeeDetailMonthPo.setCurMonthTime(DateUtil.getFormatTimeStringB(calendar.getTime()));
+        tmpPayFeeDetailMonthPo.setDeadlineTime(DateUtil.getFormatTimeStringA(deadlineTime));
+        if (feeDetailDto == null) {
+            tmpPayFeeDetailMonthPo.setPayFeeTime(null);
+        } else { // todo 浜よ垂璁板綍 淇濆瓨鏃�
+            tmpPayFeeDetailMonthPo.setPayFeeTime(DateUtil.getFormatTimeStringA(feeDetailDto.getCreateTime()));
         }
-        MonthFeeDetailDto monthFeeDetailDto = monthFeeDetailDtos.get(month);
-        return monthFeeDetailDto;
+        tmpPayFeeDetailMonthPo.setState("W"); // todo 杩欓噷鏆傛椂鍐欐锛岀洰鍓嶇敤涓嶅埌锛岀畻鏄鐣欏瓧娈�
+        tmpPayFeeDetailMonthPo.setFeeName(feeDto.getFeeName());
+        tmpPayFeeDetailMonthPo.setConfigId(feeDto.getConfigId());
+        payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo);
+
     }
 
 

--
Gitblit v1.8.0