From 0b3ff378a9faaf9d7a4831b7f0de67378fe0dfea Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:20:15 +0800
Subject: [PATCH] optimize 统计

---
 java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml | 1426 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 1,127 insertions(+), 299 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
index e1c92f7..9b7580d 100755
--- a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -6,13 +6,18 @@
 
     <!-- 淇濆瓨璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <insert id="saveReportFeeMonthStatisticsInfo" parameterType="Map">
-        insert into report_fee_month_statistics(
-        receivable_amount,statistics_id,update_time,remark,obj_name,received_amount,fee_year,fee_month,fee_id,config_id,
-        obj_id,fee_name,owe_amount,community_id,fee_create_time,obj_type,deadline_time,cur_max_time
-        ) values (
-        #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
-        #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime},#{curMaxTime}
-        )
+        insert into report_fee_month_statistics(receivable_amount, statistics_id, update_time, remark, obj_name,
+        received_amount, fee_year, fee_month, fee_id, config_id,
+        obj_id, fee_name, owe_amount, community_id, fee_create_time, obj_type,
+        deadline_time, cur_max_time,
+        his_owe_amount, cur_receivable_amount, cur_received_amount,
+        his_owe_received_amount, pre_received_amount, obj_name_num)
+        values (#{receivableAmount}, #{statisticsId}, #{updateTime}, #{remark}, #{objName}, #{receivedAmount},
+        #{feeYear}, #{feeMonth},
+        #{feeId}, #{configId}, #{objId}, #{feeName}, #{oweAmount}, #{communityId}, #{feeCreateTime}, #{objType},
+        #{deadlineTime}, #{curMaxTime},
+        #{hisOweAmount}, #{curReceivableAmount}, #{curReceivedAmount}, #{hisOweReceivedAmount},
+        #{preReceivedAmount}, #{objNameNum})
     </insert>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
@@ -23,7 +28,10 @@
         feeYear,t.fee_month,t.fee_month feeMonth,t.fee_id,t.fee_id feeId,t.config_id,t.config_id
         configId,t.obj_id,t.obj_id objId,t.fee_name,t.fee_name feeName,t.owe_amount,t.owe_amount
         oweAmount,t.community_id,t.community_id communityId,t.fee_create_time,t.fee_create_time
-        feeCreateTime,t.obj_type,t.obj_type objType,t.cur_max_time curMaxTime
+        feeCreateTime,t.obj_type,t.obj_type objType,t.cur_max_time curMaxTime,
+        t.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,t.cur_received_amount
+        curReceivedAmount,t.obj_name_num,t.obj_name_num objNameNum,
+        t.his_owe_received_amount hisOweReceivedAmount,t.pre_received_amount preReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where 1 =1
@@ -44,6 +52,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num = #{objNameNum}
         </if>
         <if test="receivedAmount !=null and receivedAmount != ''">
             and t.received_amount= #{receivedAmount}
@@ -100,6 +111,7 @@
         </if>
     </update>
 
+
     <!-- 淇敼璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <update id="updateReportFeeMonthStatisticsInfo" parameterType="Map">
         update report_fee_month_statistics t set t.status_cd = #{statusCd}
@@ -120,6 +132,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             , t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            , t.obj_name_num= #{objNameNum}
         </if>
         <if test="receivedAmount !=null and receivedAmount != ''">
             , t.received_amount= #{receivedAmount}
@@ -145,20 +160,52 @@
         <if test="oweAmount !=null and oweAmount != ''">
             , t.owe_amount= #{oweAmount}
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
         <if test="feeCreateTime !=null and feeCreateTime != ''">
             , t.fee_create_time= #{feeCreateTime}
         </if>
         <if test="objType !=null and objType != ''">
             , t.obj_type= #{objType}
         </if>
+        <if test="hisOweAmount !=null and hisOweAmount != ''">
+            , t.his_owe_amount= #{hisOweAmount}
+        </if>
+        <if test="curReceivableAmount !=null and curReceivableAmount != ''">
+            , t.cur_receivable_amount= #{curReceivableAmount}
+        </if>
+        <if test="curReceivedAmount !=null and curReceivedAmount != ''">
+            , t.cur_received_amount= #{curReceivedAmount}
+        </if>
+        <if test="hisOweReceivedAmount !=null and hisOweReceivedAmount != ''">
+            , t.his_owe_received_amount= #{hisOweReceivedAmount}
+        </if>
+        <if test="preReceivedAmount !=null and preReceivedAmount != ''">
+            , t.pre_received_amount= #{preReceivedAmount}
+        </if>
+        where 1=1
+        and t.statistics_id= #{statisticsId}
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+    </update>
+
+    <!-- 淇敼璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <update id="deleteReportFeeMonthStatisticsInfo" parameterType="Map">
+        update report_fee_month_statistics t set t.status_cd = '1'
         where 1=1
         <if test="statisticsId !=null and statisticsId != ''">
             and t.statistics_id= #{statisticsId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
     </update>
+
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁℃暟閲� add by wuxw 2018-07-03 -->
     <select id="queryReportFeeMonthStatisticssCount" parameterType="Map" resultType="Map">
@@ -183,6 +230,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="receivedAmount !=null and receivedAmount != ''">
             and t.received_amount= #{receivedAmount}
@@ -236,11 +286,20 @@
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitIds !=null ">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -254,6 +313,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -263,10 +328,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_year,t.fee_month
@@ -275,9 +340,15 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
-        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.fee_year feeYear,t.fee_month feeMonth,max(t.create_time) createTime
+        <if test="configIds !=null">
+            ,t.config_id configId
+        </if>
+        ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount)
+        receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
         from report_fee_month_statistics t
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -290,11 +361,20 @@
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitIds !=null ">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -308,6 +388,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -317,13 +403,154 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_year,t.fee_month
+        <if test="configIds !=null">
+            ,t.config_id
+        </if>
+        order by CONVERT(t.fee_month,SIGNED),CONVERT(t.fee_year,SIGNED) desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <select id="queryReportFeeSummaryDetailCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from report_fee_month_statistics t
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="unitIds !=null ">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="queryReportFeeSummaryDetail" parameterType="Map" resultType="Map">
+        select t.obj_name objName,t.fee_name feeName,t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        ,t.config_id configId,t.obj_name_num objNameNum,t.his_owe_amount hisOweAmount,t.cur_receivable_amount
+        curReceivableAmount,t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
+        hisOweReceivedAmount,t.pre_received_amount preReceivedAmount,
+        t.update_time updateTime,t.his_owe_amount+t.cur_receivable_amount
+        receivableAmount,t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount receivedAmount
+        from report_fee_month_statistics t
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="unitIds !=null ">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -331,9 +558,9 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� 澶ц add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummaryMajor" parameterType="Map" resultType="Map">
-        select SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        select
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        sum(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -346,11 +573,20 @@
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitIds !=null ">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -364,6 +600,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -373,10 +615,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -403,6 +645,9 @@
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
         </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
         </if>
@@ -415,6 +660,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -424,10 +675,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
@@ -436,15 +687,21 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
-        select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,t.create_time
-        createTime,
-        SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,max(t.update_time)
+        updateTime
+        <if test="configIds !=null">
+            ,t.config_id configId
+        </if>
+        ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
         from report_fee_month_statistics t
         INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
         inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -458,6 +715,9 @@
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
         </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
         </if>
@@ -470,6 +730,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -479,13 +745,153 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
+        <if test="configIds !=null">
+            ,t.config_id
+        </if>
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <select id="queryReportFloorUnitFeeSummaryDetailCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from report_fee_month_statistics t
+        INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+        inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="queryReportFloorUnitFeeSummaryDetail" parameterType="Map" resultType="Map">
+        select t.obj_name objName,t.fee_name feeName,t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        ,t.config_id configId,t.obj_name_num objNameNum,t.his_owe_amount hisOweAmount,t.cur_receivable_amount
+        curReceivableAmount,t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
+        hisOweReceivedAmount,t.pre_received_amount preReceivedAmount,
+        t.update_time updateTime,t.his_owe_amount+t.cur_receivable_amount receivableAmount,
+        t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount receivedAmount
+        from report_fee_month_statistics t
+        INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+        inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -494,9 +900,8 @@
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFloorUnitFeeSummaryMajor" parameterType="Map" resultType="Map">
         select
-        SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        sum(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
         inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -514,6 +919,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -536,20 +944,22 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
 
+    <!--
+    and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+    -->
     <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
         select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time
-        createTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        createTime
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -558,7 +968,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -570,6 +980,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -595,21 +1008,30 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
         </if>
-        group by t.config_id,t.fee_name,pfc.start_time
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
+        </if>
+        group by t.fee_name ,td.name ,pfc.fee_type_cd,pfc.start_time ,t.create_time
         ) t
     </select>
 
-    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03
+     and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+     -->
     <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
-        select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeStartTime,pfc.end_time
-        feeEndTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,t.config_id configId,SUM(t.his_owe_amount)
+        hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,max(t.update_time)
+        updateTime
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -618,7 +1040,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -630,6 +1052,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -655,23 +1080,24 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
         </if>
-        group by t.config_id,t.fee_name,pfc.start_time
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
+        </if>
+        group by t.fee_name,td.name ,pfc.fee_type_cd,t.config_id ,t.create_time
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
     </select>
-    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
-    <select id="queryFeeBreakdownMajor" parameterType="Map" resultType="Map">
-        select SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+
+    <select id="queryFeeBreakdownDetailCount" parameterType="Map" resultType="Map">
+        select count(1) count
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -680,7 +1106,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -692,6 +1118,9 @@
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
@@ -717,11 +1146,156 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
+        </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03
+     and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+     -->
+    <select id="queryFeeBreakdownDetail" parameterType="Map" resultType="Map">
+        select t.obj_name objName,t.fee_name feeName,t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        ,t.config_id configId,t.his_owe_amount hisOweAmount,t.obj_name_num objNameNum,t.cur_receivable_amount
+        curReceivableAmount,t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
+        hisOweReceivedAmount,t.pre_received_amount preReceivedAmount,
+        t.update_time updateTime,t.his_owe_amount+t.cur_receivable_amount receivableAmount,
+        t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount receivedAmount,t.update_time
+        updateTime
+        from report_fee_month_statistics t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
+        td.table_columns='fee_type_cd'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and pfc.config_id= #{configId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="feeTypeCd != null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and pfc.start_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and pfc.start_time &lt;= #{endTime}
+        </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0 -->
+    <select id="queryFeeBreakdownMajor" parameterType="Map" resultType="Map">
+        select
+        SUM(t.his_owe_amount + t.cur_receivable_amount) allReceivableAmount,
+        SUM(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        if(SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount) &lt; 0,0,
+        SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount))
+        allOweAmount,
+        SUM(t.his_owe_received_amount) allHisOweReceivedAmount
+        from report_fee_month_statistics t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
+        td.table_columns='fee_type_cd'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and pfc.config_id= #{configId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="feeTypeCd != null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and pfc.start_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and pfc.start_time &lt;= #{endTime}
+        </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
         </if>
         order by t.create_time desc
     </select>
