From c8195a8a1c34b9fa8db9aa4dc340d4344044ce97 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 29 六月 2021 20:52:03 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java |  307 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 289 insertions(+), 18 deletions(-)

diff --git a/java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java b/java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
old mode 100644
new mode 100755
index 48d6cdc..b027d1c
--- a/java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
+++ b/java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
@@ -3,11 +3,9 @@
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.RoomDto;
 import com.java110.dto.community.CommunityDto;
-import com.java110.dto.fee.BillDto;
-import com.java110.dto.fee.BillOweFeeDto;
-import com.java110.dto.fee.FeeAttrDto;
-import com.java110.dto.fee.FeeConfigDto;
-import com.java110.dto.fee.FeeDto;
+import com.java110.dto.contract.ContractDto;
+import com.java110.dto.contractRoom.ContractRoomDto;
+import com.java110.dto.fee.*;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.parking.ParkingSpaceDto;
@@ -18,6 +16,8 @@
 import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.intf.store.IContractInnerServiceSMO;
+import com.java110.intf.store.IContractRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo;
@@ -36,12 +36,7 @@
 import javax.script.ScriptEngineManager;
 import java.math.BigDecimal;
 import java.text.ParseException;
-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.*;
 
 /**
  * 璐圭敤璁$畻 鏈嶅姟绫�
@@ -73,6 +68,12 @@
 
     @Autowired(required = false)
     private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
+    @Autowired(required = false)
+    private IContractRoomInnerServiceSMO contractRoomInnerServiceSMOImpl;
+
+    @Autowired(required = false)
+    private IContractInnerServiceSMO contractInnerServiceSMOImpl;
 
     @Override
     public Date getFeeEndTime() {
@@ -138,6 +139,8 @@
             computeFeePriceByRoom(feeDto, roomDto);
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
             computeFeePriceByParkingSpace(feeDto);
+        } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
+            computeFeePriceByContract(feeDto, roomDto);
         }
     }
 
@@ -164,7 +167,9 @@
         feeDto.setDeadlineTime(targetEndDate);
 
         //鍔ㄦ�佽垂鐢�
-        if ("4004".equals(computingFormula) && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
+        if ("4004".equals(computingFormula)
+                && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
+                && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
             feeDto.setAmountOwed(feeDto.getFeePrice() + "");
             //feeDto.setDeadlineTime(DateUtil.getCurrentDate()); 娆犺垂鏃ユ湡涓嶅鍏堟敞閲�
         }
@@ -191,7 +196,37 @@
         feeDto.setDeadlineTime(targetEndDate);
 
         //鍔ㄦ�佽垂鐢�
-        if ("4004".equals(computingFormula) && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
+        if ("4004".equals(computingFormula)
+                && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
+                && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
+            feeDto.setAmountOwed(feeDto.getFeePrice() + "");
+            //feeDto.setDeadlineTime(DateUtil.getCurrentDate()); 娆犺垂鏃ユ湡涓嶅鍏堟敞閲�
+        }
+    }
+
+    /**
+     * 鏍规嵁鎴垮眿鏉ョ畻鍗曚环
+     *
+     * @param feeDto
+     */
+    private void computeFeePriceByContract(FeeDto feeDto, RoomDto roomDto) {
+        Map<String, Object> targetEndDateAndOweMonth = getTargetEndDateAndOweMonth(feeDto);
+        Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
+        double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
+
+        String computingFormula = feeDto.getComputingFormula();
+        double feePrice = getFeePrice(feeDto, roomDto);
+        feeDto.setFeePrice(feePrice);
+        //double month = dayCompare(feeDto.getEndTime(), DateUtil.getCurrentDate());
+        BigDecimal price = new BigDecimal(feeDto.getFeePrice());
+        price = price.multiply(new BigDecimal(oweMonth));
+        feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+        feeDto.setDeadlineTime(targetEndDate);
+
+        //鍔ㄦ�佽垂鐢�
+        if ("4004".equals(computingFormula)
+                && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
+                && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
             feeDto.setAmountOwed(feeDto.getFeePrice() + "");
             //feeDto.setDeadlineTime(DateUtil.getCurrentDate()); 娆犺垂鏃ユ湡涓嶅鍏堟敞閲�
         }
@@ -244,6 +279,15 @@
             } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
                 feeReceiptDetailPo.setArea(roomDtos.get(0).getBuiltUpArea());
                 feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText());
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
+                }
             } else {
             }
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
@@ -296,6 +340,74 @@
                 }
                 feeReceiptDetailPo.setArea(parkingSpaceDtos.get(0).getArea());
                 feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText());
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
+                }
+            } else {
+            }
+        } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
+            String computingFormula = feeDto.getComputingFormula();
+            ContractRoomDto contractRoomDto = new ContractRoomDto();
+            contractRoomDto.setContractId(feeDto.getPayerObjId());
+            contractRoomDto.setCommunityId(feeDto.getCommunityId());
+            List<ContractRoomDto> contractRoomDtos = contractRoomInnerServiceSMOImpl.queryContractRooms(contractRoomDto);
+            if (contractRoomDtos == null || contractRoomDtos.size() == 0) {
+                feeReceiptDetailPo.setArea("");
+                feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
+                return;
+            }
+            if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+                BigDecimal builtUpArea = new BigDecimal(0);
+                for (ContractRoomDto tmpContractRoomDto : contractRoomDtos) {
+                    builtUpArea = builtUpArea.add(new BigDecimal(Double.parseDouble(tmpContractRoomDto.getBuiltUpArea())));
+                }
+                feeReceiptDetailPo.setArea(builtUpArea.doubleValue() + "");
+                feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
+            } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+                feeReceiptDetailPo.setArea("");
+                feeReceiptDetailPo.setSquarePrice(feeDto.getAdditionalAmount());
+            } else if ("4004".equals(computingFormula)) {
+            } else if ("5005".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
+                }
+            } else if ("6006".equals(computingFormula)) {
+                String value = "";
+                List<FeeAttrDto> feeAttrDtos = feeDto.getFeeAttrDtos();
+                for (FeeAttrDto feeAttrDto : feeAttrDtos) {
+                    if (feeAttrDto.getSpecCd().equals(FeeAttrDto.SPEC_CD_PROXY_CONSUMPTION)) {
+                        value = feeAttrDto.getValue();
+                    }
+                }
+                feeReceiptDetailPo.setArea(value);
+                feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
+            } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
+                BigDecimal builtUpArea = new BigDecimal(0);
+                for (ContractRoomDto tmpContractRoomDto : contractRoomDtos) {
+                    builtUpArea = builtUpArea.add(new BigDecimal(Double.parseDouble(tmpContractRoomDto.getBuiltUpArea())));
+                }
+                feeReceiptDetailPo.setArea(builtUpArea.doubleValue() + "");
+                feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText());
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
+                }
             } else {
             }
         }
