wuxw
2025-02-05 979ddae1450771e1546e7adca7ad9916f51215be
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -1440,26 +1440,26 @@
    <select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
        select count(1) count
        from (
        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
        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'
        select t.obj_name objName,t.fee_name feeName,t.owner_name ownerName,t.link ownerTel,br.built_up_area builtUpArea,
        MIN(t.cur_month_time) startTime,MAX(t.cur_month_time) endTime,max(t.deadline_time) deadlineTime,SUM(t.receivable_amount) oweAmount
        from pay_fee_detail_month t
        left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
        where 1=1
        <if test="roomNum !=null and roomNum != ''">
            and br.room_num= #{roomNum}
        and t.detail_id = '-1'
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="unitId !=null and unitId != ''">
            and bu.unit_id= #{unitId}
        <if test="startTime !=null and startTime != ''">
            and t.cur_month_time &gt;= #{startTime}
        </if>
        <if test="floorId !=null and floorId != ''">
            and f.floor_id = #{floorId}
        <if test="endTime !=null and endTime != ''">
            and t.cur_month_time &lt; #{endTime}
        </if>
        <if test="objName !=null and objName != ''">
            and t.payer_obj_name= #{objName}
            and t.obj_name= #{objName}
        </if>
        <if test="floorId !=null and floorId != ''">
            and t.obj_fpc_id = #{floorId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
@@ -1468,56 +1468,40 @@
            and t.config_id= #{configId}
        </if>
        <if test="objId !=null and objId != ''">
            and t.payer_obj_id= #{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 test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        <if test="startTime !=null and startTime != ''">
            and t.end_time &gt;= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            and t.end_time &lt;= #{endTime}
        </if>
        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
        group by t.obj_name ,t.fee_name ,t.owner_name ,t.link ,br.built_up_area
        ) 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.update_time updateTime,
        t.owner_name ownerName,t.owner_tel ownerTel,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'
        select t.obj_name objName,t.fee_name feeName,t.owner_name ownerName,t.link ownerTel,br.built_up_area builtUpArea,
        MIN(t.cur_month_time) startTime,MAX(t.cur_month_time) endTime,max(t.deadline_time) deadlineTime,SUM(t.receivable_amount) oweAmount
        from pay_fee_detail_month t
        left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
        where 1=1
        <if test="roomNum !=null and roomNum != ''">
            and br.room_num= #{roomNum}
        and t.detail_id = '-1'
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="unitId !=null and unitId != ''">
            and bu.unit_id= #{unitId}
        <if test="startTime !=null and startTime != ''">
            and t.cur_month_time &gt;= #{startTime}
        </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 test="endTime !=null and endTime != ''">
            and t.cur_month_time &lt; #{endTime}
        </if>
        <if test="objName !=null and objName != ''">
            and t.payer_obj_name= #{objName}
            and t.obj_name= #{objName}
        </if>
        <if test="floorId !=null and floorId != ''">
            and t.obj_fpc_id = #{floorId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
@@ -1526,24 +1510,16 @@
            and t.config_id= #{configId}
        </if>
        <if test="objId !=null and objId != ''">
            and t.payer_obj_id= #{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 test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        <if test="startTime !=null and startTime != ''">
            and t.end_time &gt;= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            and t.end_time &lt;= #{endTime}
        </if>
        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, t.owner_name ,t.owner_tel ,br.built_up_area
        HAVING oweAmount != 0
        order by t.payer_obj_name
        group by t.obj_name ,t.fee_name ,t.owner_name ,t.link ,br.built_up_area
        order by t.obj_name
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
@@ -1551,25 +1527,25 @@
    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
    <select id="queryOweFeeDetailMajor" parameterType="Map" resultType="Map">
        select SUM(t.amount_owed) oweAmount
        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'
        select SUM(t.receivable_amount) oweAmount
        from pay_fee_detail_month t
        left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
        where 1=1
        <if test="roomNum !=null and roomNum != ''">
            and br.room_num= #{roomNum}
        and t.detail_id = '-1'
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="unitId !=null and unitId != ''">
            and bu.unit_id= #{unitId}
        <if test="startTime !=null and startTime != ''">
            and t.cur_month_time &gt;= #{startTime}
        </if>
        <if test="floorId !=null and floorId != ''">
            and f.floor_id = #{floorId}
        <if test="endTime !=null and endTime != ''">
            and t.cur_month_time &lt; #{endTime}
        </if>
        <if test="objName !=null and objName != ''">
            and t.payer_obj_name= #{objName}
            and t.obj_name= #{objName}
        </if>
        <if test="floorId !=null and floorId != ''">
            and t.obj_fpc_id = #{floorId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
@@ -1578,19 +1554,13 @@
            and t.config_id= #{configId}
        </if>
        <if test="objId !=null and objId != ''">
            and t.payer_obj_id= #{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.end_time &gt;= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            and t.end_time &lt;= #{endTime}
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
    </select>