@@ -749,6 +1323,9 @@
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
         </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
         </if>
@@ -770,11 +1347,14 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
-            and t.create_time &gt;= #{startTime}
+        <if test="startTime !=null and startTime != ''">
+            and t.fee_create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
-            and t.create_time &lt;= #{endTime}
+        <if test="endTime !=null and endTime != ''">
+            and t.deadline_time &lt;= #{endTime}
+        </if>
+        <if test="feeTypeCd !=null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
         </if>
         group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
         ) t
@@ -782,16 +1362,25 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryFeeDetail" parameterType="Map" resultType="Map">
-        select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.deadline_time
-        deadlineTime,t.create_time createTime,SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.config_id configId,t.obj_id objId,t.obj_name objName,t.obj_type objType,t.fee_name
+        feeName,t.fee_create_time feeCreateTime,pfa.`value`
+        ownerName,br.built_up_area builtUpArea ,max(t.deadline_time)
+        deadlineTime,max(t.create_time) createTime,max(t.update_time) updateTime,SUM(t.his_owe_amount)
+        hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,
+        t.obj_type objType,t.obj_name_num objNameNum
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >=0 and t.receivable_amount >= 0
+        left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
+        where t.status_cd = '0'
+
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -804,6 +1393,9 @@
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
         </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
         </if>
