wuxw
2024-02-23 a17de318404449de2e4fb741da7ce3f6c9cc6793
优化代码
3个文件已修改
8个文件已添加
995 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java
@@ -17,6 +17,7 @@
    private String endDate;
    private String floorId;
    private String[] floorIds;
    private String configId;
@@ -29,6 +30,7 @@
    private String link;
    private String feeTypeCd;
    private String[] feeTypeCds;
    private String[] unitIds;
@@ -159,4 +161,20 @@
    public void setHisDate(String hisDate) {
        this.hisDate = hisDate;
    }
    public String[] getFloorIds() {
        return floorIds;
    }
    public void setFloorIds(String[] floorIds) {
        this.floorIds = floorIds;
    }
    public String[] getFeeTypeCds() {
        return feeTypeCds;
    }
    public void setFeeTypeCds(String[] feeTypeCds) {
        this.feeTypeCds = feeTypeCds;
    }
}
java110-bean/src/main/java/com/java110/dto/report/ReportFloorFeeStatisticsDto.java
New file
@@ -0,0 +1,123 @@
package com.java110.dto.report;
public class ReportFloorFeeStatisticsDto {
    private String floorId;
    private String floorNum;
    private String floorName;
    private String oweRoomCount;
    private String feeRoomCount;
    private String receivedFee;
    private String preReceivedFee;
    private String hisOweFee;
    private String curReceivableFee;
    private String curReceivedFee;
    private String hisReceivedFee;
    //todo 欠费房屋数 oweRoomCount
    //todo 收费房屋数 feeRoomCount
    //todo 实收金额 receivedFee
    //todo 预收金额 preReceivedFee
    //todo 历史欠费金额 hisOweFee
    //todo 当期应收金额 curReceivableFee
    //todo 当期实收金额 curReceivedFee
    //todo 欠费追回 hisReceivedFee
    public String getFloorId() {
        return floorId;
    }
    public void setFloorId(String floorId) {
        this.floorId = floorId;
    }
    public String getFloorNum() {
        return floorNum;
    }
    public void setFloorNum(String floorNum) {
        this.floorNum = floorNum;
    }
    public String getFloorName() {
        return floorName;
    }
    public void setFloorName(String floorName) {
        this.floorName = floorName;
    }
    public String getOweRoomCount() {
        return oweRoomCount;
    }
    public void setOweRoomCount(String oweRoomCount) {
        this.oweRoomCount = oweRoomCount;
    }
    public String getFeeRoomCount() {
        return feeRoomCount;
    }
    public void setFeeRoomCount(String feeRoomCount) {
        this.feeRoomCount = feeRoomCount;
    }
    public String getReceivedFee() {
        return receivedFee;
    }
    public void setReceivedFee(String receivedFee) {
        this.receivedFee = receivedFee;
    }
    public String getPreReceivedFee() {
        return preReceivedFee;
    }
    public void setPreReceivedFee(String preReceivedFee) {
        this.preReceivedFee = preReceivedFee;
    }
    public String getHisOweFee() {
        return hisOweFee;
    }
    public void setHisOweFee(String hisOweFee) {
        this.hisOweFee = hisOweFee;
    }
    public String getCurReceivableFee() {
        return curReceivableFee;
    }
    public void setCurReceivableFee(String curReceivableFee) {
        this.curReceivableFee = curReceivableFee;
    }
    public String getCurReceivedFee() {
        return curReceivedFee;
    }
    public void setCurReceivedFee(String curReceivedFee) {
        this.curReceivedFee = curReceivedFee;
    }
    public String getHisReceivedFee() {
        return hisReceivedFee;
    }
    public void setHisReceivedFee(String hisReceivedFee) {
        this.hisReceivedFee = hisReceivedFee;
    }
}
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
@@ -365,7 +365,7 @@
        select count(1) from (
            select bu.floor_id,t.payer_obj_id
            from report_owe_fee t
        inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
            inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
            left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
            <if test="feeTypeCd != null and feeTypeCd != ''">
                left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
java110-db/src/main/resources/mapper/report/ReportFloorFeeStatisticsServiceDaoImplMapper.xml
New file
@@ -0,0 +1,230 @@
<?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="reportFloorFeeStatisticsServiceDaoImpl">
    <select id="getFloorOweRoomCount" parameterType="Map" resultType="Map">
        select b.floor_id floorId,count(1) oweRoomCount
        from (
            select distinct bu.floor_id,t.payer_obj_id
            from report_owe_fee t
            inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
            left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
            <if test="feeTypeCd != null and feeTypeCd != ''">
                left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
            </if>
            where
            1=1
            and t.payer_obj_type = '3333'
            and t.community_id= #{communityId}
            and t.end_time &lt;= #{endDate}
            and t.amount_owed != 0
            and bu.floor_id in
            <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
            <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 pfc.fee_type_cd = #{feeTypeCd}
            </if>
        ) b
        group by b.floor_id
    </select>
    <select id="getFloorFeeRoomCount" parameterType="Map" resultType="Map">
        select b.floor_id floorId,count(1) feeRoomCount
        from (
            select distinct bu.floor_id,t.payer_obj_id
            from report_owe_fee t
            inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
            inner join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
            left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
            where
            1=1
            and t.payer_obj_type = '3333'
            and t.community_id= #{communityId}
            and pf.community_id=  #{communityId}
            and t.end_time &lt;= #{endDate}
            and bu.floor_id in
            <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
            <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>
        ) b
        group by b.floor_id
    </select>
    <select id="getFloorReceivedFee" parameterType="Map" resultType="Map">
        select bu.floor_id floorId,ifnull(sum(t.received_amount),0.0) receivedFee
        from pay_fee_detail t
        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
        LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
        where
        1=1
        and t.status_cd = '0'
        and t.community_id= a.community_id
        and t.create_time &gt; #{startDate}
        and t.create_time &lt; #{endDate}
        and bu.floor_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="configIds !=null ">
            and pf.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>
        group by bu.floor_id
    </select>
    <select id="getFloorPreReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) preReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= a.community_id
        and t.pay_fee_time &gt; #{startDate}
        and t.pay_fee_time &lt; #{endDate}
        and t.cur_month_time &gt;= #{endDate}
        <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 t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
    <select id="getFloorHisOweFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) hisOweFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= a.community_id
        and t.detail_id = '-1'
        and t.cur_month_time &lt; #{startDate}
        <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 t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
    <select id="getFloorCurReceivableFee" parameterType="Map" resultType="Map">
        select  t.obj_fpc_id floorId,ifnull(sum(t.receivable_amount),0.0) curReceivableFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        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}
        <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 t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
    <select id="getFloorCurReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId, ifnull(sum(t.receivable_amount),0.0) curReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        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 t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
    <select id="getFloorHisReceivedFee" parameterType="Map" resultType="Map">
        select t.obj_fpc_id floorId,ifnull(sum(t.received_amount),0.0) hisReceivedFee
        from pay_fee_detail_month t
        where
        1=1
        and t.obj_fpc_id in
        <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and t.status_cd = '0'
        and t.community_id= a.community_id
        and t.pay_fee_time &gt; #{startDate}
        and t.pay_fee_time &lt; #{endDate}
        and t.cur_month_time &lt; #{startDate}
        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 t.fee_type_cd = #{feeTypeCd}
        </if>
        group by t.obj_fpc_id
    </select>
