From 6bf8b48e9d689ab90864bc2ee0e6ebeae3a4c1fa Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期四, 04 八月 2022 10:06:47 +0800
Subject: [PATCH] 1.优化报表缴费明细统计问题2、优化调查问卷投票问题3、优化投诉咨询问题3、优化业主新增用户联系地址4、增加定时任务根据身份证号自动更新年龄5、优化缴费清单

---
 service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java |   53 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 47 insertions(+), 6 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
old mode 100644
new mode 100755
index 66b38eb..9c18ccd
--- 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,7 +7,8 @@
 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.feeDiscount.FeeDiscountRuleDto;
+import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
 import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
 import com.java110.fee.dao.IFeeDiscountServiceDao;
 import com.java110.fee.discount.IComputeDiscount;
@@ -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) {
@@ -159,7 +161,7 @@
         payFeeConfigDiscountDto.setStatusCd("0");
         Date currentTime = new Date();
         payFeeConfigDiscountDto.setCurrentTime(currentTime);
-        //鏍规嵁璐圭敤鏌ヨ鎶樻墸
+        //鏍规嵁璐圭敤椤规煡璇㈡姌鎵o紙璇ヨ垂鐢ㄩ」涓嬬殑鎵�鏈夋姌鎵d俊鎭級
         List<PayFeeConfigDiscountDto> payFeeConfigDiscountDtos =
                 payFeeConfigDiscountInnerServiceSMOImpl.queryPayFeeConfigDiscounts(payFeeConfigDiscountDto);
         if (payFeeConfigDiscountDtos == null || payFeeConfigDiscountDtos.size() < 1) {
@@ -169,6 +171,9 @@
             List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
             for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
                 computeDiscountDto.setValue(value);
+                if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
+                    computeDiscountDto.setArdId(feeDetailDto.getArdId());
+                }
                 computeDiscountDtoList.add(computeDiscountDto);
             }
             return computeDiscountDtos;
@@ -181,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()) {
@@ -188,6 +217,7 @@
             } else {
                 continue;
             }
+            finishTime = c.getTime();
         }
         computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos);
         //鍙栧嚭寮�鍏虫槧灏勭殑鍊�
@@ -195,6 +225,9 @@
         List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
         for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
             computeDiscountDto.setValue(value);
+            if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
+                computeDiscountDto.setArdId(feeDetailDto.getArdId());
+            }
             computeDiscountDtoList.add(computeDiscountDto);
         }
         return computeDiscountDtoList;
@@ -206,6 +239,8 @@
             ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto();
             //瀹℃牳宸查�氳繃
             applyRoomDiscountDto.setState("4");
+            //鏄惁鍙敤鐘舵�佹爣璇�(0琛ㄧず鍦ㄧ敤锛�1琛ㄧず涓嶅彲鐢�)
+            applyRoomDiscountDto.setInUse("0");
             //灏忓尯ID
             applyRoomDiscountDto.setCommunityId(feeDetailDto.getCommunityId());
             //鎴垮眿id
@@ -214,16 +249,22 @@
             applyRoomDiscountDto.setStartTime(simpleDateFormat.format(feeDetailDto.getStartTime()));
             //缁撴潫鏃堕棿
             c.setTime(feeDetailDto.getStartTime());
+            c.add(Calendar.DAY_OF_MONTH, 2);//寮�濮嬫椂闂达紝娣诲姞1锛�2澶╃殑鍐椾綑锛屽彧瑕佹瘮5灏忓嵆鍙�
+            applyRoomDiscountDto.setStartTime(simpleDateFormat.format(c.getTime()));//閲嶆柊璁剧疆寮�濮嬫椂闂�
             double month = Double.parseDouble(feeDetailDto.getCycles());
             c.add(Calendar.MONTH, (int) month);
+            c.add(Calendar.DAY_OF_MONTH, -5);//杩欓噷鏍规嵁璁剧疆鏃堕棿鑽h獕5澶�
             Date endTime = c.getTime();
             applyRoomDiscountDto.setEndTime(simpleDateFormat.format(endTime));
+            applyRoomDiscountDto.setFeeId(feeDetailDto.getFeeId());
             //鏌ヨ鎶樻墸鐢宠琛�
             List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto);
             //鍒ゆ柇鏌ヨ鐨勬姌鎵g敵璇疯〃鏄惁鏈夋暟鎹�
             if (applyRoomDiscountDtos != null && applyRoomDiscountDtos.size() > 0) {
                 //鑾峰彇浼樻儬id
                 String discountId = applyRoomDiscountDtos.get(0).getDiscountId();
+                String ardId = applyRoomDiscountDtos.get(0).getArdId();
+                feeDetailDto.setArdId(ardId);
                 PayFeeConfigDiscountDto payFeeConfigDiscount = new PayFeeConfigDiscountDto();
                 payFeeConfigDiscount.setCommunityId(applyRoomDiscountDtos.get(0).getCommunityId());
                 payFeeConfigDiscount.setDiscountId(discountId);

--
Gitblit v1.8.0