wuxw
2025-02-05 979ddae1450771e1546e7adca7ad9916f51215be
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
@@ -896,74 +896,24 @@
    <!-- 按楼栋统计欠费 -->
    <select id="getOweFeeByFloor" parameterType="Map" resultType="Map">
        select a.floor_id floorId,a.floor_num floorNum,a.name floorName,td.status_cd feeTypeCd,
        (
        select count(1)
        from building_room br
        left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
        where
        1=1
        and a.status_cd = '0'
        and br.status_cd = '0'
        and bu.floor_id = a.floor_id
        ) roomCount,
        (
        select count(1) from (
        select bu.floor_id,br.room_id
        from report_owe_fee t
        inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
        inner join building_room br on t.payer_obj_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'
        where
        1=1
        and t.payer_obj_type = '3333'
        and t.community_id= #{communityId}
        and pf.community_id=  #{communityId}
        and t.end_time &lt; #{endDate}
        group by bu.floor_id,br.room_id
        ) b
        where b.floor_id = a.floor_id
        ) feeRoomCount,
        (
        select count(1) from (
        select bu.floor_id,br.room_id
        from report_owe_fee t
        inner join building_room br on t.payer_obj_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 pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
        where
        1=1
        and t.payer_obj_type = '3333'
        and t.community_id= #{communityId}
        and t.end_time &lt; #{endDate}
        and t.amount_owed != 0
        group by bu.floor_id,br.room_id
        ) b
        where b.floor_id = a.floor_id
        ) oweRoomCount,
        (
        select ifnull(sum(t.amount_owed),0.0) oweFee
        from report_owe_fee t
        left join pay_fee pf1 on t.fee_id = pf1.fee_id and pf1.status_cd = '0'
        LEFT JOIN building_room br on pf1.payer_obj_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'
        where
        1=1
        and bu.floor_id = a.floor_id
        and t.community_id = #{communityId}
        and t.amount_owed > 0
        and pf1.fee_type_cd = td.status_cd
        ) oweFee
        select a.floor_id floorId,a.floor_num floorNum,a.name floorName,pfdm.fee_type_cd feeTypeCd,SUM(pfdm.receivable_amount) oweFee
        from f_floor a
                 left join t_dict td on td.table_name = 'pay_fee_config' and td.table_columns = 'fee_type_cd_show'
        where 1 = 1
          and a.status_cd = '0'
          and a.community_id = #{communityId}
        left join pay_fee_detail_month pfdm on a.floor_id = pfdm.obj_fpc_id and pfdm.status_cd = '0' and a.community_id = pfdm.community_id
        where 1=1
        and a.status_cd = '0'
        and a.community_id = #{communityId}
        and pfdm.detail_id = '-1'
        <if test="startDate != null and startDate != ''">
            and pfdm.cur_month_time &gt;= #{startDate}
        </if>
        <if test="endDate != null and endDate != ''">
            and pfdm.cur_month_time &lt; #{endDate}
        </if>
        group by a.floor_id ,a.floor_num,a.name, pfdm.fee_type_cd
        order by a.seq
    </select>
    <!-- 对象欠费 -->
    <select id="getObjOweFee" parameterType="Map" resultType="Map">
    <!-- 对象欠费
        select t.payer_obj_id payerObjId, pf.fee_type_cd feeTypeCd,t.fee_name feeName,
        DATE_FORMAT(t.end_time,'%Y-%m-%d') endTime,DATE_FORMAT(t.deadline_time,'%Y-%m-%d') deadlineTime,t.amount_owed
        amountOwed
@@ -976,6 +926,27 @@
        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        -->
    <select id="getObjOweFee" parameterType="Map" resultType="Map">
        select t.fee_type_cd feeTypeCd,t.obj_id payerObjId,t.fee_name feeName,
        min(t.cur_month_time) endTime,max(t.cur_month_time) deadlineTime,max(t.deadline_time) maxDeadLineTime,
        sum(t.receivable_amount) amountOwed
        from pay_fee_detail_month t
        where t.status_cd = '0'
        and t.detail_id ='-1'
        and t.community_id = #{communityId}
        <if test="startDate != null and startDate != ''">
            and t.cur_month_time &gt;= #{startDate}
        </if>
        <if test="endDate != null and endDate != ''">
            and t.cur_month_time &lt; #{endDate}
        </if>
        and t.obj_id in
        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        group by t.fee_type_cd,t.obj_id,t.fee_name
    </select>
    <!-- 对象实收 -->