From 7b09e49e27a01b2125979ca6ed8e50b14946f925 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期六, 25 六月 2022 17:04:43 +0800
Subject: [PATCH] 1、优化巡检明显导出2、优化房屋房间数量展示3、优化优惠赠送规则 赠送月份4、新增收银台缴费选定结束日期

---
 service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java b/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
index ae4ca0f..518fa8e 100755
--- a/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
+++ b/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
@@ -7,6 +7,7 @@
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.feeDiscount.ComputeDiscountDto;
 import com.java110.dto.feeDiscount.FeeDiscountDto;
+import com.java110.dto.feeDiscount.FeeDiscountRuleDto;
 import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
 import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
 import com.java110.fee.dao.IFeeDiscountServiceDao;
@@ -23,10 +24,7 @@
 import org.springframework.web.bind.annotation.RestController;
 
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * @ClassName FloorInnerServiceSMOImpl
@@ -54,12 +52,16 @@
     @Autowired
     private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeDiscountRuleInnerServiceSMO feeDiscountRuleInnerServiceSMOImpl;
+
     //鍩�
     public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
 
     //閿�
     public static final String DISCOUNT_MODE = "DISCOUNT_MODE";
 
+    private static final String SPEC_RATE = "89002020980015"; // 璧犻�佹湀浠�
 
     @Override
     public int saveFeeDiscount(@RequestBody FeeDiscountPo feeDiscountPo) {
@@ -184,6 +186,30 @@
         for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) {
             //鑾峰彇缂磋垂鏈�澶ф埅姝㈡椂闂�
             Date payMaxEndTime = tmpPayFeeConfigDiscountDto.getPayMaxEndTime();
+            FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
+            feeDiscountDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
+            //鏌ヨ鎵撴姌琛�
+            List<FeeDiscountDto> feeDiscountInfo = BeanConvertUtil.covertBeanList(feeDiscountServiceDaoImpl.getFeeDiscountInfo(BeanConvertUtil.beanCovertMap(feeDiscountDto)), FeeDiscountDto.class);
+            Assert.listOnlyOne(feeDiscountInfo, "鏌ヨ鎵撴姌琛ㄩ敊璇紒");
+            FeeDiscountRuleDto feeDiscountRuleDto = new FeeDiscountRuleDto();
+            feeDiscountRuleDto.setRuleId(feeDiscountInfo.get(0).getRuleId());
+            //鏌ヨ鎵撴姌瑙勫垯琛�
+            List<FeeDiscountRuleDto> feeDiscountRuleDtos = feeDiscountRuleInnerServiceSMOImpl.queryFeeDiscountRules(feeDiscountRuleDto);
+            Assert.listOnlyOne(feeDiscountRuleDtos, "鏌ヨ鎵撴姌瑙勫垯琛ㄩ敊璇紒");
+            if (!StringUtil.isEmpty(feeDiscountRuleDtos.get(0).getBeanImpl()) && feeDiscountRuleDtos.get(0).getBeanImpl().equals("reductionMonthFeeRule")) { //璧犻�佽鍒�
+                FeeDiscountSpecDto feeDiscountSpecDto = new FeeDiscountSpecDto();
+                feeDiscountSpecDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
+                feeDiscountSpecDto.setSpecId(SPEC_RATE);
+                //鏌ヨ鎵撴姌瑙勬牸
+                List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(feeDiscountSpecDto);
+                Assert.listOnlyOne(feeDiscountSpecDtos, "鏌ヨ鎵撴姌瑙勬牸琛ㄩ敊璇紒");
+                //鑾峰彇璧犻�佹湀浠�
+                String specValue = feeDiscountSpecDtos.get(0).getSpecValue();
+                Calendar cal = Calendar.getInstance();
+                cal.setTime(finishTime);
+                cal.add(Calendar.MONTH, Integer.parseInt(specValue));
+                finishTime = cal.getTime();
+            }
             if (payMaxEndTime == null) {
                 doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId());
             } else if (payMaxEndTime.getTime() >= finishTime.getTime()) {
@@ -191,6 +217,7 @@
             } else {
                 continue;
             }
+            finishTime = c.getTime();
         }
         computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos);
         //鍙栧嚭寮�鍏虫槧灏勭殑鍊�

--
Gitblit v1.8.0