Procházet zdrojové kódy

优化实收统计方式

Your Name před 2 roky
rodič
revize
d2f5d32e46

+ 22 - 19
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml

@@ -214,10 +214,13 @@
     <!-- 查询实收费用 -->
     <select id="getReceivedFee" parameterType="Map" resultType="Map">
         select ifnull(sum(t.received_amount),0.0) receivedFee
-        from pay_fee_detail_month t
+        from pay_fee_detail t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.status_cd = '0' and pfa.spec_cd = '390008'
+        left join pay_fee_attrs pfa1 on pf.fee_id = pfa1.fee_id and pfa1.status_cd = '0' and pfa1.spec_cd = '390009'
+        left join pay_fee_attrs pfa2 on pf.fee_id = pfa2.fee_id and pfa2.status_cd = '0' and pfa2.spec_cd = '390012'
         <if test="floorId != null and floorId != ''">
-            LEFT JOIN building_room br on t.obj_id = br.room_id and br.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'
         </if>
         where
@@ -229,16 +232,16 @@
             and t.config_id = #{configId}
         </if>
         <if test="objName != null and objName != ''">
-            and t.obj_name like concat('%',#{objName},'%')
+            and pfa2.value like concat('%',#{objName},'%')
         </if>
         <if test="ownerName != null and ownerName != ''">
-            and t.owner_name like concat('%',#{ownerName},'%')
+            and pfa.value like concat('%',#{ownerName},'%')
         </if>
         <if test="link != null and link != ''">
-            and t.link = #{link}
+            and pfa1.value = #{link}
         </if>
         <if test="configIds !=null ">
-            and t.config_id in
+            and pf.config_id in
             <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -248,8 +251,8 @@
         </if>
         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.create_time &gt;  #{startDate}
+        and t.create_time &lt; #{endDate}
     </select>
 
     <!-- 查询欠费户数 -->
@@ -401,19 +404,19 @@
         ) feeRoomCount,
         (
         select ifnull(sum(t.received_amount),0.0) receivedFee
-        from pay_fee_detail_month t
+        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 t.obj_id = br.room_id and br.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 bu.floor_id = a.floor_id
         and t.status_cd = '0'
         and t.community_id= a.community_id
-        and t.pay_fee_time &gt; #{startDate}
-        and t.pay_fee_time &lt; #{endDate}
+        and t.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
         <if test="configIds !=null ">
-            and t.config_id in
+            and pf.config_id in
             <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -555,10 +558,10 @@
         ) feeRoomCount,
         (
         select ifnull(sum(t.received_amount),0.0) receivedFee
-        from pay_fee_detail_month t
+        from pay_fee_detail t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         <if test="floorId != null and floorId != ''">
-            LEFT JOIN building_room br on t.obj_id = br.room_id and br.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'
         </if>
         where
@@ -567,11 +570,11 @@
             and bu.floor_id = a.floor_id
         </if>
         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.community_id= a.community_id
+        and t.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
         <if test="configIds !=null ">
-            and t.config_id in
+            and pf.config_id in
             <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
                 #{item}
             </foreach>