From 09095d67f2e2acf45dcd55155da491e44206db4e Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 05 四月 2024 15:38:14 +0800
Subject: [PATCH] 修改时间 将时间修改 未23:59:59秒

---
 service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java |  323 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 168 insertions(+), 155 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java b/service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java
old mode 100644
new mode 100755
index a8247c7..ff3235b
--- a/service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java
+++ b/service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java
@@ -1,9 +1,11 @@
 package com.java110.fee.bmo.impl;
 
 import com.alibaba.fastjson.JSONArray;
+import com.java110.core.factory.CommunitySettingFactory;
 import com.java110.core.factory.Java110ThreadPoolFactory;
+import com.java110.core.log.LoggerFactory;
 import com.java110.core.smo.IComputeFeeSMO;
-import com.java110.dto.RoomDto;
+import com.java110.dto.room.RoomDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
@@ -19,24 +21,16 @@
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.StringUtil;
+import com.java110.utils.util.*;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class QueryOweFeeImpl implements IQueryOweFee {
@@ -75,24 +69,52 @@
     //閿�
     public static final String RECEIVED_AMOUNT_SWITCH = "RECEIVED_AMOUNT_SWITCH";
 
+    //绂佺敤鐢佃剳绔彁浜ゆ敹璐规寜閽�
+    public static final String OFFLINE_PAY_FEE_SWITCH = "OFFLINE_PAY_FEE_SWITCH";
+
     @Override
     public ResponseEntity<String> query(FeeDto feeDto) {
 
         //鏌ヨ璐圭敤淇℃伅arrearsEndTime
-        feeDto.setArrearsEndTime(DateUtil.getCurrentDate());
+        // todo 杩欓噷鑰冭檻棰勪粯鏈熺殑璐圭敤 鎵�浠ユ煡璇㈠叏閲忓啀鐢ㄨ垂鐢�
+        //feeDto.setArrearsEndTime(DateUtil.getCurrentDate());
         feeDto.setState(FeeDto.STATE_DOING);
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
 
-        if (feeDtos == null || feeDtos.size() < 1) {
+        if (ListUtil.isNull(feeDtos)) {
             feeDtos = new ArrayList<>();
             return ResultVo.createResponseEntity(feeDtos);
         }
+        String val = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(), TOTAL_FEE_PRICE);
+        if (StringUtil.isEmpty(val)) {
+            val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        }
         List<FeeDto> tmpFeeDtos = new ArrayList<>();
         for (FeeDto tmpFeeDto : feeDtos) {
-            computeFeeSMOImpl.computeEveryOweFee(tmpFeeDto);//璁$畻娆犺垂閲戦
-            //濡傛灉閲戦涓�0 灏辨帓闄�
-            if (tmpFeeDto.getFeePrice() > 0 && tmpFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) {
-                tmpFeeDtos.add(tmpFeeDto);
+            try {
+                //todo 鏈夌洰鏍囩粨鏉熸椂闂�,骞朵笖涓嶆槸涓�娆℃�ц垂鐢�
+                if (!StringUtil.isEmpty(feeDto.getTargetEndTime())
+                        && !FeeDto.FEE_FLAG_ONCE.equals(tmpFeeDto.getFeeFlag())
+                ) {
+                    computeFeeSMOImpl.computeEveryOweFeeByTargetEndTime(tmpFeeDto, feeDto.getTargetEndTime());//璁$畻娆犺垂閲戦
+                } else {
+                    computeFeeSMOImpl.computeEveryOweFee(tmpFeeDto);//璁$畻娆犺垂閲戦
+                }
+                //濡傛灉閲戦涓�0 灏辨帓闄�
+                tmpFeeDto.setFeeTotalPrice(
+                        MoneyUtil.computePriceScale(
+                                tmpFeeDto.getFeeTotalPrice(),
+                                tmpFeeDto.getScale(),
+                                Integer.parseInt(tmpFeeDto.getDecimalPlace())
+                        )
+                );
+
+                tmpFeeDto.setVal(val);
+                if (tmpFeeDto.getFeeTotalPrice() != 0) {
+                    tmpFeeDtos.add(tmpFeeDto);
+                }
+            } catch (Exception e) {
+                logger.error("鍙兘璐圭敤璧勬枡鏈夐棶棰樺鑷寸畻璐瑰け璐�", e);
             }
         }
 
@@ -121,11 +143,35 @@
 
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
 
-        if (feeDtos == null || feeDtos.size() < 1) {
+        if (ListUtil.isNull(feeDtos)) {
             return ResultVo.success();
         }
-
+        String cycel = null;
+        String custEndTime = null;
+        String customStartTime = "";
+        String customEndTime = "";
+        if (!StringUtil.isEmpty(feeDto.getCycle())) {
+            cycel = feeDto.getCycle();
+        }
+        if (!StringUtil.isEmpty(feeDto.getCustEndTime())) {
+            custEndTime = feeDto.getCustEndTime();
+        }
+        customStartTime = feeDto.getCustomStartTime();
+        customEndTime = feeDto.getCustomEndTime();
         feeDto = feeDtos.get(0);
+        //todo 鑰冭檻璐﹀崟妯″紡
+        if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag()) && StringUtil.isNumber(feeDto.getMonthCycle())) {
+            cycel = feeDto.getMonthCycle();
+        }
+        if (!StringUtil.isEmpty(cycel)) {
+            feeDto.setCycle(cycel);
+        }
+        if (!StringUtil.isEmpty(custEndTime)) {
+            feeDto.setCustEndTime(custEndTime);
+        }
+
+        feeDto.setCustomStartTime(customStartTime);
+        feeDto.setCustomEndTime(customEndTime);
 
         if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
             RoomDto roomDto = new RoomDto();
@@ -136,11 +182,12 @@
                 throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒版埧灞嬩俊鎭紝鏌ヨ澶氭潯鏁版嵁");
             }
             roomDto = roomDtos.get(0);
-            feeDto.setPayerObjName(roomDto.getFloorNum() + "鏍�" + roomDto.getUnitNum() + "鍗曞厓" + roomDto.getRoomNum() + "瀹�");
+            feeDto.setPayerObjName(roomDto.getFloorNum() + "-" + roomDto.getUnitNum() + "-" + roomDto.getRoomNum() );
             feeDto.setBuiltUpArea(roomDto.getBuiltUpArea());
 
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
             OwnerCarDto ownerCarDto = new OwnerCarDto();
+            ownerCarDto.setCarTypeCd("1001"); //涓氫富杞﹁締
             ownerCarDto.setCommunityId(feeDto.getCommunityId());
             ownerCarDto.setCarId(feeDto.getPayerObjId());
             List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
@@ -149,7 +196,7 @@
             parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
             parkingSpaceDto.setPsId(ownerCarDtos.get(0).getPsId());
             List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
-            if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
+            if (ListUtil.isNull(parkingSpaceDtos)) { //鏁版嵁鏈夐棶棰�
                 throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒板仠杞︿綅淇℃伅锛屾煡璇㈠鏉℃暟鎹�");
             }
             ownerCarDto = ownerCarDtos.get(0);
@@ -157,17 +204,53 @@
             feeDto.setPayerObjName(ownerCarDto.getCarNum() + "(" + parkingSpaceDto.getAreaNum() + "鍋滆溅鍦�" + parkingSpaceDto.getNum() + "杞︿綅)");
             feeDto.setBuiltUpArea(parkingSpaceDto.getArea());
         }