@@ -825,13 +1417,17 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
-            and t.create_time &gt;= #{startTime}
+        <if test="startTime !=null and startTime != ''">
+            and t.fee_create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
-            and t.create_time &lt;= #{endTime}
+        <if test="endTime !=null and endTime != ''">
+            and t.deadline_time &lt;= #{endTime}
         </if>
-        group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
+        <if test="feeTypeCd !=null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
+        group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_type,t.obj_name,pfa.`value`,br.built_up_area
+        order by pfa.`value`
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -839,8 +1435,14 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryAllFeeDetail" parameterType="Map" resultType="Map">
-        select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount,
-        SUM(t.owe_amount) allOweAmount from report_fee_month_statistics t
+        select
+        SUM(t.his_owe_amount + t.cur_receivable_amount) allReceivableAmount,
+        SUM(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        if(SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount) &lt; 0,0,
+        SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount))
+        allOweAmount,
+        SUM(t.his_owe_received_amount) allHisOweReceivedAmount
+        from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -859,6 +1461,9 @@
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
         </if>
+        <if test="objNameNum != null and objNameNum != ''">
+            and t.obj_name_num= #{objNameNum}
+        </if>
         <if test="feeYear !=null and feeYear != ''">
             and t.fee_year= #{feeYear}
         </if>
@@ -880,11 +1485,11 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
-            and t.create_time &gt;= #{startTime}
+        <if test="startTime !=null and startTime != ''">
+            and t.fee_create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
-            and t.create_time &lt;= #{endTime}
+        <if test="endTime !=null and endTime != ''">
+            and t.deadline_time &lt;= #{endTime}
         </if>
     </select>
 
@@ -927,27 +1532,30 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
-        group by t.fee_name,t.payer_obj_id,t.payer_obj_name
+        and t.amount_owed > 0 and pf.end_time &lt; now()
+        group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.create_time
         HAVING oweAmount > 0
         ) t
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
-        select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.create_time
-        createTime,SUM(t.amount_owed) oweAmount,max(t.deadline_time) deadlineTime
+        select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time updateTime,
+        pfa.`value` ownerName,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
+        deadlineTime
         from report_owe_fee t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
         where 1=1
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -955,8 +1563,14 @@
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
         </if>
         <if test="objName !=null and objName != ''">
             and t.payer_obj_name= #{objName}