</mapper>
java110-interface/src/main/java/com/java110/intf/report/IReportFloorFeeStatisticsInnerServiceSMO.java
New file
@@ -0,0 +1,104 @@
package com.java110.intf.report;
import com.java110.config.feign.FeignConfiguration;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.dto.report.ReportFloorFeeStatisticsDto;
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;
import java.util.Map;
/**
 * @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("/reportFloorFeeStatisticsApi")
public interface IReportFloorFeeStatisticsInnerServiceSMO {
    /**
     * 查询   //todo 欠费房屋数 oweRoomCount
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorOweRoomCount", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 收费房屋数 feeRoomCount
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorFeeRoomCount", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorFeeRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询    //todo 实收金额 receivedFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorReceivedFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询    //todo 预收金额 preReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorPreReceivedFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorPreReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询     //todo 历史欠费金额 hisOweFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorHisOweFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorHisOweFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 当期应收金额 curReceivableFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorCurReceivableFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorCurReceivableFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 当期实收金额 curReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorCurReceivedFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorCurReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询  //todo 欠费追回 hisReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    @RequestMapping(value = "/getFloorHisReceivedFee", method = RequestMethod.POST)
    List<ReportFloorFeeStatisticsDto> getFloorHisReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
}
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFloorFeeSummaryCmd.java
@@ -5,15 +5,22 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.floor.FloorDto;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.dto.report.ReportFloorFeeStatisticsDto;
import com.java110.intf.community.IFloorInnerServiceSMO;
import com.java110.report.statistics.IFeeStatistics;
import com.java110.report.statistics.IFloorFeeStatistics;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.ListUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -24,7 +31,10 @@
public class QueryReportFloorFeeSummaryCmd extends Cmd {
    @Autowired
    private IFeeStatistics feeStatisticsImpl;
    private IFloorFeeStatistics floorFeeStatisticsImpl;
    @Autowired
    private IFloorInnerServiceSMO floorInnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
@@ -39,17 +49,67 @@
        queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
        queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
        queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
        if(reqJson.containsKey("endDate") && !reqJson.getString("endDate").contains(":")) {
        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")){
        if (reqJson.containsKey("configIds")) {
            queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
        }
        List<Map> datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto);
        //todo 查询楼栋
        FloorDto floorDto = new FloorDto();
        floorDto.setCommunityId(reqJson.getString("communityId"));
        List<FloorDto> floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto);
        if(datas == null || datas.size() < 1){
        if (ListUtil.isNull(floorDtos)) {
            context.setResponseEntity(ResultVo.createResponseEntity(new ArrayList<>()));
            return;
        }
        List<String> floorIds = new ArrayList<>();
        List<Map> datas = new ArrayList<>();
        Map<String,Object> dataInfo = null;
        for(FloorDto floorDto1:floorDtos){
            floorIds.add(floorDto1.getFloorId());
            dataInfo = new HashMap<>();
            dataInfo.put("floorId",floorDto1.getFloorId());
            dataInfo.put("floorName",floorDto1.getFloorName());
            dataInfo.put("floorNum",floorDto1.getFloorNum());
            datas.add(dataInfo);
        }
        queryStatisticsDto.setFloorIds(floorIds.toArray(new String[floorIds.size()]));
        //todo 欠费房屋数 oweRoomCount
        List<ReportFloorFeeStatisticsDto> oweRoomCounts = floorFeeStatisticsImpl.getFloorOweRoomCount(queryStatisticsDto);
        //todo 收费房屋数 feeRoomCount
        List<ReportFloorFeeStatisticsDto> feeRoomCounts = floorFeeStatisticsImpl.getFloorFeeRoomCount(queryStatisticsDto);
        //todo 实收金额 receivedFee
        List<ReportFloorFeeStatisticsDto> receivedFees = floorFeeStatisticsImpl.getFloorReceivedFee(queryStatisticsDto);
        //todo 预收金额 preReceivedFee
        List<ReportFloorFeeStatisticsDto> preReceivedFees = floorFeeStatisticsImpl.getFloorPreReceivedFee(queryStatisticsDto);
        //todo 历史欠费金额 hisOweFee
        List<ReportFloorFeeStatisticsDto> hisOweFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto);
        //todo 当期应收金额 curReceivableFee
        List<ReportFloorFeeStatisticsDto> curReceivableFees = floorFeeStatisticsImpl.getFloorCurReceivableFee(queryStatisticsDto);
        //todo 当期实收金额 curReceivedFee
        List<ReportFloorFeeStatisticsDto> curReceivedFees = floorFeeStatisticsImpl.getFloorCurReceivedFee(queryStatisticsDto);
        //todo 欠费追回 hisReceivedFee
        List<ReportFloorFeeStatisticsDto> hisReceivedFees = floorFeeStatisticsImpl.getFloorHisOweFee(queryStatisticsDto);
        //todo 拼接数据
        computeData(datas,oweRoomCounts,feeRoomCounts,receivedFees,preReceivedFees,hisOweFees,curReceivableFees,curReceivedFees,hisReceivedFees);
        //List<Map> datas = feeStatisticsImpl.getFloorFeeSummary(queryStatisticsDto);
        if (datas == null || datas.size() < 1) {
            context.setResponseEntity(ResultVo.createResponseEntity(datas));
            return;
        }
@@ -58,29 +118,119 @@
        BigDecimal feeRoomRate = null;
        BigDecimal curReceivedFee = null;
        BigDecimal curReceivableFee = null;
        for(Map data:datas){
        for (Map data : datas) {
            //todo 计算 户收费率
            if(Double.parseDouble(data.get("feeRoomCount").toString())>0){
            if (Double.parseDouble(data.get("feeRoomCount").toString()) > 0) {
                feeRoomCountDec = new BigDecimal(Double.parseDouble(data.get("feeRoomCount").toString()));
                oweRoomCountDec = new BigDecimal(Double.parseDouble(data.get("oweRoomCount").toString()));
                feeRoomRate = feeRoomCountDec.subtract(oweRoomCountDec).divide(feeRoomCountDec,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
                data.put("feeRoomRate",feeRoomRate.doubleValue());
            }else{
                data.put("feeRoomRate",0.0);
                feeRoomRate = feeRoomCountDec.subtract(oweRoomCountDec).divide(feeRoomCountDec, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
                data.put("feeRoomRate", feeRoomRate.doubleValue());
            } else {
                data.put("feeRoomRate", 0.0);
            }
            //todo 计算 收费率
            curReceivedFee = new BigDecimal(Double.parseDouble(data.get("curReceivedFee").toString()));
            curReceivableFee = new BigDecimal(Double.parseDouble(data.get("curReceivableFee").toString()));
            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);
            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);
            }
        }
        context.setResponseEntity(ResultVo.createResponseEntity(datas));
    }
    private void computeData(List<Map> datas, List<ReportFloorFeeStatisticsDto> oweRoomCounts,
                             List<ReportFloorFeeStatisticsDto> feeRoomCounts,
                             List<ReportFloorFeeStatisticsDto> receivedFees,
                             List<ReportFloorFeeStatisticsDto> preReceivedFees,
                             List<ReportFloorFeeStatisticsDto> hisOweFees,
                             List<ReportFloorFeeStatisticsDto> curReceivableFees,
                             List<ReportFloorFeeStatisticsDto> curReceivedFees,
                             List<ReportFloorFeeStatisticsDto> hisReceivedFees) {
        //todo 欠费房屋数 oweRoomCount
        for(Map data :datas){
            data.put("oweRoomCount","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:oweRoomCounts){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("oweRoomCount",reportFloorFeeStatisticsDto.getOweRoomCount());
                }
            }
        }
        //todo 收费房屋数 feeRoomCount
        for(Map data :datas){
            data.put("feeRoomCount","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:feeRoomCounts){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("feeRoomCount",reportFloorFeeStatisticsDto.getFeeRoomCount());
                }
            }
        }
        //todo 实收金额 receivedFee
        for(Map data :datas){
            data.put("receivedFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:receivedFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("receivedFee",reportFloorFeeStatisticsDto.getReceivedFee());
                }
            }
        }
        //todo 预收金额 preReceivedFee
        for(Map data :datas){
            data.put("preReceivedFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:preReceivedFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("preReceivedFee",reportFloorFeeStatisticsDto.getPreReceivedFee());
                }
            }
        }
        //todo 历史欠费金额 hisOweFee
        for(Map data :datas){
            data.put("hisOweFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisOweFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("hisOweFee",reportFloorFeeStatisticsDto.getHisOweFee());
                }
            }
        }
        //todo 当期应收金额 curReceivableFee
        for(Map data :datas){
            data.put("curReceivableFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivableFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("curReceivableFee",reportFloorFeeStatisticsDto.getCurReceivableFee());
                }
            }
        }
        //todo 当期实收金额 curReceivedFee
        for(Map data :datas){
            data.put("curReceivedFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:curReceivedFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("curReceivedFee",reportFloorFeeStatisticsDto.getReceivedFee());
                }
            }
        }
        //todo 欠费追回 hisReceivedFee
        for(Map data :datas){
            data.put("hisReceivedFee","0");
            for(ReportFloorFeeStatisticsDto reportFloorFeeStatisticsDto:hisReceivedFees){
                if(reportFloorFeeStatisticsDto.getFloorId().equals(data.get("floorId"))){
                    data.put("hisReceivedFee",reportFloorFeeStatisticsDto.getHisReceivedFee());
                }
            }
        }
    }
}
service-report/src/main/java/com/java110/report/dao/IReportFloorFeeStatisticsServiceDao.java
New file
@@ -0,0 +1,26 @@
package com.java110.report.dao;
import java.util.List;
import java.util.Map;
/**
 * 费用统计 dao 层
 */