-        double feePrice = computeFeeSMOImpl.getFeePrice(feeDto);
-        feeDto.setFeePrice(feePrice);
+
+        Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
+        feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
+
+        feeDto.setFeeTotalPrice(
+                MoneyUtil.computePriceScale(
+                        Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()),
+                        feeDto.getScale(),
+                        Integer.parseInt(feeDto.getDecimalPlace())
+                )
+        );
+
+        if (!StringUtil.isEmpty(custEndTime)) {
+            Date date = DateUtil.getDateFromStringB(custEndTime);
+            computeFeeSMOImpl.dealRentRateCustEndTime(feeDto, date);
+        } else {
+            computeFeeSMOImpl.dealRentRateCycle(feeDto, NumberUtil.getDouble(feeDto.getCycle()));
+        }
+
+
         //搴旀敹娆惧彇鍊�
-        String val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        //鍏堝彇鍗曞皬鍖虹殑濡傛灉娌℃湁閰嶇疆 鍙� 鍏ㄥ眬鐨�
+        String val = CommunitySettingFactory.getValue(feeDto.getCommunityId(), TOTAL_FEE_PRICE);
+        if (StringUtil.isEmpty(val)) {
+            val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        }
         feeDto.setVal(val);
-        String received_amount_switch = MappingCache.getValue(DOMAIN_COMMON, RECEIVED_AMOUNT_SWITCH);
+        //鍏堝彇鍗曞皬鍖虹殑濡傛灉娌℃湁閰嶇疆 鍙� 鍏ㄥ眬鐨�
+        String received_amount_switch = CommunitySettingFactory.getValue(feeDto.getCommunityId(), RECEIVED_AMOUNT_SWITCH);
+        if (StringUtil.isEmpty(received_amount_switch)) {
+            received_amount_switch = MappingCache.getValue(DOMAIN_COMMON, RECEIVED_AMOUNT_SWITCH);
+        }
+        //鍏抽棴 绾夸笅鏀堕摱鍔熻兘
         if (StringUtil.isEmpty(received_amount_switch)) {
             feeDto.setReceivedAmountSwitch("1");//榛樿鍚敤瀹炴敹娆捐緭鍏ユ
         } else {
             feeDto.setReceivedAmountSwitch(received_amount_switch);
         }