@@ -320,9 +432,9 @@
             }
             roomDto = roomDtos.get(0);
             if (RoomDto.ROOM_TYPE_ROOM.equals(roomDto.getRoomType())) {
-                objName = roomDto.getFloorNum() + "鏍�" + roomDto.getUnitNum() + "鍗曞厓" + roomDto.getRoomNum() + "瀹�";
+                objName = roomDto.getFloorNum() + "-" + roomDto.getUnitNum() + "-" + roomDto.getRoomNum();
             } else {
-                objName = roomDto.getFloorNum() + "鏍�" + roomDto.getRoomNum() + "瀹�";
+                objName = roomDto.getFloorNum() + "-" + roomDto.getRoomNum();
             }
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
 
@@ -343,6 +455,16 @@
                 return objName;
             }
             objName = objName + "(" + parkingSpaceDtos.get(0).getAreaNum() + "鍋滆溅鍦�" + parkingSpaceDtos.get(0).getNum() + "杞︿綅)";
+        } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) {
+            ContractDto contractDto = new ContractDto();
+            contractDto.setContractId(feeDto.getPayerObjId());
+            contractDto.setCommunityId(feeDto.getCommunityId());
+            List<ContractDto> contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto);
+            if (contractDtos == null || contractDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
+                return objName;
+            }
+            objName = contractDtos.get(0).getContractCode();
+
         }
         return objName;
     }
@@ -363,15 +485,30 @@
             return ownerDtos.get(0);
         }
 
-        if(FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())){
+        if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {
             OwnerCarDto ownerCarDto = new OwnerCarDto();
             ownerCarDto.setCarId(feeDto.getPayerObjId());
             ownerCarDto.setCommunityId(feeDto.getCommunityId());
             List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
 
-            Assert.listOnlyOne(ownerCarDtos,"杞﹁締涓嶅瓨鍦�");
+            Assert.listOnlyOne(ownerCarDtos, "杞﹁締涓嶅瓨鍦�");
             ownerDto = new OwnerDto();
             ownerDto.setOwnerId(ownerCarDtos.get(0).getOwnerId());
+            ownerDto.setCommunityId(feeDto.getCommunityId());
+            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+            Assert.listOnlyOne(ownerDtos, "涓氫富涓嶅瓨鍦�");
+            return ownerDtos.get(0);
+        }
+
+        if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) {
+            ContractDto contractDto = new ContractDto();
+            contractDto.setContractId(feeDto.getPayerObjId());
+            contractDto.setCommunityId(feeDto.getCommunityId());
+            List<ContractDto> contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto);
+
+            Assert.listOnlyOne(contractDtos, "鍚堝悓涓嶅瓨鍦�");
+            ownerDto = new OwnerDto();
+            ownerDto.setOwnerId(contractDtos.get(0).getObjId());
             ownerDto.setCommunityId(feeDto.getCommunityId());
             List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
             Assert.listOnlyOne(ownerDtos, "涓氫富涓嶅瓨鍦�");
@@ -527,7 +664,7 @@
                     continue;
                 }
                 if (tmpRoomDto.getRoomId().equals(feeDto.getPayerObjId())) {
-                    objName = tmpRoomDto.getFloorNum() + "鏍�" + tmpRoomDto.getUnitNum() + "鍗曞厓" + tmpRoomDto.getRoomNum() + "瀹�";
+                    objName = tmpRoomDto.getFloorNum() + "-" + tmpRoomDto.getUnitNum() + "-" + tmpRoomDto.getRoomNum();
                     feeDto.setPayerObjName(objName);
                 }
             }
