Your Name лет назад: 2
Родитель
Сommit
3ca4623755

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

@@ -537,6 +537,30 @@
         </if>
         ) curReceivableFee,
         (
+        select ifnull(sum(t.receivable_amount),0.0) curReceivedFee
+        from pay_fee_detail_month 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_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.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 pf.fee_type_cd = #{feeTypeCd}
+        </if>
+        ) curReceivedFee,
+        (
         select ifnull(sum(t.received_amount),0.0) hisReceivedFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
@@ -726,6 +750,32 @@
         and pf.fee_type_cd = a.status_cd
         ) curReceivableFee,
         (
+        select ifnull(sum(t.receivable_amount),0.0) curReceivedFee
+        from pay_fee_detail_month 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_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        </if>
+        where
+        1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        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>
+        and pf.fee_type_cd = a.status_cd
+        ) curReceivedFee,
+        (
         select ifnull(sum(t.received_amount),0.0) hisReceivedFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'

+ 26 - 13
service-job/src/main/java/com/java110/job/export/adapt/ReportFeeSummaryAdapt.java

@@ -40,9 +40,12 @@ public class ReportFeeSummaryAdapt implements IExportDataAdapt {
         row.createCell(1).setCellValue("收费户");
         row.createCell(2).setCellValue("欠费户");
         row.createCell(3).setCellValue("历史欠费+当期欠费=欠费");
-        row.createCell(6).setCellValue("欠费追回+当期实收+预交=实收");
-        row.createCell(10).setCellValue("已交户/收费户=户收费率");
-        row.createCell(11).setCellValue("(实收-预交)/(历史欠费+欠费追回+当期应收)=收费率");
+        row.createCell(6).setCellValue("欠费追回+当期部分+预交=实缴");
+        row.createCell(10).setCellValue("当期应收");
+        row.createCell(11).setCellValue("当期实收");
+        row.createCell(12).setCellValue("已交户/收费户=户收费率");
+        row.createCell(13).setCellValue("当期实收/当期应收=收费率");
+        row.createCell(14).setCellValue("欠费追回/(欠费追回+历史欠费)=清缴率");
 
         JSONObject reqJson = exportDataDto.getReqJson();
 
@@ -93,23 +96,33 @@ public class ReportFeeSummaryAdapt implements IExportDataAdapt {
         row.createCell(8).setCellValue(dataObj.getDouble("preReceivedFee"));
         row.createCell(9).setCellValue(dataObj.getDouble("receivedFee"));
         //((fee.feeRoomCount-fee.oweRoomCount)/fee.feeRoomCount*100).toFixed(2)
+        row.createCell(10).setCellValue(dataObj.getDouble("curReceivableFee"));
+        BigDecimal curReceivableFee = new BigDecimal(dataObj.getDouble("curReceivableFee"));
+        BigDecimal curReceivedFee = curReceivableFee.subtract(curOweFee);
+        row.createCell(11).setCellValue(curReceivedFee.doubleValue());
 
+        //todo 计算户收费率
         BigDecimal feeRoomCount = new BigDecimal(dataObj.getDouble("feeRoomCount"));
         BigDecimal oweRoomCount = new BigDecimal(dataObj.getDouble("oweRoomCount"));
         BigDecimal roomFeeRate = new BigDecimal(0);
-        if(feeRoomCount.doubleValue()>0){
-            feeRoomCount.subtract(oweRoomCount).divide(feeRoomCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
+        if (feeRoomCount.doubleValue() > 0) {
+            roomFeeRate = feeRoomCount.subtract(oweRoomCount).divide(feeRoomCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
         }
-        row.createCell(10).setCellValue(roomFeeRate.doubleValue() + "%");
-        //((fee.receivedFee-fee.preReceivedFee)/(fee.hisOweFee+fee.curReceivableFee)*100).toFixed(2)
-        BigDecimal curReceivableFee = new BigDecimal(dataObj.getDouble("curReceivableFee"));
-        curReceivableFee = hisOweFee.add(curReceivableFee).add(hisReceivedFee);
+        row.createCell(12).setCellValue(roomFeeRate.doubleValue() + "%");
+
+        //todo 计算收费率 当期实收/当期应收=收费率
         roomFeeRate = new BigDecimal(0);
-        if(curReceivableFee.doubleValue()> 0) {
-            roomFeeRate = receivedFee.subtract(preReceivedFee).divide(curReceivableFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
+        if (curReceivableFee.doubleValue() > 0) {
+            roomFeeRate = curReceivedFee.divide(curReceivableFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
         }
-        row.createCell(11).setCellValue(roomFeeRate.doubleValue() + "%");
-
+        //todo 计算清缴率 欠费追回/(欠费追回+历史欠费)=清缴率
+        row.createCell(13).setCellValue(roomFeeRate.doubleValue() + "%");
+        hisReceivedFee = hisReceivedFee.add(hisOweFee);
+        roomFeeRate = new BigDecimal(0);
+        if (hisReceivedFee.doubleValue() > 0) {
+            roomFeeRate = hisReceivedFee.divide(hisReceivedFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
+        }
+        row.createCell(14).setCellValue(roomFeeRate.doubleValue() + "%");
     }
 
     /**

+ 8 - 11
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportConfigFeeSummaryCmd.java

@@ -39,6 +39,9 @@ public class QueryReportConfigFeeSummaryCmd extends Cmd {
         queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
         queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
         queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+        if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) {
+            queryStatisticsDto.setEndDate(reqJson.getString("endDate") + " 23:59:59");
+        }
         queryStatisticsDto.setFloorId(reqJson.getString("floorId"));
         if (reqJson.containsKey("configIds")) {
             queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
@@ -53,11 +56,8 @@ public class QueryReportConfigFeeSummaryCmd extends Cmd {
         BigDecimal feeRoomCountDec = null;
         BigDecimal oweRoomCountDec = null;
         BigDecimal feeRoomRate = null;
-        BigDecimal hisOweFee = null;
+        BigDecimal curReceivedFee = null;
         BigDecimal curReceivableFee = null;
-        BigDecimal hisReceivedFee = null;
-        BigDecimal receivedFee = null;
-        BigDecimal preReceivedFee = null;
         for (Map data : datas) {
             //todo 计算 户收费率
             if (Double.parseDouble(data.get("feeRoomCount").toString()) > 0) {
@@ -70,15 +70,12 @@ public class QueryReportConfigFeeSummaryCmd extends Cmd {
             }
 
             //todo 计算 收费率
-            hisOweFee = new BigDecimal(Double.parseDouble(data.get("hisOweFee").toString()));
+            curReceivedFee = new BigDecimal(Double.parseDouble(data.get("curReceivedFee").toString()));
             curReceivableFee = new BigDecimal(Double.parseDouble(data.get("curReceivableFee").toString()));
-            hisReceivedFee = new BigDecimal(Double.parseDouble(data.get("hisReceivedFee").toString()));
-            hisOweFee = curReceivableFee.add(hisOweFee).add(hisReceivedFee);
 
-            if (hisOweFee.doubleValue() > 0) {
-                receivedFee = new BigDecimal(Double.parseDouble(data.get("receivedFee").toString()));
-                preReceivedFee = new BigDecimal(Double.parseDouble(data.get("preReceivedFee").toString()));
-                feeRoomRate = receivedFee.subtract(preReceivedFee).divide(hisOweFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
+
+            if (curReceivableFee.doubleValue() > 0) {
+                feeRoomRate = curReceivedFee.divide(curReceivableFee, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
                 data.put("feeRate", feeRoomRate.doubleValue());
             } else {
                 data.put("feeRate", 0.0);

+ 3 - 0
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java

@@ -59,6 +59,9 @@ public class QueryReportFeeSummaryCmd extends Cmd {
         queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
         queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
         queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+        if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) {
+            queryStatisticsDto.setEndDate(reqJson.getString("endDate") + " 23:59:59");
+        }
         queryStatisticsDto.setConfigId(reqJson.getString("configId"));
         queryStatisticsDto.setFloorId(reqJson.getString("floorId"));
         queryStatisticsDto.setObjName(reqJson.getString("objName"));

+ 7 - 11
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java

@@ -39,6 +39,9 @@ public class QueryReportFloorFeeSummaryCmd extends Cmd {
         queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
         queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
         queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+        if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) {
+            queryStatisticsDto.setEndDate(reqJson.getString("endDate") + " 23:59:59");
+        }
         queryStatisticsDto.setFeeTypeCd(reqJson.getString("feeTypeCd"));
         if(reqJson.containsKey("configIds")){
             queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
@@ -53,11 +56,8 @@ public class QueryReportFloorFeeSummaryCmd extends Cmd {
         BigDecimal feeRoomCountDec = null;
         BigDecimal oweRoomCountDec = null;
         BigDecimal feeRoomRate = null;
-        BigDecimal hisOweFee = null;
+        BigDecimal curReceivedFee = null;
         BigDecimal curReceivableFee = null;
-        BigDecimal hisReceivedFee = null;
-        BigDecimal receivedFee = null;
-        BigDecimal preReceivedFee = null;
         for(Map data:datas){
             //todo 计算 户收费率
             if(Double.parseDouble(data.get("feeRoomCount").toString())>0){
@@ -70,15 +70,11 @@ public class QueryReportFloorFeeSummaryCmd extends Cmd {
             }
 
             //todo 计算 收费率
-            hisOweFee = new BigDecimal(Double.parseDouble(data.get("hisOweFee").toString()));
+            curReceivedFee = new BigDecimal(Double.parseDouble(data.get("curReceivedFee").toString()));
             curReceivableFee = new BigDecimal(Double.parseDouble(data.get("curReceivableFee").toString()));
-            hisReceivedFee = new BigDecimal(Double.parseDouble(data.get("hisReceivedFee").toString()));
-            hisOweFee = curReceivableFee.add(hisOweFee).add(hisReceivedFee);
 
-            if(hisOweFee.doubleValue()> 0){
-                receivedFee = new BigDecimal(Double.parseDouble(data.get("receivedFee").toString()));
-                preReceivedFee = new BigDecimal(Double.parseDouble(data.get("preReceivedFee").toString()));
-                feeRoomRate = receivedFee.subtract(preReceivedFee).divide(hisOweFee,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
+            if(curReceivableFee.doubleValue()> 0){
+                feeRoomRate = curReceivedFee.divide(curReceivableFee,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
                 data.put("feeRate",feeRoomRate.doubleValue());
             }else{
                 data.put("feeRate",0.0);