+        //鍏堝彇鍗曞皬鍖虹殑濡傛灉娌℃湁閰嶇疆 鍙� 鍏ㄥ眬鐨�
+        String offlinePayFeeSwitch = CommunitySettingFactory.getValue(feeDto.getCommunityId(), OFFLINE_PAY_FEE_SWITCH);
+        if (StringUtil.isEmpty(offlinePayFeeSwitch)) {
+            offlinePayFeeSwitch = MappingCache.getValue(DOMAIN_COMMON, OFFLINE_PAY_FEE_SWITCH);
+        }
+        feeDto.setOfflinePayFeeSwitch(offlinePayFeeSwitch);
+        //鍘绘帀澶氫綑0
+        feeDto.setSquarePrice(Double.parseDouble(feeDto.getSquarePrice()) + "");
+        feeDto.setAdditionalAmount(Double.parseDouble(feeDto.getAdditionalAmount()) + "");
         return ResultVo.createResponseEntity(feeDto);
     }
 
@@ -185,15 +268,13 @@
         List<RoomDto> tmpRoomDtos = new ArrayList<>();
         List<RoomDto> tempRooms = new ArrayList<>();
         int threadNum = Java110ThreadPoolFactory.JAVA110_DEFAULT_THREAD_NUM;
-        for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
-            tempRooms.add(roomDtos.get(roomIndex));
-            if (roomIndex % threadNum == 0 && roomIndex != 0) {
-                tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, threadNum));
-                tempRooms = new ArrayList();
+
+        tempRooms.addAll(doGetTmpRoomDto(roomDtos, feeDto, threadNum));
+        for (RoomDto tmpRoomDto : tempRooms) {
+            if (tmpRoomDto == null) {
+                continue;
             }
-        }
-        if (tempRooms.size() > 0) {
-            tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, tempRooms.size()));
+            tmpRoomDtos.add(tmpRoomDto);
         }
 
         return ResultVo.createResponseEntity(tmpRoomDtos);
@@ -209,8 +290,8 @@
                 });
             }
             return java110ThreadPoolFactory.get();
