java110
2023-02-03 3184eec0cdbf4a4b8449e0ccd8ea9a2134f7931e
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -6,15 +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,
        his_owe_amount,cur_receivable_amount,cur_received_amount, his_owe_received_amount,pre_received_amount
        ) values (
        #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
        #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime},#{curMaxTime},
        #{hisOweAmount},#{curReceivableAmount},#{curReceivedAmount},#{hisOweReceivedAmount},#{preReceivedAmount}
        )
        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 -->
@@ -27,7 +30,7 @@
        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,
        t.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,t.cur_received_amount
        curReceivedAmount,
        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'
@@ -49,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}
@@ -127,6 +133,9 @@
        <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}
        </if>
@@ -177,7 +186,6 @@
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
    </update>
    <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
@@ -196,7 +204,6 @@
        <if test="configId !=null and configId != ''">
            and t.config_id= #{configId}
        </if>
    </update>
@@ -223,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}
@@ -276,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}
@@ -294,7 +313,6 @@
        <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=",">
@@ -322,7 +340,7 @@
    <!-- 查询费用月统计信息 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
        select t.fee_year feeYear,t.fee_month feeMonth,max(t.create_time) createTime
        <if test="configIds !=null">
            ,t.config_id configId
        </if>
@@ -343,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}
@@ -386,6 +413,7 @@
        <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>
@@ -405,11 +433,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}
@@ -449,9 +486,8 @@
    <!-- 查询费用月统计信息 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.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,
        t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
        ,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
@@ -467,11 +503,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}
@@ -528,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}
@@ -591,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>
@@ -645,7 +702,6 @@
        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}
@@ -658,6 +714,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}
@@ -727,6 +786,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>
@@ -765,9 +827,8 @@
    <!-- 查询费用月统计信息 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.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,
        t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
        ,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
@@ -794,6 +855,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}
@@ -856,6 +920,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>
@@ -914,6 +981,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>
@@ -947,8 +1017,7 @@
        <if test="yearMonth !=null and yearMonth != ''">
            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
        </if>
        group by t.config_id,t.fee_name,pfc.start_time
        group by t.fee_name ,td.name ,pfc.fee_type_cd,pfc.start_time ,t.create_time
        ) t
    </select>
@@ -984,6 +1053,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>
@@ -1017,7 +1089,7 @@
        <if test="yearMonth !=null and yearMonth != ''">
            and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
        </if>
        group by t.config_id,t.fee_name,pfc.start_time
        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}
@@ -1046,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}
@@ -1087,9 +1162,8 @@
     -->
    <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.cur_receivable_amount curReceivableAmount,
        t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
        ,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
@@ -1114,6 +1188,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}
@@ -1184,6 +1261,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>
@@ -1243,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>
@@ -1276,14 +1359,15 @@
    <!-- 查询费用月统计信息 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,pfa.`value`
        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,t.create_time createTime,max(t.update_time) updateTime,SUM(t.his_owe_amount)
        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
        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'
@@ -1292,6 +1376,7 @@
        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 t.status_cd = '0'
        <if test="roomNum !=null and roomNum != ''">
            and br.room_num= #{roomNum}
        </if>
@@ -1303,6 +1388,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}
@@ -1331,7 +1419,7 @@
        <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,pfa.`value`,br.built_up_area
        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}
@@ -1365,6 +1453,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}
@@ -1440,7 +1531,8 @@
        <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>
@@ -1464,8 +1556,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}
@@ -1491,7 +1589,9 @@
        <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,pfa.`value`,br.built_up_area
        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
        updateTime,pfa.`value` ,br.built_up_area
        HAVING oweAmount > 0
        order by t.payer_obj_name
        <if test="page != -1 and page != null ">
@@ -1564,15 +1664,21 @@
        = "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}
@@ -1650,15 +1756,21 @@
        "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
        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}
@@ -1715,15 +1827,21 @@
        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}
@@ -1780,15 +1898,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}
@@ -1823,7 +1947,10 @@
        <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>
@@ -1853,6 +1980,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}
@@ -1888,8 +2018,11 @@
    <select id="queryDeadlineFee" parameterType="Map" resultType="Map">
        SELECT
        t.obj_name objName,
        t.obj_name_num objNameNum,
        t.obj_type objType,
        t.fee_name feeName,
        t.deadline_time deadlineTime
        t.deadline_time deadlineTime,
        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'
@@ -1897,7 +2030,6 @@
        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}
@@ -1910,6 +2042,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}
@@ -1998,62 +2133,66 @@
    </select>
    <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
        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'
        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.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
        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
        AND t.status_cd = '0'
        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
        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.deadline_time &gt; #{startTime}
          AND t.deadline_time &lt; #{endTime}
        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
          and t.owe_amount > 0
        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
        pf.status_cd = '0'
                 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.status_cd = '0'
          and t.community_id = #{communityId} limit 100
    </select>
    <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
@@ -2271,10 +2410,11 @@
    <select id="getReceivableInformation" parameterType="Map" resultType="Map">
        select a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
        a.receivedAmount,'0',a.receivableAmount-a.receivedAmount) oweAmount
        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
        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 1=1
@@ -2286,10 +2426,11 @@
    <select id="getFloorReceivableInformation" parameterType="Map" resultType="Map">
        select a.floorNum,a.`name`,a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
        a.receivedAmount,'0',a.receivableAmount-a.receivedAmount) oweAmount
        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
        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 =
@@ -2306,16 +2447,17 @@
    <select id="getFeeConfigReceivableInformation" parameterType="Map" resultType="Map">
        select a.feeName,a.receivableAmount,a.receivedAmount, IF(a.receivableAmount &lt;
        a.receivedAmount,'0',a.receivableAmount-a.receivedAmount) oweAmount
        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
        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 =
        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'
        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'
        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}
@@ -2329,13 +2471,16 @@
    <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 f_floor f on bu.floor_id = f.floor_id and f.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 t.community_id = #{communityId}
          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>
    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -2636,6 +2781,12 @@
        <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
@@ -2653,6 +2804,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
@@ -2683,6 +2837,12 @@
        <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
@@ -2701,6 +2861,9 @@
        <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
        where a.floorNum = b.floorNum
@@ -2716,12 +2879,12 @@
    <select id="queryHuaningPayFeeCount" parameterType="Map" resultType="Map">
        select count(1) count
        from (
        select t.floor_num
        from f_floor t
        where 1=1
        and t.community_id= #{communityId}
        GROUP BY t.floor_num
        ) tt
            select t.floor_num
            from f_floor t
            where 1=1
            and t.community_id= #{communityId}
            GROUP BY t.floor_num
            ) tt
    </select>
    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -2819,62 +2982,62 @@
    <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
        select count(1) count
        from (
        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
        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 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 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
            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 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 -->
@@ -2974,8 +3137,7 @@
    <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
        select ifnull(sum(t.received_amount),0) total
        from pay_fee_detail_month t
        where
        1=1
        where 1=1
        and t.create_time &gt; #{startTime}
        and t.create_time &lt; #{endTime}
        and t.fee_id = #{feeId}
@@ -3010,11 +3172,12 @@
    <!-- 查询无效费用 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'
        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}
          and t.community_id = #{communityId}
    </select>
    <!--清理报表 无效数据-->