wuxw
2024-02-22 bc592d61092b8c79fffe2a68a593e47be7f6ed0c
优化并发查询
2个文件已修改
113 ■■■■■ 已修改文件
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
@@ -240,7 +240,7 @@
        where
        1=1
        <if test="floorId != null and floorId != ''">
            and t.obj_fpc_id = #{floorId}
            and bu.floor_id = #{floorId}
        </if>
        <if test="configId != null and configId != ''">
            and t.config_id = #{configId}
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java
@@ -6,6 +6,7 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.Java110ThreadPoolFactory;
import com.java110.dto.report.QueryStatisticsDto;
import com.java110.report.statistics.IBaseDataStatistics;
import com.java110.report.statistics.IFeeStatistics;
@@ -60,7 +61,7 @@
        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.setConfigId(reqJson.getString("configId"));
@@ -70,47 +71,83 @@
        queryStatisticsDto.setOwnerName(reqJson.getString("ownerName"));
        queryStatisticsDto.setLink(reqJson.getString("link"));
        if(reqJson.containsKey("configIds")){
        if (reqJson.containsKey("configIds")) {
            queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
        }
        //todo 查询历史欠费
        double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto);
        //todo 查询 单月欠费
        double curOweFee = feeStatisticsImpl.getCurMonthOweFee(queryStatisticsDto);
        //todo 查询当月应收
        double curReceivableFee = feeStatisticsImpl.getCurReceivableFee(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 feeRoomCount = feeStatisticsImpl.getFeeRoomCount(queryStatisticsDto);
        //todo 欠费户数
        int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto);
        JSONObject data = new JSONObject();
        data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee));
        data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee));
        data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee));
        data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee));
        data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee));
        data.put("roomCount", roomCount);
        data.put("feeRoomCount", feeRoomCount);
        data.put("oweRoomCount", oweRoomCount);
        data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee));
        Java110ThreadPoolFactory java110ThreadPoolFactory = null;
        try {
            java110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(9);
            java110ThreadPoolFactory.submit(() -> {
                //todo 查询历史欠费
                double hisOweFee = feeStatisticsImpl.getHisMonthOweFee(queryStatisticsDto);
                data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee));
                return hisOweFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 查询 单月欠费
                double curOweFee = feeStatisticsImpl.getCurMonthOweFee(queryStatisticsDto);
                data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee));
                return curOweFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 查询当月应收
                double curReceivableFee = feeStatisticsImpl.getCurReceivableFee(queryStatisticsDto);
                data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee));
                return curReceivableFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 查询 欠费追回
                double hisReceivedFee = feeStatisticsImpl.getHisReceivedFee(queryStatisticsDto);
                data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee));
                return hisReceivedFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo  查询 预交费用
                double preReceivedFee = feeStatisticsImpl.getPreReceivedFee(queryStatisticsDto);
                data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee));
                return preReceivedFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 查询实收
                double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto);
                data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee));
                return receivedFee;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 房屋数
                long roomCount = baseDataStatisticsImpl.getRoomCount(queryStatisticsDto);
                data.put("roomCount", roomCount);
                return roomCount;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 收费房屋数
                long feeRoomCount = feeStatisticsImpl.getFeeRoomCount(queryStatisticsDto);
                data.put("feeRoomCount", feeRoomCount);
                return feeRoomCount;
            });
            java110ThreadPoolFactory.submit(() -> {
                //todo 欠费户数
                int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto);
                data.put("oweRoomCount", oweRoomCount);
                return oweRoomCount;
            });
            java110ThreadPoolFactory.get();
        } finally {
            if (java110ThreadPoolFactory != null) {
                java110ThreadPoolFactory.stop();
            }
        }
        JSONArray datas = new JSONArray();
        datas.add(data);