From bde271fdbab51e654a293dba02a31eab8ff3ea8b Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期四, 21 八月 2025 20:20:23 +0800
Subject: [PATCH] 白单流水报表与费用初始化(差创建折扣使用记录)0821

---
 service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java |   59 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 22 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 469e383..3f27b75 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
@@ -290,26 +290,30 @@
         List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto);
 
         if (!ListUtil.isNull(applyRoomDiscountDtos)) {
+
             computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos,useCycle);
             //鍙栧嚭寮�鍏虫槧灏勭殑鍊�
-            String value = MappingCache.getValue(DOMAIN_COMMON, DISCOUNT_MODE);
-            List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
-            for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
-                computeDiscountDto.setValue(value);
+                String value = MappingCache.getValue(DOMAIN_COMMON, DISCOUNT_MODE);
+                List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
 
-                computeDiscountDto.setDiscountPrice(
-                        MoneyUtil.computePriceScale(
-                                computeDiscountDto.getDiscountPrice(),
-                                feeDtos.get(0).getScale(),
-                                Integer.parseInt(feeDtos.get(0).getDecimalPlace())
-                        )
-                );
-                if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
-                    computeDiscountDto.setArdId(feeDetailDto.getArdId());
+                for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
+                    computeDiscountDto.setValue(value);
+
+                    computeDiscountDto.setDiscountPrice(
+                            MoneyUtil.computePriceScale(
+                                    computeDiscountDto.getDiscountPrice(),
+                                    feeDtos.get(0).getScale(),
+                                    Integer.parseInt(feeDtos.get(0).getDecimalPlace())
+                            )
+                    );
+                    if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
+                        computeDiscountDto.setArdId(feeDetailDto.getArdId());
+                    }
+                    computeDiscountDtoList.add(computeDiscountDto);
                 }
-                computeDiscountDtoList.add(computeDiscountDto);
-            }
-            return computeDiscountDtos;
+                if(computeDiscountDtos.size() > 0){
+                    return computeDiscountDtos;
+                }
         }
         //鏍规嵁璐圭敤椤规煡璇㈡姌鎵o紙璇ヨ垂鐢ㄩ」涓嬬殑鎵�鏈夋姌鎵d俊鎭級
         List<PayFeeConfigDiscountDto> payFeeConfigDiscountDtos =
@@ -320,6 +324,8 @@
         c.add(Calendar.MONTH, (int) mon);
         //鑾峰彇缂磋垂缁撴潫鏃堕棿
         Date finishTime = feeDetailDto.getEndTime();
+
+
         for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) {
             //鑾峰彇缂磋垂鏈�澶ф埅姝㈡椂闂�
             Date payMaxEndTime = tmpPayFeeConfigDiscountDto.getPayMaxEndTime();
@@ -356,16 +362,25 @@
                 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()) {
-                doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId());
+            double cycle = Double.parseDouble(feeDetailDto.getCycles());
+            Date startTime = feeDetailDto.getStartTime();
+            if(tmpPayFeeConfigDiscountDto.getPayMaxStarTime() == null || startTime.getTime() > tmpPayFeeConfigDiscountDto.getPayMaxStarTime().getTime()){
+                tmpPayFeeConfigDiscountDto.setPayMaxStarTime(startTime);
+            }
+            if (tmpPayFeeConfigDiscountDto.getPayMaxEndTime() == null || finishTime.getTime() < tmpPayFeeConfigDiscountDto.getPayMaxEndTime().getTime()) {
+                tmpPayFeeConfigDiscountDto.setPayMaxEndTime(finishTime);
+            }
+            cycle =DateUtil.dayCompare(
+                    tmpPayFeeConfigDiscountDto.getPayMaxStarTime(),
+                    tmpPayFeeConfigDiscountDto.getPayMaxEndTime()
+            );
+            if (cycle > 0) {
+                doCompute(tmpPayFeeConfigDiscountDto, cycle, computeDiscountDtos, feeDetailDto.getFeeId());
             } else {
                 continue;
             }
             finishTime = c.getTime();
         }
-        computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos);
         //鍙栧嚭寮�鍏虫槧灏勭殑鍊�
         String value = MappingCache.getValue(DOMAIN_COMMON, DISCOUNT_MODE);
         List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
@@ -538,7 +553,7 @@
         IComputeDiscount computeDiscount = (IComputeDiscount) ApplicationContextFactory.getBean(feeDiscountDtos.get(0).getBeanImpl());
         feeDiscountDtos.get(0).setDiscountDesc(useCycle+"");
         ComputeDiscountDto computeDiscountDto = computeDiscount.compute(feeDiscountDtos.get(0));
-        if (computeDiscountDto == null) {
+        if (computeDiscountDto == null || computeDiscountDto.getDiscountPrice() == 0) {
             return;
         }
         computeDiscountDtos.add(computeDiscountDto);

--
Gitblit v1.8.0