@@ -976,14 +1590,16 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
-        group by t.fee_name,t.payer_obj_id,t.payer_obj_name
+        and t.amount_owed > 0 and pf.end_time &lt; now()
+        group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.update_time,pfa.`value` ,br.built_up_area
         HAVING oweAmount > 0
+        order by t.payer_obj_name
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -1025,10 +1641,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -1041,31 +1657,34 @@
         t.receivable_amount receivableAmount,t.received_amount receivedAmount,d.name,d2.name feeTypeCdName,
         pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName
         from pay_fee_detail t
-        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
+        left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
         left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
         d.table_columns="prime_rate"
         left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
         = "fee_type_cd"
         left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
         "state"
-        where t.status_cd = '0'
+        where t.status_cd = '0' and pf.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
@@ -1083,7 +1702,7 @@
             and pfc.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
+            and pf.payer_obj_id= #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
             and t.fee_name= #{feeName}
@@ -1100,31 +1719,43 @@
         <if test="feeTypeCd != null and feeTypeCd != ''">
             and pfc.fee_type_cd = #{feeTypeCd}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
+        </if>
+        <if test="cashierId !=null and cashierId != ''">
+            and t.cashier_id= #{cashierId}
+        </if>
+        <if test="cashierName !=null and cashierName != ''">
+            and t.cashier_name= #{cashierName}
         </if>
         ) t
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
+        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area
+        builtUpArea ,oc.car_num carNum,
         pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
         t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
         importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
         ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
-        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId
+        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
+        t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'鍋滆溅鍦�',ps.num,'杞︿綅') psName,
+        fad.amount withholdAmount,t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount payableAmount
         from pay_fee_detail t
-        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
+        left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
+        LEFT JOIN parking_space ps on oc.ps_id = ps.ps_id and ps.status_cd = '0'
+        left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
+        left join pay_fee_attrs pfb on t.fee_id = pfb.fee_id and pfb.spec_cd = '390007'
         left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
         left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
         left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
@@ -1138,15 +1769,24 @@
         "state"
         LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
         LEFT JOIN c_business cb on t.b_id = cb.b_id
+        left join fee_account_detail fad on t.detail_id = fad.detail_id and t.community_id = fad.community_id and
+        fad.status_cd = '0' and fad.state = '1002'
         where t.status_cd = '0'
+        and pf.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
@@ -1164,7 +1804,7 @@
             and pfc.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
+            and pf.payer_obj_id = #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
             and t.fee_name= #{feeName}
@@ -1181,11 +1821,17 @@
         <if test="feeTypeCd != null and feeTypeCd != ''">
             and pfc.fee_type_cd = #{feeTypeCd}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
+        </if>
+        <if test="cashierId !=null and cashierId != ''">
+            and t.cashier_id= #{cashierId}
+        </if>
+        <if test="cashierName !=null and cashierName != ''">
+            and t.cashier_name= #{cashierName}
         </if>
         order by t.create_time desc
         <if test="page != -1 and page != null ">
@@ -1196,22 +1842,28 @@
     <select id="queryAllPayFeeDetail" parameterType="Map" resultType="Map">
         select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount
         from pay_fee_detail t
-        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
+        left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
-        where t.status_cd = '0' and t.state not in ('1100','1300')
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
@@ -1229,7 +1881,7 @@
             and pfc.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
+            and pf.payer_obj_id= #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
             and t.fee_name= #{feeName}
@@ -1240,10 +1892,10 @@
         <if test="primeRate != null and primeRate != ''">
             and t.prime_rate = #{primeRate}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -1256,8 +1908,8 @@
         ruleName,pfdd.discount_price,
         SUM(pfdd.discount_price) discountPrice
         from pay_fee_detail t
-        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
+        left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
@@ -1268,15 +1920,21 @@
         left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
         left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
         d.table_columns="prime_rate"
-        where t.status_cd = '0' and t.state not in ('1100','1300')
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="unitId !=null and unitId != ''">
             and bu.unit_id= #{unitId}
         </if>
+        <if test="unitNum !=null and unitNum != ''">
+            and bu.unit_num= #{unitNum}
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.floor_id = #{floorId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+            and f.floor_num = #{floorNum}
         </if>
         <if test="objName !=null and objName != ''">
             and t.obj_name= #{objName}
@@ -1294,7 +1952,7 @@
             and pfc.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
+            and pf.payer_obj_id= #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
             and t.fee_name= #{feeName}
@@ -1305,125 +1963,79 @@
         <if test="primeRate != null and primeRate != ''">
             and t.prime_rate = #{primeRate}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