@@ -636,6 +773,19 @@
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
                 feePrice = computeRoomCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportRoomDto, RoomDto.class));
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice()));
+                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
+                    BigDecimal sub = curDegree.subtract(preDegree);
+                    feePrice = sub.multiply(squarePrice)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
             }
@@ -670,6 +820,19 @@
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
                 feePrice = computeCarCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportCarDto, OwnerCarDto.class));
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) {
+                    throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice()));
+                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
+                    BigDecimal sub = curDegree.subtract(preDegree);
+                    feePrice = sub.multiply(squarePrice)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
             }
@@ -728,6 +891,19 @@
                 feePrice = computeRoomCustomizeFormula(feeDto, roomDto);
             } else if ("8008".equals(computingFormula)) {  //鎵嬪姩鍔ㄦ�佽垂鐢�
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("9009".equals(computingFormula)) {  //(鏈湡搴︽暟-涓婃湡搴︽暟)*鍔ㄦ�佸崟浠�+闄勫姞璐�
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } 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)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
             }
@@ -774,6 +950,81 @@
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
                 feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0));
+            } else if ("9009".equals(computingFormula)) {  //(鏈湡搴︽暟-涓婃湡搴︽暟)*鍔ㄦ�佸崟浠�+闄勫姞璐�
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } 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)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
+            } else {
+                throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
+            }
+        } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) { //鍚堝悓鐩稿叧
+            String computingFormula = feeDto.getComputingFormula();
+
+            //鏌ヨ鍚堝悓鍏宠仈鎴垮眿
+            ContractRoomDto contractRoomDto = new ContractRoomDto();
+            contractRoomDto.setContractId(feeDto.getPayerObjId());
+            contractRoomDto.setCommunityId(feeDto.getCommunityId());
+            List<ContractRoomDto> contractRoomDtos = contractRoomInnerServiceSMOImpl.queryContractRooms(contractRoomDto);
+
+            if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+                //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(roomDtos.get(0).getBuiltUpArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
+                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+                BigDecimal builtUpArea = new BigDecimal(0);
+                for (ContractRoomDto tmpContractRoomDto : contractRoomDtos) {
+                    builtUpArea = builtUpArea.add(new BigDecimal(Double.parseDouble(tmpContractRoomDto.getBuiltUpArea())));
+                }
+                feeDto.setBuiltUpArea(builtUpArea.doubleValue() + "");
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+            } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+                //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+//                BigDecimal roomDount = new BigDecimal(contractRoomDtos.size());
+//                additionalAmount = additionalAmount.multiply(roomDount);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+            } else if ("4004".equals(computingFormula)) {  //鍔ㄦ�佽垂鐢�
+                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("5005".equals(computingFormula)) {  //(鏈湡搴︽暟-涓婃湡搴︽暟)*鍗曚环+闄勫姞璐�
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } else {
+                    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);
+                }
+            } else if ("6006".equals(computingFormula)) {
+                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("7007".equals(computingFormula)) { //鑷畾涔夊叕寮�
+                feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos);
+            } else if ("8008".equals(computingFormula)) {  //鎵嬪姩鍔ㄦ�佽垂鐢�
+                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("9009".equals(computingFormula)) {  //(鏈湡搴︽暟-涓婃湡搴︽暟)*鍔ㄦ�佸崟浠�+闄勫姞璐�
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+                } 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)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
             }
@@ -840,6 +1091,26 @@
      * 鑷畾涔夊叕寮忚绠�
      *
      * @param feeDto
+     * @return C 浠h〃鎴垮眿瀵瑰簲灏忓尯闈㈢Н
+     * F 浠h〃鎴垮眿瀵瑰簲妤兼爧闈㈢Н
+     * U 浠h〃鎴垮眿瀵瑰簲鍗曞厓闈㈢Н
+     * R 浠h〃鎴垮眿闈㈢Н
+     * X 浠h〃鎴垮眿鏀惰垂绯绘暟锛堟埧灞嬬鐞嗕腑閰嶇疆锛�
+     * L 浠h〃鎴垮眿灞傛暟
+     */
+    private BigDecimal computeContractCustomizeFormula(FeeDto feeDto, List<ContractRoomDto> contractRoomDtos) {
+
+        BigDecimal total = new BigDecimal(0.0);
+        for (ContractRoomDto contractRoomDto : contractRoomDtos) {
+            total = total.add(computeRoomCustomizeFormula(feeDto, contractRoomDto));
+        }
+        return total;
+    }
+
+    /**
+     * 鑷畾涔夊叕寮忚绠�
+     *
+     * @param feeDto
      * @param roomDto
      * @return C 浠h〃鎴垮眿瀵瑰簲灏忓尯闈㈢Н
      * F 浠h〃鎴垮眿瀵瑰簲妤兼爧闈㈢Н

--
Gitblit v1.8.0