java110 пре 2 година
родитељ
комит
9eeab03453

+ 19 - 5
java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java

@@ -5,7 +5,12 @@ import java.io.Serializable;
 public class QueryStatisticsDto implements Serializable {
 
     private String communityId;
-    private String queryDate;
+    private String startDate;
+
+    /**
+     * 查询历史欠费
+     */
+    private String endDate;
 
 
     public String getCommunityId() {
@@ -16,11 +21,20 @@ public class QueryStatisticsDto implements Serializable {
         this.communityId = communityId;
     }
 
-    public String getQueryDate() {
-        return queryDate;
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
     }
 
-    public void setQueryDate(String queryDate) {
-        this.queryDate = queryDate;
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
     }
 }

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

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="reportFeeStatisticsServiceDaoImpl">
+
+    <!-- 查询历史欠费 -->
+    <select id="getHisMonthOweFee" parameterType="Map" resultType="Map">
+        select sum(t.receivable_amount - t.received_amount - t.discount_amount) hisOweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where
+        1=1
+        and t.status_cd = '0'
+        and t.community_id= #{communityId}
+        and t.cur_month_time &lt; #{startDate}
+    </select>
+
+    <!-- 查询单月欠费 -->
+    <select id="getCurMonthOweFee" parameterType="Map" resultType="Map">
+        select sum(t.receivable_amount - t.received_amount - t.discount_amount) curOweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where
+        1=1
+        and t.status_cd = '0'
+        and t.community_id= #{communityId}
+        and t.cur_month_time &gt; #{startDate}
+        and t.cur_month_time &lt; #{endDate}
+    </select>
+
+    <!-- 查询欠费追回 -->
+    <select id="getHisReceivedFee" parameterType="Map" resultType="Map">
+        select sum(t.received_amount) hisReceivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        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;  #{startDate}
+    </select>
+
+    <!-- 查询 预交费用 -->
+    <select id="getPreReceivedFee" parameterType="Map" resultType="Map">
+        select sum(t.received_amount) preReceivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        and t.community_id= #{communityId}
+        and t.pay_fee_time &gt;  #{startDate}
+        and t.pay_fee_time &lt; #{endDate}
+        and t.cur_month_time &gt;  #{endDate}
+    </select>
+
+    <!-- 查询实收费用 -->
+    <select id="getReceivedFee" parameterType="Map" resultType="Map">
+        select sum(t.received_amount) receivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        and t.community_id= #{communityId}
+        and t.pay_fee_time &gt;  #{startDate}
+        and t.pay_fee_time &lt; #{endDate}
+    </select>
+
+    <!-- 查询欠费户数 -->
+    <select id="getOweRoomCount" parameterType="Map" resultType="Map">
+        select count(1) oweRoomCount
+        from
+        (
+        select t.obj_id from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.status_cd = '0'
+        and pf.payer_obj_type = '3333'
+        and t.community_id= #{communityId}
+        and t.cur_month_time &lt; #{endDate}
+        and (t.receivable_amount - t.received_amount - t.discount_amount) > 0
+        group by t.obj_id
+        ) a
+    </select>
+
+
+
+</mapper>

+ 61 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportFeeStatisticsInnerServiceSMO.java

@@ -0,0 +1,61 @@
+package com.java110.intf.report;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.owner.OwnerDto;
+import com.java110.dto.report.QueryStatisticsDto;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * @ClassName IReportFeeStatisticsInnerServiceSMO
+ * @Description 费用统计类 服务类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "report-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/reportFeeStatisticsApi")
+public interface IReportFeeStatisticsInnerServiceSMO {
+
+
+    /**
+     * <p>查询历史月欠费</p>
+     *
+     * @param queryFeeStatisticsDto 数据对象分享
+     */
+    @RequestMapping(value = "/getHisMonthOweFee", method = RequestMethod.POST)
+    double getHisMonthOweFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto);
+
+    /**
+     * 查询当月欠费
+     * @param queryFeeStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/getCurMonthOweFee", method = RequestMethod.POST)
+    double getCurMonthOweFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto);
+
+    @RequestMapping(value = "/getHisReceivedFee", method = RequestMethod.POST)
+    double getHisReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto);
+
+    @RequestMapping(value = "/getPreReceivedFee", method = RequestMethod.POST)
+    double getPreReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto);
+
+    @RequestMapping(value = "/getReceivedFee", method = RequestMethod.POST)
+    double getReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto);
+
+    /**
+     * 欠费户数
+     * @param queryStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/getOweRoomCount", method = RequestMethod.POST)
+    int getOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto);
+}

+ 65 - 160
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java

@@ -8,10 +8,13 @@ import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.data.DataPrivilegeStaffDto;
 import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.report.QueryStatisticsDto;
 import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
 import com.java110.intf.community.IDataPrivilegeUnitV1InnerServiceSMO;
 import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
 import com.java110.report.bmo.reportFeeMonthStatistics.IGetReportFeeMonthStatisticsBMO;
+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.BeanConvertUtil;
@@ -27,182 +30,84 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * 查询费用汇总表
+ * 查询 费用汇总表
+ * <p>
+ * add by  wuxw
  */
 @Java110Cmd(serviceCode = "reportFeeMonthStatistics.queryReportFeeSummary")
 public class QueryReportFeeSummaryCmd extends Cmd {
 
     @Autowired
-    private IGetReportFeeMonthStatisticsBMO getReportFeeMonthStatisticsBMOImpl;
+    private IFeeStatistics feeStatisticsImpl;
 
     @Autowired
-    private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
-
-    @Autowired
-    private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
-
+    private IBaseDataStatistics baseDataStatisticsImpl;
+
+
+    /**
+     * 校验查询条件
+     * <p>
+     * 开始时间
+     * 结束时间
+     * 房屋
+     * 业主
+     * 楼栋
+     * 费用项
+     *
+     * @param event   事件对象
+     * @param context 请求报文数据
+     * @param reqJson
+     * @throws CmdException
+     */
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "startDate", "未包含开始日期");
+        Assert.hasKeyAndValue(reqJson, "endDate", "未包含结束日期");
         Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
     }
 
     @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
