wuxw
2024-02-23 37de399e76a816e77c9b7b11f0ece938d129c6fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="reportFloorFeeStatisticsServiceDaoImpl">
 
 
    <select id="getFloorOweRoomCount" parameterType="Map" resultType="Map">
        select b.floor_id floorId,count(1) oweRoomCount
        from (
            select distinct bu.floor_id,t.payer_obj_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'
            <if test="feeTypeCd != null and feeTypeCd != ''">
                left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
            </if>
            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
            and bu.floor_id in
            <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
            <if test="configIds !=null ">
                and t.config_id in
                <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="feeTypeCd != null and feeTypeCd != ''">
                and pfc.fee_type_cd = #{feeTypeCd}
            </if>
        ) b
        group by b.floor_id
    </select>
 
    <select id="getFloorFeeRoomCount" parameterType="Map" resultType="Map">
        select b.floor_id floorId,count(1) feeRoomCount
        from (
            select distinct bu.floor_id,t.payer_obj_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}
            and bu.floor_id in
            <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
            <if test="configIds !=null ">
                and t.config_id in
                <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="feeTypeCd != null and feeTypeCd != ''">
                and pf.fee_type_cd = #{feeTypeCd}
            </if>
        ) b
        group by b.floor_id
    </select>
 
    <select id="getFloorReceivedFee" parameterType="Map" resultType="Map">
        select bu.floor_id floorId,ifnull(sum(t.received_amount),0.0) receivedFee
        from pay_fee_detail t
        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
        LEFT JOIN building_room br on pf.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.status_cd = '0'
        and t.community_id= #{communityId}
        and t.create_time &gt; #{startDate}
        and t.create_time &lt; #{endDate}
        and bu.floor_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="configIds !=null ">
            and pf.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and pf.fee_type_cd = #{feeTypeCd}
        </if>
        group by bu.floor_id
    </select>
 
    <select id="getFloorPreReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) preReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= #{communityId}
        and t.pay_fee_time &gt; #{startDate}
        and t.pay_fee_time &lt; #{endDate}
        and t.cur_month_time &gt;= #{endDate}
        <if test="configIds !=null ">
            and t.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
 
    <select id="getFloorHisOweFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) hisOweFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= #{communityId}
        and t.detail_id = '-1'
        and t.cur_month_time &lt; #{startDate}
        <if test="configIds !=null ">
            and t.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
 
    <select id="getFloorCurReceivableFee" parameterType="Map" resultType="Map">
        select  t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) curReceivableFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= #{communityId}
        and t.cur_month_time &gt;= #{startDate}
        and t.cur_month_time &lt; #{endDate}
        <if test="configIds !=null ">
            and t.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
 
    <select id="getFloorCurReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId, ifnull(sum(t.receivable_amount),0.0) curReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= #{communityId}
        and t.cur_month_time &gt;= #{startDate}
        and t.cur_month_time &lt; #{endDate}
        and t.detail_id != '-1'
        <if test="configIds !=null ">
            and t.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
 
    <select id="getFloorHisReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) hisReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= #{communityId}
        and t.pay_fee_time &gt; #{startDate}
        and t.pay_fee_time &lt; #{endDate}
        and t.cur_month_time &lt; #{startDate}
        and t.detail_id != '-1'
        <if test="configIds !=null ">
            and t.config_id in
            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="feeTypeCd != null and feeTypeCd != ''">
            and t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
 
 
</mapper>