Bladeren bron

优化代码

java110 5 jaren geleden
bovenliggende
commit
de107d5b74

+ 6 - 6
java110-bean/src/main/java/com/java110/dto/feeDiscount/ComputeDiscountDto.java

@@ -16,7 +16,7 @@
 package com.java110.dto.feeDiscount;
 
 import com.java110.dto.PageDto;
-import com.java110.dto.feeDiscountRuleSpec.FeeDiscountRuleSpecDto;
+import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto;
 
 import java.io.Serializable;
 import java.util.List;
@@ -34,7 +34,7 @@ public class ComputeDiscountDto extends PageDto implements Serializable {
 
     private String ruleId;
 
-    private List<FeeDiscountRuleSpecDto> feeDiscountRuleSpecs;
+    private List<FeeDiscountSpecDto> feeDiscountSpecs;
 
     private double discountPrice;
 
@@ -63,12 +63,12 @@ public class ComputeDiscountDto extends PageDto implements Serializable {
         this.ruleId = ruleId;
     }
 
-    public List<FeeDiscountRuleSpecDto> getFeeDiscountRuleSpecs() {
-        return feeDiscountRuleSpecs;
+    public List<FeeDiscountSpecDto> getFeeDiscountSpecs() {
+        return feeDiscountSpecs;
     }
 
-    public void setFeeDiscountRuleSpecs(List<FeeDiscountRuleSpecDto> feeDiscountRuleSpecs) {
-        this.feeDiscountRuleSpecs = feeDiscountRuleSpecs;
+    public void setFeeDiscountSpecs(List<FeeDiscountSpecDto> feeDiscountSpecs) {
+        this.feeDiscountSpecs = feeDiscountSpecs;
     }
 
     public double getDiscountPrice() {

+ 22 - 0
java110-bean/src/main/java/com/java110/dto/feeDiscount/FeeDiscountDto.java

@@ -17,6 +17,10 @@ import java.util.List;
  **/
 public class FeeDiscountDto extends PageDto implements Serializable {
 
+    //类型 1001 优惠  2002 违约
+    public static final String DISCOUNT_TYPE_D = "1001"; //优惠
+    public static final String DISCOUNT_TYPE_V = "2002"; //违约
+
     private String discountName;
     private String discountDesc;
     private String discountType;
@@ -25,6 +29,8 @@ public class FeeDiscountDto extends PageDto implements Serializable {
     private String ruleId;
     private String ruleName;
     private String beanImpl;
+    private String feeId;
+    private double cycles;
 
     private List<FeeDiscountSpecDto> feeDiscountSpecs;
 
@@ -122,4 +128,20 @@ public class FeeDiscountDto extends PageDto implements Serializable {
     public void setBeanImpl(String beanImpl) {
         this.beanImpl = beanImpl;
     }
+
+    public String getFeeId() {
+        return feeId;
+    }
+
+    public void setFeeId(String feeId) {
+        this.feeId = feeId;
+    }
+
+    public double getCycles() {
+        return cycles;
+    }
+
+    public void setCycles(double cycles) {
+        this.cycles = cycles;
+    }
 }

+ 1 - 1
service-fee/src/main/java/com/java110/fee/discount/IComputeDiscount.java

@@ -27,7 +27,7 @@ public interface IComputeDiscount {
 
     /**
      * 计算折扣
-     * @param feeDiscountDto
+     * @param feeDiscountDto 费用优惠
      * @return
      */
     ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto);

+ 103 - 0
service-fee/src/main/java/com/java110/fee/discount/impl/DiscountFeeRule.java

@@ -0,0 +1,103 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.fee.discount.impl;
+
+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.feeDiscountSpec.FeeDiscountSpecDto;
+import com.java110.fee.discount.IComputeDiscount;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 优惠打折 规则
+ *
+ * @desc add by 吴学文 10:27
+ */
+
+@Component(value = "discountFeeRule")
+public class DiscountFeeRule implements IComputeDiscount {
+
+
+    /**
+     * 89002020980001	102020001	月份
+     * 89002020980002	102020001	打折率
+     */
+    private static final String SPEC_MONTH = "89002020980001"; //月份
+    private static final String SPEC_RATE = "89002020980002"; // 打折率
+
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+
+    @Override
+    public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
+
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs();
+
+        if (feeDiscountSpecDtos.size() < 1) {
+            return null;
+        }
+        double month = 0.0;
+        double rate = 0.0;
+        for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+            if (SPEC_MONTH.equals(feeDiscountSpecDto.getSpecId())) {
+                month = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+            if (SPEC_RATE.equals(feeDiscountSpecDto.getSpecId())) {
+                rate = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+        }
+
+        if (feeDiscountDto.getCycles() < month) {
+            return null;
+        }
+
+        //查询费用
+        FeeDto feeDto = new FeeDto();
+        feeDto.setCommunityId(feeDiscountDto.getCommunityId());
+        feeDto.setFeeId(feeDiscountDto.getFeeId());
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+        double price = computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
+
+        BigDecimal priceDec = new BigDecimal(price);
+
+        BigDecimal cycleDec = new BigDecimal(feeDiscountDto.getCycles());
+
+        double discountPrice = priceDec.multiply(cycleDec).multiply(new BigDecimal(rate)).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.setDiscountPrice(discountPrice);
+        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
+        return computeDiscountDto;
+    }
+}

+ 100 - 0
service-fee/src/main/java/com/java110/fee/discount/impl/LateFeeByDayRule.java

@@ -0,0 +1,100 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.fee.discount.impl;
+
+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.feeDiscountSpec.FeeDiscountSpecDto;
+import com.java110.fee.discount.IComputeDiscount;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.utils.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @desc add by 吴学文 12:43
+ */
+@Component(value = "lateFeeByDayRule")
+public class LateFeeByDayRule implements IComputeDiscount {
+    /**
+     * 89002020980001	102020001	月份
+     * 89002020980002	102020001	打折率
+     */
+    private static final String SPEC_RATE = "89002020980005"; // 打折率
+
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+    @Override
+    public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs();
+        if (feeDiscountSpecDtos.size() < 1) {
+            return null;
+        }
+        double rate = 0.0;
+        for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+            if (SPEC_RATE.equals(feeDiscountSpecDto.getSpecId())) {
+                rate = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+        }
+
+        FeeDto feeDto = new FeeDto();
+        feeDto.setCommunityId(feeDiscountDto.getCommunityId());
+        feeDto.setFeeId(feeDiscountDto.getFeeId());
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+        Date curTime = DateUtil.getCurrentDate();
+
+        Date endTime = feeDtos.get(0).getEndTime();
+
+        if (endTime.getTime() > curTime.getTime()) {
+            return null;
+        }
+        //查询费用
+        int day = DateUtil.daysBetween(curTime, endTime);
+
+        if (day < 1) {
+            return null;
+        }
+
+        double price = computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
+
+        BigDecimal priceDec = new BigDecimal(price);
+
+        BigDecimal dayDec = new BigDecimal(day);
+
+        double discountPrice = priceDec.divide(new BigDecimal(30)).multiply(new BigDecimal(rate)).multiply(dayDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+
+        ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
+        computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
+        computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_V);
+        computeDiscountDto.setRuleId(feeDiscountDto.getRuleId());
+        computeDiscountDto.setRuleName(feeDiscountDto.getRuleName());
+        computeDiscountDto.setDiscountPrice(discountPrice);
+        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
+        return computeDiscountDto;
+    }
+}

+ 96 - 0
service-fee/src/main/java/com/java110/fee/discount/impl/LateFeeByMonthRule.java

@@ -0,0 +1,96 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.fee.discount.impl;
+
+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.feeDiscountSpec.FeeDiscountSpecDto;
+import com.java110.fee.discount.IComputeDiscount;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.utils.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @desc add by 吴学文 12:43
+ */
+@Component(value = "lateFeeByMonthRule")
+public class LateFeeByMonthRule implements IComputeDiscount {
+    /**
+     * 89002020980001	102020001	月份
+     * 89002020980002	102020001	打折率
+     */
+    private static final String SPEC_RATE = "89002020980006"; // 打折率
+
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+    @Override
+    public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs();
+        if (feeDiscountSpecDtos.size() < 1) {
+            return null;
+        }
+        double rate = 0.0;
+        for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+            if (SPEC_RATE.equals(feeDiscountSpecDto.getSpecId())) {
+                rate = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+        }
+
+        FeeDto feeDto = new FeeDto();
+        feeDto.setCommunityId(feeDiscountDto.getCommunityId());
+        feeDto.setFeeId(feeDiscountDto.getFeeId());
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+        Date curTime = DateUtil.getCurrentDate();
+
+        Date endTime = feeDtos.get(0).getEndTime();
+
+        if (endTime.getTime() > curTime.getTime()) {
+            return null;
+        }
+        //查询费用
+        Double month = computeFeeSMOImpl.dayCompare(curTime, endTime);
+
+        double price = computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
+
+        BigDecimal priceDec = new BigDecimal(price);
+
+        BigDecimal monthDec = new BigDecimal(month);
+
+        double discountPrice = priceDec.multiply(new BigDecimal(rate)).multiply(monthDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+
+        ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
+        computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
+        computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_V);
+        computeDiscountDto.setRuleId(feeDiscountDto.getRuleId());
+        computeDiscountDto.setRuleName(feeDiscountDto.getRuleName());
+        computeDiscountDto.setDiscountPrice(discountPrice);
+        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
+        return computeDiscountDto;
+    }
+}

+ 88 - 0
service-fee/src/main/java/com/java110/fee/discount/impl/ReductionFeeRule.java

@@ -0,0 +1,88 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.fee.discount.impl;
+
+import com.java110.dto.feeDiscount.ComputeDiscountDto;
+import com.java110.dto.feeDiscount.FeeDiscountDto;
+import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto;
+import com.java110.fee.discount.IComputeDiscount;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 减免 规则
+ *
+ * @desc add by 吴学文 10:27
+ */
+
+@Component(value = "reductionFeeRule")
+public class ReductionFeeRule implements IComputeDiscount {
+
+
+    /**
+     * 89002020980001	102020001	月份
+     * 89002020980002	102020001	打折率
+     */
+    private static final String SPEC_MONTH = "89002020980003"; //月份
+    private static final String SPEC_MONEY = "89002020980004"; // 减免金额
+
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+
+    @Override
+    public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
+
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs();
+
+        if (feeDiscountSpecDtos.size() < 1) {
+            return null;
+        }
+        double month = 0.0;
+        double money = 0.0;
+        for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+            if (SPEC_MONTH.equals(feeDiscountSpecDto.getSpecId())) {
+                month = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+            if (SPEC_MONEY.equals(feeDiscountSpecDto.getSpecId())) {
+                money = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
+            }
+        }
+
+        if (feeDiscountDto.getCycles() < month) {
+            return null;
+        }
+
+        Double cycle = feeDiscountDto.getCycles() / month;
+        BigDecimal cycleDec = new BigDecimal(cycle.intValue());
+
+        double discountPrice = cycleDec.multiply(new BigDecimal(money)).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.setDiscountPrice(discountPrice);
+        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
+        return computeDiscountDto;
+    }
+}

+ 51 - 2
service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java

@@ -7,10 +7,12 @@ import com.java110.dto.fee.FeeDetailDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.feeDiscount.ComputeDiscountDto;
 import com.java110.dto.feeDiscount.FeeDiscountDto;
+import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto;
 import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
 import com.java110.fee.dao.IFeeDiscountServiceDao;
 import com.java110.fee.discount.IComputeDiscount;
 import com.java110.intf.fee.IFeeDiscountInnerServiceSMO;
+import com.java110.intf.fee.IFeeDiscountSpecInnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
 import com.java110.intf.fee.IPayFeeConfigDiscountInnerServiceSMO;
 import com.java110.po.feeDiscount.FeeDiscountPo;
@@ -44,6 +46,9 @@ public class FeeDiscountInnerServiceSMOImpl extends BaseServiceSMO implements IF
     @Autowired
     private IPayFeeConfigDiscountInnerServiceSMO payFeeConfigDiscountInnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeDiscountSpecInnerServiceSMO feeDiscountSpecInnerServiceSMOImpl;
+
 
     @Override
     public int saveFeeDiscount(@RequestBody FeeDiscountPo feeDiscountPo) {
@@ -80,10 +85,46 @@ public class FeeDiscountInnerServiceSMOImpl extends BaseServiceSMO implements IF
 
         List<FeeDiscountDto> feeDiscounts = BeanConvertUtil.covertBeanList(feeDiscountServiceDaoImpl.getFeeDiscountInfo(BeanConvertUtil.beanCovertMap(feeDiscountDto)), FeeDiscountDto.class);
 
+        freshDiscountSpec(feeDiscounts);
+
         return feeDiscounts;
     }
 
 
+    private void freshDiscountSpec(List<FeeDiscountDto> feeDiscounts) {
+
+        if (feeDiscounts == null || feeDiscounts.size() < 1) {
+            return;
+        }
+
+        List<String> discountIds = new ArrayList<>();
+        for (FeeDiscountDto feeDiscount : feeDiscounts) {
+            discountIds.add(feeDiscount.getDiscountId());
+        }
+
+        FeeDiscountSpecDto tmpFeeDiscountSpecDto = new FeeDiscountSpecDto();
+
+        tmpFeeDiscountSpecDto.setDiscountIds(discountIds.toArray(new String[discountIds.size()]));
+        tmpFeeDiscountSpecDto.setCommunityId(feeDiscounts.get(0).getCommunityId());
+
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(tmpFeeDiscountSpecDto);
+
+        if (feeDiscountSpecDtos == null || feeDiscountSpecDtos.size() < 1) {
+            return;
+        }
+        List<FeeDiscountSpecDto> tmpSpecs = null;
+        for (FeeDiscountDto feeDiscount : feeDiscounts) {
+            tmpSpecs = new ArrayList<>();
+            for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+                if (feeDiscount.getDiscountId().equals(feeDiscountSpecDto.getDiscountId())) {
+                    tmpSpecs.add(feeDiscountSpecDto);
+                }
+            }
+            feeDiscount.setFeeDiscountSpecs(tmpSpecs);
+        }
+    }
+
+
     /**
      * 计算折扣
      *
@@ -113,13 +154,13 @@ public class FeeDiscountInnerServiceSMOImpl extends BaseServiceSMO implements IF
         }
 
         for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) {
-            doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos);
+            doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId());
         }
         return computeDiscountDtos;
 
     }
 
-    private void doCompute(PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto, double cycles, List<ComputeDiscountDto> computeDiscountDtos) {
+    private void doCompute(PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto, double cycles, List<ComputeDiscountDto> computeDiscountDtos, String feeId) {
 
         FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
         feeDiscountDto.setCommunityId(tmpPayFeeConfigDiscountDto.getCommunityId());
@@ -128,8 +169,16 @@ public class FeeDiscountInnerServiceSMOImpl extends BaseServiceSMO implements IF
         if (feeDiscountDtos == null || feeDiscountDtos.size() < 1) {
             return;
         }
+        for (FeeDiscountDto tmpFeeDiscountDto : feeDiscountDtos) {
+            tmpFeeDiscountDto.setFeeId(feeId);
+            tmpFeeDiscountDto.setCycles(cycles);
+        }
         IComputeDiscount computeDiscount = (IComputeDiscount) ApplicationContextFactory.getBean(feeDiscountDtos.get(0).getBeanImpl());
         ComputeDiscountDto computeDiscountDto = computeDiscount.compute(feeDiscountDtos.get(0));
+
+        if (computeDiscountDto == null) {
+            return;
+        }
         computeDiscountDtos.add(computeDiscountDto);
     }