diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 12720182f5..055d174c2e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -11,6 +11,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.dao.DuplicateKeyException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import java.time.Duration; import java.time.LocalDateTime; @@ -281,7 +283,10 @@ public abstract class BaseRequestLogAspect { } else { StringBuilder builder = new StringBuilder("["); for (Object object : args) { - if (object != null) { + if (object != null + && !(object instanceof ServletRequest) + && !(object instanceof ServletResponse) + ) { try { // 尝试作为json解析 String objectString = JSON.toJSONString(object); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java new file mode 100644 index 0000000000..9860f9d1ad --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java @@ -0,0 +1,15 @@ +package com.epmet.commons.tools.constant; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/12/27 10:22 上午 + * @version: 1.0 + */ +public interface CustomerIdConstant { + /** + * 市北生产-客户ID + */ + String SHI_BEI_CUSTOMER_ID = "b09527201c4409e19d1dbc5e3c3429a1"; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 1558df9b36..f3c669d7cd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -628,4 +628,12 @@ public class RedisKeys { return rootPrefix.concat("resi:").concat("export").concat(":template:changed").concat(customerId); } + /** + * desc:临时方案 + * @param agencyId + * @return + */ + public static String getOrgTreeCacheKey(String agencyId) { + return rootPrefix.concat("org:temp:orgtree").concat(agencyId); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java index 200054ae6d..071926bf1b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java @@ -487,9 +487,9 @@ public class GovProjectServiceImpl implements GovProjectService { if (!org.springframework.util.CollectionUtils.isEmpty(userList)) { //2-1.根据身份证号查询负能平台用户信息 IcResiUserDTO icResiUserDTO = epmetUserService.getIcResiUser(userList.get(0).getIdNum(), formDTO.getCustomerId()); - resultDTO.setIcUserId(icResiUserDTO.getId()); - resultDTO.setIcUserName(icResiUserDTO.getName()); if (null != icResiUserDTO) { + resultDTO.setIcUserId(icResiUserDTO.getId()); + resultDTO.setIcUserName(icResiUserDTO.getName()); //2-2.查询人员的家庭成员数据 List homeList = epmetUserService.getHomeUserList(icResiUserDTO.getHomeId(), icResiUserDTO.getId()); resultDTO.setHomeUserList(homeList); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml index 0282677e40..d2cc49d64a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml @@ -4,7 +4,7 @@ + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index c04e3d18e6..230082385f 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -260,10 +260,10 @@ WHERE dm.del_flag = '0' AND rd.del_flag = '0' + + AND org.CUSTOMER_ID = #{customerId} + - - AND org.CUSTOMER_ID = #{customerId} - AND org.AREA_CODE LIKE concat(#{areaCode}, '%') 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..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 @@ -903,6 +903,7 @@ public class DemoController { ScreenCentralZoneDataFormDTO formDTO = new ScreenCentralZoneDataFormDTO(); formDTO.setCustomerId(customerId); formDTO.setDateId(dateId); + formDTO.setProjectId(param.getProjectId()); screenProjectSettleService.extractScreenData(formDTO); }); } @@ -1111,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/dataToIndex/impl/IndexOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java index 6bc96d1006..a30c0e3169 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.extract.dataToIndex.impl; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.CustomerIdConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractIndexFormDTO; @@ -67,6 +68,8 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService log.error("indexOriginExtractAll 获取客户Id为空"); return; } + //去除 市北客户id的抽取 + customerIds.remove(CustomerIdConstant.SHI_BEI_CUSTOMER_ID); } String finalMonthId = monthId; 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..73507e7c54 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 @@ -38,6 +38,7 @@ import com.epmet.util.DimIdGenerator; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -127,17 +128,26 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { //获取项目信息 List projectList = projectService.getProjectInfo(customerId, dateString, projectId); factOriginProjectMainDailyService.deleteByDate(customerId, dateString,projectId); + 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()); - //获取议题信息 - List issueList = issueService.getIssueInfoByIds(issueIds); - //提取话题ID - List topicIds = issueList.stream().map(IssueDTO::getSourceId).collect(Collectors.toList()); - //获取话题信息 - List topicList = topicService.getTopicByIds(topicIds); + if (CollectionUtils.isNotEmpty(issueIds)) { + //分批次获取 + //获取议题信息 + List> partition = ListUtils.partition(issueIds, NumConstant.FIFTY); + partition.forEach(part -> issueList.addAll(issueService.getIssueInfoByIds(part))); + //提取话题ID + List topicIds = issueList.stream().map(IssueDTO::getSourceId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(topicIds)) { + //获取话题信息 + List> topicPart = ListUtils.partition(topicIds, NumConstant.FIFTY); + topicPart.forEach(part -> topicList.addAll(topicService.getTopicByIds(part))); + } + } //获取网格认证党员 List partyMemberList = partyMemberService.getPartyMemberByCustomer(customerId); //生成DTO @@ -231,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); } @@ -239,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 -> { //获取日期相关维度 @@ -291,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 -> { //获取日期相关维度 @@ -337,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()); @@ -367,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/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index a36e2c6577..0d3d541634 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.CustomerIdConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; @@ -461,6 +462,11 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } catch (Exception e) { log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e); } + //去除 市北客户id的抽取 + if (CustomerIdConstant.SHI_BEI_CUSTOMER_ID.equals(customerId)){ + log.info("===== extractMonthly method end not contains shi bei:{}======", customerId); + return; + } //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 ExecutorService pool = Executors.newSingleThreadExecutor(); pool.submit(() -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index 5694fbaef0..3fd804ec7a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java @@ -15,7 +15,6 @@ import com.epmet.dto.indexcal.IndexStatisticsFormDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.redis.IndexCalRedis; import com.epmet.service.crm.CustomerRelationService; -import com.epmet.service.evaluationindex.extract.dataToIndex.IndexOriginExtractService; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import com.epmet.util.DimIdGenerator; @@ -59,8 +58,6 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { private ScreenCustomerAgencyDao screenCustomerAgencyDao; @Autowired private CustomerRelationService customerRelationService; - @Autowired - private IndexOriginExtractService indexOriginExtractService; @Override public Boolean indexCalculate(CalculateCommonFormDTO formDTO) { 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} 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/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(); } /** 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/IcPartyUnitService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java index 490e19bee6..b844a95bf6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java @@ -114,6 +114,15 @@ public interface IcPartyUnitService extends BaseService { */ List option(IcPartyUnitDTO dto); + /** + * @Description 获取组织以及下级单位列表 + * @Param dto + * @Return {@link List< OptionDTO>} + * @Author zhaoqifeng + * @Date 2021/11/22 14:35 + */ + List options(IcPartyUnitDTO dto); + /** * 导入数据 * @Param tokenDto 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/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 4057d1ba41..966060878c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -366,7 +366,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + Map option = icPartyUnitService.options(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); //获取服务事项字典 SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); codeFormDTO.setCustomerId(tokenDto.getCustomerId()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index ab96c7c68b..8c11573fdf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -193,7 +193,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl options(IcPartyUnitDTO dto) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.and(wp -> wp.eq(IcPartyUnitEntity::getAgencyId, dto.getAgencyId()).or(). + like(IcPartyUnitEntity::getPids, dto.getAgencyId())); + wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime); + wrapper.eq(StringUtils.isNotBlank(dto.getServiceMatter()), IcPartyUnitEntity::getServiceMatter, dto.getServiceMatter()); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(item -> { + OptionDTO option = new OptionDTO(); + option.setValue(item.getId()); + option.setLabel(item.getUnitName()); + return option; + }).collect(Collectors.toList()); + } + /** * 导入数据 * 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-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 4ebf4f1fd3..a2632d820f 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -90,6 +90,12 @@ 2.0.0 compile + + com.epmet + gov-issue-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java index 4c091c1c6a..3731ecf8e6 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java @@ -2,6 +2,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.feign.impl.GovIssueFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -22,7 +23,7 @@ public interface GovIssueFeignClient { * @date 2020.05.20 15:39 **/ @PostMapping(value = "gov/issue/issuevotestatisticaldaily/dailystatisticalvotejob") - Result dailyStatisticalVoteJob(); + Result dailyStatisticalVoteJob(DailyStatisticalVoteJob form); /** * @Description 将所有表决中的投票数从缓存同步到数据库,要进行数据对比,若数据一致无需更新 diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/impl/GovIssueFeignClientFallBack.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/impl/GovIssueFeignClientFallBack.java index 0267ca347f..7623db9dab 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/impl/GovIssueFeignClientFallBack.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/impl/GovIssueFeignClientFallBack.java @@ -3,6 +3,7 @@ package com.epmet.feign.impl; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.feign.GovIssueFeignClient; import org.springframework.stereotype.Component; @@ -15,8 +16,8 @@ import org.springframework.stereotype.Component; @Component public class GovIssueFeignClientFallBack implements GovIssueFeignClient { @Override - public Result dailyStatisticalVoteJob() { - return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "dailyStatisticalVoteJob"); + public Result dailyStatisticalVoteJob(DailyStatisticalVoteJob form) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "dailyStatisticalVoteJob",form); } @Override diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IssueVotingDailyStatisticalTaskService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IssueVotingDailyStatisticalTaskService.java index 0b72ddc1b2..3d14b1be08 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IssueVotingDailyStatisticalTaskService.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/IssueVotingDailyStatisticalTaskService.java @@ -2,6 +2,7 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.DailyStatisticalVoteJob; /** * @Description 生成议题表决日统计数定时任务 @@ -10,6 +11,6 @@ import com.epmet.commons.tools.utils.Result; */ public interface IssueVotingDailyStatisticalTaskService { - Result issueVotingDailyStatistical(); + Result issueVotingDailyStatistical(DailyStatisticalVoteJob form); } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IssueVotingDailyStatisticalTaskServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IssueVotingDailyStatisticalTaskServiceImpl.java index eb31c97810..504dc46994 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IssueVotingDailyStatisticalTaskServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/IssueVotingDailyStatisticalTaskServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.feign.GovIssueFeignClient; import com.epmet.service.IssueVotingDailyStatisticalTaskService; import org.springframework.beans.factory.annotation.Autowired; @@ -18,7 +19,7 @@ public class IssueVotingDailyStatisticalTaskServiceImpl implements IssueVotingDa private GovIssueFeignClient govIssueFeignClient; @Override - public Result issueVotingDailyStatistical() { - return govIssueFeignClient.dailyStatisticalVoteJob(); + public Result issueVotingDailyStatistical(DailyStatisticalVoteJob form) { + return govIssueFeignClient.dailyStatisticalVoteJob(form); } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DailyStatisticalVoteTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DailyStatisticalVoteTask.java index 1c33869895..41302d5305 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DailyStatisticalVoteTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DailyStatisticalVoteTask.java @@ -1,7 +1,10 @@ package com.epmet.task; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.service.IssueVotingDailyStatisticalTaskService; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +27,11 @@ public class DailyStatisticalVoteTask implements ITask{ @Override public void run(String params) { logger.debug("dailyStatisticalVoteTask定时任务正在执行,参数为:{}", params); - Result result=issueVotingDailyStatisticalTaskService.issueVotingDailyStatistical(); + DailyStatisticalVoteJob form = new DailyStatisticalVoteJob(); + if (StringUtils.isNotBlank(params)) { + form = JSON.parseObject(params, DailyStatisticalVoteJob.class); + } + Result result=issueVotingDailyStatisticalTaskService.issueVotingDailyStatistical(form); if(result.success()){ logger.debug("dailyStatisticalVoteTask定时任务正在执行定时任务执行成功"); }else{ diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java index 6c7960d26b..ecbd1f1997 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -29,4 +30,8 @@ public class PolyLineDTO implements Serializable { */ private Integer oppositionIncrement; + public PolyLineDTO() { + this.supportIncrement = NumConstant.ZERO; + this.oppositionIncrement = NumConstant.ZERO; + } } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DailyStatisticalVoteJob.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DailyStatisticalVoteJob.java new file mode 100644 index 0000000000..ff64816eca --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DailyStatisticalVoteJob.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/12/29 10:56 上午 + * @DESC + */ +@Data +public class DailyStatisticalVoteJob implements Serializable { + + private static final long serialVersionUID = -3685299478100771134L; + + private String customerId; + + private String dateId; + + private String startDate; + + private String endDate; + + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java index a8b2cae5dd..75f4bb0da4 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java @@ -23,4 +23,9 @@ public class ResiBuzzLeftPieChartFormDTO implements Serializable { * 组织类型,agency:组织,grid:网格 */ private String orgType; + + /** + * 表决中:voting 已转项目:shift_project 已关闭:closed,全部:all + */ + private String status = "all"; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/DailyStatisticalVoteJobResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/DailyStatisticalVoteJobResultDTO.java new file mode 100644 index 0000000000..7bb45f5a4e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/DailyStatisticalVoteJobResultDTO.java @@ -0,0 +1,70 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/12/29 1:52 下午 + * @DESC + */ +@Data +public class DailyStatisticalVoteJobResultDTO implements Serializable { + + private static final long serialVersionUID = 5266996778036448163L; + + private String issueId; + + /** + * 统计日期 + */ + private Date statisticalDate; + + /** + * 到该日的总赞成数 + */ + private Integer supportCount; + + /** + * 到该日的总反对数 + */ + private Integer oppositionCount; + + /** + * 到该日的总票数 + */ + private Integer totalCount; + + /** + * 该日增量 + */ + private Integer todayIncrement; + + /** + * 该日赞成增量 + */ + private Integer supportIncrement; + + /** + * 该日反对增量 + */ + private Integer oppositionIncrement; + + /** + * 应表决数 + */ + private Integer votableCount; + + public DailyStatisticalVoteJobResultDTO() { + this.supportCount = NumConstant.ZERO; + this.oppositionCount = NumConstant.ZERO; + this.totalCount = NumConstant.ZERO; + this.todayIncrement = NumConstant.ZERO; + this.supportIncrement = NumConstant.ZERO; + this.oppositionIncrement = NumConstant.ZERO; + this.votableCount = NumConstant.ZERO; + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java index 22ae365945..ad9a746ca6 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java @@ -37,10 +37,17 @@ public class ResiBuzzLeftPieChartResultDTO implements Serializable { */ private String color; + @JsonIgnore + private String issueId; + + @JsonIgnore + private Boolean status; + public ResiBuzzLeftPieChartResultDTO() { this.count = NumConstant.ZERO; this.categoryCode = ""; this.categoryName = ""; this.color = ""; + this.status = false; } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index ed50325a90..b11a2e960b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -83,7 +83,7 @@ public class IssueManageController { * @author zxc */ @PostMapping("votingtrend") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_DETAIL) +// @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_DETAIL) public Result votingTrend(@RequestBody IssueIdFormDTO issueId){ return new Result().ok(issueVoteStatisticalService.votingTrend(issueId)); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java index 7a7c4530f1..5265af8079 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java @@ -35,6 +35,7 @@ import com.epmet.dto.result.VoteResultDTO; import com.epmet.dto.result.VotingTrendResultDTO; import com.epmet.excel.IssueVoteStatisticalExcel; import com.epmet.service.IssueVoteStatisticalService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -49,10 +50,11 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-05-11 */ +@Slf4j @RestController @RequestMapping("issuevotestatistical") public class IssueVoteStatisticalController { - + @Autowired private IssueVoteStatisticalService issueVoteStatisticalService; @@ -129,7 +131,8 @@ public class IssueVoteStatisticalController { **/ @PostMapping("syncvotingcacheanddb") public Result syncVotingCacheAndDb(){ - issueVoteStatisticalService.syncVotingCacheToDb(); + //issueVoteStatisticalService.syncVotingCacheToDb(); + log.error("syncvotingcacheanddb 又执行了"); return new Result(); } @@ -159,4 +162,4 @@ public class IssueVoteStatisticalController { return new Result>().ok(issueVoteStatisticalService.myPartIssues(myPartIssuesFormDTO)); } -} \ No newline at end of file +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalDailyController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalDailyController.java index c0532cbbf5..1d4128ace9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalDailyController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalDailyController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.IssueVoteStatisticalDailyDTO; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.excel.IssueVoteStatisticalDailyExcel; import com.epmet.service.IssueVoteStatisticalDailyService; import org.springframework.beans.factory.annotation.Autowired; @@ -99,8 +100,9 @@ public class IssueVoteStatisticalDailyController { * @date 2020.05.20 15:39 **/ @PostMapping(value = "dailystatisticalvotejob") - public Result dailyStatisticalVoteJob(){ - issueVoteStatisticalDailyService.countVotingDailyStatistic(); + public Result dailyStatisticalVoteJob(@RequestBody DailyStatisticalVoteJob form){ +// issueVoteStatisticalDailyService.countVotingDailyStatistic(); + issueVoteStatisticalDailyService.countVotingDailyStatisticNew(form); return new Result(); } } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index 4fb4664534..0a82cb5530 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java @@ -254,6 +254,26 @@ public interface IssueDao extends BaseDao { */ List resiBuzzLeftPieChart(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("length")Integer length,@Param("customerId")String customerId); + /** + * @Description + * @param length + * @author zxc + * @date 2021/12/30 9:18 上午 + */ + List resiBuzzLeftPieChartByIssueIds(@Param("length")Integer length,@Param("issueIds")List issueIds); + + List resiBuzzIssueCategoryByIssueIds(@Param("length")Integer length,@Param("issueIds")List issueIds); + List resiBuzzIssueCategoryNameByIssueIds(List categories,@Param("customerId")String customerId); + + /** + * @Description 查询前50名的议题ID + * @param orgId + * @param orgType + * @author zxc + * @date 2021/12/30 9:16 上午 + */ + List resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status); + /** * @Description 查询组织下每个网格的项目数 * @param orgId @@ -270,4 +290,6 @@ public interface IssueDao extends BaseDao { */ List selectCategoryNameByIssueIds(@Param("issueIds")List issueIds); + List selectCategoryNameByIssueList(List issueIds,@Param("customerId")String customerId); + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java index 65d2d35904..a83bba6689 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java @@ -19,8 +19,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IssueVoteDetailDTO; +import com.epmet.dto.PolyLineDTO; import com.epmet.dto.form.VoteFormDTO; import com.epmet.dto.form.VoteRedisFormDTO; +import com.epmet.dto.result.DailyStatisticalVoteJobResultDTO; import com.epmet.dto.result.IssueAttitudeCountResultDTO; import com.epmet.dto.result.IssueVoteResultDTO; import com.epmet.dto.result.MyPartIssuesResultDTO; @@ -130,4 +132,23 @@ public interface IssueVoteDetailDao extends BaseDao { * @date 2021/5/12 1:48 下午 */ List selectIssueVoteCountBatch(@Param("issueIds")List issueIds); + + /** + * @Description 查询客户下的议题表决日增 + * @param customerId + * @param dateId 当dateId为空时,查询的是累计值 + * @author zxc + * @date 2021/12/29 2:02 下午 + */ + List statisticVote(@Param("customerId")String customerId,@Param("dateId")String dateId); + + /** + * @Description 根据议题ID查询折线图一天的数据 + * @param issueId + * @param dateId + * @author zxc + * @date 2021/12/29 4:19 下午 + */ + PolyLineDTO polyLineData(@Param("issueId")String issueId,@Param("dateId")String dateId);; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java index 6b500ad3fd..ce47a20ff6 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java @@ -78,4 +78,13 @@ public interface IssueVoteStatisticalDailyDao extends BaseDao list); + + /** + * @Description 删除历史数据 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/12/29 2:51 下午 + */ + Integer delHistoryData(@Param("customerId")String customerId,@Param("dateId")String dateId); } \ No newline at end of file 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 155627f390..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 @@ -256,12 +256,17 @@ public class IssueVoteDetailRedis { IssueDTO issue = issueService.get(issueId); if(null != issue){ // 如果是表决中的议题,数据现算 - VoteRedisFormDTO voteCache = new VoteRedisFormDTO(); + VoteRedisFormDTO voteCache; if (issue.getIssueStatus().equals(IssueConstant.ISSUE_VOTING)){ SelectIssueVotingDetailFormDTO formDTO = new SelectIssueVotingDetailFormDTO(); 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-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalDailyService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalDailyService.java index cf94b37242..42d3beac71 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalDailyService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalDailyService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IssueVoteStatisticalDailyDTO; +import com.epmet.dto.form.DailyStatisticalVoteJob; import com.epmet.entity.IssueVoteStatisticalDailyEntity; import java.util.List; @@ -101,4 +102,12 @@ public interface IssueVoteStatisticalDailyService extends BaseService imp } List list = allList.stream().skip(formDTO.getPageSize() * (formDTO.getPageNo() - NumConstant.ONE)) .limit(formDTO.getPageSize()).collect(Collectors.toList()); - List names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, list.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List pieChat = getPieChat(list.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + Iterator listIterator = pieChat.iterator(); + while (listIterator.hasNext()){ + ResiBuzzLeftPieChartResultDTO next = listIterator.next(); + for (int i = 0; i < categories.size(); i++) { + if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){ + next.setStatus(true); + listIterator.remove(); + continue; + } + } + } + categories.addAll(pieChat); +// List names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List names = baseDao.selectCategoryNameByIssueList(categories,tokenDto.getCustomerId()); if (CollectionUtils.isNotEmpty(names)){ list.forEach(l -> names.stream().filter(n -> l.getIssueId().equals(n.getIssueId())).forEach(n -> l.setCategoryName(n.getCn()))); } @@ -1651,13 +1666,43 @@ public class IssueServiceImpl extends BaseServiceImpl imp } // 分类编码长度 Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId()); - List result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); - if(CollectionUtils.isEmpty(result)){ +// List result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); + List issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType(),formDTO.getStatus()); + if(CollectionUtils.isEmpty(issueIds)){ + return new ArrayList<>(); + } + List categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, issueIds); + List pieChat = getPieChat(issueIds); + Iterator list = pieChat.iterator(); + while (list.hasNext()){ + ResiBuzzLeftPieChartResultDTO next = list.next(); + for (int i = 0; i < categories.size(); i++) { + if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){ + next.setStatus(true); + list.remove(); + continue; + } + } + } + categories.addAll(pieChat); +// List result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds); + List result = baseDao.resiBuzzIssueCategoryNameByIssueIds(categories, tokenDto.getCustomerId()); + if (CollectionUtils.isEmpty(result)){ return new ArrayList<>(); } return result; } + public List getPieChat(List issueIds){ + List resultDTOS = new ArrayList<>(); + issueIds.forEach(i -> { + ResiBuzzLeftPieChartResultDTO dto = new ResiBuzzLeftPieChartResultDTO(); + dto.setIssueId(i); + resultDTOS.add(dto); + }); + return resultDTOS; + } + /** * @Description 查询组织下每个网格的项目数 * @param formDTO diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java index 7758cc57cb..d494413fed 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java @@ -253,8 +253,11 @@ public class IssueVoteDetailServiceImpl extends BaseServiceImpl customerIds = new ArrayList<>(); + if (StringUtils.isBlank(form.getCustomerId())){ + Result> allCustomerList = operCrmOpenFeignClient.getAllCustomerList(); + if (!allCustomerList.success() || CollectionUtils.isEmpty(allCustomerList.getData())){ + throw new EpmetException("查询所有客户失败..."); + } + customerIds = allCustomerList.getData().stream().map(m -> m.getId()).collect(Collectors.toList()); + }else { + customerIds.add(form.getCustomerId()); + } + if (StringUtils.isNotBlank(form.getStartDate()) && StringUtils.isNotBlank(form.getEndDate())){ + List daysBetween = DateUtils.getDaysBetween(form.getStartDate(), form.getEndDate()); + customerIds.forEach(customerId -> { + daysBetween.forEach(dateId -> { + statisticVote(customerId,dateId); + }); + }); + }else { + if (StringUtils.isBlank(form.getDateId())){ + form.setDateId(LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", "")); + } + customerIds.forEach(customerId -> { + statisticVote(customerId, form.getDateId()); + }); + } + } + + /** + * @Description 统计 issue_vote_statistical_daily 表 + * 只统计表决日增存在的,不存在的不写入,查询程序补全 + * @param customerId + * @param dateId 格式:YYYY-MM-DD + * @author zxc + * @date 2021/12/29 1:46 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void statisticVote(String customerId,String dateId){ + // 日增 + List dayAdd = issueVoteDetailDao.statisticVote(customerId, dateId); + if (CollectionUtils.isNotEmpty(dayAdd)){ + //累计 + List allDayAdd = issueVoteDetailDao.statisticVote(customerId, null); + dayAdd.forEach(d -> allDayAdd.stream().filter(a -> a.getIssueId().equals(d.getIssueId())).forEach(a -> { + d.setOppositionCount(a.getOppositionCount()); + d.setSupportCount(a.getSupportCount()); + d.setTotalCount(a.getTotalCount()); + })); + List needInsert = ConvertUtils.sourceToTarget(dayAdd, IssueVoteStatisticalDailyEntity.class); + Integer delNum; + do { + delNum = baseDao.delHistoryData(customerId, dateId); + } while (delNum != null && delNum > NumConstant.ZERO); + List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseDao.insertBatch(p); + }); + } + } + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index 4c90eb6981..f5cd7251c9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.IssueConstant; import com.epmet.dao.IssueDao; @@ -66,6 +67,9 @@ import java.time.ZoneOffset; import java.util.*; import java.util.stream.Collectors; +import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN; +import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMMDD; + /** * 议题表决统计表 * @@ -205,12 +209,36 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl polyLineDTOS = issueVoteStatisticalDao.polyLineData(issueId); - PolyLineDTO polyLineDTO = new PolyLineDTO(); - polyLineDTO.setVoteDate(LocalDateTime.now().toEpochSecond(ZoneOffset.of(IssueConstant.BEIJING_TIME_ZONE))); +// PolyLineDTO polyLineDTO = new PolyLineDTO(); +// polyLineDTO.setVoteDate(LocalDateTime.now().toEpochSecond(ZoneOffset.of(IssueConstant.BEIJING_TIME_ZONE))); //议题 已转项目 或 已结案 的时间 - String date = issueDao.operateTime(issueId.getIssueId()); +// String date = issueDao.operateTime(issueId.getIssueId()); + IssueEntity issueEntity = issueDao.selectById(issueId.getIssueId()); + String startDate = DateUtils.format(issueEntity.getDecidedTime(),DATE_PATTERN); + String endDate = null == issueEntity.getVotingDeadline() ? + DateUtils.format(new Date(),DATE_PATTERN) : + DateUtils.format(issueEntity.getVotingDeadline(),DATE_PATTERN); + List polyLine = getPolyLine(startDate, endDate); + String today = LocalDate.now().toString(); + if (today.equals(endDate)){ + PolyLineDTO polyLineDTO = issueVoteDetailDao.polyLineData(issueId.getIssueId(), endDate); + polyLine.get(polyLine.size() - NumConstant.ONE).setSupportIncrement(polyLineDTO.getSupportIncrement()); + polyLine.get(polyLine.size() - NumConstant.ONE).setOppositionIncrement(polyLineDTO.getOppositionIncrement()); + } + if (CollectionUtils.isEmpty(polyLineDTOS)){ + votingTrendResultDTO.setPolyLine(polyLine); + return votingTrendResultDTO; + } + polyLineDTOS.forEach(pd -> { + polyLine.forEach(p -> { + if (pd.getVoteDate().equals(p.getVoteDate())){ + p.setOppositionIncrement(pd.getOppositionIncrement()); + p.setSupportIncrement(pd.getSupportIncrement()); + } + }); + }); //今天刚转项目或刚刚关闭,当天数据DB没有,直接从缓存拿 - if (polyLineDTOS.size() == NumConstant.ZERO && date.equals(LocalDate.now().toString())) { + /*if (polyLineDTOS.size() == NumConstant.ZERO && date.equals(LocalDate.now().toString())) { polyLineDTO.setSupportIncrement(voteRedisFormDTO.getSupportAmount()); polyLineDTO.setOppositionIncrement(voteRedisFormDTO.getOppositionAmount()); polyLineDTOS.add(polyLineDTO); @@ -222,18 +250,37 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl getPolyLine(String startTime, String endTime){ + List result = new ArrayList<>(); + Date start = DateUtils.parse(startTime, DATE_PATTERN); + Date end = DateUtils.parse(endTime, DATE_PATTERN); + Calendar tempStart = Calendar.getInstance(); + tempStart.setTime(start); + Calendar tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + // 日期加1(包含结束) + tempEnd.add(Calendar.DATE, +1); + while (tempStart.before(tempEnd)) { + PolyLineDTO dto = new PolyLineDTO(); + dto.setVoteDate(tempStart.getTimeInMillis()/1000); + result.add(dto); + tempStart.add(Calendar.DAY_OF_YEAR, 1); + } + return result; + } + /** * @param formDTO * @Description 满意度评价列表——已关闭 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index ecc7dd39f0..721c1865a8 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml @@ -621,31 +621,31 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml index 3b5b4be83a..def42fc563 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml @@ -181,4 +181,43 @@ ) + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml index dcad30689c..bcbe6a5a4d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml @@ -280,4 +280,13 @@ id = #{item.id} + + + + DELETE FROM issue_vote_statistical_daily + WHERE CUSTOMER_ID = #{customerId} + AND STATISTICAL_DATE = #{dateId} + LIMIT 1000 + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml index edde73cb25..fa89630a63 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml @@ -119,9 +119,9 @@ SELECT @@ -677,5 +697,19 @@ DEL_FLAG = '0' AND PID = #{orgId} + diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java deleted file mode 100644 index 02f58c15ca..0000000000 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.epmet.controller; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.EventListFormDTO; -import com.epmet.dto.form.UpdateViewTimeFormDTO; -import com.epmet.dto.result.EventListResultDTO; -import com.epmet.service.ResiEventService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -/** - * 居民报事表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-08-03 - */ -@RestController -@RequestMapping("event") -public class EventController { - - @Autowired - private ResiEventService resiEventService; - - - -} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java index b3053bbd93..f40e6c3de8 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java @@ -99,7 +99,7 @@ public class ProjectTraceController { * @date 2020/5/11 16:25 */ @PostMapping("projectdetail") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) + //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) public Result getProjectDetail(@LoginUser TokenDto tokenDto, @RequestBody ProjectDetailFromDTO fromDTO) { ProjectDetailResultDTO result = projectTraceService.getProjectDetail(tokenDto, fromDTO); return new Result().ok(result); diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java index ca48b13304..70706d8461 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -77,6 +78,7 @@ public class ResiEventController { * @author yinzuomei * @date 2021/8/3 10:46 */ + @NoRepeatSubmit @PostMapping("report") public Result report(@LoginUser TokenDto tokenDto, @RequestBody ResiEventFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -93,6 +95,7 @@ public class ResiEventController { * @author yinzuomei * @date 2021/8/3 10:54 */ + @NoRepeatSubmit @PostMapping("recall") public Result recall(@LoginUser TokenDto tokenDto, @RequestBody ReCallEventFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -205,6 +208,7 @@ public class ResiEventController { * @author yinzuomei * @date 2021/8/5 10:47 */ + @NoRepeatSubmit @PostMapping("close") public Result closeResiEvent(@LoginUser TokenDto tokenDto, @RequestBody CloseResiEventFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); @@ -254,4 +258,4 @@ public class ResiEventController { ValidatorUtils.validateEntity(formDTO,ResiEventResearchAnalysisFormDTO.AddUserInternalGroup.class); return new Result().ok(resiEventService.queryResiEventResearchAnalysis(formDTO)); } -} \ No newline at end of file +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java index 0d7f93a2d8..002621c98f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -43,7 +44,7 @@ import java.util.List; @RestController @RequestMapping("resieventreply") public class ResiEventReplyController { - + @Autowired private ResiEventReplyService resiEventReplyService; @@ -62,13 +63,14 @@ public class ResiEventReplyController { /** * 报事-工作人员回复 - * + * * @param tokenDto - * @param replyFormDTO - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei + * @param replyFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei * @date 2021/8/4 14:19 */ + @NoRepeatSubmit @PostMapping("govReply") public Result govReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO replyFormDTO){ replyFormDTO.setUserId(tokenDto.getUserId()); @@ -79,13 +81,14 @@ public class ResiEventReplyController { /** * 报事当事人回复 - * + * * @param tokenDto - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei * @date 2021/8/4 14:37 */ + @NoRepeatSubmit @PostMapping("selfReply") public Result selfReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO formDTO){ formDTO.setUserId(tokenDto.getUserId()); @@ -103,6 +106,7 @@ public class ResiEventReplyController { * @author yinzuomei * @date 2021/8/4 15:06 */ + @NoRepeatSubmit @PostMapping("atReply") public Result atReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO formDTO){ formDTO.setUserId(tokenDto.getUserId()); @@ -110,4 +114,4 @@ public class ResiEventReplyController { resiEventReplyService.atReply(formDTO); return new Result(); } -} \ No newline at end of file +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java index 4b27f0c0a3..1efda7b0b3 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java @@ -50,7 +50,7 @@ public class BaseGridDailyworkController { @PostMapping("sync") public Result getStaffBaseInfo(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) { ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); - baseGridDailyworkService.insertPatrolRecord(formDTO); + baseGridDailyworkService.insertBaseGridWorkRecord(formDTO); return new Result(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java index 8f8de7114b..5be0280fc9 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java @@ -103,12 +103,12 @@ public class BaseGridDailyworkEntity implements Serializable { /** * 重点人员是否在当地-当事件类型为【特殊人群服务与管理】时必填 */ - private String isKeyPeopleLocate; + private String isKeypeopleLocate; /** * 重点人员现状 */ - private String keyPeopleStatus; + private String keypeopleStatus; /** * 发生地 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java index e13b8d01b7..682185ca8a 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java @@ -3,6 +3,7 @@ package com.epmet.opendata.mq.listener; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -53,6 +54,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr } try { + Thread.sleep(NumConstant.ONE_THOUSAND); msgs.forEach(this::consumeMessage); } catch (Exception e) { logger.error(ExceptionUtils.getErrorStackTrace(e)); @@ -96,7 +98,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr aBoolean = SpringContextUtils.getBean(UserPatrolRecordService.class).updatePatrolRecord(patrolRecordForm); break; case SystemMessageType.PATROL_ROUTINE_WORK_ADD: - aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertPatrolRecord(patrolRecordForm); + aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm); break; default: log.error("错误的消息类型:{}", tags); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java index 0d40bb6aea..010b698d63 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java @@ -34,7 +34,7 @@ public interface BaseGridDailyworkService extends BaseService> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(midPatrolFormDTO); if (record == null || !record.success()) { log.error("获取例行工作记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); - return false; + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); } Map deptMap = exDeptService.getDeptDTOMap(patrolRecordForm.getCustomerId()); Map userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId()); @@ -82,7 +84,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO); if (record == null || !record.success()) { - log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); - return false; + log.error("insertPatrolRecord 获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); } List data = record.getData(); if (CollectionUtils.isEmpty(data)) { //数据已被删除了 //暂时设置error 用于排错 - log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); + log.error("insertPatrolRecord获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); int effectRow = baseDao.deleteById(patrolRecordForm.getId()); log.warn("del effectRow:{}", effectRow); - return true; + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); } List insertList = new ArrayList<>(); data.forEach(o-> insertList.add(buildEntity(o))); @@ -94,17 +96,17 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO); if (record == null || !record.success()) { - log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); - return false; + log.error("updatePatrolRecord 获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); } List data = record.getData(); if (CollectionUtils.isEmpty(data)) { //数据已被删除了 //暂时设置error 用于排错 - log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); + log.error("updatePatrolRecord 获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); int effectRow = baseDao.deleteById(patrolRecordForm.getId()); log.warn("del effectRow:{}", effectRow); - return true; + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); } data.forEach(o->{ UserPatrolRecordEntity recordEntity = buildEntity(o); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml index d88441780c..3047bc30c9 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml @@ -17,8 +17,8 @@ - - + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java index 94a4d4ac88..99f04a4b8d 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java @@ -28,6 +28,8 @@ public class VolunteerDistributionResultDTO { @Data public static class Distribution { private Set volunteerCategories; + private String volunteerCategoriesStr; + private String buildingId; private String epmetUserId; private String icResiUserId; private String longitude; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d710c4ed2b..45e8ee383e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -688,6 +688,6 @@ public interface EpmetUserOpenFeignClient { * @param patrolQueryFormDTO * @return */ - @PostMapping(value = "//epmetuser/patrolroutinework/selectList") + @PostMapping(value = "/epmetuser/patrolroutinework/selectList") Result> getPatrolRoutineWorkList(@RequestBody PatrolQueryFormDTO patrolQueryFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index c3f1da8654..f1822e93f2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -226,4 +226,6 @@ public interface IcResiUserDao extends BaseDao { */ List getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId, @Param("code") String code); + + List listIcResiInfosByUserIds(@Param("userIds") List userIds); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java deleted file mode 100644 index 0167079052..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity; - -import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 网格员例行工作 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-19 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("patrol_routine_work") -public class GridUserWorkEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户ID - */ - private String customerId; - - /** - * 网格ID - */ - private String gridId; - - /** - * gridId的PID - */ - private String pids; - - /** - * 用户Id user.id 谁创建的 - */ - private String userId; - - /** - * 事项名称 - */ - private String title; - - /** - * 发生日期 格式为“YYYY-MM-DD” - */ - private Date happenTime; - - /** - * 有无变动(异常)1:是、0:否 - */ - private Integer isNormal; - - /** - * 备注说明 - */ - private String workContent; - - /** - * 经度 - */ - private String longitude; - /** - * 纬度 - */ - private String latitude; - -} 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 715c280a55..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,25 +2,30 @@ 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; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.IcFormItemOptionsDTO; -import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.IcFormOptionsQueryFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; -import com.epmet.dto.result.ResiUserBaseInfoResultDTO; import com.epmet.dto.result.VolunteerDistributionResultDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.VolunteerService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; 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; /** @@ -29,6 +34,7 @@ import java.util.stream.Collectors; * @Date 2021/12/10 5:48 下午 * @Version 1.0 */ +@Slf4j @Service public class VolunteerServiceImpl implements VolunteerService, ResultDataResolver { @@ -90,91 +96,154 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve * @return */ public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId) { - //epmetHeartOpenFeignClient.queryVolunteerPage() - - // 1.分页查询出所有志愿者列表 - int pageNo = 1; - int pageSize = 100; + VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); - // 志愿者epmet user id - Set volunteerEpmetUserIds = new HashSet<>(); + // 1.==========分页查询出所有志愿者列表========== - // 分页查询志愿者的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++; + 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; } + // 计算页数 + int pageSize = 200; + int pageCount = volunteerCount / pageSize; + int lastPageItems = volunteerCount % pageSize; + pageCount = lastPageItems > 0 ? ++pageCount : pageCount; - VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); + // 志愿者epmet user id 集合 + List volunteerEpmetUserIds = new ArrayList<>(); + + // 分页查询志愿者的epmet user id + 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()); + }); - // 2.填充ic居民信息 - for (String volunteerEpmetUserId : volunteerEpmetUserIds) { + volsPageFutures.add(future); + } - VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution(); + // 阻塞,等待子线程返回结果,然后添加到志愿者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居民信息========== + List>> volResiInfoFutures = new ArrayList<>(); + + // 将所有的userId按100固定分割成多个部分,循环用每个部分去查询,然后填充 + List> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100); + + for (List volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) { + + log.info("【志愿者分布】查询ic居民信息,切割后,本组的userId个数:{}", volunteerEpmetUserIdPart.size()); + + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listIcResiInfosByUserIds(volunteerEpmetUserIdPart); + }); - ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId); + volResiInfoFutures.add(future); + } - //使用身份证号查询ic resi信息 - IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null); - if (icResiUserInfo == null) { - continue; + // 阻塞的,获取各个子线程计算结果 + 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)); } + } - // 查询志愿者类别 - List volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId()); - //if (CollectionUtils.isEmpty(volunteerCategories)) { - // // 此人没有志愿者信息 - // continue; - //} + 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(); - for (String vTypesString : volunteerCategories) { - String[] vTypes = vTypesString.split(","); + 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(icResiUserInfo.getBuildId()), + IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); - distribution.setVolunteerCategories(volunteerTypes); - distribution.setEpmetUserId(userBaseInfo.getUserId()); - distribution.setIcResiUserId(icResiUserInfo.getId()); + icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId()); + icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId()); Optional.of(building).ifPresent(b -> { - distribution.setLongitude(b.getLongitude()); - distribution.setLatitude(b.getLatitude()); + icResiInfo.setLongitude(b.getLongitude()); + icResiInfo.setLatitude(b.getLatitude()); }); - r.getDistributions().add(distribution); } - - return r; + + 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); + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index b10e6e259f..6b07136f1c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -489,4 +489,21 @@ GROUP BY CULTURE + +