From adae025ffc96205a8b66b7b00aca2832c2734156 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 12 Feb 2022 16:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E9=A2=84=E8=AD=A6=E6=BC=8F?= =?UTF-8?q?=E6=B4=9E=E9=87=8C=E9=9D=A2=20=E7=9B=B4=E6=8E=A5=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=9C=80=E5=A4=9A1000=20=E8=A6=81=E4=B8=8D=E7=84=B6?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/IcStatsResiWarnDao.java | 4 +- .../impl/StatsResiWarnServiceImpl.java | 37 ++++++++----------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java index 09c0d6979d..610eeba0a0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java @@ -18,7 +18,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.PersonWarnLeftPieDTO; import com.epmet.dto.result.UserWarnNameListResultDTO; import com.epmet.entity.IcStatsResiWarnEntity; @@ -39,6 +38,7 @@ public interface IcStatsResiWarnDao extends BaseDao { List selectResiWarnByAgencyId(@Param("customerId") String customerId,@Param("agencyId") String agencyId); + @Deprecated List> userWarnList(@Param("customerId") String customerId, @Param("buildingIdList") List buildingIdList, @Param("tableName") String tableName, @@ -76,4 +76,4 @@ public interface IcStatsResiWarnDao extends BaseDao { List> selectCategoryCountByColumn(@Param("columnNames") List columnNames,@Param("agencyId")String agencyId); -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java index 5947a62259..5178ecbd3a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -9,8 +10,6 @@ import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcStatsResiWarnDao; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiCategoryWarnConfigDTO; -import com.epmet.dto.PersonWarnLeftPieDTO; -import com.epmet.dto.form.CategoryCountListFormDTO; import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO; import com.epmet.dto.form.StatsResiListFormDTO; import com.epmet.dto.result.*; @@ -20,6 +19,7 @@ import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.StatsResiWarnService; +import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -159,26 +159,21 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); //根据buildingID,tableName he columnName获取名字 -// List> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); - List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); -// result.forEach(item->{ -// item.setConfigId(configId); -// List> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); -// item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames")); -// }); - if (!CollectionUtils.isEmpty(dtos)){ - Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); - result.forEach(item->{ - item.setConfigId(configId); - groupByBuild.forEach((k,v) -> { - if (item.getBuildingId().equals(k)){ - item.setUserList(v); - } + //限制条数 一栋楼内最多显示1000 即可 + PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{ + List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + if (!CollectionUtils.isEmpty(dtos)){ + Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); + result.forEach(item->{ + item.setConfigId(configId); + groupByBuild.forEach((k,v) -> { + if (item.getBuildingId().equals(k)){ + item.setUserList(v); + } + }); }); - }); - } - - + } + }); return mapResult; }