Browse Source

优化报表支持按时间段

wuxw 1 year ago
parent
commit
979ddae145

+ 56 - 86
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>
-        <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>
-        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}
-        </if>
-        <if test="unitId !=null and unitId != ''">
-            and bu.unit_id= #{unitId}
-        </if>
-        <if test="unitNum !=null and unitNum != ''">
-            and bu.unit_num= #{unitNum}
+        and t.detail_id = '-1'
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
         </if>
-        <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
+        <if test="startTime !=null and startTime != ''">
+            and t.cur_month_time &gt;= #{startTime}
         </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>
-        <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>
-        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>
 

+ 35 - 64
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>
 
     <!-- 对象实收 -->

+ 10 - 0
java110-utils/src/main/java/com/java110/utils/util/DateUtil.java

@@ -980,4 +980,14 @@ public class DateUtil {
         calendar.add(Calendar.SECOND, -1);
         return getFormatTimeStringA(calendar.getTime());
     }
+    public static Date getPreSecTime(Date time,int month) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(time);
+        calendar.add(Calendar.MONTH,month);
+        calendar.add(Calendar.SECOND, -1);
+        return calendar.getTime();
+    }
+    public static String getPreSecTimeStr(Date time,int month) {
+        return getFormatTimeStringB(getPreSecTime(time,month));
+    }
 }

+ 6 - 5
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportReportFeeSMOImpl.java

@@ -12,6 +12,7 @@ import com.java110.dto.system.ComponentValidateResult;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -1617,15 +1618,15 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
         row.createCell(3).setCellValue("业主电话");
         row.createCell(4).setCellValue("面积");
         row.createCell(5).setCellValue("费用项");
-        row.createCell(6).setCellValue("费用开始时间");
-        row.createCell(7).setCellValue("更新时间");
+        row.createCell(6).setCellValue("开始时间");
+        row.createCell(7).setCellValue("结束时间");
         row.createCell(8).setCellValue("欠费时长(天)");
         row.createCell(9).setCellValue("欠费时长(月)");
         row.createCell(10).setCellValue("欠费金额");
 
         //查询楼栋信息
         JSONArray rooms = this.getReportOweFeeDetail(pd, result);