-        }finally {
-            if(java110ThreadPoolFactory != null){
+        } finally {
+            if (java110ThreadPoolFactory != null) {
                 java110ThreadPoolFactory.stop();
             }
         }
@@ -223,7 +304,7 @@
         tmpFeeDto.setState(FeeDto.STATE_DOING);
         tmpFeeDto.setPayerObjId(tmpRoomDto.getRoomId());
         tmpFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
-        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.querySimpleFees(tmpFeeDto);
 
         if (feeDtos == null || feeDtos.size() < 1) {
             return null;
@@ -234,7 +315,8 @@
 
             computeFeeSMOImpl.computeEveryOweFee(tempFeeDto, tmpRoomDto);//璁$畻娆犺垂閲戦
             //濡傛灉閲戦涓�0 灏辨帓闄�
-            if (tempFeeDto.getFeePrice() > 0 && tempFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) {
+            //if (tempFeeDto.getFeePrice() > 0 && tempFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) {
+            if (tempFeeDto.getFeePrice() > 0) {
                 tmpFeeDtos.add(tempFeeDto);
             }
         }
@@ -390,7 +472,7 @@
 
     private void dealFeePs(ParkingSpaceDto tmpParkingSpaceDto, FeeDto feeDto) {
         // 杞暟 * 鍛ㄦ湡 * 30 + 寮�濮嬫椂闂� = 鐩爣 鍒版湡鏃堕棿
-        Map<String, Object> targetEndDateAndOweMonth = getTargetEndDateAndOweMonth(feeDto);
+        Map<String, Object> targetEndDateAndOweMonth = computeFeeSMOImpl.getTargetEndDateAndOweMonth(feeDto);
         Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
         double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
         if (!tmpParkingSpaceDto.getPsId().equals(feeDto.getPayerObjId())) {
@@ -409,6 +491,12 @@
 
             BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
             feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        } else if ("3003".equals(computingFormula)) { // 鍥哄畾璐圭敤
+            feePrice = 0.0;
+        } else if ("1101".equals(computingFormula)) { // 绉熼噾
+            feePrice = 0.0;
+        } else if ("1102".equals(computingFormula)) { // 绉熼噾
+            feePrice = 0.0;
         } else if ("4004".equals(computingFormula)) {
             feePrice = Double.parseDouble(feeDto.getAmount());
         } else if ("5005".equals(computingFormula)) {
@@ -418,6 +506,19 @@
                 BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
                 BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+                BigDecimal sub = curDegree.subtract(preDegree);
+                feePrice = sub.multiply(squarePrice)
+                        .add(additionalAmount)
+                        .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            }
+        } else if ("9009".equals(computingFormula)) {  //(鏈湡搴︽暟-涓婃湡搴︽暟)*鍔ㄦ�佸崟浠�+闄勫姞璐�
+            if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                feePrice = -1.00;
+            } else {
+                BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
                 BigDecimal sub = curDegree.subtract(preDegree);
                 feePrice = sub.multiply(squarePrice)
@@ -435,7 +536,9 @@
         feeDto.setAmountOwed(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue() + "");
         feeDto.setDeadlineTime(targetEndDate);
         //鍔ㄦ�佽垂鐢�
-        if ("4004".equals(computingFormula)) {
+        if ("4004".equals(computingFormula)
+                && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
+        ) {
             feeDto.setAmountOwed(feeDto.getFeePrice() + "");
             feeDto.setDeadlineTime(DateUtil.getCurrentDate());
         }
@@ -487,7 +590,7 @@
     }
 
     private void dealFeeRoom(RoomDto tmpRoomDto, FeeDto feeDto) {
-        Map<String, Object> targetEndDateAndOweMonth = getTargetEndDateAndOweMonth(feeDto);
+        Map<String, Object> targetEndDateAndOweMonth = computeFeeSMOImpl.getTargetEndDateAndOweMonth(feeDto);
         Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
         double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
         if (!tmpRoomDto.getRoomId().equals(feeDto.getPayerObjId())) {
@@ -505,6 +608,17 @@
         } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
             BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
             feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        } else if ("3003".equals(computingFormula)) { // 鍥哄畾璐圭敤
+            BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+            BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(tmpRoomDto.getRoomArea()));
+            BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+            feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        } else if ("1101".equals(computingFormula)) { // 绉熼噾
+            BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpRoomDto.getRoomRent()));
+            feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        } else if ("1102".equals(computingFormula)) { // 绉熼噾
+            BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpRoomDto.getRoomRent()));
+            feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         } else if ("4004".equals(computingFormula)) {
             feePrice = Double.parseDouble(feeDto.getAmount());
         } else if ("5005".equals(computingFormula)) {
@@ -515,6 +629,20 @@
                 BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
                 BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+                BigDecimal sub = curDegree.subtract(preDegree);
+                feePrice = sub.multiply(squarePrice)
+                        .add(additionalAmount)
+                        .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            }
+        } else if ("9009".equals(computingFormula)) {
+
+            if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                feePrice = -1.00;
+            } else {
+                BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
                 BigDecimal sub = curDegree.subtract(preDegree);
                 feePrice = sub.multiply(squarePrice)
@@ -540,121 +668,6 @@
 
     }
 
