Sfoglia il codice sorgente

优化小数点 问题

java110 3 anni fa
parent
commit
01330b0db6

+ 74 - 78
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java

@@ -179,7 +179,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
         BigDecimal price = new BigDecimal(feeDto.getFeePrice());
         price = price.multiply(new BigDecimal(oweMonth));
-        feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+        feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
         feeDto.setDeadlineTime(targetEndDate);
 
         //动态费用
@@ -208,7 +208,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         //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.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
         feeDto.setDeadlineTime(targetEndDate);
 
         //动态费用
@@ -236,7 +236,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         //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.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
         feeDto.setDeadlineTime(targetEndDate);
 
         //动态费用
@@ -284,7 +284,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -306,7 +306,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -347,7 +347,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -376,7 +376,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -424,7 +424,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -450,7 +450,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 } 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);
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
                     feeReceiptDetailPo.setArea(sub.doubleValue() + "");
                     feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
                 }
@@ -795,19 +795,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(reportRoomDto.getBuiltUpArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
             } else if ("2002".equals(computingFormula)) { // 固定费用
                 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
             } else if ("3003".equals(computingFormula)) { // 固定费用
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
             } else if ("1101".equals(computingFormula)) { // 租金
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent()));
-                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
             } else if ("4004".equals(computingFormula)) {
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
             } else if ("5005".equals(computingFormula)) {
@@ -821,7 +821,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("6006".equals(computingFormula)) {
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
@@ -838,7 +838,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                 }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
@@ -850,11 +850,11 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("0"));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
             } else if ("2002".equals(computingFormula)) { // 固定费用
                 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
             } else if ("3003".equals(computingFormula)) { // 固定费用
                 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
                 feePrice = new BigDecimal(0);
@@ -873,7 +873,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("6006".equals(computingFormula)) {
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
@@ -890,13 +890,13 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                 }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
         }
-        return feePrice.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        return feePrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
     }
 
     @Override
@@ -929,41 +929,41 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getBuiltUpArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("2002".equals(computingFormula)) { // 固定费用
                 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("3003".equals(computingFormula)) { // 固定费用
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("1101".equals(computingFormula)) { // 租金
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent()));
-                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("4004".equals(computingFormula)) {  //动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("5005".equals(computingFormula)) {  //(本期度数-上期度数)*单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -976,11 +976,11 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
 
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else if ("6006".equals(computingFormula)) {
@@ -988,20 +988,20 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeRoomCustomizeFormula(feeDto, roomDto);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("8008".equals(computingFormula)) {  //手动动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -1014,10 +1014,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else {
@@ -1043,41 +1043,41 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("2002".equals(computingFormula)) { // 固定费用
                 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("3003".equals(computingFormula)) { // 固定费用
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("1101".equals(computingFormula)) { // 租金
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent()));
-                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("4004".equals(computingFormula)) {
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("5005".equals(computingFormula)) {
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -1090,10 +1090,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else if ("6006".equals(computingFormula)) {
@@ -1101,13 +1101,13 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -1120,10 +1120,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else {
@@ -1147,43 +1147,43 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 }
                 feeDto.setBuiltUpArea(builtUpArea.doubleValue() + "");
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } 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);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("3003".equals(computingFormula)) { // 固定费用
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea()));
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("1101".equals(computingFormula)) { // 租金
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent()));
-                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN);
+                feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("4004".equals(computingFormula)) {  //动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("5005".equals(computingFormula)) {  //(本期度数-上期度数)*单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -1196,10 +1196,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else if ("6006".equals(computingFormula)) {
@@ -1207,20 +1207,20 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos);
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("8008".equals(computingFormula)) {  //手动动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
                 if (!StringUtil.isEmpty(feeDto.getCycle())) {
                     BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
                     BigDecimal amount = new BigDecimal(feeDto.getAmount());
-                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                    feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                 }
             } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
@@ -1233,10 +1233,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                     BigDecimal sub = curDegree.subtract(preDegree);
                     feePrice = sub.multiply(squarePrice)
                             .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                            .setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (!StringUtil.isEmpty(feeDto.getCycle())) {
                         BigDecimal cycle1 = new BigDecimal(feeDto.getCycle());
-                        feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle1).setScale(3, BigDecimal.ROUND_DOWN);
+                        feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP);
                     }
                 }
             } else {
@@ -1244,7 +1244,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             }
         }
 
-        feePrice.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        feePrice.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
         feeAmount.put("feePrice", feePrice);
         feeAmount.put("feeTotalPrice", feeTotalPrice);
         return feeAmount;
@@ -1604,16 +1604,12 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
 
 
     public static void main(String[] args) {
-        ComputeFeeSMOImpl computeFeeSMO = new ComputeFeeSMOImpl();
-        try {
-            double month = computeFeeSMO.dayCompare(
-                    DateUtil.getDateFromString("2022-04-14 00:00:00", DateUtil.DATE_FORMATE_STRING_A),
-                    DateUtil.getDateFromString("2022-06-01 00:00:00", DateUtil.DATE_FORMATE_STRING_A)
-            );
-            System.out.println(month);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
+        BigDecimal squarePrice = new BigDecimal(Double.parseDouble("4.50"));
+        BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("52.69"));
+        BigDecimal additionalAmount = new BigDecimal(Double.parseDouble("0"));
+            BigDecimal cycle = new BigDecimal(Double.parseDouble("3"));
+        BigDecimal  feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_DOWN);
+        System.out.println(feeTotalPrice.doubleValue());
     }
 
 //    public static void main(String[] args) {