From 5f83dbf4942e7f2e67963ae4ece013c22f091b72 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期五, 25 八月 2023 09:18:26 +0800
Subject: [PATCH] 优化物品

---
 service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java |   53 ++++++++++++++++-------------------------------------
 1 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java b/service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java
index 7047129..720f49b 100755
--- a/service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java
+++ b/service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java
@@ -17,9 +17,9 @@
 
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.fee.FeeDto;
-import com.java110.dto.feeDiscount.ComputeDiscountDto;
-import com.java110.dto.feeDiscount.FeeDiscountDto;
-import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
+import com.java110.dto.fee.ComputeDiscountDto;
+import com.java110.dto.fee.FeeDiscountDto;
+import com.java110.dto.fee.FeeDiscountSpecDto;
 import com.java110.fee.discount.IComputeDiscount;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -38,7 +38,6 @@
 @Component(value = "reductionMonthFeeRule")
 public class ReductionMonthFeeRule implements IComputeDiscount {
 
-
     /**
      * 89002020980001	102020001	鏈堜唤
      * 89002020980002	102020001	鎵撴姌鐜�
@@ -46,13 +45,12 @@
     private static final String SPEC_MONTH = "89002020980014"; //鏈堜唤
     private static final String SPEC_RATE = "89002020980015"; // 璧犻�佹湀浠�
 
-
     @Autowired
     private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
 
+
     @Autowired
     private IComputeFeeSMO computeFeeSMOImpl;
-
 
     @Override
     public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
@@ -72,46 +70,27 @@
                 reductionMonth = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
             }
         }
-
         if (feeDiscountDto.getCycles() < month) {
+            return null;
+        } else {
+            //鏌ヨ璐圭敤
+            FeeDto feeDto = new FeeDto();
+            feeDto.setCommunityId(feeDiscountDto.getCommunityId());
+            feeDto.setFeeId(feeDiscountDto.getFeeId());
+            List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+            Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
+            BigDecimal priceDec = new BigDecimal(feePriceAll.get("feePrice").toString());
+            BigDecimal cycleDec = new BigDecimal(reductionMonth);
+            double discountPrice = priceDec.multiply(cycleDec).doubleValue();
             ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
             computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
             computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_D);
             computeDiscountDto.setRuleId(feeDiscountDto.getRuleId());
             computeDiscountDto.setRuleName(feeDiscountDto.getRuleName());
             computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName());
-            computeDiscountDto.setDiscountPrice(0.0);
+            computeDiscountDto.setDiscountPrice(discountPrice);
             computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
             return computeDiscountDto;
         }
-
-        //鏌ヨ璐圭敤
-        FeeDto feeDto = new FeeDto();
-        feeDto.setCommunityId(feeDiscountDto.getCommunityId());
-        feeDto.setFeeId(feeDiscountDto.getFeeId());
-        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-
-        Map feePriceAll=computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
-
-        BigDecimal priceDec = new BigDecimal(feePriceAll.get("feePrice").toString());
-
-        double cycleRate = Math.floor(feeDiscountDto.getCycles()/month);
-
-        BigDecimal cycleRateDec = new BigDecimal(cycleRate);
-
-
-        BigDecimal reductionMonthDec = new BigDecimal(reductionMonth);
-
-        double discountPrice = priceDec.multiply(cycleRateDec).multiply(reductionMonthDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
-
-        ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
-        computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
-        computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_D);
-        computeDiscountDto.setRuleId(feeDiscountDto.getRuleId());
-        computeDiscountDto.setRuleName(feeDiscountDto.getRuleName());
-        computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName());
-        computeDiscountDto.setDiscountPrice(discountPrice);
-        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
-        return computeDiscountDto;
     }
 }

--
Gitblit v1.8.0