-
-    /**
-     * 璁$畻2涓棩鏈熶箣闂寸浉宸殑  浠ュ勾銆佹湀銆佹棩涓哄崟浣嶏紝鍚勮嚜璁$畻缁撴灉鏄灏�
-     * 姣斿锛�2011-02-02 鍒�  2017-03-02
-     * 浠ュ勾涓哄崟浣嶇浉宸负锛�6骞�
-     * 浠ユ湀涓哄崟浣嶇浉宸负锛�73涓湀
-     * 浠ユ棩涓哄崟浣嶇浉宸负锛�2220澶�
-     *
-     * @param fromDate
-     * @param toDate
-     * @return
-     */
-    public static double dayCompare(Date fromDate, Date toDate) {
-        Calendar from = Calendar.getInstance();
-        from.setTime(fromDate);
-        Calendar to = Calendar.getInstance();
-        to.setTime(toDate);
-
-        long t1 = from.getTimeInMillis();
-        long t2 = to.getTimeInMillis();
-        double days = (t2 - t1) * 1.00 / (24 * 60 * 60 * 1000);
-
-        BigDecimal tmpDays = new BigDecimal(days);
-        BigDecimal monthDay = new BigDecimal(30);
-
-        return tmpDays.divide(monthDay, 2, RoundingMode.HALF_UP).doubleValue();
-    }
-
-    private Map getTargetEndDateAndOweMonth(FeeDto feeDto) {
-        Date targetEndDate = null;
-        double oweMonth = 0.0;
-
-        Map<String, Object> targetEndDateAndOweMonth = new HashMap<>();
-
-        if (FeeDto.STATE_FINISH.equals(feeDto.getState())) {
-            targetEndDate = feeDto.getEndTime();
-            targetEndDateAndOweMonth.put("oweMonth", oweMonth);
-            targetEndDateAndOweMonth.put("targetEndDate", targetEndDate);
-            return targetEndDateAndOweMonth;
-        }
-        if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
-            if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
-                targetEndDate = feeDto.getCurReadingTime();
-            } else if (feeDto.getImportFeeEndTime() == null) {
-                targetEndDate = feeDto.getConfigEndTime();
-            } else {
-                targetEndDate = feeDto.getImportFeeEndTime();
-            }
-            //鍒ゆ柇褰撳墠璐圭敤鏄笉鏄鍏ヨ垂鐢�
-            oweMonth = 1.0;
-
-        } else {
-            //褰撳墠鏃堕棿
-            Date billEndTime = DateUtil.getCurrentDate();
-            //寮�濮嬫椂闂�
-            Date startDate = feeDto.getStartTime();
-            //鍒版湡鏃堕棿
-            Date endDate = feeDto.getEndTime();
-            if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {
-                OwnerCarDto ownerCarDto = new OwnerCarDto();
-                ownerCarDto.setCommunityId(feeDto.getCommunityId());
-                ownerCarDto.setCarId(feeDto.getPayerObjId());
-                List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
-
-                if (ownerCarDtos == null || ownerCarDtos.size() != 1) {
-                    targetEndDateAndOweMonth.put("oweMonth", 0);
-                    targetEndDateAndOweMonth.put("targetEndDate", "");
-                    return targetEndDateAndOweMonth;
-                }
-
-                targetEndDate = ownerCarDtos.get(0).getEndTime();
-                //璇存槑娌℃湁娆犺垂
-                if (endDate.getTime() >= targetEndDate.getTime()) {
-                    // 鐩爣鍒版湡鏃堕棿 - 鍒版湡鏃堕棿 = 娆犺垂鏈堜唤
-                    oweMonth = 0;
-                    targetEndDateAndOweMonth.put("oweMonth", oweMonth);
-                    targetEndDateAndOweMonth.put("targetEndDate", targetEndDate);
-                    return targetEndDateAndOweMonth;
-                }
-            }
-
-            //缂磋垂鍛ㄦ湡
-            long paymentCycle = Long.parseLong(feeDto.getPaymentCycle());
-            // 褰撳墠鏃堕棿 - 寮�濮嬫椂闂�  = 鏈堜唤
-            double mulMonth = 0.0;
-            mulMonth = dayCompare(startDate, billEndTime);
-
-            // 鏈堜唤/ 鍛ㄦ湡 = 杞暟锛堝悜涓婂彇鏁达級
-            double round = 0.0;
-            if ("1200".equals(feeDto.getPaymentCd())) { // 棰勪粯璐�
-                round = Math.floor(mulMonth / paymentCycle) + 1;
-            } else { //鍚庝粯璐�
-                round = Math.floor(mulMonth / paymentCycle);
-            }
-            // 杞暟 * 鍛ㄦ湡 * 30 + 寮�濮嬫椂闂� = 鐩爣 鍒版湡鏃堕棿
-            targetEndDate = getTargetEndTime(round * paymentCycle, startDate);
-            //璐圭敤 蹇粨鏉熶簡
-            if (feeDto.getConfigEndTime().getTime() < targetEndDate.getTime()) {
-                targetEndDate = feeDto.getConfigEndTime();
-            }
-            //璇存槑娌℃湁娆犺垂
-            if (endDate.getTime() < targetEndDate.getTime()) {
-                // 鐩爣鍒版湡鏃堕棿 - 鍒版湡鏃堕棿 = 娆犺垂鏈堜唤
-                oweMonth = dayCompare(endDate, targetEndDate);
-            }
-
-            if (feeDto.getEndTime().getTime() > targetEndDate.getTime()) {
-                targetEndDate = feeDto.getEndTime();
-            }
-        }
-
-        targetEndDateAndOweMonth.put("oweMonth", oweMonth);
-        targetEndDateAndOweMonth.put("targetEndDate", targetEndDate);
-        return targetEndDateAndOweMonth;
-    }
 
     private Date getTargetEndTime(double v, Date startDate) {
         Calendar endDate = Calendar.getInstance();

--
Gitblit v1.8.0