-        group by fdr.discount_small_type
+        group by pfc.fee_name,f.floor_num,bu.unit_num ,br.room_num ,oc.car_num ,
+        pf.payer_obj_type ,t.start_time ,t.end_time ,t.create_time ,
+        t.receivable_amount ,t.received_amount ,pfa.`value`
+        ,t.prime_rate,d.name ,fdr.discount_small_type ,fdr.rule_name,pfdd.discount_price
         order by t.create_time desc
     </select>
 
     <select id="queryDeadlineFeeCount" parameterType="Map" resultType="Map">
         select count(1) count
-        from (
-        SELECT
-        t.obj_name objName,
-        t.fee_name feeName,
-        t.deadline_time deadlineTime
-        FROM
-        report_fee_month_statistics t
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0'
-        <if test="roomNum !=null and roomNum != ''">
-            and br.room_num= #{roomNum}
-        </if>
-        <if test="unitId !=null and unitId != ''">
-            and bu.unit_id= #{unitId}
-        </if>
-        <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
+        from pay_fee_detail_month t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where 1=1
+        and t.detail_id = '-1'
+        <if test="configId !=null and configId != ''">
+            and t.config_id = #{configId}
         </if>
         <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
+            and t.obj_name like CONCAT('%',#{objName},'%')
         </if>
-        <if test="feeYear !=null and feeYear != ''">
-            and t.fee_year= #{feeYear}
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name like CONCAT('%',#{ownerName},'%')
         </if>
-        <if test="feeMonth !=null and feeMonth != ''">
-            and t.fee_month= #{feeMonth}
-        </if>
-        <if test="feeId !=null and feeId != ''">
-            and t.fee_id= #{feeId}
-        </if>
-        <if test="configId !=null and configId != ''">
-            and t.config_id= #{configId}
-        </if>
-        <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
-        </if>
-        <if test="feeName !=null and feeName != ''">
-            and t.fee_name= #{feeName}
+        <if test="link !=null and link != ''">
+            and t.link = #{link}
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime !=''">
             and t.deadline_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.deadline_time &lt;= #{endTime}
         </if>
-        ) t
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryDeadlineFee" parameterType="Map" resultType="Map">
-        SELECT
+
+        select
         t.obj_name objName,
+        pf.payer_obj_type objType,
         t.fee_name feeName,
         t.deadline_time deadlineTime
-        FROM
-        report_fee_month_statistics t
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-
-        where t.status_cd = '0'
-        <if test="roomNum !=null and roomNum != ''">
-            and br.room_num= #{roomNum}
-        </if>
-        <if test="unitId !=null and unitId != ''">
-            and bu.unit_id= #{unitId}
-        </if>
-        <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
+        from pay_fee_detail_month t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where 1=1
+        and t.detail_id = '-1'
+        <if test="configId !=null and configId != ''">
+            and t.config_id = #{configId}
         </if>
         <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
+            and t.obj_name like CONCAT('%',#{objName},'%')
         </if>
-        <if test="feeYear !=null and feeYear != ''">
-            and t.fee_year= #{feeYear}
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name like CONCAT('%',#{ownerName},'%')
         </if>
-        <if test="feeMonth !=null and feeMonth != ''">
-            and t.fee_month= #{feeMonth}
-        </if>
-        <if test="feeId !=null and feeId != ''">
-            and t.fee_id= #{feeId}
-        </if>
-        <if test="configId !=null and configId != ''">
-            and t.config_id= #{configId}
-        </if>
-        <if test="objId !=null and objId != ''">
-            and t.obj_id= #{objId}
-        </if>
-        <if test="feeName !=null and feeName != ''">
-            and t.fee_name= #{feeName}
+        <if test="link !=null and link != ''">
+            and t.link = #{link}
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime !=''">
             and t.deadline_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.deadline_time &lt;= #{endTime}
         </if>
         order by t.deadline_time
@@ -1435,24 +2047,34 @@
     <select id="queryPrePaymentNewCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-        select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime
-        ,oc.car_num carNum
+        select pfc.fee_name feeName,pfa.`value` objName,pfa1.`value` link,pfa2.`value` ownerName, t.end_time endTime ,
+        t.payer_obj_type payerObjType
         from pay_fee t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
-        oc.car_type_cd='1001'
+        LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390012' and pfa.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390009' and pfa1.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
         where t.state = '2008001'
         and t.status_cd = '0'
+        <if test="ownerName != null and ownerName != ''">
+            and pfa2.value like concat('%' #{ownerName} ,'%')
+        </if>
+        <if test="objName != null and objName != ''">
+            and pfa.`value` like concat('%',#{objName},'%')
+        </if>
+        <if test="link != null and link != ''">
+            and pfa1.`value` = #{link}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.end_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null  and endTime != ''">
             and t.end_time &lt;= #{endTime}
         </if>
         ) t
@@ -1460,24 +2082,34 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryPrePayment" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime ,
-        oc.car_num carNum,t.payer_obj_type payerObjType
+        select pfc.fee_name feeName,pfa.`value` objName,pfa1.`value` link,pfa2.`value` ownerName, t.end_time endTime ,
+        t.payer_obj_type payerObjType
         from pay_fee t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
-        oc.car_type_cd='1001'
+        LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390012' and pfa.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390009' and pfa1.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
         where t.state = '2008001'
         and t.status_cd = '0'
+        <if test="ownerName != null and ownerName != ''">
+            and pfa2.value like concat('%' #{ownerName} ,'%')
+        </if>
+        <if test="objName != null and objName != ''">
+            and pfa.`value` like concat('%',#{objName},'%')
+        </if>
+        <if test="link != null and link != ''">
+            and pfa1.`value` = #{link}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.end_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null  and endTime != ''">
             and t.end_time &lt;= #{endTime}
         </if>
         <if test="page != -1 and page != null ">
@@ -1486,62 +2118,66 @@
     </select>
 
     <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName,count(t.payer_obj_id) objCount from pay_fee t
+        select pfc.fee_name feeName, count(t.payer_obj_id) objCount
+        from pay_fee t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         where t.state = '2008001'
         and t.status_cd = '0'
         and t.end_time &gt; #{startTime}
         and t.end_time &lt; #{endTime}
-        and t.community_id= #{communityId}
-        group by pfc.fee_name ,pfc.config_id
+        and t.community_id = #{communityId}
+        group by pfc.fee_name, pfc.config_id
         order by objCount
     </select>
 
     <select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
-        SELECT
-        t.fee_name feeName,
-        count(t.obj_id) objCount
-        FROM
-        report_fee_month_statistics t
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        WHERE
-        1 = 1
+        SELECT t.fee_name feeName, count(t.obj_id) objCount
+        FROM report_fee_month_statistics t
+        inner join pay_fee pf on t.fee_id = pf.fee_id
+        and pf.community_id = t.community_id and pf.status_cd = '0'
+        WHERE 1 = 1
         AND t.status_cd = '0'
-        and t.community_id= #{communityId}
+        and t.community_id = #{communityId}
         AND t.deadline_time &gt; #{startTime}
         AND t.deadline_time &lt; #{endTime}
-        group by t.config_id,t.fee_name
+        group by t.config_id, t.fee_name
         order by objCount desc
     </select>
 
     <select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
-        select t.fee_name feeName,count( distinct t.obj_id) objCount
+        select t.fee_name feeName, count(distinct t.obj_id) objCount
         from report_fee_month_statistics t
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where t.community_id = #{communityId}
         and t.owe_amount > 0
-        group by t.config_id,t.fee_name
+        group by t.config_id, t.fee_name
         order by objCount desc
     </select>
 
     <select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
-        select t.fee_name feeName,count(distinct t.obj_id) objCount
+        select t.fee_name feeName, count(distinct t.obj_id) objCount
         from report_fee_month_statistics t
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where t.community_id = #{communityId}
-        group by t.config_id,t.fee_name
+        group by t.config_id, t.fee_name
         order by objCount desc
     </select>
 
     <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
-        select t.config_id configId, t.fee_id feeId,t.statistics_id statisticsId,t.fee_year feeYear,fee_month feeMonth
+        select t.config_id configId,
+        t.fee_id feeId,
+        t.statistics_id statisticsId,
+        t.fee_year feeYear,
+        fee_month feeMonth
         from report_fee_month_statistics t
-        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
         pf.status_cd = '0'
         where t.owe_amount > 0
         and t.status_cd = '0'
-        and t.community_id = #{communityId}
-        limit 100
+        and t.community_id = #{communityId} limit 100
     </select>
 
     <!-- 鏌ヨ璐圭敤閰嶇疆淇℃伅 add by wuxw 2018-07-03 -->
@@ -1740,6 +2376,7 @@
 
     <select id="queryRepairForStaff" parameterType="Map" resultType="Map">
         SELECT r.staff_id staffId,r.staff_name staffName,r.state FROM r_repair_user r
+        inner join u_user u on u.user_id = r.staff_id and u.status_cd = '0'
         WHERE r.state!='10005' AND r.state!='10009' AND r.state!='11000' AND
         r.state!='12000' AND r.state != '10007' AND r.status_cd = '0' AND
         r.repair_event != 'payUser' AND r.repair_event != 'startUser' AND r.staff_id != '-1'
@@ -1757,33 +2394,61 @@
     </select>
 
     <select id="getReceivableInformation" parameterType="Map" resultType="Map">
-        select sum(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount)
-        oweAmount
+        select a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
+        a.oweReceivedAmount,'0',a.receivableAmount-a.oweReceivedAmount) oweAmount
+        from (
+        select sum(t.his_owe_amount+t.cur_receivable_amount)
+        receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount) oweReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.community_id = #{communityId}
+        where 1=1
+        and t.fee_year= #{feeYear}
+        and t.fee_month= #{feeMonth}
+        and t.community_id = #{communityId}
+        ) a
     </select>
 
     <select id="getFloorReceivableInformation" parameterType="Map" resultType="Map">
-        select f.floor_num floorNum,f.`name`,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount
+        select a.floorNum,a.`name`,a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
+        a.oweReceivedAmount,'0',a.receivableAmount-a.oweReceivedAmount) oweAmount
+        from (
+        select f.floor_num floorNum,f.`name`,sum(t.his_owe_amount+t.cur_receivable_amount)
+        receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount) oweReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         inner join building_room br on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
         t.community_id and br.status_cd = '0'
         inner join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
         inner join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
-        where t.community_id = #{communityId}
+        where 1=1
+        and t.fee_year= #{feeYear}
+        and t.fee_month= #{feeMonth}
+        and t.community_id = #{communityId}
         group by f.floor_num ,f.`name`
+        ) a
     </select>
 
     <select id="getFeeConfigReceivableInformation" parameterType="Map" resultType="Map">
-        select t.fee_name feeName,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount
+        select a.feeName,a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
+        a.oweReceivedAmount,'0',a.receivableAmount-a.oweReceivedAmount) oweAmount
+        from (
+        select t.fee_name feeName,sum(t.his_owe_amount+t.cur_receivable_amount)
+        receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount) oweReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.community_id = #{communityId}
+        left join building_room br on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
+        t.community_id and br.status_cd = '0'
+        left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
+        left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
+        where 1=1
+        and t.fee_year= #{feeYear}
+        and t.fee_month= #{feeMonth}
+        and t.community_id = #{communityId}
         group by t.fee_name
+        ) a
     </select>
 
 
@@ -1791,11 +2456,14 @@
     <select id="queryNoFeeRoomsCount" parameterType="Map" resultType="Map">
         select count(1) count
         from building_room t
-        inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
+        inner join building_unit bu
+        on t.unit_id = bu.unit_id and bu.status_cd = '0'
         inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         where t.status_cd = '0'
-        and not exists(
-        select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
+        and not exists (
+        select 1 from pay_fee pf where t.room_id = pf.payer_obj_id
+        and pf.status_cd = '0'
+        and pf.state = '2008001'
         )
         and t.community_id = #{communityId}
     </select>
@@ -1814,7 +2482,7 @@
         select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
         )
         and t.community_id = #{communityId}
-        order by t.create_time desc
+        order by bo.name
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -1854,7 +2522,7 @@
         left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on t.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
         where 1 = 1
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -2086,7 +2754,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2097,13 +2766,20 @@
         <if test="objName !=null and objName != ''">
             and rfms.obj_name= #{objName}
         </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and rfms.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and rfms.fee_month= #{feeMonth}
+        </if>
         GROUP BY t.floor_num
         ) a,
         (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and  curT.community_id = t.community_id
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
+        curT.status_cd = '0' and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2113,6 +2789,9 @@
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and curT.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and curT.fee_month= #{feeMonth}
         </if>
         GROUP BY t.floor_num
         ) b