-        if (rooms == null || rooms.size() == 0) {
+        if (ListUtil.isNull(rooms)) {
             return;
         }
         JSONObject dataObj = null;
@@ -1639,8 +1640,8 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
             row.createCell(3).setCellValue(dataObj.getString("ownerTel"));
             row.createCell(4).setCellValue(dataObj.getString("builtUpArea"));
             row.createCell(5).setCellValue(dataObj.getString("feeName"));
-            row.createCell(6).setCellValue(dataObj.getString("feeCreateTime"));
-            row.createCell(7).setCellValue(dataObj.getString("updateTime"));
+            row.createCell(6).setCellValue(dataObj.getString("startTime"));
+            row.createCell(7).setCellValue(dataObj.getString("endTime"));
             row.createCell(8).setCellValue(dataObj.getString("oweDay"));
             monthDec = new BigDecimal(dataObj.getString("oweDay"));
             monthDec = monthDec.divide(new BigDecimal("30"), 2, BigDecimal.ROUND_HALF_UP);

+ 12 - 12
service-job/src/main/java/com/java110/job/export/adapt/DataReportOweStatisticsAdapt.java

@@ -8,6 +8,7 @@ import com.java110.intf.dev.IDictV1InnerServiceSMO;
 import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
 import com.java110.job.export.IExportDataAdapt;
 import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -52,17 +53,14 @@ public class DataReportOweStatisticsAdapt implements IExportDataAdapt {
         Sheet sheet = workbook.createSheet("欠费统计");
         Row row = sheet.createRow(0);
         row.createCell(0).setCellValue("楼栋");
-        row.createCell(1).setCellValue("户数");
-        row.createCell(2).setCellValue("收费户数");
-        row.createCell(3).setCellValue("欠费户数");
-        row.createCell(4).setCellValue("欠费");
+        row.createCell(1).setCellValue("欠费");
         DictDto dictDto = new DictDto();
         dictDto.setTableName("pay_fee_config");
         dictDto.setTableColumns("fee_type_cd_show");
         List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDicts(dictDto);
 
         for (int dictIndex = 0; dictIndex < dictDtos.size(); dictIndex++) {
-            row.createCell(5 + dictIndex).setCellValue(dictDtos.get(dictIndex).getName());
+            row.createCell(2 + dictIndex).setCellValue(dictDtos.get(dictIndex).getName());
         }
 
         QueryStatisticsDto queryStatisticsDto = new QueryStatisticsDto();
@@ -87,6 +85,7 @@ public class DataReportOweStatisticsAdapt implements IExportDataAdapt {
 
     /**
      * 封装数据到Excel中
+     *
      * @param datas
      * @param sheet
      * @param dictDtos
@@ -99,24 +98,25 @@ public class DataReportOweStatisticsAdapt implements IExportDataAdapt {
             row = sheet.createRow(roomIndex + 1);
             dataObj = datas.get(roomIndex);
             row.createCell(0).setCellValue(dataObj.get("floorNum").toString());
-            row.createCell(1).setCellValue(dataObj.get("roomCount").toString());
-            row.createCell(2).setCellValue(dataObj.get("feeRoomCount").toString());
-            row.createCell(3).setCellValue(dataObj.get("oweRoomCount").toString());
-            row.createCell(4).setCellValue(dataObj.get("oweFee").toString());
+            row.createCell(1).setCellValue(dataObj.get("oweFee").toString());
 
             for (int dictIndex = 0; dictIndex < dictDtos.size(); dictIndex++) {
+                if (!dataObj.containsKey("oweFee" + dictDtos.get(dictIndex).getStatusCd())) {
+                    row.createCell(2 + dictIndex).setCellValue("0");
+                    continue;
+                }
                 oweFee = dataObj.get("oweFee" + dictDtos.get(dictIndex).getStatusCd()).toString();
                 if (StringUtil.isEmpty(oweFee)) {
                     oweFee = "0";
                 }
-                row.createCell(5 + dictIndex).setCellValue(oweFee);
+                row.createCell(2 + dictIndex).setCellValue(oweFee);
             }
         }
 
     }
 
     private List<Map> computeOweReceivedFee(List<Map> datas) {
-        if (datas == null || datas.size() < 1) {
+        if (ListUtil.isNull(datas)) {
             return new ArrayList<>();
         }
 
@@ -127,7 +127,7 @@ public class DataReportOweStatisticsAdapt implements IExportDataAdapt {
             }
         }
 
-        if (tmpDatas == null || tmpDatas.size() < 1) {
+        if (ListUtil.isNull(tmpDatas)) {
             return new ArrayList<>();
         }
 

+ 2 - 0
service-report/src/main/java/com/java110/report/api/ReportFeeMonthStatisticsApi.java

@@ -258,6 +258,7 @@ public class ReportFeeMonthStatisticsApi {
                                                     @RequestParam(value = "startTime", required = false) String startTime,
                                                     @RequestParam(value = "endTime", required = false) String endTime,
                                                     @RequestParam(value = "objName", required = false) String objName,
+                                                    @RequestParam(value = "feeTypeCd", required = false) String feeTypeCd,
                                                     @RequestParam(value = "page") int page,
                                                     @RequestParam(value = "row") int row) {
         ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
@@ -273,6 +274,7 @@ public class ReportFeeMonthStatisticsApi {
         reportFeeMonthStatisticsDto.setStartTime(startTime);
         reportFeeMonthStatisticsDto.setEndTime(endTime);
         reportFeeMonthStatisticsDto.setObjName(objName);
+        reportFeeMonthStatisticsDto.setFeeTypeCd(feeTypeCd);
         return getReportFeeMonthStatisticsBMOImpl.queryOweFeeDetail(reportFeeMonthStatisticsDto);
     }
 

+ 2 - 2
service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java

@@ -951,8 +951,8 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         int day = 0;
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
             try {
-                day = DateUtil.daysBetween(DateUtil.getDateFromStringA(reportFeeMonthStatisticsDto.getDeadlineTime()),
-                        DateUtil.getDateFromStringA(reportFeeMonthStatisticsDto.getFeeCreateTime()));
+                day = DateUtil.daysBetween(DateUtil.getDateFromStringB(reportFeeMonthStatisticsDto.getEndTime()),
+                        DateUtil.getDateFromStringB(reportFeeMonthStatisticsDto.getStartTime()));
                 reportFeeMonthStatisticsDto.setOweDay(day);
             } catch (Exception e) {
                 logger.error("计算欠费天数失败", e);

+ 2 - 1
service-report/src/main/java/com/java110/report/cmd/dataReport/QueryOweDetailStatisticsCmd.java

@@ -14,6 +14,7 @@ import com.java110.report.statistics.IBaseDataStatistics;
 import com.java110.report.statistics.IFeeStatistics;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -122,7 +123,7 @@ public class QueryOweDetailStatisticsCmd extends Cmd {
         //todo 查询房屋 欠费信息 返回 payerObjId, feeTypeCd,feeName,endTime,deadlineTime,amountOwed
         List<Map> infos = feeStatisticsImpl.getObjOweFee(queryStatisticsDto);
 
-        if (infos == null || infos.size() < 1) {
+        if (ListUtil.isNull(infos)) {
             return datas;
         }
 

+ 27 - 7
service-report/src/main/java/com/java110/report/smo/impl/ReportFeeMonthStatisticsInnerServiceSMOImpl.java

@@ -16,11 +16,14 @@ import com.java110.po.reportFee.ReportFeeMonthStatisticsPo;
 import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.MoneyUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -290,6 +293,24 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
 
         List<ReportFeeMonthStatisticsDto> infos = BeanConvertUtil.covertBeanList(reportFeeMonthStatisticsServiceDaoImpl.queryOweFeeDetail(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)), ReportFeeMonthStatisticsDto.class);
 
+        if (ListUtil.isNull(infos)) {
+            return infos;
+        }
+        //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) startDate,MAX(t.cur_month_time) endDate,max(t.deadline_time) deadlineTime,SUM(t.receivable_amount) oweAmount
+        for (ReportFeeMonthStatisticsDto info : infos) {
+            Date endTime = DateUtil.getDateFromStringA(info.getEndTime());
+            Date startTime = DateUtil.getDateFromStringA(info.getStartTime());
+            endTime = DateUtil.getPreSecTime(endTime, 1);
+            Date deadLineTime = DateUtil.getDateFromStringB(info.getDeadlineTime());
+            if (endTime.getTime() > deadLineTime.getTime()) {
+                endTime = deadLineTime;
+            }
+            info.setEndTime(DateUtil.getFormatTimeStringB(endTime));
+            info.setStartTime(DateUtil.getFormatTimeStringB(startTime));
+            info.setOweAmount(MoneyUtil.computePriceScale(Double.parseDouble(info.getOweAmount())) + "");
+        }
+
         return infos;
     }
 
@@ -570,10 +591,10 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
 
     @Override
     public List<Map> queryHuaningPayFee(@RequestBody Map paramInfo) {
-        int page = (int)paramInfo.get("page");
+        int page = (int) paramInfo.get("page");
 
         if (page != PageDto.DEFAULT_PAGE) {
-            paramInfo.put("page",(page - 1) * (int)paramInfo.get("row"));
+            paramInfo.put("page", (page - 1) * (int) paramInfo.get("row"));
         }
         List<Map> deposits = reportFeeMonthStatisticsServiceDaoImpl.queryHuaningPayFee(paramInfo);
         return deposits;
@@ -591,10 +612,10 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
 
     @Override
     public List<Map> queryHuaningPayFeeTwo(@RequestBody Map paramInfo) {
-        int page = (int)paramInfo.get("page");
+        int page = (int) paramInfo.get("page");
 
         if (page != PageDto.DEFAULT_PAGE) {
-            paramInfo.put("page",(page - 1) * (int)paramInfo.get("row"));
+            paramInfo.put("page", (page - 1) * (int) paramInfo.get("row"));
         }
         List<Map> deposits = reportFeeMonthStatisticsServiceDaoImpl.queryHuaningPayFeeTwo(paramInfo);
         return deposits;
@@ -607,10 +628,10 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
 
     @Override
     public List<Map> queryHuaningOweFeeDetail(@RequestBody Map paramInfo) {
-        int page = (int)paramInfo.get("page");
+        int page = (int) paramInfo.get("page");
 
         if (page != PageDto.DEFAULT_PAGE) {
-            paramInfo.put("page",(page - 1) * (int)paramInfo.get("row"));
+            paramInfo.put("page", (page - 1) * (int) paramInfo.get("row"));
         }
         List<Map> deposits = reportFeeMonthStatisticsServiceDaoImpl.queryHuaningOweFeeDetail(paramInfo);
         return deposits;
@@ -624,7 +645,6 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
     }
 
 
-
     public IReportFeeMonthStatisticsServiceDao getReportFeeMonthStatisticsServiceDaoImpl() {
         return reportFeeMonthStatisticsServiceDaoImpl;
     }

+ 20 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportFeeStatisticsInnerServiceSMOImpl.java

@@ -7,10 +7,13 @@ import com.java110.dto.report.QueryStatisticsDto;
 import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
 import com.java110.report.dao.IReportFeeStatisticsServiceDao;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ListUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -257,6 +260,23 @@ public class ReportFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO imple
     @Override
     public List<Map> getObjOweFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
         List<Map> infos = reportFeeStatisticsServiceDaoImpl.getObjOweFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
+        if(ListUtil.isNull(infos)){
+            return infos;
+        }
+        //  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
+        for(Map info : infos){
+            Date deadlineTime = (Date) info.get("deadlineTime");
+            Date endTime = (Date) info.get("endTime");
+            deadlineTime = DateUtil.getPreSecTime(deadlineTime,1);
+            Date maxDeadLineTime = (Date) info.get("maxDeadLineTime");
+            if(deadlineTime.getTime() > maxDeadLineTime.getTime()){
+                deadlineTime = maxDeadLineTime;
+            }
+            info.put("deadlineTime",DateUtil.getFormatTimeStringB(deadlineTime));
+            info.put("endTime",DateUtil.getFormatTimeStringB(endTime));
+        }
         return infos;
     }