From cb087f3d4398562c25051c462d4779e5d1d11ce0 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 30 Dec 2021 14:57:25 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8E=AA=E6=96=BD?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IcUserDemandRecController.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 06c991b31c..01a928da76 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -265,15 +265,13 @@ public class IcUserDemandRecController { * @throws Exception */ @PostMapping("analysis-export") - public Result analysisExport(HttpServletResponse response,@LoginUser TokenDto tokenDto, @RequestBody PageListAnalysisFormDTO formDTO)throws Exception { + public void analysisExport(HttpServletResponse response,@LoginUser TokenDto tokenDto, @RequestBody PageListAnalysisFormDTO formDTO)throws Exception { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setPageFlag(false); PageData res=icUserDemandRecService.pageListAnalysis(formDTO); if (!CollectionUtils.isEmpty(res.getList())) { ExcelUtils.exportExcelToTarget(response, null, res.getList(), DemandRecExcelResultDTO.class); - return new Result(); } - return new Result(); } /** From 30bc8f327c027a2a2872f62465b6e3b2c03c9089 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 30 Dec 2021 14:59:20 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/controller/DemoController.java | 1 + 1 file changed, 1 insertion(+) 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 a6de8eb159..69ede23cf1 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 @@ -1111,6 +1111,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(); From bc45b7a5f3b92c89f17b4d16bf5cda277476756b Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 30 Dec 2021 15:35:17 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96=20=E6=97=A5=E5=BF=97=E6=8E=92=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dao/project/ProjectDao.java | 3 ++- .../todata/impl/ProjectExtractServiceImpl.java | 13 +++++++++++-- .../com/epmet/service/project/ProjectService.java | 2 +- .../service/project/impl/ProjectServiceImpl.java | 4 ++-- .../main/resources/mapper/project/ProjectDao.xml | 3 +++ 5 files changed, 19 insertions(+), 6 deletions(-) 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 3c860e4d37..36b6600d13 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 @@ -128,7 +128,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { List projectList = projectService.getProjectInfo(customerId, dateString, projectId); factOriginProjectMainDailyService.deleteByDate(customerId, dateString,projectId); 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()); @@ -231,7 +231,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); } @@ -239,7 +241,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 -> { //获取日期相关维度 @@ -291,7 +295,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 -> { //获取日期相关维度 @@ -337,8 +343,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()); @@ -367,7 +374,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 990480fa2c..a9664b82e7 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 @@ -243,8 +243,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} From 9c99e653fff4177a06916f11aa07ead7bb254f16 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 30 Dec 2021 15:40:19 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96=20=E6=97=A5=E5=BF=97=E6=8E=92=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/FactOriginExtractController.java | 4 ++++ 1 file changed, 4 insertions(+) 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(); } From 698b859bb852ae14673e05b61bb8c76438a4ed2c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 30 Dec 2021 16:25:27 +0800 Subject: [PATCH 5/8] dbupdate --- .../src/main/java/com/epmet/redis/IssueVoteDetailRedis.java | 5 +++++ 1 file changed, 5 insertions(+) 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 79068b4124..580b6a0f76 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 @@ -262,6 +262,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); From fdceeece40d827082e991b069a40c23a15233793 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 30 Dec 2021 17:40:24 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=201.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BF=97=E6=84=BF=E8=80=85=E4=BF=A1=E6=81=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=8C=E5=BC=82=E6=AD=A5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/EpmetHeartOpenFeignClient.java | 8 + .../EpmetHeartOpenFeignClientFallback.java | 5 + .../controller/ResiVolunteerController.java | 14 + .../epmet/service/VolunteerInfoService.java | 7 + .../impl/VolunteerInfoServiceImpl.java | 7 + .../service/impl/VolunteerServiceImpl.java | 241 ++++++++++-------- 6 files changed, 172 insertions(+), 110 deletions(-) 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 4bad8f25d7..b75ac8e39b 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 @@ -66,4 +66,12 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/volunteer/page") Result> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input); + + /** + * 查询志愿者数量 + * @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 27c2c9bdc8..5271fb57e0 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 @@ -60,4 +60,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> queryVolunteerPage(VolunteerCommonFormDTO input) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryVolunteerPage", input); } + + @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 e1d18e5536..6205fb524a 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 @@ -144,4 +144,18 @@ public class ResiVolunteerController { List l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize); return new Result>().ok(l); } + + /** + * 查询志愿者数量 + * @param input + * @return + */ + @PostMapping("count") + public Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) { + ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.VolunteerPage.class); + String customerId = input.getCustomerId(); + + Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId); + 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 6a84fb67a1..4fa082f5e3 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 @@ -97,4 +97,11 @@ public interface VolunteerInfoService extends BaseService { List queryListVolunteer(String customerId,String userRealName); List queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize); + + /** + * 查询志愿者数量 + * @param customerId + * @return + */ + Integer getVolunteerCount(String customerId); } 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 ac87cc6b4c..9d1e7a9240 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 @@ -278,4 +278,11 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); + query.eq(VolunteerInfoEntity::getCustomerId, customerId); + return baseDao.selectCount(query); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java index 2d5e776c8f..238b70cc41 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.UserBaseInfoDao; @@ -16,7 +17,6 @@ import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.VolunteerService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,6 +24,8 @@ import org.springframework.stereotype.Service; import com.google.common.collect.Lists; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; /** @@ -94,135 +96,154 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve * @return */ public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId) { - //epmetHeartOpenFeignClient.queryVolunteerPage() + VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); + + // 1.==========分页查询出所有志愿者列表========== + + String vcErrorMsg = "【志愿者分布】查询志愿者总数出错"; + VolunteerCommonFormDTO volunteerCountForm = new VolunteerCommonFormDTO(); + volunteerCountForm.setCustomerId(customerId); + Integer volunteerCount = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getVolunteerCount(volunteerCountForm), + ServiceConstant.EPMET_HEART_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + vcErrorMsg, + vcErrorMsg); + + if (volunteerCount == null || volunteerCount == 0) { + // 没得志愿者,直接返回 + return r; + } - // 1.分页查询出所有志愿者列表 - int pageNo = 1; + // 计算页数 int pageSize = 200; + int pageCount = volunteerCount / pageSize; + int lastPageItems = volunteerCount % pageSize; + pageCount = lastPageItems > 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.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; - } - - pageNo++; + List>> volsPageFutures = new ArrayList<>(); + + for (int pageNo = 1 ; pageNo <= pageCount ; pageNo ++) { + + int pageNoTemp = pageNo; + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listVolunteersByPage(customerId, pageNoTemp, pageSize) + .stream() + .map(v -> v.getUserId()) + .collect(Collectors.toSet()); + }); + + volsPageFutures.add(future); } - - VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); - + // 阻塞,等待子线程返回结果,然后添加到志愿者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 (List volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) { - // 填充志愿者类型 - 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, Integer pageNo, Integer pageSize) { + VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); + volunteerForm.setCustomerId(customerId); + 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); + } } From e99b34a4d1725e1fe708083140e2ba553615a8c5 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 30 Dec 2021 18:27:12 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=AD=98=E4=B8=AA=E5=8D=8A=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=E5=90=A7=20=E8=AE=A9=E4=BB=96=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=97=B6=20=E5=88=AB=E5=86=8D=E9=80=A0?= =?UTF-8?q?=E6=88=91=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/CustomerAgencyServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a1024cead5..a6972b1dcc 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 @@ -1133,7 +1133,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Fri, 31 Dec 2021 11:00:27 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=90=88=E5=B9=B6dev=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetHeartOpenFeignClient.java | 2 +- .../fallback/EpmetHeartOpenFeignClientFallback.java | 2 +- .../epmet/controller/ResiVolunteerController.java | 4 ++-- .../java/com/epmet/service/VolunteerInfoService.java | 2 +- .../epmet/service/impl/VolunteerInfoServiceImpl.java | 12 ++++++++++-- .../java/com/epmet/task/AutoEvaluateDemandTask.java | 2 +- .../com/epmet/service/impl/VolunteerServiceImpl.java | 1 + 7 files changed, 17 insertions(+), 8 deletions(-) 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 fa1010d5be..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,7 +74,7 @@ public interface EpmetHeartOpenFeignClient { * @return */ @PostMapping("/heart/residemand/autoevaluate") - Result AutoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); + Result autoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); /** * 查询志愿者数量 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 3f1b877e63..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,7 @@ 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); } 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 f9467f995b..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 @@ -153,10 +153,10 @@ public class ResiVolunteerController { */ @PostMapping("count") public Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) { - ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.VolunteerPage.class); String customerId = input.getCustomerId(); + String pidsPrefix = input.getSuperiorAgencyId(); - Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId); + 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 6f7f26df7b..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 @@ -102,5 +102,5 @@ public interface VolunteerInfoService extends BaseService { * @param customerId * @return */ - Integer getVolunteerCount(String customerId); + 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 408627e3ae..0713d4bfdd 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 @@ -385,9 +385,17 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); - query.eq(VolunteerInfoEntity::getCustomerId, customerId); + + 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-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java index 2eed9f1d3f..9aa05b6b27 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java @@ -103,6 +103,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve String vcErrorMsg = "【志愿者分布】查询志愿者总数出错"; VolunteerCommonFormDTO volunteerCountForm = new VolunteerCommonFormDTO(); volunteerCountForm.setCustomerId(customerId); + volunteerCountForm.setSuperiorAgencyId(agencyId); Integer volunteerCount = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getVolunteerCount(volunteerCountForm), ServiceConstant.EPMET_HEART_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),