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 2520d4bd89..d15122b107 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 @@ -23,6 +23,7 @@ import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -89,10 +90,15 @@ public class StatsGroupServiceImpl implements StatsGroupService { DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(formDTO); if (customerIds.size() != NumConstant.ZERO) { customerIds.forEach(customerId -> { + Boolean status = true; try { List gridsInfo = customerGridService.getCustomerGridIdList(customerId, dimIdBean.getDateId()); - List resultDTOS = groupDataService.groupGridDaily(customerId, dimIdBean, gridsInfo); - factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS, customerId); + List> partition = ListUtils.partition(gridsInfo, NumConstant.ONE_HUNDRED); + for (List p : partition) { + List resultDTOS = groupDataService.groupGridDaily(customerId, dimIdBean, p); + factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS, customerId,status); + status = false; + } } catch (Exception e) { log.error(String.format(GroupConstant.STATS_FAILED_GRID_DAILY, customerId, LocalDate.now(), e)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java index bcf2157ecd..732e5062eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java @@ -99,5 +99,5 @@ public interface FactGroupGridDailyService extends BaseService formDto,String customerId); + void statisticsGroupGridDaily(List formDto,String customerId,Boolean status); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java index f0c8d90832..85902dd39f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java @@ -115,15 +115,18 @@ public class FactGroupGridDailyServiceImpl extends BaseServiceImpl formDto,String customerId) { + public void statisticsGroupGridDaily(List formDto,String customerId,Boolean status) { if (CollectionUtils.isEmpty(formDto)){ return; } String dateId = formDto.get(NumConstant.ZERO).getDateId(); - Integer delNum; - do { - delNum = baseDao.deleteInsertDateId(dateId,customerId); - }while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND); + // true 为当前客户第一回进入 + if (!status){ + Integer delNum; + do { + delNum = baseDao.deleteInsertDateId(dateId,customerId); + }while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND); + } List> partition = ListUtils.partition(formDto, NumConstant.ONE_HUNDRED); partition.forEach(p -> { baseDao.insertGroupGridDaily(p);