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

---
 java110-db/src/main/resources/mapper/fee/PayFeeConfigDiscountServiceDaoImplMapper.xml                   |   15 
 java110-bean/src/main/java/com/java110/po/payFee/PayFeeConfigDiscountPo.java                            |    9 
 service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java             |    8 
 java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml                              |   11 
 service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java |   85 +++--
 service-user/src/main/java/com/java110/user/cmd/owner/AuthOwnerCmd.java                                 |    2 
 springboot/src/main/java/com/java110/boot/BootApplicationStart.java                                     |    2 
 java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml                              |  240 ++++-----------
 java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java                                |   11 
 service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java                  |   59 ++-
 service-fee/src/main/java/com/java110/fee/api/PayFeeConfigDiscountApi.java                              |    1 
 java110-db/src/main/resources/mapper/common/CarInoutServiceDaoImplMapper.xml                            |    6 
 java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java                                              |   38 +
 service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java                                 |    2 
 service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java                                     |  201 +++++++++---
 service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java                         |    2 
 service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java    |  208 +++++++++----
 17 files changed, 508 insertions(+), 392 deletions(-)

diff --git a/java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java b/java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java
index 28d23d6..ffaf41c 100755
--- a/java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java
+++ b/java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java
@@ -4,6 +4,7 @@
 import com.java110.dto.PageDto;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -185,20 +186,23 @@
 
     private String targetEndTime;
 
-    private double[] report;
+    private BigDecimal[] report;
 
     private int[] yearArr;
 
+    private int[] yearArr2;
+
     private List repostList;
 
-    private int length;
+    private int reportLength;
 