-        String configIds = "";
-        if (reqJson.containsKey("configIds")) {
-            configIds = reqJson.getString("configIds");
-            reqJson.remove("configIds");
-        }
-        ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = BeanConvertUtil.covertBean(reqJson, ReportFeeMonthStatisticsDto.class);
-
-        String staffId = context.getReqHeaders().get("user-id");
-        DataPrivilegeStaffDto dataPrivilegeStaffDto = new DataPrivilegeStaffDto();
-        dataPrivilegeStaffDto.setStaffId(staffId);
-        String[] unitIds = dataPrivilegeUnitV1InnerServiceSMOImpl.queryDataPrivilegeUnitsByStaff(dataPrivilegeStaffDto);
-
-        if (unitIds != null && unitIds.length > 0) {
-            reportFeeMonthStatisticsDto.setUnitIds(unitIds);
-        }
-
-        if (!StringUtil.isEmpty(configIds)) {
-            reportFeeMonthStatisticsDto.setConfigIds(configIds.split(","));
-        }
-        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryCount(reportFeeMonthStatisticsDto);
-
-        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = new ArrayList<>();
-        if (count > 0) {
-            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummary(reportFeeMonthStatisticsDto);
-            if (reportFeeMonthStatisticsDto.getConfigIds() != null) {
-                reportFeeMonthStatisticsList = dealConfigReportFeeMonthStatisticsList(reportFeeMonthStatisticsList, "FeeSummary");
-            }
-            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsList) {
-                //获取应收金额
-                double receivableAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivableAmount());
-                //获取实收金额
-                double receivedAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivedAmount());
-                if (receivableAmount != 0) {
-                    double chargeRate = (receivedAmount / receivableAmount) * 100.0;
-                    reportFeeMonthStatistics.setChargeRate(String.format("%.2f", chargeRate) + "%");
-                } else {
-                    reportFeeMonthStatistics.setChargeRate("0%");
-
-                }
-                reportFeeMonthStatisticsDtos.add(reportFeeMonthStatistics);
-
-            }
-            ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryMajor(reportFeeMonthStatisticsDto);
-            if (reportFeeMonthStatisticsList != null && reportFeeMonthStatisticsList.size() > 0) {
-                for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsList) {
-                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
-                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount());
-                    reportFeeMonthStatisticsDto1.setAllHisOweReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllHisOweReceivedAmount());
-                }
-            }
-        } else {
-            reportFeeMonthStatisticsDtos = new ArrayList<>();
-        }
-
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos);
-
-        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-        context.setResponseEntity(responseEntity);
-    }
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
 
