浏览代码

报表优化

xiaogang 3 年之前
父节点
当前提交
2b3b2724a1

+ 9 - 4
java110-bean/src/main/java/com/java110/dto/reportOwnerPayFee/ReportOwnerPayFeeDto.java

@@ -42,19 +42,16 @@ public class ReportOwnerPayFeeDto extends PageDto implements Serializable {
     private String unitNum;
     private String roomNum;
 
-
     private Date createTime;
 
     private String statusCd = "0";
 
     private String feeEndTime;
 
+    private String feeTypeCd;
 
     private List<ReportOwnerPayFeeDto> reportOwnerPayFeeDtos;
 
-
-
-
     public String getConfigName() {
         return configName;
     }
@@ -287,4 +284,12 @@ public class ReportOwnerPayFeeDto extends PageDto implements Serializable {
     public void setFeeEndTime(String feeEndTime) {
         this.feeEndTime = feeEndTime;
     }
+
+    public String getFeeTypeCd() {
+        return feeTypeCd;
+    }
+
+    public void setFeeTypeCd(String feeTypeCd) {
+        this.feeTypeCd = feeTypeCd;
+    }
 }

+ 35 - 17
java110-db/src/main/resources/mapper/report/ReportOwnerPayFeeServiceDaoImplMapper.xml

@@ -7,11 +7,11 @@
 
     <!-- 保存业主缴费明细信息 add by wuxw 2018-07-03 -->
     <insert id="saveReportOwnerPayFeeInfo" parameterType="Map">
-        insert into report_owner_pay_fee(
-        config_name,amount,pf_id,detail_id,obj_name,owner_id,fee_id,pf_month,owner_name,pf_year,config_id,pf_date,obj_id,fee_name,community_id,obj_type
-        ) values (
-        #{configName},#{amount},#{pfId},#{detailId},#{objName},#{ownerId},#{feeId},#{pfMonth},#{ownerName},#{pfYear},#{configId},#{pfDate},#{objId},#{feeName},#{communityId},#{objType}
-        )
+        insert into report_owner_pay_fee(config_name, amount, pf_id, detail_id, obj_name, owner_id, fee_id, pf_month,
+                                         owner_name, pf_year, config_id, pf_date, obj_id, fee_name, community_id,
+                                         obj_type)
+        values (#{configName}, #{amount}, #{pfId}, #{detailId}, #{objName}, #{ownerId}, #{feeId}, #{pfMonth},
+                #{ownerName}, #{pfYear}, #{configId}, #{pfDate}, #{objId}, #{feeName}, #{communityId}, #{objType})
     </insert>
 
     <select id="queryReportOwnerMonthPayFees" parameterType="Map" resultType="Map">
@@ -38,17 +38,24 @@
 
     <!-- 查询业主缴费明细信息 add by wuxw 2018-07-03 -->
     <select id="getReportOwnerPayFeeInfo" parameterType="Map" resultType="Map">
-        select t.community_id communityId,pfa.`value` ownerId,pfa1.`value` ownerName,pfc.fee_name feeName,pfa2.`value` importFeeName,t.config_id configId,t.fee_id feeId,
-        concat(ff.floor_num , '-' , bu.unit_num , '-',br.room_num) roomName,t.payer_obj_type payerObjType,oc.car_num carNum,con.contract_code contractCode
+        select t.community_id communityId,pfa.`value` ownerId,pfa1.`value` ownerName,pfc.fee_name feeName,pfa2.`value`
+        importFeeName,t.config_id configId,t.fee_id feeId,
+        concat(ff.floor_num , '-' , bu.unit_num , '-',br.room_num) roomName,t.payer_obj_type payerObjType,oc.car_num
+        carNum,con.contract_code contractCode
         from pay_fee t
-        inner join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.community_id = t.community_id and pfa.spec_cd = '390007' and pfa.status_cd = '0'
-        inner join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.community_id = t.community_id and pfa1.spec_cd = '390008' and pfa1.status_cd = '0'
-        left join pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.community_id = t.community_id and pfa2.spec_cd = '390002' and pfa2.status_cd = '0'
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.community_id = t.community_id and pfc.status_cd = '0'
+        inner join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.community_id = t.community_id and pfa.spec_cd =
+        '390007' and pfa.status_cd = '0'
+        inner join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.community_id = t.community_id and pfa1.spec_cd
+        = '390008' and pfa1.status_cd = '0'
+        left join pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.community_id = t.community_id and pfa2.spec_cd =
+        '390002' and pfa2.status_cd = '0'
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.community_id = t.community_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 ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
+        oc.car_type_cd='1001'
         left join contract con on t.payer_obj_id = con.contract_id and t.payer_obj_type = '7777' and con.status_cd = '0'
         where 1=1
         <if test="feeEndTime !=null and feeEndTime != ''">
@@ -65,6 +72,9 @@
         <if test="ownerName !=null and ownerName != ''">
             and pfa1.`value` = #{ownerName}
         </if>
+        <if test="feeTypeCd != null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
         <if test="feeId !=null and feeId != ''">
             and t.fee_id= #{feeId}
         </if>
@@ -147,14 +157,19 @@
     <select id="queryReportOwnerPayFeesCount" parameterType="Map" resultType="Map">
         select count(1) count
         from pay_fee t
-        inner join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.community_id = t.community_id and pfa.spec_cd = '390007' and pfa.status_cd = '0'
-        inner join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.community_id = t.community_id and pfa1.spec_cd = '390008' and pfa1.status_cd = '0'
-        left join pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.community_id = t.community_id and pfa2.spec_cd = '390002' and pfa2.status_cd = '0'
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.community_id = t.community_id and pfc.status_cd = '0'
+        inner join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.community_id = t.community_id and pfa.spec_cd =
+        '390007' and pfa.status_cd = '0'
+        inner join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.community_id = t.community_id and pfa1.spec_cd
+        = '390008' and pfa1.status_cd = '0'
+        left join pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.community_id = t.community_id and pfa2.spec_cd =
+        '390002' and pfa2.status_cd = '0'
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.community_id = t.community_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 ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
+        oc.car_type_cd='1001'
         left join contract con on t.payer_obj_id = con.contract_id and t.payer_obj_type = '7777' and con.status_cd = '0'
         where 1=1
         <if test="feeEndTime !=null and feeEndTime != ''">
@@ -183,6 +198,9 @@
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num = #{roomNum}
         </if>
+        <if test="feeTypeCd != null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
     </select>
 
 </mapper>

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

@@ -490,7 +490,7 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
     private void reportPrePaymentFee(IPageData pd, ComponentValidateResult result, Workbook workbook) {
         Sheet sheet = workbook.createSheet("预交费提醒表");
         Row row = sheet.createRow(0);
-        row.createCell(0).setCellValue("号");
+        row.createCell(0).setCellValue("号");
         row.createCell(1).setCellValue("费用项");
         row.createCell(2).setCellValue("费用开始时间");
         row.createCell(3).setCellValue("距离费用开始时间(天)");
@@ -513,7 +513,7 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
     private void reportDeadlineFee(IPageData pd, ComponentValidateResult result, Workbook workbook) {
         Sheet sheet = workbook.createSheet("费用到期提醒表");
         Row row = sheet.createRow(0);
-        row.createCell(0).setCellValue("号");
+        row.createCell(0).setCellValue("号");
         row.createCell(1).setCellValue("费用项");
         row.createCell(2).setCellValue("费用结束时间");
         row.createCell(3).setCellValue("距离费用结束时间(天)");
@@ -1582,8 +1582,9 @@ 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("欠费金额");
         //查询楼栋信息
         JSONArray rooms = this.getReportOweFeeDetail(pd, result);
         if (rooms == null || rooms.size() == 0) {
@@ -1599,8 +1600,9 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
             row.createCell(3).setCellValue(dataObj.getString("builtUpArea"));
             row.createCell(4).setCellValue(dataObj.getString("feeName"));
             row.createCell(5).setCellValue(dataObj.getString("feeCreateTime"));
-            row.createCell(6).setCellValue(dataObj.getString("oweDay"));
-            row.createCell(7).setCellValue(dataObj.getString("oweAmount"));
+            row.createCell(6).setCellValue(dataObj.getString("updateTime"));
+            row.createCell(7).setCellValue(dataObj.getString("oweDay"));
+            row.createCell(8).setCellValue(dataObj.getString("oweAmount"));
         }
     }
 

+ 27 - 17
service-report/src/main/java/com/java110/report/api/ReportFeeMonthStatisticsApi.java

@@ -252,6 +252,7 @@ public class ReportFeeMonthStatisticsApi {
                                                  @RequestParam(value = "unitId", required = false) String unitId,
                                                  @RequestParam(value = "roomId", required = false) String roomId,
                                                  @RequestParam(value = "roomNum", required = false) String roomNum,
+                                                 @RequestParam(value = "feeTypeCd", required = false) String feeTypeCd,
                                                  @RequestParam(value = "startTime", required = false) String startTime,
                                                  @RequestParam(value = "endTime", required = false) String endTime,
                                                  @RequestParam(value = "feeName", required = false) String feeName,
@@ -270,6 +271,7 @@ public class ReportFeeMonthStatisticsApi {
         reportFeeMonthStatisticsDto.setRoomNum(roomNum);
         reportFeeMonthStatisticsDto.setFeeName(feeName);
         reportFeeMonthStatisticsDto.setConfigId(configId);
+        reportFeeMonthStatisticsDto.setFeeTypeCd(feeTypeCd);
         reportFeeMonthStatisticsDto.setStartTime(startTime);
         reportFeeMonthStatisticsDto.setEndTime(endTime);
         return getReportFeeMonthStatisticsBMOImpl.queryFeeDetail(reportFeeMonthStatisticsDto);
@@ -293,6 +295,7 @@ public class ReportFeeMonthStatisticsApi {
                                                     @RequestParam(value = "roomNum", required = false) String roomNum,
                                                     @RequestParam(value = "startTime", required = false) String startTime,
                                                     @RequestParam(value = "endTime", required = false) String endTime,
+                                                    @RequestParam(value = "objName", required = false) String objName,
                                                     @RequestParam(value = "page") int page,
                                                     @RequestParam(value = "row") int row) {
         ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
@@ -307,6 +310,7 @@ public class ReportFeeMonthStatisticsApi {
         reportFeeMonthStatisticsDto.setRoomNum(roomNum);
         reportFeeMonthStatisticsDto.setStartTime(startTime);
         reportFeeMonthStatisticsDto.setEndTime(endTime);
+        reportFeeMonthStatisticsDto.setObjName(objName);
         return getReportFeeMonthStatisticsBMOImpl.queryOweFeeDetail(reportFeeMonthStatisticsDto);
     }
 
@@ -575,11 +579,9 @@ public class ReportFeeMonthStatisticsApi {
      * @path /app/reportFeeMonthStatistics/queryNoFeeRooms
      */
     @RequestMapping(value = "/queryNoFeeRooms", method = RequestMethod.GET)
-    public ResponseEntity<String> queryNoFeeRooms(
-            @RequestParam(value = "communityId") String communityId,
-            @RequestParam(value = "page") int page,
-            @RequestParam(value = "row") int row
-    ) {
+    public ResponseEntity<String> queryNoFeeRooms(@RequestParam(value = "communityId") String communityId,
+                                                  @RequestParam(value = "page") int page,
+                                                  @RequestParam(value = "row") int row) {
         RoomDto roomDto = new RoomDto();
         roomDto.setCommunityId(communityId);
         roomDto.setPage(page);
@@ -599,13 +601,17 @@ public class ReportFeeMonthStatisticsApi {
      * @path /app/reportFeeMonthStatistics/queryHuaningOweFee
      */
     @RequestMapping(value = "/queryHuaningOweFee", method = RequestMethod.GET)
-    public ResponseEntity<String> queryHuaningOweFee(
-            @RequestParam(value = "communityId") String communityId,
-            @RequestParam(value = "page") int page,
-            @RequestParam(value = "row") int row
-    ) {
+    public ResponseEntity<String> queryHuaningOweFee(@RequestParam(value = "communityId") String communityId,
+                                                     @RequestParam(value = "configId", required = false) String configId,
+                                                     @RequestParam(value = "feeTypeCd", required = false) String feeTypeCd,
+                                                     @RequestParam(value = "floorNum", required = false) String floorNum,
+                                                     @RequestParam(value = "page") int page,
+                                                     @RequestParam(value = "row") int row) {
         ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
         reportFeeMonthStatisticsDto.setCommunityId(communityId);
+        reportFeeMonthStatisticsDto.setConfigId(configId);
+        reportFeeMonthStatisticsDto.setFeeTypeCd(feeTypeCd);
+        reportFeeMonthStatisticsDto.setFloorNum(floorNum);
         reportFeeMonthStatisticsDto.setPage(page);
         reportFeeMonthStatisticsDto.setRow(row);
         reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
@@ -623,15 +629,19 @@ public class ReportFeeMonthStatisticsApi {
      * @path /app/reportFeeMonthStatistics/queryHuaningPayFee
      */
     @RequestMapping(value = "/queryHuaningPayFee", method = RequestMethod.GET)
-    public ResponseEntity<String> queryHuaningPayFee(
-            @RequestParam(value = "communityId") String communityId,
-            @RequestParam(value = "year") int year,
-            @RequestParam(value = "month") int month,
-            @RequestParam(value = "page") int page,
-            @RequestParam(value = "row") int row
-    ) {
+    public ResponseEntity<String> queryHuaningPayFee(@RequestParam(value = "communityId") String communityId,
+                                                     @RequestParam(value = "configId", required = false) String configId,
+                                                     @RequestParam(value = "feeTypeCd", required = false) String feeTypeCd,
+                                                     @RequestParam(value = "floorNum", required = false) String floorNum,
+                                                     @RequestParam(value = "year", required = false) int year,
+                                                     @RequestParam(value = "month", required = false) int month,
+                                                     @RequestParam(value = "page") int page,
+                                                     @RequestParam(value = "row") int row) {
         Map paramInfo = new HashMap();
         paramInfo.put("communityId", communityId);
+        paramInfo.put("configId", configId);
+        paramInfo.put("feeTypeCd", feeTypeCd);
+        paramInfo.put("floorNum", floorNum);
         paramInfo.put("year", year);
         paramInfo.put("month", month);
         paramInfo.put("page", page);

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

@@ -99,6 +99,7 @@ public class ReportOwnerPayFeeApi {
                                                          @RequestParam(value = "configId", required = false) String configId,
                                                          @RequestParam(value = "roomName", required = false) String roomName,
                                                          @RequestParam(value = "ownerName", required = false) String ownerName,
+                                                         @RequestParam(value = "feeTypeCd",required = false) String feeTypeCd,
                                                          @RequestParam(value = "page") int page,
                                                          @RequestParam(value = "row") int row) {
         ReportOwnerPayFeeDto reportOwnerPayFeeDto = new ReportOwnerPayFeeDto();
@@ -109,6 +110,7 @@ public class ReportOwnerPayFeeApi {
         reportOwnerPayFeeDto.setConfigId(configId);
         reportOwnerPayFeeDto.setRoomName(roomName);
         reportOwnerPayFeeDto.setOwnerName(ownerName);
+        reportOwnerPayFeeDto.setFeeTypeCd(feeTypeCd);
         if (!StringUtil.isEmpty(roomName) && roomName.contains("-")) {
             String[] datas = roomName.split("-");
             if (datas.length != 3) {

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

@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Service("getReportFeeMonthStatisticsBMOImpl")
@@ -232,8 +233,8 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
 
     @Override
     public ResponseEntity<String> queryReportFloorUnitFeeSummary(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear()+"");
-        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth()+"");
+        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
+        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummaryCount(reportFeeMonthStatisticsDto);
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
@@ -276,11 +277,34 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdown(reportFeeMonthStatisticsDto);
             ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdownMajor(reportFeeMonthStatisticsDto);
+            reportFeeMonthStatisticsDto.setPage(PageDto.DEFAULT_PAGE);
+            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatistics = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdown(reportFeeMonthStatisticsDto);
+            BigDecimal allOweAmount = new BigDecimal(0.0);
+            BigDecimal allHisOweReceivedAmount = new BigDecimal(0.0);
+            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistic : reportFeeMonthStatistics) {
+                //获取历史欠费
+                BigDecimal hisOweAmount = new BigDecimal(reportFeeMonthStatistic.getHisOweAmount());
+                //获取当月应收
+                BigDecimal curReceivableAmount = new BigDecimal(reportFeeMonthStatistic.getCurReceivableAmount());
+                //获取当月实收
+                BigDecimal curReceivedAmount = new BigDecimal(reportFeeMonthStatistic.getCurReceivedAmount());
+                //获取欠债追回
+                BigDecimal hisOweReceivedAmount = new BigDecimal(reportFeeMonthStatistic.getHisOweReceivedAmount());
+                //计算欠费金额
+                BigDecimal oweAmount = hisOweAmount.add(curReceivableAmount).subtract(curReceivedAmount).subtract(hisOweReceivedAmount);
+                if (oweAmount.compareTo(BigDecimal.ZERO) == 1) { //欠费金额大于0
+                    allOweAmount = allOweAmount.add(oweAmount);
+                }
+                if (hisOweReceivedAmount.compareTo(BigDecimal.ZERO) == 1) { //欠费追回大于0
+                    allHisOweReceivedAmount = allHisOweReceivedAmount.add(hisOweReceivedAmount);
+                }
+            }
             if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
                 for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) {
                     reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
                     reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount());
-                    reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount());
+                    reportFeeMonthStatisticsDto1.setAllOweAmount(allOweAmount.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
+                    reportFeeMonthStatisticsDto1.setAllHisOweReceivedAmount(allHisOweReceivedAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
                 }
             }
         } else {
@@ -298,24 +322,43 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
     public ResponseEntity<String> queryFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
 
 
-        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear()+"");
-        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth()+"");
+        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
+        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
 
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDetailCount(reportFeeMonthStatisticsDto);
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
-        //应收总金额(大计)
-        Double allReceivableAmount = 0.0;
-        //实收金额(大计)
-        Double allReceivedAmount = 0.0;
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDetail(reportFeeMonthStatisticsDto);
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllFeeDetail(reportFeeMonthStatisticsDto);
+            reportFeeMonthStatisticsDto.setPage(PageDto.DEFAULT_PAGE);
+            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatistics = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDetail(reportFeeMonthStatisticsDto);
+            BigDecimal allOweAmount = new BigDecimal(0.0);
+            BigDecimal allHisOweReceivedAmount = new BigDecimal(0.0);
+            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistic : reportFeeMonthStatistics) {
+                //获取历史欠费
+                BigDecimal hisOweAmount = new BigDecimal(reportFeeMonthStatistic.getHisOweAmount());
+                //获取当月应收
+                BigDecimal curReceivableAmount = new BigDecimal(reportFeeMonthStatistic.getCurReceivableAmount());
+                //获取当月实收
+                BigDecimal curReceivedAmount = new BigDecimal(reportFeeMonthStatistic.getCurReceivedAmount());
+                //获取欠费追回
+                BigDecimal hisOweReceivedAmount = new BigDecimal(reportFeeMonthStatistic.getHisOweReceivedAmount());
+                //计算欠费金额
+                BigDecimal oweAmount = hisOweAmount.add(curReceivableAmount).subtract(curReceivedAmount).subtract(hisOweReceivedAmount);
+                if (oweAmount.compareTo(BigDecimal.ZERO) == 1) { //欠费金额大于0
+                    allOweAmount = allOweAmount.add(oweAmount);
+                }
+                if (hisOweReceivedAmount.compareTo(BigDecimal.ZERO) == 1) { //欠费追回大于0
+                    allHisOweReceivedAmount = allHisOweReceivedAmount.add(hisOweReceivedAmount);
+                }
+            }
             if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
                 for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) {
                     reportFeeMonthStatisticsDto1.setAllReceivableAmount(reportFeeMonthStatisticsList.get(0).getAllReceivableAmount());
                     reportFeeMonthStatisticsDto1.setAllReceivedAmount(reportFeeMonthStatisticsList.get(0).getAllReceivedAmount());
-                    reportFeeMonthStatisticsDto1.setAllOweAmount(reportFeeMonthStatisticsList.get(0).getAllOweAmount());
+                    reportFeeMonthStatisticsDto1.setAllOweAmount(allOweAmount.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
+                    reportFeeMonthStatisticsDto1.setAllHisOweReceivedAmount(allHisOweReceivedAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
                 }
             }
         } else {
@@ -383,8 +426,6 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         Double allVacantHousingDiscount = 0.0;
         //空置房减免(大计)
         Double allVacantHousingReduction = 0.0;
-
-
         //吴学文 注释 感觉和上面的369 功能重复
         //int size = 0;
         if (count > 0) {
@@ -1217,7 +1258,8 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
     private void freshReportOweDay(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
             try {
-                int day = DateUtil.daysBetween(DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getDeadlineTime(), DateUtil.DATE_FORMATE_STRING_A), DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getFeeCreateTime(),
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                int day = DateUtil.daysBetween(DateUtil.getDateFromString(format.format(new Date()), DateUtil.DATE_FORMATE_STRING_A), DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getFeeCreateTime(),
                         DateUtil.DATE_FORMATE_STRING_A));
                 reportFeeMonthStatisticsDto.setOweDay(day);
             } catch (Exception e) {

+ 5 - 5
service-report/src/main/java/com/java110/report/bmo/reportOwnerPayFee/impl/GetReportOwnerPayFeeBMOImpl.java

@@ -27,11 +27,11 @@ public class GetReportOwnerPayFeeBMOImpl implements IGetReportOwnerPayFeeBMO {
      * @return 订单服务能够接受的报文
      */
     public ResponseEntity<String> get(ReportOwnerPayFeeDto reportOwnerPayFeeDto) {
-        if(!StringUtil.isEmpty(reportOwnerPayFeeDto.getPfYear())) {
-            reportOwnerPayFeeDto.setFeeEndTime(reportOwnerPayFeeDto.getPfYear()+"-01-01");
-        }else{
-            Calendar calendar =Calendar.getInstance();
-            reportOwnerPayFeeDto.setFeeEndTime(calendar.get(Calendar.YEAR)+"-01-01");
+        if (!StringUtil.isEmpty(reportOwnerPayFeeDto.getPfYear())) {
+            reportOwnerPayFeeDto.setFeeEndTime(reportOwnerPayFeeDto.getPfYear() + "-01-01");
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            reportOwnerPayFeeDto.setFeeEndTime(calendar.get(Calendar.YEAR) + "-01-01");
         }
         int count = reportOwnerPayFeeInnerServiceSMOImpl.queryReportOwnerPayFeesCount(reportOwnerPayFeeDto);