-    public int getLength() {
-        return length;
+
+    public int getReportLength() {
+        return reportLength;
     }
 
-    public void setLength(int length) {
-        this.length = length;
+    public void setReportLength(int reportLength) {
+        this.reportLength = reportLength;
     }
 
     public String getAmount() {
@@ -241,6 +245,13 @@
         this.secondaryFeeTypeCdName = secondaryFeeTypeCdName;
     }
 
+    public BigDecimal[] getReport() {
+        return report;
+    }
+
+    public void setReport(BigDecimal[] report) {
+        this.report = report;
+    }
 
     public String getCommunityId() {
         return communityId;
@@ -933,13 +944,6 @@
         this.contractFee = contractFee;
     }
 
-    public double[] getReport() {
-        return report;
-    }
-
-    public void setReport(double[] report) {
-        this.report = report;
-    }
 
     public int[] getYearArr() {
         return yearArr;
@@ -949,6 +953,14 @@
         this.yearArr = yearArr;
     }
 
+    public int[] getYearArr2() {
+        return yearArr2;
+    }
+
+    public void setYearArr2(int[] yearArr2) {
+        this.yearArr2 = yearArr2;
+    }
+
     public List getRepostList() {
         return repostList;
     }
diff --git a/java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java b/java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java
index 80bbbb3..b7dd04a 100644
--- a/java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java
+++ b/java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java
@@ -5,6 +5,7 @@
  */
 public class ImportRoomFee {
 
+
     private String payerObjName;
 
     private String floorNum;
@@ -69,6 +70,16 @@
     private String openInv;
     private String isContractFee;
 
+    private String payObjId;
+
+    public String getPayObjId() {
+        return payObjId;
+    }
+
+    public void setPayObjId(String payObjId) {
+        this.payObjId = payObjId;
+    }
+
     public String getOpenInv() {
         return openInv;
     }
diff --git a/java110-bean/src/main/java/com/java110/po/payFee/PayFeeConfigDiscountPo.java b/java110-bean/src/main/java/com/java110/po/payFee/PayFeeConfigDiscountPo.java
index 6cbfe47..6bd293a 100644
--- a/java110-bean/src/main/java/com/java110/po/payFee/PayFeeConfigDiscountPo.java
+++ b/java110-bean/src/main/java/com/java110/po/payFee/PayFeeConfigDiscountPo.java
@@ -13,6 +13,7 @@
     private String startTime;
     private String endTime;
     private String payMaxEndTime;
+    private String payMaxStartTime;
 
     public String getConfigDiscountId() {
         return configDiscountId;
@@ -78,4 +79,12 @@
     public void setPayMaxEndTime(String payMaxEndTime) {
         this.payMaxEndTime = payMaxEndTime;
     }
+
+    public String getPayMaxStartTime() {
+        return payMaxStartTime;
+    }
+
+    public void setPayMaxStartTime(String payMaxStartTime) {
+        this.payMaxStartTime = payMaxStartTime;
+    }
 }
diff --git a/java110-db/src/main/resources/mapper/common/CarInoutServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/common/CarInoutServiceDaoImplMapper.xml
index e15873c..943c217 100755
--- a/java110-db/src/main/resources/mapper/common/CarInoutServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/common/CarInoutServiceDaoImplMapper.xml
@@ -90,7 +90,8 @@
         out_rec.out_time,
         out_rec.out_time AS outTime,
         td1.name AS stateName,
-        out_rec.payment_amount AS money
+        out_rec.payment_amount AS money,
+        t.create_time  -- 鏂板鎺掑簭瀛楁鍒癝ELECT鍒楄〃
         FROM
         car_inout t
         -- 鍏堝乏杩炴帴鍑哄満璁板綍锛岀‘淇漮ut_rec琛ㄥ湪鍓嶉潰瀹氫箟
@@ -219,9 +220,6 @@
         </if>
         <if test="startTime != null and startTime != ''">
             and t.in_time &gt; #{startTime}
-        </if>
-        <if test="direction != null and direction != ''">
-            and t.direction &gt; #{direction}
         </if>
         <if test="endTime != null and endTime != ''">
             and t.out_time &lt; #{endTime}
diff --git a/java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml
index 05df2be..f231ac5 100755
--- a/java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml
@@ -441,12 +441,19 @@
         <if test="curYear != null and curYear != ''">
             and DATE_FORMAT(DATE_SUB(t.end_time,INTERVAL 1 DAY),'%Y') = #{curYear}
         </if>
+        <if test="createTime != null and createTime != ''">
+            and #{createTime} = t.create_time
+        </if>
+        <if test="payOrderId != null and payOrderId != ''">
+            and #{payOrderId} = t.pay_order_id
+        </if>
+
     </select>
 
     <!-- 淇濆瓨璐圭敤鏄庣粏淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
     <insert id="saveFeeDetail" parameterType="Map">
         insert into
-        pay_fee_detail(
+        pay_fee_detail(b_id,pay_order_id,
         prime_rate,detail_id,receivable_amount,cycles,remark,received_amount,community_id,
         fee_id,state,start_time,end_time,payable_amount,cashier_name,cashier_id,open_invoice,
         acct_amount,discount_amount,deduction_amount,late_amount,gift_amount,invoice_no,transferor_name
@@ -454,7 +461,7 @@
             ,create_time
         </if>
         )
-        values(#{primeRate},#{detailId},#{receivableAmount},#{cycles},#{remark},#{receivedAmount},#{communityId},#{feeId},#{state},
+        values(#{bId},#{payOrderId},#{primeRate},#{detailId},#{receivableAmount},#{cycles},#{remark},#{receivedAmount},#{communityId},#{feeId},#{state},
         #{startTime},#{endTime},#{payableAmount},#{cashierName},#{cashierId},#{openInvoice},
         #{acctAmount},#{discountAmount},#{deductionAmount},#{lateAmount},#{giftAmount},#{invoiceNo},#{transferorName}
         <if test="createTime != null and createTime != ''">
diff --git a/java110-db/src/main/resources/mapper/fee/PayFeeConfigDiscountServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/fee/PayFeeConfigDiscountServiceDaoImplMapper.xml
index 4fa3601..15f3532 100755
--- a/java110-db/src/main/resources/mapper/fee/PayFeeConfigDiscountServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/fee/PayFeeConfigDiscountServiceDaoImplMapper.xml
@@ -31,11 +31,11 @@
             #{payMaxEndTime}
         </if>
         ,
-        <if test="payMaxStarTime == ''">
-            #{payMaxStarTime}
+        <if test="payMaxStartTime == ''">
+            NULL
         </if>
-        <if test="payMaxStarTime != ''">
-            #{endTime}
+        <if test="payMaxStartTime != ''">
+            #{payMaxStartTime}
         </if>
         )
     </insert>
@@ -64,10 +64,10 @@
             and t.community_id= #{communityId}
         </if>
         <if test="currentTime !=null ">
-            and t.start_time &lt; #{currentTime}
+            and (t.start_time &lt; #{currentTime} or t.start_time is NULL)
         </if>
         <if test="currentTime !=null ">
-            and t.end_time &gt; #{currentTime}
+            and (t.end_time &gt; #{currentTime} or t.end_time is NULL)
         </if>
         order by t.create_time desc
         <if test="page != -1 and page != null ">
@@ -93,6 +93,9 @@
         <if test="payMaxStarTime !=null and payMaxStarTime != ''">
             , t.pay_max_star_time= #{payMaxStarTime}
         </if>
+        <if test="payMaxEndTime !=null and payMaxEndTime != ''">
+            , t.paymax_end_time= #{payMaxEndTime}
+        </if>
         where 1=1
         <if test="configDiscountId !=null and configDiscountId != ''">
             and t.config_discount_id= #{configDiscountId}
diff --git a/java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml
index a320d91..26fb689 100644
--- a/java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml
@@ -3,187 +3,69 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="reportFeeServiceDaoImpl">
     <select id="repostInFee" resultType="java.util.Map">
-        -- 姝ラ1锛氫娇鐢ㄤ紶鍏ョ殑yearList浣滀负骞翠唤鑼冨洿锛堥伩鍏嶉�掑綊CTE锛�
-        WITH all_years AS (
-        <foreach collection="yearList" item="year" separator="UNION ALL">
-            SELECT #{year} AS year
-        </foreach>
-        ),
-        -- 姝ラ2锛氱敓鎴愭墍鏈夎垂鐢ㄧ被鍨�
-        all_fee_types AS (
-        SELECT DISTINCT
-        f.fee_type_cd,
-        COALESCE(dict.`name`, '鏈煡绫诲瀷') AS fee_type_name
-        FROM pay_fee f
-        LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd
-        ),
-        -- 姝ラ3锛氱敓鎴�"绫诲瀷+骞翠唤"鍏ㄩ噺缁勫悎
-        all_type_year AS (
         SELECT
-        t.fee_type_cd,
-        t.fee_type_name,
-        y.year AS detail_year
-        FROM all_fee_types t
-        CROSS JOIN all_years y
-        ),
-        -- 姝ラ4锛氬師濮嬫暟鎹仛鍚堬紙鎸夊勾浠藉垪琛ㄥ姩鎬佸鐞嗭級
-        original_agg AS (
-        SELECT
-        f.fee_type_cd,
-        COALESCE(dict.`name`, '鏈煡绫诲瀷') AS fee_type_name,
-        d.detail_year,
-        -- 鏍稿績骞村害瀛楁
-        SUM(DISTINCT d.receivable_amount) AS 璇ュ勾搴旂即鎬婚,
-        ROUND(SUM(DISTINCT d.receivable_amount)/12, 4) AS 姣忔湀璐圭敤,
-        12 AS 搴旀敹鏈堜唤鏁�,
-        ROUND(CASE WHEN SUM(DISTINCT d.receivable_amount) = 0 THEN 0
-        ELSE SUM(DISTINCT d.received_amount)/SUM(DISTINCT d.receivable_amount)*100
-        END, 2) AS 褰撳勾鏀剁即鐜�,
-        SUM(DISTINCT d.discount_amount) AS 鎶樻墸閲戦,
-        -- 鍚勫勾瀹炵即锛堥亶鍘唝earList鐢熸垚瀛楁锛�
-        <foreach collection="yearList" item="y" separator=",">
-            SUM(CASE WHEN YEAR(d.pay_fee_time) = #{y} THEN d.received_amount ELSE 0 END) AS ${y}骞村疄缂�
-        </foreach>,
-        -- 鍏朵粬鏍稿績瀛楁
-        SUM(DISTINCT d.receivable_amount) AS 褰撳勾棰勭畻,
-        SUM(DISTINCT d.received_amount) AS 褰撳勾瀹炵即,  -- 褰撳勾瀹炵即=褰撳勾瀹為檯鏀跺埌鐨勯噾棰�
-        SUM(DISTINCT d.discount_amount) AS 褰撳勾鎶樻墸鎬婚,
-        SUM(DISTINCT d.receivable_amount) - SUM(DISTINCT d.received_amount) AS 褰撳勾娆犳,
-        -- 姣忔湀搴旀敹锛堥亶鍘唌onthList鐢熸垚瀛楁锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(DISTINCT CASE WHEN d.detail_month = #{m} THEN d.receivable_amount ELSE 0 END) AS 褰撳勾${m}鏈堝簲鏀�
-        </foreach>,
-        -- 姣忔湀瀹炵即锛堥亶鍘唌onthList鐢熸垚瀛楁锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(DISTINCT CASE WHEN d.detail_month = #{m} THEN d.received_amount ELSE 0 END) AS 褰撳勾${m}鏈堝疄缂�
-        </foreach>
-        FROM pay_fee_detail_month d
-        INNER JOIN pay_fee f ON d.fee_id = f.fee_id
-        LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd
-        WHERE d.community_id = #{communityId}
-        AND d.status_cd = '0'
-        AND d.detail_year BETWEEN #{startYear} AND #{endYear}
-        GROUP BY f.fee_type_cd, COALESCE(dict.`name`, '鏈煡绫诲瀷'), d.detail_year
-        ),
-        -- 姝ラ5锛氬叏閲忔槑缁嗚锛堝叧鑱旇仛鍚堢粨鏋滐級
-        detail_rows AS (
-        SELECT
-        a.fee_type_cd,
-        a.fee_type_name,
-        a.detail_year AS 璐圭敤鎵�灞炲勾浠�,
-        '鏄庣粏' AS 琛岀被鍨�,
-        -- 鏍稿績骞村害瀛楁
-        COALESCE(o.璇ュ勾搴旂即鎬婚, 0) AS 璇ュ勾搴旂即鎬婚,
-        COALESCE(o.姣忔湀璐圭敤, 0) AS 姣忔湀璐圭敤,
-        COALESCE(o.搴旀敹鏈堜唤鏁�, 12) AS 搴旀敹鏈堜唤鏁�,
-        COALESCE(o.褰撳勾鏀剁即鐜�, 0) AS 褰撳勾鏀剁即鐜�,
-        COALESCE(o.鎶樻墸閲戦, 0) AS 鎶樻墸閲戦,
-        -- 鍚勫勾瀹炵即锛堥亶鍘唝earList锛�
-        <foreach collection="yearList" item="y" separator=",">
-            COALESCE(o.${y}骞村疄缂�, 0) AS ${y}骞村疄缂�
-        </foreach>,
-        -- 鍏朵粬鏍稿績瀛楁
-        COALESCE(o.褰撳勾棰勭畻, 0) AS 褰撳勾棰勭畻,
-        COALESCE(o.褰撳勾瀹炵即, 0) AS 褰撳勾瀹炵即,
-        COALESCE(o.褰撳勾鎶樻墸鎬婚, 0) AS 褰撳勾鎶樻墸鎬婚,
-        COALESCE(o.褰撳勾娆犳, 0) AS 褰撳勾娆犳,
-        -- 姣忔湀搴旀敹锛堥亶鍘唌onthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            COALESCE(o.褰撳勾${m}鏈堝簲鏀�, 0) AS 褰撳勾${m}鏈堝簲鏀�
-        </foreach>,
-        -- 姣忔湀瀹炵即锛堥亶鍘唌onthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            COALESCE(o.褰撳勾${m}鏈堝疄缂�, 0) AS 褰撳勾${m}鏈堝疄缂�
-        </foreach>
-        FROM all_type_year a
-        LEFT JOIN original_agg o
-        ON a.fee_type_cd = o.fee_type_cd
-        AND a.detail_year = o.detail_year
-        ),
-        -- 姝ラ6锛氱被鍨嬫�昏琛岋紙鑱氬悎鏄庣粏琛岋級
-        type_total_rows AS (
-        SELECT
-        fee_type_cd,
-        fee_type_name,
-        '绫诲瀷鎬昏' AS 璐圭敤鎵�灞炲勾浠�,
-        '绫诲瀷鎬昏' AS 琛岀被鍨�,
-        SUM(璇ュ勾搴旂即鎬婚) AS 璇ュ勾搴旂即鎬婚,
-        ROUND(SUM(璇ュ勾搴旂即鎬婚) / (12 * COUNT(DISTINCT 璐圭敤鎵�灞炲勾浠�)), 4) AS 姣忔湀璐圭敤,
-        12 * COUNT(DISTINCT 璐圭敤鎵�灞炲勾浠�) AS 搴旀敹鏈堜唤鏁�,
-        ROUND(CASE WHEN SUM(璇ュ勾搴旂即鎬婚) = 0 THEN 0
-        ELSE SUM(褰撳勾瀹炵即) / SUM(璇ュ勾搴旂即鎬婚) * 100
-        END, 2) AS 褰撳勾鏀剁即鐜�,
-        SUM(鎶樻墸閲戦) AS 鎶樻墸閲戦,
-        -- 鍚勫勾瀹炵即鍚堣锛堥亶鍘唝earList锛�
-        <foreach collection="yearList" item="y" separator=",">
-            SUM(${y}骞村疄缂�) AS ${y}骞村疄缂�
-        </foreach>,
-        -- 鍏朵粬鏍稿績瀛楁鍚堣
-        SUM(褰撳勾棰勭畻) AS 褰撳勾棰勭畻,
-        SUM(褰撳勾瀹炵即) AS 褰撳勾瀹炵即,
-        SUM(褰撳勾鎶樻墸鎬婚) AS 褰撳勾鎶樻墸鎬婚,
-        SUM(褰撳勾娆犳) AS 褰撳勾娆犳,
-        -- 姣忔湀搴旀敹鍚堣锛堥亶鍘唌onthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(褰撳勾${m}鏈堝簲鏀�) AS 褰撳勾${m}鏈堝簲鏀�
-        </foreach>,
-        -- 姣忔湀瀹炵即鍚堣锛堥亶鍘唌onthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(褰撳勾${m}鏈堝疄缂�) AS 褰撳勾${m}鏈堝疄缂�
-        </foreach>
-        FROM detail_rows
-        GROUP BY fee_type_cd, fee_type_name
-        ),
-        -- 姝ラ7锛氭�诲悎璁¤锛堣仛鍚堟墍鏈夋暟鎹級
-        grand_total_row AS (
-        SELECT
-        'ALL' AS fee_type_cd,
-        '鎵�鏈夌被鍨嬫�昏' AS fee_type_name,
-        '鎬诲悎璁�' AS 璐圭敤鎵�灞炲勾浠�,
-        '鎬诲悎璁�' AS 琛岀被鍨�,
-        SUM(璇ュ勾搴旂即鎬婚) AS 璇ュ勾搴旂即鎬婚,
-        ROUND(SUM(璇ュ勾搴旂即鎬婚) / (12 * COUNT(DISTINCT 璐圭敤鎵�灞炲勾浠�)), 4) AS 姣忔湀璐圭敤,
-        12 * COUNT(DISTINCT 璐圭敤鎵�灞炲勾浠�) AS 搴旀敹鏈堜唤鏁�,
-        ROUND(CASE WHEN SUM(璇ュ勾搴旂即鎬婚) = 0 THEN 0
-        ELSE SUM(褰撳勾瀹炵即) / SUM(璇ュ勾搴旂即鎬婚) * 100
-        END, 2) AS 褰撳勾鏀剁即鐜�,
-        SUM(鎶樻墸閲戦) AS 鎶樻墸閲戦,
-        -- 鍚勫勾瀹炵即鎬诲悎璁★紙閬嶅巻yearList锛�
-        <foreach collection="yearList" item="y" separator=",">
-            SUM(${y}骞村疄缂�) AS ${y}骞村疄缂�
-        </foreach>,
-        -- 鍏朵粬鏍稿績瀛楁鎬诲悎璁�
-        SUM(褰撳勾棰勭畻) AS 褰撳勾棰勭畻,
-        SUM(褰撳勾瀹炵即) AS 褰撳勾瀹炵即,
-        SUM(褰撳勾鎶樻墸鎬婚) AS 褰撳勾鎶樻墸鎬婚,
-        SUM(褰撳勾娆犳) AS 褰撳勾娆犳,
-        -- 姣忔湀搴旀敹鎬诲悎璁★紙閬嶅巻monthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(褰撳勾${m}鏈堝簲鏀�) AS 褰撳勾${m}鏈堝簲鏀�
-        </foreach>,
-        -- 姣忔湀瀹炵即鎬诲悎璁★紙閬嶅巻monthList锛�
-        <foreach collection="monthList" item="m" separator=",">
-            SUM(褰撳勾${m}鏈堝疄缂�) AS 褰撳勾${m}鏈堝疄缂�
-        </foreach>
-        FROM detail_rows
-        )
+            fee_type_cd AS 'fee_type_cd',
+            detail_year,
+            -- 褰撳勾搴旀敹娆鹃」鍚堣锛堜繚鐣�2浣嶅皬鏁帮級
+            ROUND(SUM(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN receivable_amount ELSE 0 END), 2) AS '璇ュ勾搴旂即鎬婚',
 
-        -- 鏈�缁堢粨鏋滐細鍚堝苟鎵�鏈夎骞舵帓搴�
-        SELECT * FROM (
-        SELECT * FROM type_total_rows
-        UNION ALL
-        SELECT * FROM detail_rows
-        UNION ALL
-        SELECT * FROM grand_total_row
-        ) AS all_rows
-        ORDER BY
-        CASE
-        WHEN 琛岀被鍨� = '鎬诲悎璁�' THEN 2
-        WHEN 琛岀被鍨� = '绫诲瀷鎬昏' THEN 0
-        ELSE 1
-        END,
-        fee_type_cd,
-        CASE WHEN 璐圭敤鎵�灞炲勾浠� = '绫诲瀷鎬昏' THEN 0 ELSE CAST(璐圭敤鎵�灞炲勾浠� AS UNSIGNED) END
+            -- 褰撳勾鏀剁即鐜囷紙淇濈暀2浣嶅皬鏁帮紝鐧惧垎姣旀牸寮忥級
+            ROUND(
+                    CASE
+                        WHEN SUM(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN receivable_amount ELSE 0 END) = 0 THEN 0
+                        ELSE SUM(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN received_amount ELSE 0 END)
+                                 / SUM(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN receivable_amount ELSE 0 END) * 100
+                        END, 2
+            ) AS '褰撳勾鏀剁即鐜�',
+
+            -- 鎬绘姌鎵i噾棰濓紙淇濈暀2浣嶅皬鏁帮級
+            ROUND(SUM(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN discount_amount ELSE 0 END), 2) AS '鎶樻墸閲戦',
+
+            -- 2020-2024骞村疄鏀堕噾棰濓紙淇濈暀2浣嶅皬鏁帮級
+            ROUND(SUM(CASE WHEN detail_year = 2020 THEN received_amount ELSE 0 END), 2) AS '2020骞村疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2021 THEN received_amount ELSE 0 END), 2) AS '2021骞村疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2022 THEN received_amount ELSE 0 END), 2) AS '2022骞村疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2023 THEN received_amount ELSE 0 END), 2) AS '2023骞村疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2024 THEN received_amount ELSE 0 END), 2) AS '2024骞村疄缂�',
+
+            -- 2025骞村悎璁℃暟鎹紙淇濈暀2浣嶅皬鏁帮級
+            ROUND(SUM(CASE WHEN detail_year = 2025 THEN receivable_amount ELSE 0 END), 2) AS '褰撳勾棰勭畻',
+            ROUND(SUM(CASE WHEN detail_year = 2025 THEN received_amount ELSE 0 END), 2) AS '2025骞村疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 THEN discount_amount ELSE 0 END), 2) AS '褰撳勾鎶樻墸鎬婚',
+            ROUND(SUM(CASE WHEN detail_year = 2025 THEN receivable_amount - received_amount ELSE 0 END), 2) AS '褰撳勾娆犳',
+
+            -- 2025骞村悇鏈堜唤瀹炴敹锛堜繚鐣�2浣嶅皬鏁帮級
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 1 THEN received_amount ELSE 0 END), 2) AS '褰撳勾1鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 2 THEN received_amount ELSE 0 END), 2) AS '褰撳勾2鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 3 THEN received_amount ELSE 0 END), 2) AS '褰撳勾3鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 4 THEN received_amount ELSE 0 END), 2) AS '褰撳勾4鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 5 THEN received_amount ELSE 0 END), 2) AS '褰撳勾5鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 6 THEN received_amount ELSE 0 END), 2) AS '褰撳勾6鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 7 THEN received_amount ELSE 0 END), 2) AS '褰撳勾7鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 8 THEN received_amount ELSE 0 END), 2) AS '褰撳勾8鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 9 THEN received_amount ELSE 0 END), 2) AS '褰撳勾9鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 10 THEN received_amount ELSE 0 END), 2) AS '褰撳勾10鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 11 THEN received_amount ELSE 0 END), 2) AS '褰撳勾11鏈堝疄缂�',
+            ROUND(SUM(CASE WHEN detail_year = 2025 AND detail_month = 12 THEN received_amount ELSE 0 END), 2) AS '褰撳勾12鏈堝疄缂�',
+
+            -- 姣忔湀璐圭敤锛堜繚鐣�2浣嶅皬鏁帮級鍜屽簲鏀舵湀浠芥暟锛堟暣鏁帮紝鏃犻渶澶勭悊锛�
+            ROUND(AVG(CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN receivable_amount ELSE NULL END), 2) AS '姣忔湀璐圭敤',
+            COUNT(DISTINCT CASE WHEN detail_year BETWEEN 2020 AND 2025 THEN CONCAT(detail_year, '-', detail_month) END) AS '搴旀敹鏈堜唤鏁�',
+
+            -- 璐圭敤鎵�灞炲勾浠斤紙鍖哄垎鏅�氳鍜屾眹鎬昏锛�
+            CASE
+                WHEN detail_year IS NULL THEN '绫诲瀷鎬昏'
+                ELSE CAST(detail_year AS CHAR)
+                END AS '璐圭敤鎵�灞炲勾浠�'
+
+        FROM
+            pay_fee_detail_month
+        WHERE
+            community_id = #{communityId}
+            detail_year BETWEEN 2020 AND 2025
+        GROUP BY
+            fee_type_cd, detail_year
+        WITH ROLLUP;
     </select>
     <insert id="saveReport" parameterType="Map">
         INSERT INTO report_query_record (
diff --git a/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java b/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
index e4ba241..fe41746 100755
--- a/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
+++ b/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
@@ -112,7 +112,7 @@
      */
     @RequestMapping(value = "/saveApplyRoomDiscount", method = RequestMethod.POST)
     public ResponseEntity<String> saveApplyRoomDiscount(@RequestBody JSONObject reqJson) throws ParseException {
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Assert.hasKeyAndValue(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
         Assert.hasKeyAndValue(reqJson, "roomId", "璇锋眰鎶ユ枃涓湭鍖呭惈roomId");
         Assert.hasKeyAndValue(reqJson, "roomName", "璇锋眰鎶ユ枃涓湭鍖呭惈roomName");
diff --git a/service-fee/src/main/java/com/java110/fee/api/PayFeeConfigDiscountApi.java b/service-fee/src/main/java/com/java110/fee/api/PayFeeConfigDiscountApi.java
index 6f28666..978f6e2 100755
--- a/service-fee/src/main/java/com/java110/fee/api/PayFeeConfigDiscountApi.java
+++ b/service-fee/src/main/java/com/java110/fee/api/PayFeeConfigDiscountApi.java
@@ -49,6 +49,7 @@
 
         PayFeeConfigDiscountPo payFeeConfigDiscountPo = BeanConvertUtil.covertBean(reqJson, PayFeeConfigDiscountPo.class);
         String paymaxEndTime = reqJson.getString("payMaxEndTime");
+        payFeeConfigDiscountPo.setPayMaxStartTime(reqJson.getString("payMaxStarTime"));
 //        if (StringUtil.isEmpty(paymaxEndTime)) {
 //            //濡傛灉浼樻儬鏈�澶ф椂闂翠负绌猴紝灏遍粯璁や负2037-12-31 00:00:00
 //            payFeeConfigDiscountPo.setPayMaxEndTime("2037-12-31 00:00:00");
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
index bd845be..2f17d2f 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
@@ -23,6 +23,7 @@
 import org.springframework.http.ResponseEntity;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.ParseException;
 import java.util.*;
 
@@ -54,6 +55,10 @@
         feeQueryParams.setStartYear(startYear);
         int currentYear = java.time.Year.now().getValue();
         feeQueryParams.setEndYear(currentYear + 2);
+        if(reqJson.containsKey("endYear") && !reqJson.get("endYear").equals("") && reqJson.get("endYear") != null) {
+            currentYear=Integer.parseInt(reqJson.get("endYear")+"");
+            feeQueryParams.setEndYear(Integer.parseInt(reqJson.get("endYear")+"")+2);
+        }
         int endYear = feeQueryParams.getEndYear();
         int doYear = endYear - startYear;
 
@@ -64,35 +69,45 @@
         reportQueryRecord.setEndYear(currentYear+"");
         List<ReportQueryRecord> reportQueryRecords = reportFeeInnerServiceSMOImpl.queryReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
 
-        if(reportQueryRecords.size()>0){
+        if(reportQueryRecords.size()>0 && !reqJson.containsKey("reload")){
+            ResultVo resultVo = new ResultVo(JSONObject.parse(reportQueryRecords.get(reportQueryRecords.size()-1).getReportContent()));
 
+            ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+            context.setResponseEntity(responseEntity);
         }
 
-        List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>();
-        queryFee(reportFeeDtoLists ,reqJson);
+        else{
+            List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>();
+            queryFee(reportFeeDtoLists ,reqJson);
+            int[] arr = new int[endYear - startYear + 1];
+            int[] arr2 = new int[endYear - startYear + 1 - 3];
+            for (int i = startYear; i <= endYear; i++) {
+                arr[i-startYear] = i;
+            }
+            for (int i = startYear; i < currentYear; i++) {
+                arr2[i-startYear] = i;
+            }
 
-        int[] arr = new int[endYear - startYear + 1];
-        for (int i = startYear; i <= endYear; i++) {
-            arr[i-startYear] = i;
+            FeeDto feeDto = new FeeDto();
+            feeDto.setRepostList(reportFeeDtoLists);
+            feeDto.setYearArr(arr);
+            feeDto.setYearArr2(arr2);
+            feeDto.setReportLength(doYear - 1 + 20);
+
+            reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
+            reportQueryRecord.setQueryStatus("0");
+            reportQueryRecord.setEndYear(currentYear+"");
+            reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto));
+
+            int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
+
+            ResultVo resultVo = new ResultVo(feeDto);
+
+            ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+            context.setResponseEntity(responseEntity);
         }
-
-        FeeDto feeDto = new FeeDto();
-        feeDto.setRepostList(reportFeeDtoLists);
-        feeDto.setYearArr(arr);
-        feeDto.setLength(doYear - 1 + 20);
-
-        reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
-        reportQueryRecord.setQueryStatus("0");
-        reportQueryRecord.setEndYear(currentYear+"");
-        reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto));
-
-        int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
-
-        ResultVo resultVo = new ResultVo(feeDto);
-
-        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-
-        context.setResponseEntity(responseEntity);
     }
     public void queryFee(List<List<FeeDto>> reportFeeDtoLists, JSONObject reqJson) {
         int startYear = 2020;
@@ -104,13 +119,46 @@
         feeQueryParams.setStartYear(startYear);
         int currentYear = java.time.Year.now().getValue();
         feeQueryParams.setEndYear(currentYear + 2);
+        if(reqJson.containsKey("endYear") && !reqJson.get("endYear").equals("") && reqJson.get("endYear") != null){
+            currentYear=Integer.parseInt(reqJson.get("endYear")+"");
+            feeQueryParams.setEndYear(Integer.parseInt(reqJson.get("endYear")+"")+2);
+        }
         int endYear = feeQueryParams.getEndYear();
-        reportFeeDtoLists.add(new LinkedList<FeeDto>());
-        reportFeeDtoLists.add(new LinkedList<FeeDto>());
-        reportFeeDtoLists.add(new LinkedList<FeeDto>());
-        reportFeeDtoLists.add(new LinkedList<FeeDto>());
-        int ind = 1;
         int doYear = endYear - startYear;
+        LinkedList<FeeDto> col1 = new LinkedList<>();
+        FeeDto col = new FeeDto();
+        BigDecimal[] col1Fee = new BigDecimal[doYear - 1 + 20];
+        col.setReport(col1Fee);
+        col.setCurYear("鏀跺叆鍚堣锛堢櫧鍗曟祦姘达級");
+        col1.add(col);
+
+        LinkedList<FeeDto> col2 = new LinkedList<>();
+        BigDecimal[] col2Fee = new BigDecimal[doYear - 1 + 20];
+        col = new FeeDto();
+        col.setReport(col2Fee);
+        col.setCurYear("鐗╀笟璐�+浠f敹鍚堣");
+        col2.add(col);
+
+        LinkedList<FeeDto> col3 = new LinkedList<>();
+        col = new FeeDto();
+        col.setReport(col2Fee);
+        col.setCurYear("鐗╀笟璐瑰悎璁�(1+2)");
+        col3.add(col);
+
+        LinkedList<FeeDto> col4 = new LinkedList<>();
+        col = new FeeDto();
+        col.setReport(new BigDecimal[doYear - 1 + 20]);
+        col.setCurYear("鐗╀笟璐逛唬鏀跺悎璁�");
+        col3.add(col);
+
+        BigDecimal[] col4Fee = new BigDecimal[doYear - 1 + 20];
+        BigDecimal[] colByCar = new BigDecimal[doYear - 1 + 20];
+        BigDecimal[] colByOther = new BigDecimal[doYear - 1 + 20];
+        reportFeeDtoLists.add(col1);
+        reportFeeDtoLists.add(col2);
+        reportFeeDtoLists.add(col2);
+        reportFeeDtoLists.add(col4);
+        int ind = 1;
 
         int[] arr = new int[endYear - startYear + 1];
         for (int i = startYear; i <= endYear; i++) {
@@ -128,28 +176,66 @@
             int kg = 0;
             for (Map map : result){
                 if(map.get("璐圭敤鎵�灞炲勾浠�").equals("绫诲瀷鎬昏") && map.get("fee_type_cd").equals(dictDto1.getStatusCd())){
-                    double[] doubles = new double[doYear - 1 + 20];
-                    doubles[0] = ((BigDecimal) map.get("璇ュ勾搴旂即鎬婚")).doubleValue();
-                    doubles[1] = ((BigDecimal) map.get("姣忔湀璐圭敤")).doubleValue();
-                    doubles[2] = ((Long) map.get("搴旀敹鏈堜唤鏁�")).doubleValue();
-                    doubles[3] = ((BigDecimal) map.get("褰撳勾鏀剁即鐜�")).doubleValue();
-                    doubles[4] = ((BigDecimal) map.get("鎶樻墸閲戦")).doubleValue();
+                    BigDecimal[] doubles = new BigDecimal[doYear - 1 + 20];
+                    doubles[0] = (BigDecimal) map.get("璇ュ勾搴旂即鎬婚");
+                    doubles[1] = (BigDecimal) map.get("姣忔湀璐圭敤");
+                    doubles[2] = (BigDecimal) map.get("搴旀敹鏈堜唤鏁�");
+                    doubles[3] = (BigDecimal) map.get("褰撳勾鏀剁即鐜�");
+                    doubles[4] = (BigDecimal) map.get("鎶樻墸閲戦");
                     int inde = 0;
                     for (int i : arr){
                         if(i < currentYear){
                             inde++;
-                            doubles[i - startYear + 5] = ((BigDecimal) map.get(i + "骞村疄缂�")).doubleValue();
+                            doubles[i - startYear + 5] = (BigDecimal) map.get(i + "骞村疄缂�");
                         }
                     }
-                    doubles[inde + 5] =((BigDecimal) map.get("褰撳勾棰勭畻")).doubleValue();
-                    doubles[inde + 6] =((BigDecimal) map.get(currentYear + "骞村疄缂�")).doubleValue();
-                    doubles[inde + 7] =((BigDecimal) map.get("褰撳勾鎶樻墸鎬婚")).doubleValue();
-                    doubles[inde + 8] =((BigDecimal) map.get("褰撳勾娆犳")).doubleValue();
+                    doubles[inde + 5] =(BigDecimal) map.get("褰撳勾棰勭畻");
+                    doubles[inde + 6] =(BigDecimal) map.get(currentYear + "骞村疄缂�");
+                    doubles[inde + 7] =(BigDecimal) map.get("褰撳勾鎶樻墸鎬婚");
+                    doubles[inde + 8] =(BigDecimal) map.get("褰撳勾娆犳");
 
                     for (int i = 1 ; i <= 12 ; i++){
-                        doubles[inde + 8 + i] =((BigDecimal) map.get("褰撳勾"+(i < 10 ? "0"+i : i) +"鏈堝疄缂�")).doubleValue();
+                        doubles[inde + 8 + i] =(BigDecimal) map.get("褰撳勾"+(i < 10 ? "0"+i : i) +"鏈堝疄缂�");
                     }
                     feeDto.setCurYear(dictDto1.getName()+"鎬昏");
+                    if(Integer.parseInt(dictDto1.getStatusCd())%630000000 < 3){
+                        for(int i = 0 ; i < doubles.length ; i++){
+                            if(i == 3){
+                                if (doubles[i].intValue() != 0){
+                                    col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                    col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                }
+                            }else{
+                                col1Fee[i].add(doubleUse(doubles[i]));
+                                col2Fee[i].add(doubleUse(doubles[i]));
+                            }
+                        }
+                    }
+                    else if(Integer.parseInt(dictDto1.getStatusCd())%630000000 < 8){
+                        for(int i = 0 ; i < doubles.length ; i++){
+                            if(i == 3){
+                                if (doubles[i].intValue() != 0){
+                                    col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                    col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                }
+                            }else{
+                                col1Fee[i].add(doubleUse(doubles[i]));
+                                col2Fee[i].add(doubleUse(doubles[i]));
+                            }
+                        }
+                    }else{
+                        for(int i = 0 ; i < doubles.length ; i++){
+                            if(i == 3){
+                                if (doubles[i].intValue() != 0){
+                                    col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                    col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+                                }
+                            }else{
+                                col1Fee[i].add(doubleUse(doubles[i]));
+                                col2Fee[i].add(doubleUse(doubles[i]));
+                            }
+                        }
+                    }
                     feeDto.setReport(doubles);
                     feeDto.setCount(ind);
 
@@ -159,7 +245,7 @@
                 feeDto.setCurYear("绫诲瀷鎬昏");
             }
             if (feeDto.getReport() == null){
-                feeDto.setReport(new double[doYear - 1 + 20]);
+                feeDto.setReport(new BigDecimal[doYear - 1 + 20]);
             }
             if(feeDto.getFeeTypeCdName() == null) {
                 feeDto.setFeeTypeCdName(dictDto1.getName());
@@ -174,26 +260,26 @@
                 kg = 0;
                 for (Map map : result){
                     if(map.get("璐圭敤鎵�灞炲勾浠�").equals(i+"") && map.get("fee_type_cd").equals(dictDto1.getStatusCd())){
-                        double[] doubles = new double[doYear - 1 + 20];
-                        doubles[0] = ((BigDecimal) map.get("璇ュ勾搴旂即鎬婚")).doubleValue();
-                        doubles[1] = ((BigDecimal) map.get("姣忔湀璐圭敤")).doubleValue();
-                        doubles[2] = ((Long) map.get("搴旀敹鏈堜唤鏁�")).doubleValue();
-                        doubles[3] = ((BigDecimal) map.get("褰撳勾鏀剁即鐜�")).doubleValue();
-                        doubles[4] = ((BigDecimal) map.get("鎶樻墸閲戦")).doubleValue();
+                        BigDecimal[] doubles = new BigDecimal[doYear - 1 + 20];
+                        doubles[0] = (BigDecimal) map.get("璇ュ勾搴旂即鎬婚");
+                        doubles[1] = (BigDecimal) map.get("姣忔湀璐圭敤");
+                        doubles[2] = (BigDecimal) map.get("搴旀敹鏈堜唤鏁�");
+                        doubles[3] = (BigDecimal) map.get("褰撳勾鏀剁即鐜�");
+                        doubles[4] = (BigDecimal) map.get("鎶樻墸閲戦");
                         int inde = 0;
                         for (int in : arr){
                             if(in < currentYear){
                                 inde++;
-                                doubles[in - startYear + 5] = ((BigDecimal) map.get(i + "骞村疄缂�")).doubleValue();
+                                doubles[in - startYear + 5] = (BigDecimal) map.get(i + "骞村疄缂�");
                             }
                         }
-                        doubles[inde + 5] =((BigDecimal) map.get("褰撳勾棰勭畻")).doubleValue();
-                        doubles[inde + 6] =((BigDecimal) map.get(currentYear + "骞村疄缂�")).doubleValue();
-                        doubles[inde + 7] =((BigDecimal) map.get("褰撳勾鎶樻墸鎬婚")).doubleValue();
-                        doubles[inde + 8] =((BigDecimal) map.get("褰撳勾娆犳")).doubleValue();
+                        doubles[inde + 5] =(BigDecimal) map.get("褰撳勾棰勭畻");
+                        doubles[inde + 6] =(BigDecimal) map.get(currentYear + "骞村疄缂�");
+                        doubles[inde + 7] =(BigDecimal) map.get("褰撳勾鎶樻墸鎬婚");
+                        doubles[inde + 8] =(BigDecimal) map.get("褰撳勾娆犳");
 
                         for (int in = 1 ; in <= 12 ; in++){
-                            doubles[inde + 8 + in] =((BigDecimal) map.get("褰撳勾"+(in < 10 ? "0"+in : in) +"鏈堝疄缂�")).doubleValue();
+                            doubles[inde + 8 + in] =(BigDecimal) map.get("褰撳勾"+(in < 10 ? "0"+in : in) +"鏈堝疄缂�");
                         }
                         feeDto = new FeeDto();
                         feeDto.setFeeTypeCdName(dictDto1.getName());
@@ -208,7 +294,7 @@
                     feeDto = new FeeDto();
                     feeDto.setFeeTypeCdName(dictDto1.getName());
                     feeDto.setCurYear(String.valueOf(i));
-                    feeDto.setReport(new double[doYear - 1 + 20]);
+                    feeDto.setReport(new BigDecimal[doYear - 1 + 20]);
                     feeDto.setCount(ind);
                     feeDtos2.add(feeDto);
                 }
@@ -232,6 +318,7 @@
                 LinkedList linkedList = new LinkedList();
                 FeeDto feeDto1 = new FeeDto();
                 feeDto1.setCurYear("鍋滆溅璐瑰悎璁★紙3+...+7锛�");
+                feeDto1.setReport(colByCar);
                 linkedList.add(feeDto1);
                 reportFeeDtoLists.add(linkedList);
             }
@@ -239,10 +326,14 @@
                 LinkedList linkedList = new LinkedList();
                 FeeDto feeDto1 = new FeeDto();
                 feeDto1.setCurYear("鍏朵粬绫诲悎璁★紙8+...+22锛�");
+                feeDto1.setReport(colByOther);
                 linkedList.add(feeDto1);
                 reportFeeDtoLists.add(linkedList);
             }
             ind ++;
         }
     }
+    public BigDecimal doubleUse(BigDecimal num){
+        return  num;
+    }
 }
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);
diff --git a/service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java b/service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java
index 0d4f071..5bbdc3c 100644
--- a/service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java
+++ b/service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java
@@ -42,7 +42,7 @@
             carInoutDto.setTotal(i);
             carInoutDto.setRecords((int) Math.ceil((double) i / (double) reqJson.getInteger("row")));
             List<ApiCarInoutDataVo> carInoutDtos = iCarInoutInnerServiceSMOImpl.queryCarInouts2(carInoutDto);