-    private List<ReportFeeMonthStatisticsDto> dealConfigReportFeeMonthStatisticsList(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList, String flag) {
-        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, flag);
-            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;
-    }
+        QueryStatisticsDto queryStatisticsDto = new QueryStatisticsDto();
+        queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
+        queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
+        queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+
+        //todo 查询历史欠费
+        double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto);
+
+        //todo 查询 单月欠费
+        double curOweFee = feeStatisticsImpl.getCurMonthOweFee(queryStatisticsDto);
+
+        //todo 查询 欠费追回
+        double hisReceivedFee = feeStatisticsImpl.getHisReceivedFee(queryStatisticsDto);
+
+        //todo  查询 预交费用
+        double preReceivedFee = feeStatisticsImpl.getPreReceivedFee(queryStatisticsDto);
+
+        //todo 查询实收
+        double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto);
+
+        //todo 房屋数
+        long roomCount = baseDataStatisticsImpl.getRoomCount(queryStatisticsDto);
+
+        //todo 空闲房屋数
+        long freeRoomCount = baseDataStatisticsImpl.getFreeRoomCount(queryStatisticsDto);
 
+        //todo 欠费户数
+        int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto);
 
-    private ReportFeeMonthStatisticsDto hasReportFeeMonthStatisticsDto(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos, ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto, String flag) {
-        for (ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
-            if ("FeeSummary".equals(flag) && tmpReportFeeMonthStatisticsDto.getFeeYear().equals(reportFeeMonthStatisticsDto.getFeeYear())
-                    && tmpReportFeeMonthStatisticsDto.getFeeMonth().equals(reportFeeMonthStatisticsDto.getFeeMonth())) {
-                return tmpReportFeeMonthStatisticsDto;
-            }
-            if ("FloorUnitFeeSummary".equals(flag) && tmpReportFeeMonthStatisticsDto.getFeeYear().equals(reportFeeMonthStatisticsDto.getFeeYear())
-                    && tmpReportFeeMonthStatisticsDto.getFeeMonth().equals(reportFeeMonthStatisticsDto.getFeeMonth())
-                    && tmpReportFeeMonthStatisticsDto.getFloorNum().equals(reportFeeMonthStatisticsDto.getFloorNum())
-                    && tmpReportFeeMonthStatisticsDto.getUnitNum().equals(reportFeeMonthStatisticsDto.getUnitNum())
-            ) {
-                return tmpReportFeeMonthStatisticsDto;
-            }
-        }
-
-        return null;
+        JSONObject data = new JSONObject();
+        data.put("hisOweFee", hisOweFee);
+        data.put("curOweFee", curOweFee);
+        data.put("hisReceivedFee", hisReceivedFee);
+        data.put("preReceivedFee", preReceivedFee);
+        data.put("receivedFee", receivedFee);
+        data.put("roomCount", roomCount);
+        data.put("freeRoomCount", freeRoomCount);
+        data.put("oweRoomCount", oweRoomCount);
+        context.setResponseEntity(ResultVo.createResponseEntity(data));
     }
 }

+ 55 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeStatisticsServiceDao.java

@@ -0,0 +1,55 @@
+package com.java110.report.dao;
+
+import java.util.Map;
+
+/**
+ * 费用统计 dao 层
+ */
+public interface IReportFeeStatisticsServiceDao {
+    /**
+     * 历史欠费
+     *
+     * @param info
+     * @return
+     */
+    double getHisMonthOweFee(Map info);
+
+    /**
+     * 查询当月欠费
+     *
+     * @param info
+     * @return
+     */
+    double getCurMonthOweFee(Map info);
+
+    /**
+     * 查询欠费追回
+     *
+     * @param info
+     * @return
+     */
+    double getHisReceivedFee(Map info);
+
+    /**
+     * 查询 预交费用
+     *
+     * @param info
+     * @return
+     */
+    double getPreReceivedFee(Map info);
+
+    /**
+     * 查询 实收费用
+     *
+     * @param info
+     * @return
+     */
+    double getReceivedFee(Map info);
+
+    /**
+     * 查询欠费户数
+     * @param info
+     * @return
+     */
+    int getOweRoomCount(Map info);
+}

+ 122 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeStatisticsServiceDaoImpl.java

@@ -0,0 +1,122 @@
+package com.java110.report.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.core.log.LoggerFactory;
+import com.java110.dto.report.ReportCarDto;
+import com.java110.dto.report.ReportRoomDto;
+import com.java110.report.dao.IReportCommunityServiceDao;
+import com.java110.report.dao.IReportFeeStatisticsServiceDao;
+import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName ReportCommunityServiceDaoImpl
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2020/10/15 22:15
+ * @Version 1.0
+ * add by wuxw 2020/10/15
+ **/
+@Service("reportFeeStatisticsServiceDaoImpl")
+public class ReportFeeStatisticsServiceDaoImpl extends BaseServiceDao implements IReportFeeStatisticsServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(ReportFeeStatisticsServiceDaoImpl.class);
+
+    @Override
+    public double getHisMonthOweFee(Map info) {
+        logger.debug("查询历史欠费 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getHisMonthOweFee", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Double.parseDouble(infos.get(0).get("hisOweFee").toString());
+    }
+
+    @Override
+    public double getCurMonthOweFee(Map info) {
+        logger.debug("查询单月欠费 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getCurMonthOweFee", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Double.parseDouble(infos.get(0).get("curOweFee").toString());
+    }
+
+    /**
+     * 查询欠费追回
+     * @param info
+     * @return
+     */
+    @Override
+    public double getHisReceivedFee(Map info) {
+        logger.debug("查询 欠费追回 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getHisReceivedFee", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Double.parseDouble(infos.get(0).get("hisReceivedFee").toString());
+    }
+
+    /**
+     * 查询预交费用
+     * @param info
+     * @return
+     */
+    @Override
+    public double getPreReceivedFee(Map info) {
+        logger.debug("查询 预交费用 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getPreReceivedFee", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Double.parseDouble(infos.get(0).get("preReceivedFee").toString());
+    }
+
+    /**
+     * 实收费用
+     * @param info
+     * @return
+     */
+    @Override
+    public double getReceivedFee(Map info) {
+        logger.debug("查询 预交费用 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getReceivedFee", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Double.parseDouble(infos.get(0).get("receivedFee").toString());
+    }
+
+    @Override
+    public int getOweRoomCount(Map info) {
+        logger.debug("查询 欠费户数 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getOweRoomCount", info);
+
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("oweRoomCount").toString());
+    }
+
+}

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

@@ -0,0 +1,75 @@
+package com.java110.report.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * @ClassName ReportFeeStatisticsInnerServiceSMOImpl
+ * @Description 费用统计类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class ReportFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO implements IReportFeeStatisticsInnerServiceSMO {
+
+    @Autowired
+    private IReportFeeStatisticsServiceDao reportFeeStatisticsServiceDaoImpl;
+
+    /**
+     * 查询历史欠费
+     *
+     * @param queryFeeStatisticsDto 数据对象分享
+     * @return
+     */
+    @Override
+    public double getHisMonthOweFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto) {
+        double info = reportFeeStatisticsServiceDaoImpl.getHisMonthOweFee(BeanConvertUtil.beanCovertMap(queryFeeStatisticsDto));
+        return info;
+    }
+
+    @Override
+    public double getCurMonthOweFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto) {
+        double info = reportFeeStatisticsServiceDaoImpl.getCurMonthOweFee(BeanConvertUtil.beanCovertMap(queryFeeStatisticsDto));
+        return info;
+    }
+
+    @Override
+    public double getHisReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto) {
+        double info = reportFeeStatisticsServiceDaoImpl.getHisReceivedFee(BeanConvertUtil.beanCovertMap(queryFeeStatisticsDto));
+        return info;
+    }
+
+    @Override
+    public double getPreReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto) {
+        double info = reportFeeStatisticsServiceDaoImpl.getPreReceivedFee(BeanConvertUtil.beanCovertMap(queryFeeStatisticsDto));
+        return info;
+    }
+
+    @Override
+    public double getReceivedFee(@RequestBody QueryStatisticsDto queryFeeStatisticsDto) {
+        double info = reportFeeStatisticsServiceDaoImpl.getReceivedFee(BeanConvertUtil.beanCovertMap(queryFeeStatisticsDto));
+        return info;
+    }
+
+    /**
+     * 查询欠费户数
+     * @param queryStatisticsDto
+     * @return
+     */
+    @Override
+    public int getOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto) {
+        int info = reportFeeStatisticsServiceDaoImpl.getOweRoomCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
+        return info;
+    }
+}

+ 7 - 0
service-report/src/main/java/com/java110/report/statistics/IFeeStatistics.java

