Sfoglia il codice sorgente

优化应收款映射取值是否保留小数问题

xiaogang 5 anni fa
parent
commit
a079f63f02

+ 11 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java

@@ -42,6 +42,9 @@ public class FeeDto extends PageDto implements Serializable {
     private String[] feeTypeCds;
     private String configId;
 
+    //映射关系开关值
+    private String val;
+
     private String squarePrice;
     private String additionalAmount;
     private String state;
@@ -516,4 +519,12 @@ public class FeeDto extends PageDto implements Serializable {
     public void setBuiltUpArea(String builtUpArea) {
         this.builtUpArea = builtUpArea;
     }
+
+    public String getVal() {
+        return val;
+    }
+
+    public void setVal(String value) {
+        this.val = value;
+    }
 }

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

@@ -583,14 +583,14 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
                 BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea()));
                 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(3, BigDecimal.ROUND_HALF_EVEN);
             } 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);
-            } else if ("4004".equals(computingFormula)) {
+                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)) {
+            } else if ("5005".equals(computingFormula)) {  //(本期度数-上期度数)*单价+附加费
                 if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
                     //throw new IllegalArgumentException("抄表数据异常");
                 } else {
@@ -653,7 +653,7 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
         }
-        return feePrice.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        return feePrice.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
     }
 
     public Map getTargetEndDateAndOweMonth(FeeDto feeDto, OwnerCarDto ownerCarDto) {

+ 9 - 0
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java

@@ -15,6 +15,7 @@ import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
+import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.util.Assert;
@@ -59,6 +60,11 @@ public class QueryOweFeeImpl implements IQueryOweFee {
     @Autowired
     private IComputeFeeSMO computeFeeSMOImpl;
 
+    //域
+    public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
+
+    //键
+    public static final String TOTAL_FEE_PRICE = "TOTAL_FEE_PRICE";
 
     @Override
     public ResponseEntity<String> query(FeeDto feeDto) {
@@ -145,6 +151,9 @@ public class QueryOweFeeImpl implements IQueryOweFee {
         }
         double feePrice = computeFeeSMOImpl.getFeePrice(feeDto);
         feeDto.setFeePrice(feePrice);
+        //取出开关映射的值
+        String val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+        feeDto.setVal(val);
         return ResultVo.createResponseEntity(feeDto);
     }