-
+            i = carInoutDtos.size();
             ApiCarInoutVo carInoutVo = new ApiCarInoutVo();
 
             carInoutVo.setTotal(i);
diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java
index d0918fe..eca63cf 100644
--- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java
+++ b/service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java
@@ -109,6 +109,19 @@
      */
     private void importCarFeeDetail(ImportRoomFee importRoomFee, String storeId, String userId, String batchId) {
 
+        PayFeeDetailPo payFeeDetailPo = new PayFeeDetailPo();
+        payFeeDetailPo.setPayOrderId(importRoomFee.getRoomId());
+        payFeeDetailPo.setCycles(importRoomFee.getCycle());
+        payFeeDetailPo.setCreateTime(importRoomFee.getCreateTime());
+        payFeeDetailPo.setCommunityId(importRoomFee.getCommunityId());
+        payFeeDetailPo.setPayOrderId(importRoomFee.getRoomId());
+        int count = feeDetailInnerServiceSMOImpl.queryFeeDetailsCountByVo(payFeeDetailPo);
+
+        if (count > 0) {
+            throw new IllegalStateException("閲嶅鐨勭即璐硅褰�");
+        }
+
+
         FeeConfigDto feeConfigDto = new FeeConfigDto();
         feeConfigDto.setFeeNameEq(importRoomFee.getFeeName().trim());
         feeConfigDto.setCommunityId(importRoomFee.getCommunityId());
@@ -129,40 +142,41 @@
 
         List<PayFeePo> payFeePos = null;
         if (ListUtil.isNull(feeDtos)) {
-            PayFeePo payFeePo = new PayFeePo();
-            payFeePo.setCommunityId(importRoomFee.getCommunityId());
-            payFeePo.setConfigId(feeDto.getConfigId());
-            payFeePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_CAR);
-            payFeePo.setStartTime(importRoomFee.getStartTime());
-            payFeePo.setEndTime(importRoomFee.getEndTime());
-            payFeePo.setAmount(importRoomFee.getAmount());
-            payFeePo.setFeeFlag(tmpFeeConfigDto.getFeeFlag());
-            payFeePo.setFeeTypeCd(tmpFeeConfigDto.getFeeTypeCd());
-            payFeePo.setIncomeObjId(storeId);
-            payFeePo.setBatchId(batchId);
-            if (FeeDto.FEE_FLAG_ONCE.equals(tmpFeeConfigDto.getFeeFlag())) {
-                payFeePo.setState(FeeDto.STATE_FINISH);
-            } else {
-                payFeePo.setState(FeeDto.STATE_DOING);
-            }
-            payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
-            payFeePo.setPayerObjId(importRoomFee.getCarId());
-            payFeePo.setUserId(userId);
-            payFeePo.setCreateTime(importRoomFee.getCreateTime());
-            payFeePos = new ArrayList<>();
-            payFeePos.add(payFeePo);
-            feeInnerServiceSMOImpl.saveFee(payFeePos);
-            List<FeeAttrPo> feeAttrsPos = new ArrayList<>();
-            //鏌ヨ涓氫富淇℃伅
-            if (!FeeDto.FEE_FLAG_CYCLE.equals(tmpFeeConfigDto.getFeeFlag())) {
-                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME,
-                        importRoomFee.getEndTime()));
-            }
-            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_ID, importRoomFee.getOwnerId()));
-            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_LINK, importRoomFee.getOwnerLink()));
-            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_NAME, importRoomFee.getOwnerName()));
-            feeAttrInnerServiceSMOImpl.saveFeeAttrs(feeAttrsPos);
-            feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+            throw new IllegalArgumentException("涓嶅瓨鍦ㄥ搴旂殑缂磋垂璁板綍");
+//            PayFeePo payFeePo = new PayFeePo();
+//            payFeePo.setCommunityId(importRoomFee.getCommunityId());
+//            payFeePo.setConfigId(feeDto.getConfigId());
+//            payFeePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_CAR);
+//            payFeePo.setStartTime(importRoomFee.getStartTime());
+//            payFeePo.setEndTime(importRoomFee.getEndTime());
+//            payFeePo.setAmount(importRoomFee.getAmount());
+//            payFeePo.setFeeFlag(tmpFeeConfigDto.getFeeFlag());
+//            payFeePo.setFeeTypeCd(tmpFeeConfigDto.getFeeTypeCd());
+//            payFeePo.setIncomeObjId(storeId);
+//            payFeePo.setBatchId(batchId);
+//            if (FeeDto.FEE_FLAG_ONCE.equals(tmpFeeConfigDto.getFeeFlag())) {
+//                payFeePo.setState(FeeDto.STATE_FINISH);
+//            } else {
+//                payFeePo.setState(FeeDto.STATE_DOING);
+//            }
+//            payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
+//            payFeePo.setPayerObjId(importRoomFee.getCarId());
+//            payFeePo.setUserId(userId);
+//            payFeePo.setCreateTime(importRoomFee.getCreateTime());
+//            payFeePos = new ArrayList<>();
+//            payFeePos.add(payFeePo);
+//            feeInnerServiceSMOImpl.saveFee(payFeePos);
+//            List<FeeAttrPo> feeAttrsPos = new ArrayList<>();
+//            //鏌ヨ涓氫富淇℃伅
+//            if (!FeeDto.FEE_FLAG_CYCLE.equals(tmpFeeConfigDto.getFeeFlag())) {
+//                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME,
+//                        importRoomFee.getEndTime()));
+//            }
+//            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_ID, importRoomFee.getOwnerId()));
+//            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_LINK, importRoomFee.getOwnerLink()));
+//            feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_NAME, importRoomFee.getOwnerName()));
+//            feeAttrInnerServiceSMOImpl.saveFeeAttrs(feeAttrsPos);
+//            feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
         }
 
         for (FeeDto tmpFeeDto : feeDtos) {
@@ -191,6 +205,7 @@
         payFeeDetailPo.setPrimeRate("1.0");
         payFeeDetailPo.setFeeId(tmpFeeDto.getFeeId());
         payFeeDetailPo.setStartTime(importRoomFee.getStartTime());
+        importRoomFee.setPayObjId(payFeeDetailPo.getPayOrderId() != null ? importRoomFee.getPayObjId() : importRoomFee.getRoomId());
         String endTime = importRoomFee.getEndTime();
         //todo 鍛ㄦ湡鎬ц垂鐢ㄦ椂鏃堕棿鑷姩鍔犱竴澶╋紝鍥犱负鐗╀笟缁熻鐨凟xcel 涓�鑸皯涓�澶�
         if (!FeeDto.FEE_FLAG_ONCE.equals(tmpFeeDto.getFeeFlag())) {
@@ -207,6 +222,8 @@
         payFeeDetailPo.setState("1400");
         payFeeDetailPo.setCashierName(importRoomFee.getStaffName());
         payFeeDetailPo.setPayableAmount(importRoomFee.getAmount());
+        payFeeDetailPo.setPayOrderId(payFeeDetailPo.getPayOrderId() !=null ? payFeeDetailPo.getPayOrderId() : importRoomFee.getRoomId());
+        payFeeDetailPo.setbId(importRoomFee.getBatchId());
         int saved = feeDetailInnerServiceSMOImpl.saveFeeDetail(payFeeDetailPo);
 
         if (saved < 1) {
diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java
index a8d5cc2..b171883 100644
--- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java
+++ b/service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java
@@ -1,8 +1,12 @@
 package com.java110.job.importData.adapt;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.PropertyWhiteListFlowDto;
+import com.java110.dto.fee.ComputeDiscountDto;
 import com.java110.dto.fee.FeeAttrDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
@@ -11,6 +15,7 @@
 import com.java110.dto.owner.OwnerRoomRelDto;
 import com.java110.dto.room.RoomDto;
 import com.java110.dto.system.ComponentValidateResult;
+import com.java110.fee.api.FeeDiscountApi;
 import com.java110.intf.IImportPropertyWhiteListfFlowServiceSMO;
 import com.java110.intf.common.ICarInoutInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
@@ -25,19 +30,23 @@
 import com.java110.po.fee.PayFeeDetailPo;
 import com.java110.po.fee.PayFeePo;
 import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.DAOException;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
+import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 鎴垮眿缂磋垂淇℃伅瀵煎叆 閫傞厤鍣�
@@ -47,6 +56,8 @@
 @Service("importHistoryFeeDetailQueueData")
 public class ImportHistoryFeeDetailQueueDataAdapt extends DefaultImportData implements IImportDataAdapt {
 
+    @Autowired
+    private FeeDiscountApi feeDiscountApi;
 
     @Autowired
     private IImportFeeDetailInnerServiceSMO importFeeDetailInnerServiceSMOImpl;
@@ -78,6 +89,10 @@
     @Autowired
     private ICarInoutInnerServiceSMO carInoutInnerServiceSMOImpl;
 
+    @Autowired
+    private ImportCarHistoryFeeDetailQueueDataAdapt importCarHistoryFeeDetailQueueDataAdapt;
+
+
     @Override
     public void importData(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
         importDatas(assetImportLogDetailDtos);
@@ -86,6 +101,7 @@
     private void importDatas(List<AssetImportLogDetailDto> infos) {
 
         List<ImportRoomFee> importRoomFees = new ArrayList<>();
+        List<ImportRoomFee> importCarFees = new ArrayList<>();
         for (AssetImportLogDetailDto assetImportLogDetailDto : infos) {
             String communityId = assetImportLogDetailDto.getCommunityId();
             JSONObject data = JSONObject.parseObject(assetImportLogDetailDto.getContent());
@@ -93,9 +109,11 @@
             RoomDto roomDto = new RoomDto();
             roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
             roomDto.setCommunityId(communityId);
+//            List<String> roomTypes = Arrays.asList("浣忓畢鐗╀笟璐�","鍟嗛摵鐗╀笟璐�","缁翠慨鏀跺叆","缁翠慨鍩洪噾鏀跺叆","鐢佃垂鍙婄鐞嗚垂","浠f敹姘磋垂","鍚勭被鎶奸噾","绉熼噾鏀跺叆");
+            List<String> carTypes = Arrays.asList("涓存椂鍋滆溅璐�", "涓氫富浜ф潈杩囬亾鍋滆溅璐�", "灏忎笟涓讳骇鏉冭溅杈嗙鐞嗚垂","鍦颁笅鍋滆溅璐�","鍦伴潰鍋滆溅璐�");
+            List<String> contractTypes = Arrays.asList("鍨冨溇娓呰繍璐�","鍏朵粬鏀跺叆","琛ヨ创璐圭敤","鍦哄湴浣跨敤璐�","鐢垫骞垮憡锛堜笟濮斾細锛�","蹇�掓煖","鐢垫骞垮憡锛堣仈璁級","鎴夸骇涓粙","闈炴満鍔ㄨ溅绠$悊璐�","鍏朵粬骞垮憡");
             if(importRoomFee.getSecondaryFeeTypeCd()!= null && importRoomFee.getSecondaryFeeTypeCd().equals("涓存椂鍋滆溅璐�-鍏朵粬")){
                 CarInoutPo carInout = new CarInoutPo();
-                carInout.setbId(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("invoiceReceiptNo"));
                 carInout.setCommunityId(communityId);
                 carInout.setCarNum("A888888");
                 carInout.setVehicleType("temp");
@@ -103,9 +121,9 @@
                 carInout.setState("100300");
                 carInout.setInTime(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("chargeStart"));
                 carInout.setStatusCd("0");
-                carInout.setCreateTime(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("inputTime"));
 
-// 妫�鏌ラ噸澶嶄唬鐮�...
+                carInout.setCreateTime(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("inputTime"));
+                carInout.setbId(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("batchId"));
 
                 List<CarInoutPo> carInoutPos = new ArrayList<>();
                 carInout.setInoutId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId));
@@ -116,7 +134,7 @@
                     // 鍒涘缓鏂扮殑瀵硅薄锛岃�屼笉鏄慨鏀瑰凡娣诲姞鐨勫璞�
                     CarInoutPo exitCarInout = new CarInoutPo();
                     // 澶嶅埗鍩烘湰灞炴��
-                    exitCarInout.setbId(carInout.getbId());
+                    exitCarInout.setbId(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("batchId"));
                     exitCarInout.setCommunityId(carInout.getCommunityId());
                     exitCarInout.setCarNum(carInout.getCarNum());
                     exitCarInout.setVehicleType(carInout.getVehicleType());
@@ -139,10 +157,11 @@
                 }catch (Exception e){
 
                     updateImportLogDetailState(importRoomFee.getDetailId(),e);
+                    throw new IllegalArgumentException(e.getMessage());
                 }
                 updateImportLogDetailState(importRoomFee.getDetailId());
             }
-            else if(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("secondaryFeeTypeCd").contains("骞垮憡")){
+            else if(contractTypes.contains(importRoomFee.getSecondaryFeeTypeCd())){
                 List<RoomDto> roomDtos = iRoomInnerServiceSMOImpl.queryRooms(roomDto);
                 try {
                     importRoomFee.setRoomId(roomDtos.get(0).getRoomId());
@@ -168,8 +187,37 @@
                 importRoomFee.setStaffName(data.getString("charger"));
                 importRoomFee.setIsContractFee("O");
                 importRoomFee.setOpenInv(data.containsKey("invoiceReceiptNo") && data.getString("invoiceReceiptNo") != null ? "Y" : "N");
+                importRoomFee.setObjType("7777");
+                LocalDateTime startDate = LocalDateTime.parse(importRoomFee.getStartTime(), formatter);
+                LocalDateTime endDate = LocalDateTime.parse(importRoomFee.getEndTime(), formatter);
+                importRoomFee.setCycle(String.valueOf(ChronoUnit.MONTHS.between(startDate, endDate)));
 //            if(importRoomFee.getPayerObjName())
-                importRoomFees.add(importRoomFee);
+                importCarFees.add(importRoomFee);
+            }
+            else if(carTypes.contains(JSONObject.parseObject(infos.get(0).getContent()).get("category22"))){
+                List<RoomDto> roomDtos = iRoomInnerServiceSMOImpl.queryRooms(roomDto);
+                try {
+                    importRoomFee.setRoomId(roomDtos.get(0).getRoomId());
+                }catch (Exception e){
+                    updateImportLogDetailState(importRoomFee.getDetailId(),new IllegalArgumentException("璐圭敤椤�"+importRoomFee.getFeeName()+"涓嶅瓨鍦�"));
+                    throw new IllegalArgumentException("闂ㄥ鍙�"+importRoomFee.getDoorRoomNum()+"鏈煡璇㈠埌鎴垮眿");
+                }
+                importRoomFee.setFeeName(data.getString("secondaryFeeTypeCd"));
+                importRoomFee.setDetailId(assetImportLogDetailDto.getDetailId());
+                importRoomFee.setStartTime(data.getString("chargeStart"));
+                importRoomFee.setEndTime(data.getString("chargeEnd").split(" ")[0]+" 23:59:59");
+                importRoomFee.setCreateTime(data.getString("inputTime"));
+                importRoomFee.setReceivableAmount(data.getString("bankDepositAmount"));
+                importRoomFee.setAmount(data.getString("chargeAmount"));
+                importRoomFee.setCarNum(data.getString("licensePlate"));
+                importRoomFee.setStaffName(data.getString("charger"));
+                importRoomFee.setOpenInv(data.containsKey("invoiceReceiptNo") && data.getString("invoiceReceiptNo") != null ? "Y" : "N");
+//            if(importRoomFee.getPayerObjName())
+                importRoomFee.setObjType("6666");
+                LocalDateTime startDate = LocalDateTime.parse(importRoomFee.getStartTime(), formatter);
+                LocalDateTime endDate = LocalDateTime.parse(importRoomFee.getEndTime(), formatter);
+                importRoomFee.setCycle(String.valueOf(ChronoUnit.MONTHS.between(startDate, endDate)));
+                importCarFees.add(importRoomFee);
             }
             else{
                 List<RoomDto> roomDtos = iRoomInnerServiceSMOImpl.queryRooms(roomDto);
@@ -180,14 +228,6 @@
                     throw new IllegalArgumentException("闂ㄥ鍙�"+importRoomFee.getDoorRoomNum()+"鏈煡璇㈠埌鎴垮眿");
                 }
                 importRoomFee.setFeeName(data.getString("secondaryFeeTypeCd"));
-                FeeDto feeDto = new FeeDto();
-                feeDto.setFeeName(importRoomFee.getFeeName());
-                List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-                if(feeDtos.size() == 0){
-                    updateImportLogDetailState(importRoomFee.getDetailId(),new IllegalArgumentException("璐圭敤椤�"+importRoomFee.getFeeName()+"涓嶅瓨鍦�"));
-                    throw new IllegalArgumentException("璐圭敤椤�"+importRoomFee.getFeeName()+"涓嶅瓨鍦�");
-                }
-
                 importRoomFee.setDetailId(assetImportLogDetailDto.getDetailId());
                 importRoomFee.setStartTime(data.getString("chargeStart"));
                 importRoomFee.setEndTime(data.getString("chargeEnd").split(" ")[0]+" 23:59:59");
@@ -201,17 +241,21 @@
             }
         }
 
-        if (ListUtil.isNull(importRoomFees)) {
+        if (ListUtil.isNull(importRoomFees) && ListUtil.isNull(importCarFees)) {
             return;
         }
 
-        importFeeDetails(importRoomFees.get(0).getStoreId(), importRoomFees.get(0).getUserId(), importRoomFees, importRoomFees.get(0).getBatchId());
-//        ImportCarHistoryFeeDetailQueueDataAdapt importCarHistoryFeeDetailQueueDataAdapt = new ImportCarHistoryFeeDetailQueueDataAdapt();
-//        importCarHistoryFeeDetailQueueDataAdapt.importCarFeeDetails(importRoomFees.get(0).getStoreId(), importRoomFees.get(0).getUserId(), importRoomFees, importRoomFees.get(0).getBatchId());
+        if(!(ListUtil.isNull(importRoomFees))){
+            importFeeDetails(importRoomFees.get(0).getStoreId(), importRoomFees.get(0).getUserId(), importRoomFees, importRoomFees.get(0).getBatchId());
+        }
+        if(!(ListUtil.isNull(importCarFees))){
+            importCarHistoryFeeDetailQueueDataAdapt.importCarFeeDetails(importCarFees.get(0).getStoreId(), importCarFees.get(0).getUserId(), importCarFees, importCarFees.get(0).getBatchId());
+        }
 //
 //
 
     }
+
 
     private void importFeeDetails(String storeId, String userId, List<ImportRoomFee> importRoomFees, String batchId) {
 
@@ -231,6 +275,7 @@
                     continue;
                 }
                 importFeeDetail(importRoomFee, storeId, userId, batchId);
+//                feeDiscountApi
                 updateImportLogDetailState(importRoomFee.getDetailId());
             } catch (Exception e) {
                 e.printStackTrace();
@@ -238,6 +283,8 @@
             }
         }
     }
+
+
 
     DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 
@@ -254,7 +301,7 @@
         List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
 
         if (ListUtil.isNull(feeConfigDtos)) {
-            return;
+            throw new IllegalArgumentException("鏀惰垂椤逛笉瀛樺湪");
         }
 
         FeeConfigDto tmpFeeConfigDto = feeConfigDtos.get(0);
@@ -263,59 +310,63 @@
         feeDto.setConfigId(tmpFeeConfigDto.getConfigId());
         feeDto.setCommunityId(importRoomFee.getCommunityId());
         feeDto.setPayerObjId(importRoomFee.getRoomId());
-        feeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
+        feeDto.setPayerObjType(importRoomFee.getObjType() ==null?FeeDto.PAYER_OBJ_TYPE_ROOM:importRoomFee.getObjType());
+        feeDto.setFeeTypeCd(feeConfigDtos.get(0).getFeeTypeCd());
+        feeDto.setConfigId(tmpFeeConfigDto.getConfigId());
         // 瑙f瀽鏃ユ湡瀛楃涓�
         LocalDateTime startDate = LocalDateTime.parse(importRoomFee.getStartTime(), formatter);
         LocalDateTime endDate = LocalDateTime.parse(importRoomFee.getEndTime(), formatter);
         importRoomFee.setCycle(String.valueOf(ChronoUnit.MONTHS.between(startDate, endDate)));
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-
-        List<PayFeePo> payFeePos = null;
+        importRoomFee.setPayObjId(importRoomFee.getRoomId());
         if (ListUtil.isNull(feeDtos)) {
-            List<FeeAttrPo> feeAttrsPos = new ArrayList<>();
-            PayFeePo payFeePo = new PayFeePo();
-            payFeePo.setCommunityId(importRoomFee.getCommunityId());
-            payFeePo.setConfigId(feeDto.getConfigId());
-            payFeePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
-            payFeePo.setStartTime(importRoomFee.getStartTime());
-            payFeePo.setEndTime(DateUtil.getNextSecTime(importRoomFee.getEndTime()));
-            payFeePo.setAmount(importRoomFee.getAmount());
-            payFeePo.setFeeFlag(tmpFeeConfigDto.getFeeFlag());
-            payFeePo.setFeeTypeCd(tmpFeeConfigDto.getFeeTypeCd());
-            payFeePo.setIncomeObjId(storeId);
-            payFeePo.setBatchId(batchId);
-            if (FeeDto.FEE_FLAG_ONCE.equals(tmpFeeConfigDto.getFeeFlag())) {
-                payFeePo.setState(FeeDto.STATE_FINISH);
-            } else {
-                payFeePo.setState(FeeDto.STATE_DOING);
-            }
-            payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
-            payFeePo.setPayerObjId(importRoomFee.getRoomId());
-            payFeePo.setUserId(userId);
-            payFeePo.setCreateTime(importRoomFee.getCreateTime());
-            payFeePos = new ArrayList<>();
-            payFeePos.add(payFeePo);
-            feeInnerServiceSMOImpl.saveFee(payFeePos);
-
-            //鏌ヨ涓氫富淇℃伅
-            OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
-            ownerRoomRelDto.setRoomId(importRoomFee.getRoomId());
-            List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-            if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() > 0) {
-                if (!FeeDto.FEE_FLAG_CYCLE.equals(tmpFeeConfigDto.getFeeFlag())) {
-                    feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME,
-                            importRoomFee.getEndTime()));
-                }
-                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_ID, ownerRoomRelDtos.get(0).getOwnerId()));
-                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_LINK, ownerRoomRelDtos.get(0).getLink()));
-                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_NAME, ownerRoomRelDtos.get(0).getOwnerName()));
-                feeAttrInnerServiceSMOImpl.saveFeeAttrs(feeAttrsPos);
-            }
-
-
-            feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+            throw new IllegalArgumentException("鏌ヨ涓嶅埌璇ヨ褰曠殑璐圭敤椤癸細"+importRoomFee.getFeeName()+startDate+endDate);
+//            List<FeeAttrPo> feeAttrsPos = new ArrayList<>();
+//            PayFeePo payFeePo = new PayFeePo();
+//            payFeePo.setCommunityId(importRoomFee.getCommunityId());
+//            payFeePo.setConfigId(feeDto.getConfigId());
+//            payFeePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
+//            payFeePo.setStartTime(importRoomFee.getStartTime());
+//            payFeePo.setEndTime(DateUtil.getNextSecTime(importRoomFee.getEndTime()));
+//            payFeePo.setAmount(importRoomFee.getAmount());
+//            payFeePo.setFeeFlag(tmpFeeConfigDto.getFeeFlag());
+//            payFeePo.setFeeTypeCd(tmpFeeConfigDto.getFeeTypeCd());
+//            payFeePo.setIncomeObjId(storeId);
+//            payFeePo.setBatchId(batchId);
+//            if (FeeDto.FEE_FLAG_ONCE.equals(tmpFeeConfigDto.getFeeFlag())) {
+//                payFeePo.setState(FeeDto.STATE_FINISH);
+//            } else {
+//                payFeePo.setState(FeeDto.STATE_DOING);
+//            }
+//            payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
+//            payFeePo.setPayerObjId(importRoomFee.getRoomId());
+//            payFeePo.setUserId(userId);
+//            payFeePo.setCreateTime(importRoomFee.getCreateTime());
+//            payFeePos = new ArrayList<>();
+//            payFeePos.add(payFeePo);
+//            feeInnerServiceSMOImpl.saveFee(payFeePos);
+//
+//            //鏌ヨ涓氫富淇℃伅
+//            OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
+//            ownerRoomRelDto.setRoomId(importRoomFee.getRoomId());
+//            List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
+//            if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() > 0) {
+//                if (!FeeDto.FEE_FLAG_CYCLE.equals(tmpFeeConfigDto.getFeeFlag())) {
+//                    feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME,
+//                            importRoomFee.getEndTime()));
+//                }
+//                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_ID, ownerRoomRelDtos.get(0).getOwnerId()));
+//                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_LINK, ownerRoomRelDtos.get(0).getLink()));
+//                feeAttrsPos.add(addFeeAttr(payFeePo, FeeAttrDto.SPEC_CD_OWNER_NAME, ownerRoomRelDtos.get(0).getOwnerName()));
+//                feeAttrInnerServiceSMOImpl.saveFeeAttrs(feeAttrsPos);
+//            }
+//
+//
+//            feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
         }
