From 55c742edc6798d01486f50805abd955c3bafd9b7 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 23 Jun 2020 11:12:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=B0=8F=E7=BB=84=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StatsGroupServiceImpl.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index 15ad3e0b3a..e4447e07ba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -58,17 +58,19 @@ public class StatsGroupServiceImpl implements StatsGroupService { public void groupGridDaily(Date date) { Integer pageNo = NumConstant.ONE; Integer pageSize = NumConstant.ONE_HUNDRED; - List customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize); - if (customerIds.size() == NumConstant.ZERO){ - return; - } - customerIds.forEach(customerId -> { - DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); - List gridsInfo = dimGridService.getGridListByCustomerId(customerId); - List resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo); - factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId); - }); + List customerIds; + do { + customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize); + if (customerIds.size() != NumConstant.ZERO){ + customerIds.forEach(customerId -> { + DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); + List gridsInfo = dimGridService.getGridListByCustomerId(customerId); + List resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo); + factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId); + }); + } + }while (customerIds.size() != NumConstant.ZERO && customerIds.size() == pageSize); } /** @@ -79,17 +81,18 @@ public class StatsGroupServiceImpl implements StatsGroupService { public void groupAgencyDaily(Date date) { Integer pageNo = NumConstant.ONE; Integer pageSize = NumConstant.ONE_HUNDRED; - List customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize); - if (customerIds.size() == NumConstant.ZERO){ - return; - } - DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); - customerIds.forEach(customerId -> { - - List customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId); - List agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId); - factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId); - }); + List customerIds; + do { + customerIds = dimCustomerService.selectCustomerIdPage(pageNo++,pageSize); + if (customerIds.size() != NumConstant.ZERO){ + DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); + customerIds.forEach(customerId -> { + List customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId); + List agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId); + factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId); + }); + } + }while (customerIds.size() != NumConstant.ZERO && customerIds.size() == pageSize); } /** @@ -258,6 +261,8 @@ public class StatsGroupServiceImpl implements StatsGroupService { /** * @Description 获取时间维度 dateId--weekId--monthId--quarterId--yearId + * 如果有自定义时间,根据自定义时间获取时间维度 + * 没有自定义时间,默认获取前一天的时间维度 * @param * @author zxc */