@@ -48,4 +48,11 @@ public interface IFeeStatistics {
      */
     double getReceivedFee(QueryStatisticsDto queryFeeStatisticsDto);
 
+    /**
+     * 查询欠费户数
+     *
+     * @param queryStatisticsDto
+     * @return
+     */
+    int getOweRoomCount(QueryStatisticsDto queryStatisticsDto);
 }

+ 15 - 2
service-report/src/main/java/com/java110/report/statistics/impl/BaseDataStatisticsImpl.java

@@ -1,7 +1,10 @@
 package com.java110.report.statistics.impl;
 
+import com.java110.dto.RoomDto;
 import com.java110.dto.report.QueryStatisticsDto;
+import com.java110.intf.community.IRoomV1InnerServiceSMO;
 import com.java110.report.statistics.IBaseDataStatistics;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -9,13 +12,23 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class BaseDataStatisticsImpl implements IBaseDataStatistics {
+
+    @Autowired
+    private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl;
+
     @Override
     public long getRoomCount(QueryStatisticsDto queryStatisticsDto) {
-        return 0;
+
+        RoomDto roomDto = new RoomDto();
+        roomDto.setCommunityId(queryStatisticsDto.getCommunityId());
+        return roomV1InnerServiceSMOImpl.queryRoomsCount(roomDto);
     }
 
     @Override
     public long getFreeRoomCount(QueryStatisticsDto queryStatisticsDto) {
-        return 0;
+        RoomDto roomDto = new RoomDto();
+        roomDto.setCommunityId(queryStatisticsDto.getCommunityId());
+        roomDto.setState(RoomDto.STATE_FREE);
+        return roomV1InnerServiceSMOImpl.queryRoomsCount(roomDto);
     }
 }

+ 37 - 5
service-report/src/main/java/com/java110/report/statistics/impl/FeeStatisticsImpl.java

@@ -1,7 +1,9 @@
 package com.java110.report.statistics.impl;
 
 import com.java110.dto.report.QueryStatisticsDto;
+import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
 import com.java110.report.statistics.IFeeStatistics;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -10,33 +12,63 @@ import org.springframework.stereotype.Service;
 @Service
 public class FeeStatisticsImpl implements IFeeStatistics {
 
+    @Autowired
+    private IReportFeeStatisticsInnerServiceSMO reportFeeStatisticsInnerServiceSMOImpl;
+
     /**
      * 查询 历史欠费
+     *
      * @param queryFeeStatisticsDto
      * @return
      */
     @Override
     public double getHisMonthOweFee(QueryStatisticsDto queryFeeStatisticsDto) {
-        return 0;
+        return reportFeeStatisticsInnerServiceSMOImpl.getHisMonthOweFee(queryFeeStatisticsDto);
     }
 
+    /**
+     * 查询 当月欠费
+     * @param queryFeeStatisticsDto
+     * @return
+     */
     @Override
     public double getCurMonthOweFee(QueryStatisticsDto queryFeeStatisticsDto) {
-        return 0;
+        return reportFeeStatisticsInnerServiceSMOImpl.getCurMonthOweFee(queryFeeStatisticsDto);
     }
 
+
+    /**
+     * 查询 欠费追回
+     * @param queryFeeStatisticsDto
+     * @return
+     */
     @Override
     public double getHisReceivedFee(QueryStatisticsDto queryFeeStatisticsDto) {
-        return 0;
+        return reportFeeStatisticsInnerServiceSMOImpl.getHisReceivedFee(queryFeeStatisticsDto);
     }
 
+    /**
+     * 查询 预交费用
+     * @param queryFeeStatisticsDto
+     * @return
+     */
     @Override
     public double getPreReceivedFee(QueryStatisticsDto queryFeeStatisticsDto) {
-        return 0;
+        return reportFeeStatisticsInnerServiceSMOImpl.getPreReceivedFee(queryFeeStatisticsDto);
     }
 
+    /**
+     * 查询 实收费用
+     * @param queryFeeStatisticsDto
+     * @return
+     */
     @Override
     public double getReceivedFee(QueryStatisticsDto queryFeeStatisticsDto) {
-        return 0;
+        return reportFeeStatisticsInnerServiceSMOImpl.getReceivedFee(queryFeeStatisticsDto);
+    }
+
+    @Override
+    public int getOweRoomCount(QueryStatisticsDto queryStatisticsDto) {
+        return reportFeeStatisticsInnerServiceSMOImpl.getOweRoomCount(queryStatisticsDto);
     }
 }