-
+        if(feeDtos.size()>1){
+            throw new IllegalArgumentException("璇ュ垵濮嬪寲缂磋垂璁板綍淇℃伅涓寘鍚涓垂鐢ㄨ褰�"+importRoomFee.getFeeName()+startDate+endDate);
+        }
         for (FeeDto tmpFeeDto : feeDtos) {
             doImportFeeDetail(tmpFeeDto, importRoomFee);
         }
@@ -351,13 +402,32 @@
         payFeeDetailPo.setState("1400");
         payFeeDetailPo.setCashierName(importRoomFee.getStaffName());
         payFeeDetailPo.setPayableAmount(importRoomFee.getAmount());
-
+        payFeeDetailPo.setPayOrderId(importRoomFee.getPayObjId());
         int count = feeDetailInnerServiceSMOImpl.queryFeeDetailsCountByVo(payFeeDetailPo);
+
+
 
         if (count > 0) {
             throw new IllegalStateException("閲嶅鐨勭即璐硅褰�");
         }
 
+        try {
+            ResponseEntity<String> resultVo = feeDiscountApi.computeFeeDiscount(tmpFeeDto.getFeeId(), tmpFeeDto.getCommunityId(), Double.parseDouble(importRoomFee.getCycle()), importRoomFee.getPayObjId(),
+                    tmpFeeDto.getPayerObjType(), importRoomFee.getEndTime(), importRoomFee.getEndTime(), importRoomFee.getStartTime(), 1, 20);
+
+// 2. 浠� ResultVo 涓幏鍙� data 骞跺己杞负鐩爣绫诲瀷
+            if (resultVo != null) {
+                // 鍋囪 data 瀛楁瀛樺偍鐨勬槸 List<ComputeDiscountDto>
+                JSONArray data = (JSONArray) JSONObject.parseObject(resultVo.getBody()).get("data");
+                JSONObject o = (JSONObject) data.get(0);
+                String discountPrice = o.get("discountPrice").toString();
+                String discountId =  o.get("discountId").toString();
+            }
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+
+
         payFeeDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
         if(importRoomFee.getOpenInv() != null){
             payFeeDetailPo.setOpenInvoice(importRoomFee.getOpenInv());
diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java
index 54b6179..7460432 100644
--- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java
+++ b/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java
@@ -267,12 +267,12 @@
             payFeePo.setContractFee(contractDtos.get(0).getContractId());
 //            payFeePo.setCreateTime(importFeeDetailPo.getC);
             ContractPartyaDto contractPartyaDto = new ContractPartyaDto();
-            if(importRoomFee.getPayerObjName() == null || Objects.equals(importRoomFee.getPayerObjName(), "")){
-                contractPartyaDto.setPartyA(importRoomFee.getPayerObjName());
-            }
-            else{
+            if(importRoomFee.getPayerObjName() == null || Objects.equals(importRoomFee.getPayerObjName(), "")){//褰撴病鍐欏叆涓讳綋鏃�
                 contractPartyaDto.setPartyaId(contractDtos.get(0).getbPartyaId());
             }
+            else{//鍐欏叆浜�
+                contractPartyaDto.setPartyA(importRoomFee.getPayerObjName());
+            }
             List<ContractPartyaDto> contractPartyaDtos = iContractPartyaInnerServiceSMO.queryContractPartyas(contractPartyaDto);
             if (ListUtil.isNull(contractPartyaDtos)) {
                 throw new IllegalArgumentException("涓嶅瓨鍦ㄥ悎鍚屼富浣擄細"+importRoomFee.getPayerObjName());
diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/AuthOwnerCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/AuthOwnerCmd.java
index 13a3d46..b42583e 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/AuthOwnerCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/AuthOwnerCmd.java
@@ -70,7 +70,7 @@
         Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖�");
         Assert.hasKeyAndValue(reqJson, "roomName", "鏈寘鍚埧灞�");
         Assert.hasKeyAndValue(reqJson, "roomId", "鏈寘鍚埧灞�");
-        Assert.hasKeyAndValue(reqJson, "link", "鏈寘鍚墜鏈哄彿");
+        Assert.hasKeyAndValue(reqJson, "link", "鎵嬫満鍙蜂笉鑳戒负绌�");
 //        Assert.hasKeyAndValue(reqJson, "ownerName", "鏈寘鍚汉鍛樺悕绉�");
         Assert.hasKeyAndValue(reqJson, "ownerTypeCd", "鏈寘鍚汉鍛樼被鍨�");
 
diff --git a/springboot/src/main/java/com/java110/boot/BootApplicationStart.java b/springboot/src/main/java/com/java110/boot/BootApplicationStart.java
index dc41267..9f97eac 100644
--- a/springboot/src/main/java/com/java110/boot/BootApplicationStart.java
+++ b/springboot/src/main/java/com/java110/boot/BootApplicationStart.java
@@ -208,7 +208,7 @@
             Environment.setSystemStartWay(Environment.SPRING_BOOT);
 
             //鍒锋柊缂撳瓨
-//            flushMainCache(args);
+            flushMainCache(args);
 
             //鏈嶅姟鍚姩瀹屾垚
             ServiceStartInit.printStartSuccessInfo();

--
Gitblit v1.8.0