瀏覽代碼

优化代码

Your Name 2 年之前
父節點
當前提交
36a726b06d

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java

@@ -7,6 +7,8 @@ import java.io.Serializable;
 public class QueryStatisticsDto extends PageDto implements Serializable {
 
     private String communityId;
+
+    private String hisDate;
     private String startDate;
 
     /**
@@ -149,4 +151,12 @@ public class QueryStatisticsDto extends PageDto implements Serializable {
     public void setStoreId(String storeId) {
         this.storeId = storeId;
     }
+
+    public String getHisDate() {
+        return hisDate;
+    }
+
+    public void setHisDate(String hisDate) {
+        this.hisDate = hisDate;
+    }
 }

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

@@ -1043,61 +1043,61 @@
             #{item}
         </foreach>
     </select>
-    <!-- 已收房屋金额 -->
+    <!-- 已收房屋 -->
     <select id="getReceivedRoomCount" 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
-        from report_owe_fee t
-        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.amount_owed > 0
-        and t.payer_obj_type = '3333'
+        select count(DISTINCT pf.payer_obj_id) from pay_fee_detail t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' and pf.payer_obj_type = '3333'
+        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
+        bu.floor_id = #{floorId}
         and t.community_id = #{communityId}
-        and t.payer_obj_id in
-        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
+        and t.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
     </select>
     <!-- 已收房屋金额 -->
     <select id="getReceivedRoomAmount" 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
-        from report_owe_fee t
-        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.amount_owed > 0
-        and t.payer_obj_type = '3333'
+        select ifnull(sum(t.received_amount),0) amount from pay_fee_detail t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' and pf.payer_obj_type = '3333'
+        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
+        bu.floor_id = #{floorId}
         and t.community_id = #{communityId}
-        and t.payer_obj_id in
-        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
+        and t.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
     </select>
     <!-- 欠费清缴户 -->
     <select id="getHisOweReceivedRoomCount" 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
-        from report_owe_fee t
-        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.amount_owed > 0
-        and t.payer_obj_type = '3333'
-        and t.community_id = #{communityId}
-        and t.payer_obj_id in
-        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
+        select count(DISTINCT t.obj_id) count
+        from pay_fee_detail_month t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' and pf.payer_obj_type = '3333'
+        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
+        bu.floor_id = #{floorId}
+        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; #{hisDate}
+        and t.detail_id != '-1'
+        and t.status_cd = '0'
     </select>
     <!-- 欠费清缴金额 -->
     <select id="getHisOweReceivedRoomAmount" 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
-        from report_owe_fee t
-        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.amount_owed > 0
-        and t.payer_obj_type = '3333'
-        and t.community_id = #{communityId}
-        and t.payer_obj_id in
-        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
-            #{item}
-        </foreach>
+        select ifnull(sum(t.received_amount),0) amount
+        from pay_fee_detail_month t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' and pf.payer_obj_type = '3333'
+        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
+        bu.floor_id = #{floorId}
+        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; #{hisDate}
+        and t.detail_id != '-1'
+        and t.status_cd = '0'
     </select>
 
 </mapper>

+ 1 - 0
service-report/src/main/java/com/java110/report/cmd/dataReport/QueryDataReportFeeStatisticsCmd.java

@@ -102,6 +102,7 @@ public class QueryDataReportFeeStatisticsCmd extends Cmd {
         // todo 本日已交户数
         queryStatisticsDto.setStartDate(DateUtil.getFormatTimeStringB(DateUtil.getCurrentDate())+" 00:00:00");
         queryStatisticsDto.setEndDate(DateUtil.getFormatTimeStringB(DateUtil.getCurrentDate())+" 23:59:59");
+        queryStatisticsDto.setHisDate(DateUtil.getFormatTimeStringB(DateUtil.getFirstDate()));
         double todayReceivedRoomCount = feeStatisticsImpl.getReceivedRoomCount(queryStatisticsDto);
         data.put("todayReceivedRoomCount",todayReceivedRoomCount);