java110 лет назад: 4
Родитель
Сommit
4e01e72b92

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java

@@ -73,6 +73,8 @@ public class FeeConfigDto extends PageDto implements Serializable {
     private String statusCd = "0";
     private String computingFormulaText;
 
+    private double amount;
+
 
     public String getFeeTypeCd() {
         return feeTypeCd;
@@ -267,4 +269,12 @@ public class FeeConfigDto extends PageDto implements Serializable {
     public void setFeeNameEq(String feeNameEq) {
         this.feeNameEq = feeNameEq;
     }
+
+    public double getAmount() {
+        return amount;
+    }
+
+    public void setAmount(double amount) {
+        this.amount = amount;
+    }
 }

+ 37 - 15
java110-bean/src/main/java/com/java110/dto/reportFeeMonthStatistics/ReportFeeMonthStatisticsDto.java

@@ -70,6 +70,8 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     //支付方式
     private String primeRate;
 
+    private double configReceivedAmount = 0;
+
     //应收总金额(小计)
     private String totalReceivableAmount;
 
@@ -125,11 +127,13 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
 
     private String repairId;
 
-    private String hisOweAmount;
-    private String curReceivableAmount;
-    private String curReceivedAmount;
-    private String hisOweReceivedAmount;
-    private String preReceivedAmount;
+    private double hisOweAmount;
+    private double curReceivableAmount;
+    private double curReceivedAmount;
+    private double hisOweReceivedAmount;
+    private double preReceivedAmount;
+
+    private String[] configIds;
 
     public String getReceivableAmount() {
         return receivableAmount;
@@ -594,6 +598,7 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     public void setRepairId(String repairId) {
         this.repairId = repairId;
     }
+
     public String getAllOweAmount() {
         return allOweAmount;
     }
@@ -626,43 +631,60 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
         this.builtUpArea = builtUpArea;
     }
 
-    public String getHisOweAmount() {
+
+    public String[] getConfigIds() {
+        return configIds;
+    }
+
+    public void setConfigIds(String[] configIds) {
+        this.configIds = configIds;
+    }
+
+    public double getConfigReceivedAmount() {
+        return configReceivedAmount;
+    }
+
+    public void setConfigReceivedAmount(double configReceivedAmount) {
+        this.configReceivedAmount = configReceivedAmount;
+    }
+
+    public double getHisOweAmount() {
         return hisOweAmount;
     }
 
-    public void setHisOweAmount(String hisOweAmount) {
+    public void setHisOweAmount(double hisOweAmount) {
         this.hisOweAmount = hisOweAmount;
     }
 
-    public String getCurReceivableAmount() {
+    public double getCurReceivableAmount() {
         return curReceivableAmount;
     }
 
-    public void setCurReceivableAmount(String curReceivableAmount) {
+    public void setCurReceivableAmount(double curReceivableAmount) {
         this.curReceivableAmount = curReceivableAmount;
     }
 
-    public String getCurReceivedAmount() {
+    public double getCurReceivedAmount() {
         return curReceivedAmount;
     }
 
-    public void setCurReceivedAmount(String curReceivedAmount) {
+    public void setCurReceivedAmount(double curReceivedAmount) {
         this.curReceivedAmount = curReceivedAmount;
     }
 
-    public String getHisOweReceivedAmount() {
+    public double getHisOweReceivedAmount() {
         return hisOweReceivedAmount;
     }
 
-    public void setHisOweReceivedAmount(String hisOweReceivedAmount) {
+    public void setHisOweReceivedAmount(double hisOweReceivedAmount) {
         this.hisOweReceivedAmount = hisOweReceivedAmount;
     }
 
-    public String getPreReceivedAmount() {
+    public double getPreReceivedAmount() {
         return preReceivedAmount;
     }
 
-    public void setPreReceivedAmount(String preReceivedAmount) {
+    public void setPreReceivedAmount(double preReceivedAmount) {
         this.preReceivedAmount = preReceivedAmount;
     }
 }

+ 28 - 6
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -292,6 +292,13 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -313,7 +320,11 @@
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
-        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        <if test="configIds !=null">
+            ,t.config_id configId
+        </if>
+        ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
         SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount) hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
         max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
         from report_fee_month_statistics t
@@ -346,6 +357,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -362,6 +379,9 @@
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_year,t.fee_month
+        <if test="configIds !=null">
+            ,t.config_id
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -370,11 +390,7 @@
     <!-- 查询费用月统计信息 大计 add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummaryMajor" parameterType="Map" resultType="Map">
         select
-        sum(t.his_owe_amount+t.cur_receivable_amount) allReceivableAmount,
-        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
-        if(sum(t.his_owe_amount+t.cur_receivable_amount-t.cur_received_amount-his_owe_received_amount) &lt; 0,
-        0,
-        sum(t.his_owe_amount+t.cur_receivable_amount-t.cur_received_amount-his_owe_received_amount)) allOweAmount
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount
         from report_fee_month_statistics t
         left join building_room br on t.obj_id = br.room_id and t.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'
@@ -405,6 +421,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>

+ 7 - 5
service-report/src/main/java/com/java110/report/api/ReportFeeMonthStatisticsApi.java

@@ -16,11 +16,7 @@ import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Calendar;
 import java.util.HashMap;
@@ -135,6 +131,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 = "configIds", required = false) String configIds,
                                                         @RequestParam(value = "page") int page,
                                                         @RequestParam(value = "row") int row) {
         ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
@@ -149,6 +146,9 @@ public class ReportFeeMonthStatisticsApi {
         reportFeeMonthStatisticsDto.setRoomNum(roomNum);
         reportFeeMonthStatisticsDto.setStartTime(startTime);
         reportFeeMonthStatisticsDto.setEndTime(endTime);
+        if (!StringUtil.isEmpty(configIds)) {
+            reportFeeMonthStatisticsDto.setConfigIds(configIds.split(","));
+        }
         return getReportFeeMonthStatisticsBMOImpl.queryReportFeeSummary(reportFeeMonthStatisticsDto);
     }
 
@@ -648,6 +648,7 @@ public class ReportFeeMonthStatisticsApi {
         paramInfo.put("row", row);
         return getReportFeeMonthStatisticsBMOImpl.queryHuaningPayFee(paramInfo);
     }
+
     /**
      * 查询华宁物业 欠费统计报表
      * 作者: 吴学文
@@ -674,6 +675,7 @@ public class ReportFeeMonthStatisticsApi {
         paramInfo.put("row", row);
         return getReportFeeMonthStatisticsBMOImpl.queryHuaningPayFeeTwo(paramInfo);
     }
+
     /**
      * 查询华宁物业 欠费统计报表
      * 作者: 吴学文

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

@@ -33,12 +33,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service("getReportFeeMonthStatisticsBMOImpl")
 public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthStatisticsBMO {
@@ -93,6 +88,9 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = new ArrayList<>();
         if (count > 0) {
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummary(reportFeeMonthStatisticsDto);
+            if (reportFeeMonthStatisticsDto.getConfigIds() != null) {
+                reportFeeMonthStatisticsList = dealConfigReportFeeMonthStatisticsList(reportFeeMonthStatisticsList);
+            }
             for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsList) {
                 //获取应收金额
                 double receivableAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivableAmount());
@@ -127,6 +125,100 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         return responseEntity;
     }
 
+    /**
+     * 将configId group by 后数据 合并处理
+     *
+     * @param reportFeeMonthStatisticsList
+     * @return
+     */
+    private List<ReportFeeMonthStatisticsDto> dealConfigReportFeeMonthStatisticsList(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList) {
+        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = new ArrayList<>();
+        BigDecimal hisOweAmountDec = null;
+        BigDecimal curReceivableAmountDec = null;
+        BigDecimal curReceivedAmountDec = null;
+        BigDecimal hisOweReceivedAmountDec = null;
+        BigDecimal preReceivedAmountDec = null;
+        BigDecimal receivableAmountDec = null;
+        BigDecimal receivedAmountDec = null;
+        List<FeeConfigDto> feeConfigDtos = null;
+        FeeConfigDto feeConfigDto = null;
+        for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsList) {
+            ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = hasReportFeeMonthStatisticsDto(reportFeeMonthStatisticsDtos, reportFeeMonthStatisticsDto);
+            if (tmpReportFeeMonthStatisticsDto == null) {
+                feeConfigDtos = new ArrayList<>();
+                feeConfigDto = new FeeConfigDto();
+                feeConfigDto.setConfigId(reportFeeMonthStatisticsDto.getConfigId());
+                feeConfigDto.setAmount(Double.parseDouble(reportFeeMonthStatisticsDto.getReceivedAmount()));
+                feeConfigDtos.add(feeConfigDto);
+                reportFeeMonthStatisticsDto.setFeeConfigDtos(feeConfigDtos);
+                reportFeeMonthStatisticsDtos.add(reportFeeMonthStatisticsDto);
+                continue;
+            }
+            feeConfigDtos = tmpReportFeeMonthStatisticsDto.getFeeConfigDtos();
+            feeConfigDto = new FeeConfigDto();
+            feeConfigDto.setConfigId(reportFeeMonthStatisticsDto.getConfigId());
+            feeConfigDto.setAmount(Double.parseDouble(reportFeeMonthStatisticsDto.getReceivedAmount()));
+            feeConfigDtos.add(feeConfigDto);
+            tmpReportFeeMonthStatisticsDto.setFeeConfigDtos(feeConfigDtos);
+
+            //历史欠费
+            hisOweAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getHisOweAmount());
+            hisOweAmountDec = hisOweAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getHisOweAmount()))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setHisOweAmount(hisOweAmountDec.doubleValue());
+
+
+            //当月应收
+            curReceivableAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getCurReceivableAmount());
+            curReceivableAmountDec = curReceivableAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getCurReceivableAmount()))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setCurReceivableAmount(curReceivableAmountDec.doubleValue());
+
+            //当月实收
+            curReceivedAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getCurReceivedAmount());
+            curReceivedAmountDec = curReceivedAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getCurReceivedAmount()))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setCurReceivedAmount(curReceivedAmountDec.doubleValue());
+
+            //欠费追回
+            hisOweReceivedAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getHisOweReceivedAmount());
+            hisOweReceivedAmountDec = hisOweReceivedAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getHisOweReceivedAmount()))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setHisOweReceivedAmount(hisOweReceivedAmountDec.doubleValue());
+
+            //预交费
+            preReceivedAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getPreReceivedAmount());
+            preReceivedAmountDec = preReceivedAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getPreReceivedAmount()))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setPreReceivedAmount(preReceivedAmountDec.doubleValue());
+
+            //总费用
+            receivableAmountDec = new BigDecimal(Double.parseDouble(tmpReportFeeMonthStatisticsDto.getReceivableAmount()));
+            receivableAmountDec = receivableAmountDec.add(new BigDecimal(Double.parseDouble(reportFeeMonthStatisticsDto.getReceivableAmount())))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setReceivableAmount(receivableAmountDec.doubleValue() + "");
+
+            //实收
+            receivedAmountDec = new BigDecimal(Double.parseDouble(tmpReportFeeMonthStatisticsDto.getReceivedAmount()));
+            receivedAmountDec = receivedAmountDec.add(new BigDecimal(Double.parseDouble(reportFeeMonthStatisticsDto.getReceivedAmount())))
+                    .setScale(2, BigDecimal.ROUND_HALF_UP);
+            tmpReportFeeMonthStatisticsDto.setReceivedAmount(receivedAmountDec.doubleValue() + "");
+        }
+
+        return reportFeeMonthStatisticsDtos;
+    }
+
+    private ReportFeeMonthStatisticsDto hasReportFeeMonthStatisticsDto(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos, ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+        for (ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
+            if (tmpReportFeeMonthStatisticsDto.getFeeYear().equals(reportFeeMonthStatisticsDto.getFeeYear())
+                    && tmpReportFeeMonthStatisticsDto.getFeeMonth().equals(reportFeeMonthStatisticsDto.getFeeMonth())) {
+                return tmpReportFeeMonthStatisticsDto;
+            }
+        }
+
+        return null;
+    }
+
     @Override
     public ResponseEntity<String> queryReportFloorUnitFeeSummary(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummaryCount(reportFeeMonthStatisticsDto);