diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 411cc8ad2c..5b6b444919 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -1112,6 +1112,7 @@ public class DemoController { }else { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); + result.add(dateId); redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); } long end = System.currentTimeMillis(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 8d86caed9c..cf3ce5abf5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.stats.DimCustomerService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -23,6 +24,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/9/15 11:06 */ +@Slf4j @RestController @RequestMapping("factorigin") public class FactOriginExtractController { @@ -95,6 +97,7 @@ public class FactOriginExtractController { @PostMapping("project") public Result projectData(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { + long start = System.currentTimeMillis(); if (StringUtils.isNotBlank(extractOriginFormDTO.getCustomerId())) { List daysBetween; if (StringUtils.isBlank(extractOriginFormDTO.getDateId())) { @@ -115,6 +118,7 @@ public class FactOriginExtractController { projectExtractService.saveOriginProjectDaily(dto); }); } + log.info("projectData end,cost:{}",System.currentTimeMillis() - start); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index f090c31a71..e154508f30 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -200,7 +200,8 @@ public interface ProjectDao extends BaseDao { * 获取已转项目事件事件 * * @param customerId + * @param projectId * @return */ - List getEventList(@Param("customerId") String customerId); + List getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index f941c7313b..164387d70b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -131,7 +131,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { List issueList = new ArrayList<>(); List topicList = new ArrayList<>(); if (!CollectionUtils.isEmpty(projectList)) { - Map projectEventMap = projectService.getEventList(customerId); + Map projectEventMap = projectService.getEventList(customerId, projectId); //提取议题ID List issueIds = projectList.stream().filter(item -> ProjectConstant.ISSUE.equals(item.getOrigin())).map(ProjectDTO::getOriginId).collect(Collectors.toList()); @@ -241,7 +241,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } //满意度 + long start = System.currentTimeMillis(); List satisfaction = projectService.getProjectSatisfaction(customerId, projectId); + log.info("saveOriginProjectDaily 满意度 cost:{}",System.currentTimeMillis()-start); if (CollectionUtils.isNotEmpty(satisfaction)) { factOriginProjectMainDailyService.updateBatchById(satisfaction); } @@ -249,7 +251,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { final List mainList = list; List logList = new ArrayList<>(); //节点发起人 部门流转退回结案 + start = System.currentTimeMillis(); List processList = projectProcessService.getProcessListByCustomer(customerId, dateString, projectId); + log.info("saveOriginProjectDaily 节点发起人 部门流转退回结案 cost:{}",System.currentTimeMillis()-start); if (!CollectionUtils.isEmpty(processList)) { logList = processList.stream().map(process -> { //获取日期相关维度 @@ -301,7 +305,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { }).collect(Collectors.toList()); } //节点发起人 响应 + start = System.currentTimeMillis(); List responseList = projectProcessService.getResponseProcessList(customerId, dateString, projectId); + log.info("saveOriginProjectDaily 节点发起人 响应 cost:{}",System.currentTimeMillis()-start); if (!CollectionUtils.isEmpty(responseList)) { logList.addAll(responseList.stream().map(process -> { //获取日期相关维度 @@ -347,8 +353,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } //项目评论人 + start = System.currentTimeMillis(); List satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString, projectId); - + log.info("saveOriginProjectDaily 项目评论人 cost:{}",System.currentTimeMillis()-start); satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> { //进行满意度评价的居民的所属机关的父机机关信息 log.setPid(main.getPid()); @@ -377,7 +384,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { //节点接收人 + start = System.currentTimeMillis(); List processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString, projectId); + log.info("saveOriginProjectDaily 节点接收人 cost:{}",System.currentTimeMillis()-start); logList.addAll(processStaffList.stream().map(process -> { //获取日期相关维度 DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 6b844a3481..87b377d39e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -202,5 +202,5 @@ public interface ProjectService extends BaseService { * @param projectId * @return */ - Map getEventList(String customerId); + Map getEventList(String customerId, String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 5b4d087830..ecdcda2e71 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -249,8 +249,8 @@ public class ProjectServiceImpl extends BaseServiceImpl getEventList(String customerId) { - List list = baseDao.getEventList(customerId); + public Map getEventList(String customerId, String projectId) { + List list = baseDao.getEventList(customerId, projectId); if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) { return Collections.emptyMap(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 715b37f605..766636e76b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -259,6 +259,9 @@ from resi_event_report_org rero inner join resi_event re on rero.RESI_EVENT_ID = re.id and re.SHIFT_PROJECT = 1 and re.DEL_FLAG = '0' where rero.del_flag = '0' + + AND re.PROJECT_ID = #{projectId} + and rero.CUSTOMER_ID = #{customerId} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index d4f3c8c92d..ffce4482d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -74,5 +74,13 @@ public interface EpmetHeartOpenFeignClient { * @return */ @PostMapping("/heart/residemand/autoevaluate") - Result AutoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); + Result autoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); + + /** + * 查询志愿者数量 + * @param input + * @return + */ + @PostMapping("/heart/resi/volunteer/count") + Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index eed34f0116..db83d85a27 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -68,7 +68,12 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli * @return */ @Override - public Result AutoEvaluateDemand(AutoEvaluateDemandFormDTO formDTO) { + public Result autoEvaluateDemand(AutoEvaluateDemandFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "autoEvaluate",formDTO); } + + @Override + public Result getVolunteerCount(VolunteerCommonFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getVolunteerCount", input); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 842919a3f2..ed5609eed3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -145,4 +145,18 @@ public class ResiVolunteerController { List l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, superiorAgencyId); return new Result>().ok(l); } + + /** + * 查询志愿者数量 + * @param input + * @return + */ + @PostMapping("count") + public Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) { + String customerId = input.getCustomerId(); + String pidsPrefix = input.getSuperiorAgencyId(); + + Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, pidsPrefix); + return new Result().ok(volunteerCount); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index 3df4a76018..adf45e6437 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -96,4 +96,11 @@ public interface VolunteerInfoService extends BaseService { List queryListVolunteer(String customerId,String staffId,String userRealName); List queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId); + + /** + * 查询志愿者数量 + * @param customerId + * @return + */ + Integer getVolunteerCount(String customerId, String pidsPrefix); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index c7c92dd56d..de63c1f712 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -390,4 +390,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); + + Optional.ofNullable(customerId).ifPresent((cId) -> { + query.eq(VolunteerInfoEntity::getCustomerId, cId); + }); + + Optional.ofNullable(pidsPrefix).ifPresent((pidsPrefixt) -> { + query.likeRight(VolunteerInfoEntity::getPids, pidsPrefixt); + }); + + return baseDao.selectCount(query); + } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java index c1ce071d0e..23d5d34787 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java @@ -26,6 +26,6 @@ public class AutoEvaluateDemandTask implements ITask { if (StringUtils.isNotBlank(params)) { formDTO = JSON.parseObject(params, AutoEvaluateDemandFormDTO.class); } - Result result = heartOpenFeignClient.AutoEvaluateDemand(formDTO); + Result result = heartOpenFeignClient.autoEvaluateDemand(formDTO); } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java index 23e0c2bb02..6330942024 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java @@ -264,6 +264,11 @@ public class IssueVoteDetailRedis { formDTO.setIssueId(issueId); formDTO.setGridId(issue.getGridId()); voteCache = issueVoteDetailService.selectIssueVotingDetail(formDTO); + IssueVoteStatisticalDTO dto = ConvertUtils.sourceToTarget(voteCache, IssueVoteStatisticalDTO.class); + dto.setVotableCount(voteCache.getShouldVoteCount()); + dto.setSupportCount(voteCache.getSupportAmount()); + dto.setOppositionCount(voteCache.getOppositionAmount()); + issueVoteStatisticalDao.updateBtIssueId(dto); }else { // 状态是关闭,转议题的,直接从结果表查询 voteCache = issueVoteStatisticalDao.selectVoteDetail(issueId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 6e6bc84e49..b9d49f7235 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1136,7 +1136,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl 0 ? ++pageCount : pageCount; - // 志愿者epmet user id + // 志愿者epmet user id 集合 List volunteerEpmetUserIds = new ArrayList<>(); // 分页查询志愿者的epmet user id - while (true) { - - VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); - volunteerForm.setCustomerId(customerId); - volunteerForm.setSuperiorAgencyId(agencyId); - volunteerForm.setPageNo(pageNo); - volunteerForm.setPageSize(pageSize); - - String errorMsg = "【志愿者分布】分页查询志愿者列表失败"; - List volunteerPage = getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm), - ServiceConstant.EPMET_HEART_SERVER, - EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), - errorMsg, - errorMsg); - - // 将本页userId添加到总集中去 - volunteerEpmetUserIds.addAll(volunteerPage.stream().map(v -> v.getUserId()).collect(Collectors.toSet())); - - if (volunteerPage.size() < pageSize) { - // 说明是最后一页了 - break; - } + List>> volsPageFutures = new ArrayList<>(); - pageNo++; - } + for (int pageNo = 1 ; pageNo <= pageCount ; pageNo ++) { + int pageNoTemp = pageNo; + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listVolunteersByPage(customerId, agencyId, pageNoTemp, pageSize) + .stream() + .map(v -> v.getUserId()) + .collect(Collectors.toSet()); + }); - VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); + volsPageFutures.add(future); + } + + // 阻塞,等待子线程返回结果,然后添加到志愿者userId集合中去 + for (CompletableFuture> future : volsPageFutures) { + try { + volunteerEpmetUserIds.addAll(future.get()); + } catch (InterruptedException e) { + log.error("【志愿者分布】异步获取志愿者userId列表被中断:{}", ExceptionUtils.getErrorStackTrace(e)); + } catch (ExecutionException e) { + log.error("【志愿者分布】异步获取志愿者userId列表失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size()); - - // 2.填充ic居民信息 + + // 2.==========异步填充ic居民信息========== + List>> volResiInfoFutures = new ArrayList<>(); + + // 将所有的userId按100固定分割成多个部分,循环用每个部分去查询,然后填充 List> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100); + for (List volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) { - List icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart); - - // 填充志愿者类型 - for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) { - // 将志愿者类型列表字符串,切割放到set中 - Set volunteerTypes = new HashSet(); - String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr(); - - if (StringUtils.isNotEmpty(volunteerCategoriesStr)) { - String[] vTypes = volunteerCategoriesStr.split(","); - if (vTypes != null && vTypes.length > 0) { - volunteerTypes.addAll(Arrays.asList(vTypes)); - } - icResiInfo.setVolunteerCategories(volunteerTypes); - } else { - icResiInfo.setVolunteerCategories(new HashSet<>()); - } + log.info("【志愿者分布】查询ic居民信息,切割后,本组的userId个数:{}", volunteerEpmetUserIdPart.size()); - // 填充建筑坐标 - String msg = "【志愿者分布】查询楼栋信息失败"; - IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()), - ServiceConstant.GOV_ORG_SERVER, - EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listIcResiInfosByUserIds(volunteerEpmetUserIdPart); + }); - icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId()); - icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId()); - Optional.of(building).ifPresent(b -> { - icResiInfo.setLongitude(b.getLongitude()); - icResiInfo.setLatitude(b.getLatitude()); - }); + volResiInfoFutures.add(future); + } + // 阻塞的,获取各个子线程计算结果 + for (CompletableFuture> volResiInfoFuture : volResiInfoFutures) { + try { + List distributions = volResiInfoFuture.get(); + r.getDistributions().addAll(distributions); + } catch (InterruptedException e) { + log.error("【志愿者分布】异步获取志愿者的居民信息被中断:{}", ExceptionUtils.getErrorStackTrace(e)); + } catch (ExecutionException e) { + log.error("【志愿者分布】异步获取志愿者的居民信息失败:{}", ExceptionUtils.getErrorStackTrace(e)); } - r.getDistributions().addAll(icResiInfos); } - - // 就有代码,稳定之后可以删掉 - //for (String volunteerEpmetUserId : volunteerEpmetUserIds) { - // - // VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution(); - // - // ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId); - // if (userBaseInfo == null || StringUtils.isBlank(userBaseInfo.getIdNum())){ - // log.warn("getVolunteerDistribution selecUserBaseInfoByUserId return null or idCard is null,volunteerEpmetUserId:{}", volunteerEpmetUserId); - // continue; - // } - // //使用身份证号查询ic resi信息 - // IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null); - // if (icResiUserInfo == null) { - // continue; - // } - // - // // 查询志愿者类别 - // List volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId()); - // //if (CollectionUtils.isEmpty(volunteerCategories)) { - // // // 此人没有志愿者信息 - // // continue; - // //} - // - // // 将志愿者类型列表字符串,切割放到set中 - // Set volunteerTypes = new HashSet(); - // for (String vTypesString : volunteerCategories) { - // String[] vTypes = vTypesString.split(","); - // if (vTypes != null && vTypes.length > 0) { - // volunteerTypes.addAll(Arrays.asList(vTypes)); - // } - // } - // - // - // String msg = "【志愿者分布】查询楼栋信息失败"; - // IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()), - // ServiceConstant.GOV_ORG_SERVER, - // EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); - // - // distribution.setVolunteerCategories(volunteerTypes); - // distribution.setEpmetUserId(userBaseInfo.getUserId()); - // distribution.setIcResiUserId(icResiUserInfo.getId()); - // Optional.of(building).ifPresent(b -> { - // distribution.setLongitude(b.getLongitude()); - // distribution.setLatitude(b.getLatitude()); - // }); - // - // r.getDistributions().add(distribution); - //} return r; } + /** + * userId列表批量获取他们对应的志愿者信息 + * @param volunteerEpmetUserIdPart + * @return + */ + private List listIcResiInfosByUserIds(List volunteerEpmetUserIdPart) { + List icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart); + + // 填充志愿者类型 + for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) { + // 将志愿者类型列表字符串,切割放到set中 + Set volunteerTypes = new HashSet(); + String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr(); + + if (StringUtils.isNotEmpty(volunteerCategoriesStr)) { + String[] vTypes = volunteerCategoriesStr.split(","); + if (vTypes != null && vTypes.length > 0) { + volunteerTypes.addAll(Arrays.asList(vTypes)); + } + icResiInfo.setVolunteerCategories(volunteerTypes); + } else { + icResiInfo.setVolunteerCategories(new HashSet<>()); + } + + // 填充建筑坐标 + String msg = "【志愿者分布】查询楼栋信息失败"; + IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()), + ServiceConstant.GOV_ORG_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + + icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId()); + icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId()); + Optional.of(building).ifPresent(b -> { + icResiInfo.setLongitude(b.getLongitude()); + icResiInfo.setLatitude(b.getLatitude()); + }); + + } + + return icResiInfos; + } + + /** + * 分页查询志愿者列表 + * @param customerId + * @param pageNo + * @param pageSize + * @return + */ + private List listVolunteersByPage(String customerId, String agencyId, Integer pageNo, Integer pageSize) { + VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); + volunteerForm.setCustomerId(customerId); + volunteerForm.setSuperiorAgencyId(agencyId); + volunteerForm.setPageNo(pageNo); + volunteerForm.setPageSize(pageSize); + + String errorMsg = "【志愿者分布】分页查询志愿者列表失败"; + return getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm), + ServiceConstant.EPMET_HEART_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + errorMsg, + errorMsg); + } + }