@@ -2131,7 +2810,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2142,13 +2822,20 @@
         <if test="objName !=null and objName != ''">
             and rfms.obj_name= #{objName}
         </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and rfms.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and rfms.fee_month= #{feeMonth}
+        </if>
         GROUP BY t.floor_num
         ) a,
         (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and  curT.community_id = t.community_id
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
+        curT.status_cd = '0' and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2158,6 +2845,9 @@
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and curT.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and curT.fee_month= #{feeMonth}
         </if>
         GROUP BY t.floor_num
         ) b
@@ -2177,19 +2867,20 @@
         select t.floor_num
         from f_floor t
         where 1=1
-            and t.community_id= #{communityId}
+        and t.community_id= #{communityId}
         GROUP BY t.floor_num
         ) tt
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryHuaningPayFee" parameterType="Map" resultType="Map">
-        select a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
+        select
+        a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
         from
         (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
@@ -2201,10 +2892,11 @@
         (select t.floor_num floorNum,sum(pfdm1.received_amount ) receivedAmount1
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2214,10 +2906,11 @@
         (select t.floor_num floorNum,sum(pfdm2.received_amount ) receivedAmount2
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2227,10 +2920,11 @@
         (select t.floor_num floorNum,sum(pfdm3.received_amount ) receivedAmount3
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm3 on  pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
+        LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
+        pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2240,10 +2934,11 @@
         (select t.floor_num floorNum,sum(pfdm4.received_amount ) receivedAmount4
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm4 on  pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
+        LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
+        pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2253,7 +2948,7 @@
         (select t.floor_num floorNum,SUM(rfms.receivable_amount) receivableAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
         where t.community_id = #{communityId}
         and rfms.fee_year = #{year}
@@ -2272,45 +2967,121 @@
     <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-        select t.floor_num floorNum,sum(pfdm.receivable_amount) receivableAmount ,
-        sum(pfdm.received_amount) receivedAmount,SUM(pfdm1.discount_amount) receivedAmount1,
-        SUM(pfdm2.received_amount) receivedAmount2
+        select a.floorNum, d.receivableAmount,
+        a.receivedAmount, b.receivedAmount1,
+        c.receivedAmount2
+        from
+        (select t.floor_num floorNum, sum (pfd.received_amount) receivedAmount
         from f_floor t
-        LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
-        LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
-        LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
-        and DATE_FORMAT(pfd.create_time,'%Y-%m') =  #{yearMonth}
-        <if test="communityId !=null and communityId != ''">
-            and t.community_id= #{communityId}
-        </if>
-        GROUP BY t.floor_num
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) a,
+        (select t.floor_num floorNum, SUM (pfdm1.discount_amount) receivedAmount1
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) b,
+        (select t.floor_num floorNum, SUM (pfdm2.received_amount) receivedAmount2
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) c,
+        (select t.floor_num floorNum, SUM (rfms.owe_amount) receivableAmount
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
+        where t.community_id= #{communityId}
+        group by t.floor_num
+        ) d
+        where a.floorNum = b.floorNum
+        and b.floorNum = c.floorNum
+        and c.floorNum = d.floorNum
         ) tt
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryHuaningPayFeeTwo" parameterType="Map" resultType="Map">
-        select t.floor_num floorNum,sum(pfdm.receivable_amount) receivableAmount ,
-        sum(pfdm.received_amount) receivedAmount,SUM(pfdm1.discount_amount) receivedAmount1,
-        SUM(pfdm2.received_amount) receivedAmount2
+        select a.floorNum,d.receivableAmount ,
+        a.receivedAmount,b.receivedAmount1,
+        c.receivedAmount2
+        from
+        (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
         from f_floor t
-        LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
-        LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
-        LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
-        and DATE_FORMAT(pfd.create_time,'%Y-%m') =  #{yearMonth}
-        <if test="communityId !=null and communityId != ''">
-            and t.community_id= #{communityId}
-        </if>
-        GROUP BY t.floor_num
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) a,
+        (select t.floor_num floorNum,SUM(pfdm1.discount_amount) receivedAmount1
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) b,
+        (select t.floor_num floorNum,SUM(pfdm2.received_amount) receivedAmount2
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) c,
+        (select t.floor_num floorNum,SUM(rfms.owe_amount) receivableAmount
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
+        where t.community_id= #{communityId}
+        group by t.floor_num
+        ) d
+        where a.floorNum = b.floorNum
+        and b.floorNum = c.floorNum
+        and c.floorNum = d.floorNum
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -2318,7 +3089,8 @@
     <select id="queryHuaningOweFeeDetailCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
+        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
+        feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
         from report_owe_fee t
         left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
         left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -2332,7 +3104,8 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryHuaningOweFeeDetail" parameterType="Map" resultType="Map">
-        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
+        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
+        feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
         from report_owe_fee t
         left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
         left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -2345,4 +3118,59 @@
             limit #{page}, #{row}
         </if>
     </select>
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
+        select ifnull(sum(t.received_amount),0) total
+        from pay_fee_detail_month t
+        where 1=1
+        and t.create_time &gt; #{startTime}
+        and t.create_time &lt; #{endTime}
+        and t.fee_id = #{feeId}
+        <if test="flag == 1">
+            and concat(t.detail_year,lpad(t.detail_month,2,0)) = #{yearMonth}
+        </if>
+        <if test="flag == 2">
+            and concat(t.detail_year,lpad(t.detail_month,2,0)) &lt; #{yearMonth}
+        </if>
+        <if test="flag == 3">
+            and concat(t.detail_year,lpad(t.detail_month,2,0)) &gt; #{yearMonth}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="queryRoomAndParkingSpace" parameterType="Map" resultType="Map">
+        select
+        br.room_id roomId,br.room_num roomNum,bu.unit_num unitNum,f.floor_num floorNum,t.owner_id ownerId
+        from building_owner_room_rel t
+        left join building_room br on t.room_id = br.room_id and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        where t.status_cd = '0'
+        and t.owner_id in
+        <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+    <!-- 鏌ヨ鏃犳晥璐圭敤 add by wuxw 2018-07-03 -->
+    <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
+        select t.fee_id feeId
+        from pay_fee t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id
+        inner join report_fee_month_statistics rfms on t.fee_id = rfms.fee_id and rfms.status_cd = '0'
+        where (t.status_cd = '1' or pfc.status_cd = '1')
+        and t.community_id = #{communityId}
+    </select>
+
+    <!--娓呯悊鎶ヨ〃 鏃犳晥鏁版嵁-->
+    <update id="deleteInvalidFee" parameterType="Map">
+        delete from report_fee_month_statistics where fee_id in
+        <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and community_id = #{communityId}
+    </update>
 </mapper>

--
Gitblit v1.8.0