public interface IReportFloorFeeStatisticsServiceDao {
    List<Map> getFloorOweRoomCount(Map info);
    List<Map> getFloorFeeRoomCount(Map info);
    List<Map> getFloorReceivedFee(Map info);
    List<Map> getFloorPreReceivedFee(Map info);
    List<Map> getFloorHisOweFee(Map info);
    List<Map> getFloorCurReceivableFee(Map info);
    List<Map> getFloorCurReceivedFee(Map info);
    List<Map> getFloorHisReceivedFee(Map info);
}
service-report/src/main/java/com/java110/report/dao/impl/ReportFloorFeeStatisticsServiceDaoImpl.java
New file
@@ -0,0 +1,76 @@
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.report.dao.IReportFeeStatisticsServiceDao;
import com.java110.report.dao.IReportFloorFeeStatisticsServiceDao;
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("reportFloorFeeStatisticsServiceDaoImpl")
public class ReportFloorFeeStatisticsServiceDaoImpl extends BaseServiceDao implements IReportFloorFeeStatisticsServiceDao {
    private static Logger logger = LoggerFactory.getLogger(ReportFloorFeeStatisticsServiceDaoImpl.class);
    @Override
    public List<Map> getFloorOweRoomCount(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorOweRoomCount", info);
        return infos;
    }
    @Override
    public List<Map> getFloorFeeRoomCount(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorFeeRoomCount", info);
        return infos;
    }
    @Override
    public List<Map> getFloorReceivedFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorReceivedFee", info);
        return infos;
    }
    @Override
    public List<Map> getFloorPreReceivedFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorPreReceivedFee", info);
        return infos;
    }
    @Override
    public List<Map> getFloorHisOweFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorHisOweFee", info);
        return infos;
    }
    @Override
    public List<Map> getFloorCurReceivableFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivableFee", info);
        return infos;
    }
    @Override
    public List<Map> getFloorCurReceivedFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivedFee", info);
        return infos;
    }
    @Override
    public List<Map> getFloorHisReceivedFee(Map info) {
        List<Map> infos = sqlSessionTemplate.selectList("reportFloorFeeStatisticsServiceDaoImpl.getFloorHisReceivedFee", info);
        return infos;
    }
}
service-report/src/main/java/com/java110/report/smo/impl/ReportFloorFeeStatisticsInnerServiceSMOImpl.java
New file
@@ -0,0 +1,84 @@
package com.java110.report.smo.impl;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.PageDto;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.dto.report.ReportFloorFeeStatisticsDto;
import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
import com.java110.intf.report.IReportFloorFeeStatisticsInnerServiceSMO;
import com.java110.report.dao.IReportFeeStatisticsServiceDao;
import com.java110.report.dao.IReportFloorFeeStatisticsServiceDao;
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.HashMap;
import java.util.List;
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 ReportFloorFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO implements IReportFloorFeeStatisticsInnerServiceSMO {
    @Autowired
    private IReportFloorFeeStatisticsServiceDao reportFloorFeeStatisticsServiceDaoImpl;
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorOweRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorOweRoomCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorFeeRoomCount(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorFeeRoomCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorPreReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorPreReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorHisOweFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorHisOweFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorCurReceivableFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivableFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorCurReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorCurReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorHisReceivedFee(@RequestBody QueryStatisticsDto queryStatisticsDto) {
        List<Map> data = reportFloorFeeStatisticsServiceDaoImpl.getFloorHisReceivedFee(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
        return BeanConvertUtil.covertBeanList(data, ReportFloorFeeStatisticsDto.class);
    }
}
service-report/src/main/java/com/java110/report/statistics/IFloorFeeStatistics.java
New file
@@ -0,0 +1,92 @@
package com.java110.report.statistics;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.dto.report.ReportFloorFeeStatisticsDto;
import java.util.List;
import java.util.Map;
/**
 * 楼栋费用统计
 */
public interface IFloorFeeStatistics {
    /**
     * 查询   //todo 欠费房屋数 oweRoomCount
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorOweRoomCount(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 收费房屋数 feeRoomCount
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorFeeRoomCount(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询    //todo 实收金额 receivedFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorReceivedFee(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询    //todo 预收金额 preReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorPreReceivedFee(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询     //todo 历史欠费金额 hisOweFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorHisOweFee(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 当期应收金额 curReceivableFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorCurReceivableFee(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询   //todo 当期实收金额 curReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorCurReceivedFee(QueryStatisticsDto queryStatisticsDto);
    /**
     * 查询  //todo 欠费追回 hisReceivedFee
     * @param queryStatisticsDto
     * @return
     */
    List<ReportFloorFeeStatisticsDto> getFloorHisReceivedFee(QueryStatisticsDto queryStatisticsDto);
}
service-report/src/main/java/com/java110/report/statistics/impl/FloorFeeStatisticsImpl.java
New file
@@ -0,0 +1,58 @@
package com.java110.report.statistics.impl;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.dto.report.ReportFloorFeeStatisticsDto;
import com.java110.intf.report.IReportFloorFeeStatisticsInnerServiceSMO;
import com.java110.report.statistics.IFloorFeeStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class FloorFeeStatisticsImpl implements IFloorFeeStatistics {
    @Autowired
    private IReportFloorFeeStatisticsInnerServiceSMO reportFloorFeeStatisticsInnerServiceSMOImpl;
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorOweRoomCount(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorOweRoomCount(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorFeeRoomCount(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorFeeRoomCount(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorReceivedFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorReceivedFee(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorPreReceivedFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorPreReceivedFee(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorHisOweFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorHisOweFee(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorCurReceivableFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorCurReceivableFee(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorCurReceivedFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorCurReceivedFee(queryStatisticsDto);
    }
    @Override
    public List<ReportFloorFeeStatisticsDto> getFloorHisReceivedFee(QueryStatisticsDto queryStatisticsDto) {
        return reportFloorFeeStatisticsInnerServiceSMOImpl.getFloorHisReceivedFee(queryStatisticsDto);
    }
}