diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.9__add_data_type.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.9__add_data_type.sql new file mode 100644 index 0000000000..d4aebf1828 --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.9__add_data_type.sql @@ -0,0 +1,10 @@ +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000012', 'grid_type', '网格类型', '', 12, 0, 0, '', '2021-12-23 18:23:27', '', '2021-12-23 18:23:27'); + +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000300', 1000000000000000012, '党政机关', '0', '0', '', 0, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000301', 1000000000000000012, '企业', '1', '0', '', 0, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000302', 1000000000000000012, '园区', '2', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000303', 1000000000000000012, '商圈', '3', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000304', 1000000000000000012, '市场', '4', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000305', 1000000000000000012, '景区', '5', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000306', 1000000000000000012, '医院', '6', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000307', 1000000000000000012, '学校', '7', '0', '', 4, 0, 0, '', '2021-12-23 18:39:18', '', '2021-12-23 18:39:18'); 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 57630deaaf..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 @@ -630,10 +630,10 @@ public class RedisKeys { /** * desc:临时方案 - * @param userId + * @param agencyId * @return */ - public static String getOrgTreeCacheKey(String userId) { - return rootPrefix.concat("ic:temp:orgtree").concat("userId"); + public static String getOrgTreeCacheKey(String agencyId) { + return rootPrefix.concat("org:temp:orgtree").concat(agencyId); } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml index 6f040d326b..ca3642230b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml @@ -91,7 +91,8 @@ rankData.RESOLVED_RATIO, rankData.GOVERN_RATIO, rankData.SATISFACTION_RATIO, - agency.AGENCY_NAME AS parentAgencyName + agency.AGENCY_NAME AS parentAgencyName, + rankData.MONTH_ID as monthId FROM screen_govern_rank_data rankData LEFT JOIN diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 411cc8ad2c..5b6b444919 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -1112,6 +1112,7 @@ public class DemoController { }else { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); + result.add(dateId); redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); } long end = System.currentTimeMillis(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 8d86caed9c..cf3ce5abf5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.stats.DimCustomerService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -23,6 +24,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/9/15 11:06 */ +@Slf4j @RestController @RequestMapping("factorigin") public class FactOriginExtractController { @@ -95,6 +97,7 @@ public class FactOriginExtractController { @PostMapping("project") public Result projectData(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { + long start = System.currentTimeMillis(); if (StringUtils.isNotBlank(extractOriginFormDTO.getCustomerId())) { List daysBetween; if (StringUtils.isBlank(extractOriginFormDTO.getDateId())) { @@ -115,6 +118,7 @@ public class FactOriginExtractController { projectExtractService.saveOriginProjectDaily(dto); }); } + log.info("projectData end,cost:{}",System.currentTimeMillis() - start); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index f090c31a71..e154508f30 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -200,7 +200,8 @@ public interface ProjectDao extends BaseDao { * 获取已转项目事件事件 * * @param customerId + * @param projectId * @return */ - List getEventList(@Param("customerId") String customerId); + List getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 94926108ff..164387d70b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -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/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 6b844a3481..87b377d39e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -202,5 +202,5 @@ public interface ProjectService extends BaseService { * @param projectId * @return */ - Map getEventList(String customerId); + Map getEventList(String customerId, String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 5b4d087830..ecdcda2e71 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -249,8 +249,8 @@ public class ProjectServiceImpl extends BaseServiceImpl getEventList(String customerId) { - List list = baseDao.getEventList(customerId); + public Map getEventList(String customerId, String projectId) { + List list = baseDao.getEventList(customerId, projectId); if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) { return Collections.emptyMap(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 715b37f605..766636e76b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -259,6 +259,9 @@ from resi_event_report_org rero inner join resi_event re on rero.RESI_EVENT_ID = re.id and re.SHIFT_PROJECT = 1 and re.DEL_FLAG = '0' where rero.del_flag = '0' + + AND re.PROJECT_ID = #{projectId} + and rero.CUSTOMER_ID = #{customerId} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index d4f3c8c92d..ffce4482d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -74,5 +74,13 @@ public interface EpmetHeartOpenFeignClient { * @return */ @PostMapping("/heart/residemand/autoevaluate") - Result AutoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); + Result autoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); + + /** + * 查询志愿者数量 + * @param input + * @return + */ + @PostMapping("/heart/resi/volunteer/count") + Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index eed34f0116..db83d85a27 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -68,7 +68,12 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli * @return */ @Override - public Result AutoEvaluateDemand(AutoEvaluateDemandFormDTO formDTO) { + public Result autoEvaluateDemand(AutoEvaluateDemandFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "autoEvaluate",formDTO); } + + @Override + public Result getVolunteerCount(VolunteerCommonFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getVolunteerCount", input); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 4a71e4d5e3..3c5853ae14 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 @@ -297,15 +297,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 842919a3f2..ed5609eed3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -145,4 +145,18 @@ public class ResiVolunteerController { List l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, superiorAgencyId); return new Result>().ok(l); } + + /** + * 查询志愿者数量 + * @param input + * @return + */ + @PostMapping("count") + public Result getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) { + String customerId = input.getCustomerId(); + String pidsPrefix = input.getSuperiorAgencyId(); + + Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, pidsPrefix); + return new Result().ok(volunteerCount); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java index 5108fb6dbc..22e69d652e 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 3df4a76018..adf45e6437 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -96,4 +96,11 @@ public interface VolunteerInfoService extends BaseService { List queryListVolunteer(String customerId,String staffId,String userRealName); List queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId); + + /** + * 查询志愿者数量 + * @param customerId + * @return + */ + Integer getVolunteerCount(String customerId, String pidsPrefix); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 045b9564cc..116b3c47a5 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 43c0cd8bb0..2370562d4b 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/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index 4732322466..5e212d050e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -771,16 +771,6 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl> reportTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode()); - Map reportTypeMap=reportTypeRes.success()&& MapUtils.isNotEmpty(reportTypeRes.getData())?reportTypeRes.getData():new HashMap<>(); - - Result> statusRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode()); - Map statusMap=statusRes.success()&& MapUtils.isNotEmpty(statusRes.getData())?statusRes.getData():new HashMap<>(); - - Result> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); - Map serviceTypeMap=serviceTypeRes.success()&& MapUtils.isNotEmpty(serviceTypeRes.getData())?serviceTypeRes.getData():new HashMap<>(); - for(DemandRecResultDTO res:list){ if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) { res.setGridName(gridInfoMap.get(res.getGridId()).getGridName()); @@ -794,11 +784,27 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl NumConstant.ZERO){ - // 获取志愿者信息 - VolunteerInfoDTO dto = baseDao.selectVolunteerInfoByUserId(tokenDto.getUserId()); + // 获取志愿者信息 + // Integer volunteerFlag = baseDao.queryVolunteerFlagByUserId(tokenDto.getUserId()); + VolunteerInfoDTO dto = baseDao.selectVolunteerInfoByUserId(tokenDto.getUserId()); + if (null!=dto){ resultDTO.setVolunteerIntroduce(dto.getVolunteerIntroduce() == null ? "" : dto.getVolunteerIntroduce()); resultDTO.setVolunteerSignature(dto.getVolunteerSignature() == null ? "" : dto.getVolunteerSignature()); // 遗留数据处理,如果表中数据为空,一律返回null,前端重新获取 网格信息 resultDTO.setGridId( "".equals(dto.getGridId()) ? null : dto.getGridId()); - resultDTO.setGridName( "".equals(dto.getGridName()) ? null : dto.getGridName()); + resultDTO.setGridName( "".equals(dto.getGridName()) ? null : dto.getGridName()); } } else { logger.error("获取用户基本信息失败"); @@ -396,4 +383,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); + + Optional.ofNullable(customerId).ifPresent((cId) -> { + query.eq(VolunteerInfoEntity::getCustomerId, cId); + }); + + Optional.ofNullable(pidsPrefix).ifPresent((pidsPrefixt) -> { + query.likeRight(VolunteerInfoEntity::getPids, pidsPrefixt); + }); + + return baseDao.selectCount(query); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index d6447bf39e..92e7a3efab 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -233,10 +233,27 @@ r.PARENT_CODE as parentCode, r.CONTENT, r.REPORT_TYPE as reportType, + ( + case when r.REPORT_TYPE='community' then '社区帮办' + when r.REPORT_TYPE='building_caption' then '楼长帮办' + when r.REPORT_TYPE='party' then '党员帮办' + when r.REPORT_TYPE='self_help' then '自身上报' + else '' + end + )as reportTypeName, r.REPORT_TIME as reportTime, r.REPORT_USER_NAME as reportUserName, r.REPORT_USER_MOBILE as reportUserMobile, r.`STATUS` as status, + ( + case when r.`STATUS`='pending' then '待处理' + when r.`STATUS`='canceled' then '已取消' + when r.`STATUS`='assigned' then '已派单' + when r.`STATUS`='have_order' then '已接单' + when r.`STATUS`='finished' then '已完成' + else '' + end + )as statusName, r.DEMAND_USER_ID as demandUserId, r.DEMAND_USER_NAME as demandUserName, r.DEMAND_USER_MOBILE as demandUserMobile, diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java index c1ce071d0e..23d5d34787 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java @@ -26,6 +26,6 @@ public class AutoEvaluateDemandTask implements ITask { if (StringUtils.isNotBlank(params)) { formDTO = JSON.parseObject(params, AutoEvaluateDemandFormDTO.class); } - Result result = heartOpenFeignClient.AutoEvaluateDemand(formDTO); + Result result = heartOpenFeignClient.autoEvaluateDemand(formDTO); } } diff --git a/epmet-module/gov-issue/gov-issue-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/ResiBuzzLeftPieChartResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java index 8db3918fab..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 = "#0091ed"; + this.color = ""; + this.status = false; } } 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/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index 8ab346293c..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 @@ -262,6 +262,9 @@ public interface IssueDao extends BaseDao { */ 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 @@ -269,7 +272,7 @@ public interface IssueDao extends BaseDao { * @author zxc * @date 2021/12/30 9:16 上午 */ - List resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType); + List resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status); /** * @Description 查询组织下每个网格的项目数 @@ -287,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/redis/IssueVoteDetailRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java index 23e0c2bb02..6330942024 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java @@ -264,6 +264,11 @@ public class IssueVoteDetailRedis { formDTO.setIssueId(issueId); formDTO.setGridId(issue.getGridId()); voteCache = issueVoteDetailService.selectIssueVotingDetail(formDTO); + IssueVoteStatisticalDTO dto = ConvertUtils.sourceToTarget(voteCache, IssueVoteStatisticalDTO.class); + dto.setVotableCount(voteCache.getShouldVoteCount()); + dto.setSupportCount(voteCache.getSupportAmount()); + dto.setOppositionCount(voteCache.getOppositionAmount()); + issueVoteStatisticalDao.updateBtIssueId(dto); }else { // 状态是关闭,转议题的,直接从结果表查询 voteCache = issueVoteStatisticalDao.selectVoteDetail(issueId); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 9bbd2c552c..a8c3188586 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -1616,7 +1616,22 @@ public class IssueServiceImpl extends BaseServiceImpl 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()))); } @@ -1663,17 +1678,42 @@ public class IssueServiceImpl extends BaseServiceImpl imp // 分类编码长度 Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId()); // List result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); - List issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType()); + List issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType(),formDTO.getStatus()); if(CollectionUtils.isEmpty(issueIds)){ return new ArrayList<>(); } - List result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds); + 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/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index 4c23af7ff7..3273fb243e 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 @@ -617,31 +617,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java new file mode 100644 index 0000000000..cfaf9da56a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/22 2:00 下午 + * @DESC + */ +@Data +public class AppointmentMiniFormDTO implements Serializable { + + private static final long serialVersionUID = -7113952715343314153L; + + public interface AppointmentMiniForm{} + + /** + * 事项ID + */ + @NotBlank(message = "matterId不能为空",groups = AppointmentMiniForm.class) + private String matterId; + + /** + * 预约日期 + */ + @NotBlank(message = "appointmentDate不能为空",groups = AppointmentMiniForm.class) + private String appointmentDate; + + /** + * 预约编号 + */ + @NotBlank(message = "timeId不能为空",groups = AppointmentMiniForm.class) + private String timeId; + + /** + * 预约人 + */ + private String appointmentName; + + /** + * 预约电话 + */ + private String appointmentPhone; + + /** + * 备注 + */ + private String remark; + + /** + * 组织ID + */ + @NotBlank(message = "orgId不能为空",groups = AppointmentMiniForm.class) + private String orgId; + + /** + * 组织类型,grid:网格,agency:组织 + */ + @NotBlank(message = "orgType不能为空",groups = AppointmentMiniForm.class) + private String orgType; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java index 59462d429b..cdd4d8d7d6 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -40,6 +41,12 @@ public class AllMattersResultDTO implements Serializable { private String centerName; + @JsonIgnore + private String startTime; + + @JsonIgnore + private String endTime; + public AllMattersResultDTO() { this.matterName = ""; this.allowTime = ""; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java index 4858babc52..c3024a6bbb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java @@ -41,6 +41,8 @@ public class AppointmentRecordResultDTO implements Serializable { private String remark; private String recordId; + private String centerName; + private String address; /** * 预约时间 @@ -51,6 +53,8 @@ public class AppointmentRecordResultDTO implements Serializable { @JsonIgnore private String timeId; + @JsonIgnore + private String matterId; public AppointmentRecordResultDTO() { this.sort = NumConstant.ZERO; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java index ced0df2da5..a733afaa2f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java @@ -8,6 +8,7 @@ package com.epmet.constant; public interface PartyServiceCenterConstant { String ORG_TYPE_AGENCY = "agency"; + String ORG_TYPE_GRID = "grid"; String APPOINTMENT_STATUS_APPOINTING = "appointing"; String APPOINTMENT_STATUS_CANCEL = "cancel"; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index e4fb99d157..434a305c90 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -20,8 +20,6 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.redis.RedisKeys; -import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; @@ -55,8 +53,6 @@ import java.util.Set; @RestController @RequestMapping("customeragency") public class CustomerAgencyController { - @Autowired - private RedisUtils redisUtils; @Autowired private CustomerAgencyService customerAgencyService; @@ -371,16 +367,7 @@ public class CustomerAgencyController { @PostMapping("agencygridtree") public Result getOrgTreeData(@LoginUser TokenDto tokenDTO) { //tokenDTO.setUserId("dffe71e021a61b900f9025f4f07f6955"); - String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(tokenDTO.getUserId()); - Object o = redisUtils.get(orgTreeCacheKey); - AgencyTreeResultDTO result = null; - if (o == null){ - result = customerAgencyService.getOrgTreeData(tokenDTO.getUserId()); - redisUtils.set(orgTreeCacheKey,result,RedisUtils.MINUTE_THIRTY_EXPIRE); - }else { - result = (AgencyTreeResultDTO) o; - } - return new Result().ok(result); + return new Result().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId())); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java index 3b2872a7f3..a2f71aa778 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java @@ -155,6 +155,13 @@ public class IcPartyServiceCenterController { return new Result(); } + @PostMapping("appointmentmini") + public Result appointmentMini(@RequestBody AppointmentMiniFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, AppointmentMiniFormDTO.AppointmentMiniForm.class); + icPartyServiceCenterService.appointmentMini(formDTO,tokenDto); + return new Result(); + } + /** * @Description 党群服务中心列表 * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index a1aa0b631a..107a2061be 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -58,6 +58,7 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 组织首页-下级机关列表 **/ List selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum); + List selectSubAgencyByAgencyId(@Param("pId") String pId); /** @@ -79,8 +80,8 @@ public interface CustomerAgencyDao extends BaseDao { CustomerAgencyEntity getAgencyByStaffId(@Param("staffId") String staffId); /** - * @Description 根据agencyId查询地区编码 * @param agencyId 所属机关id + * @Description 根据agencyId查询地区编码 * @author zxc * @date 2020/4/28 15:50 */ @@ -104,6 +105,7 @@ public interface CustomerAgencyDao extends BaseDao { /** * 查询客户根级组织 + * * @param customerId * @return */ @@ -111,10 +113,11 @@ public interface CustomerAgencyDao extends BaseDao { /** * 获取所属机关单位名称(上级-所属) - * @author zhaoqifeng - * @date 2020/5/22 17:53 + * * @param agencyId * @return java.lang.String + * @author zhaoqifeng + * @date 2020/5/22 17:53 */ String selectAgencyName(@Param("agencyId") String agencyId); @@ -127,46 +130,48 @@ public interface CustomerAgencyDao extends BaseDao { List selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids); /** - * @Description 查询一个工作人员最近登录的网格以及机关信息 * @param gridId * @return + * @Description 查询一个工作人员最近登录的网格以及机关信息 * @author wangc * @date 2020.08.17 09:50 - **/ + **/ ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId); + /** - * @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息 * @param staffId * @return + * @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息 * @author wangc * @date 2020.08.17 09:50 **/ - ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId")String staffId); + ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId") String staffId); + /** - * @Description 根据agencyId查找指定机构的信息,直属网格、部门 * @param agencyId * @return + * @Description 根据agencyId查找指定机构的信息,直属网格、部门 * @author wangc * @date 2020.08.18 13:41 - **/ - ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId")String agencyId); + **/ + ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId") String agencyId); /** - * @Description 根绝agencyId查找其下属机构的信息 * @param pid * @return + * @Description 根绝agencyId查找其下属机构的信息 * @author wangc * @date 2020.08.18 13:42 - **/ + **/ List selectSubAgencyByPid(@Param("pid") String pid); /** - * @Description 根据agencyId查找指定机构直属的部门,将grid与dept分开是因为grid与dept的数量可能不等,造成重复数据无法去重 * @param agencyId * @return + * @Description 根据agencyId查找指定机构直属的部门,将grid与dept分开是因为grid与dept的数量可能不等,造成重复数据无法去重 * @author wangc * @date 2020.08.18 13:42 - **/ + **/ List selectDeptList(@Param("agencyId") String agencyId); /** @@ -186,30 +191,33 @@ public interface CustomerAgencyDao extends BaseDao { AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); /** - * @Description 返回elementTree结构的agency树 * @param customerId * @param pid * @return java.util.List + * @Description 返回elementTree结构的agency树 * @Author liushaowen * @Date 2020/11/6 14:57 */ - List getAgencyElementTree(@Param("customerId") String customerId,@Param("pid") String pid); + List getAgencyElementTree(@Param("customerId") String customerId, @Param("pid") String pid); /** * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 * @author sun **/ OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId); + /** * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 * @author sun **/ List selectAgencyGridList(@Param("agencyId") String agencyId); + /** * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 * @author sun **/ List selectAgencyDeptList(@Param("agencyId") String agencyId); + /** * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 * @author sun @@ -236,6 +244,7 @@ public interface CustomerAgencyDao extends BaseDao { /** * 根据新增人员类型判断查询机关信息 + * * @author sun */ OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType); @@ -247,41 +256,47 @@ public interface CustomerAgencyDao extends BaseDao { List getStaffOrgListByStaffId(@Param("staffId") String staffId); /** - * @Description 【地图配置】删除 * @param orgId * @param level + * @Description 【地图配置】删除 * @author zxc * @date 2021/10/25 9:39 上午 */ void delMapArea(@Param("orgId") String orgId, @Param("level") String level); /** - * @Description 【地图配置】新增 * @param orgId * @param level * @param coordinates + * @Description 【地图配置】新增 * @author zxc * @date 2021/10/25 9:59 上午 */ - void addMapArea(@Param("orgId") String orgId, @Param("level") String level,@Param("coordinates")String coordinates); + void addMapArea(@Param("orgId") String orgId, @Param("level") String level, @Param("coordinates") String coordinates); /** - * @Description 地图查询下级组织 * @param pid * @param type + * @Description 地图查询下级组织 * @author zxc * @date 2021/10/25 2:30 下午 */ - List selectSonOrg(@Param("pid")String pid,@Param("type")String type); + List selectSonOrg(@Param("pid") String pid, @Param("type") String type); /** - * @Description 查询下级agencyId * @param orgId + * @Description 查询下级agencyId * @author zxc * @date 2021/12/9 4:42 下午 */ List getSonAgencyId(@Param("orgId") String orgId); + /** + * desc:获取组织和网格的数据 树形sql + * @param agencyId + * @return + */ + ExtStaffPermissionResultDTO selectAgencyAndGridById(@Param("agencyId") String agencyId); /** * @Description 【事件】社区服务热线 * @author sun diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java index ad1ff57769..065dc62906 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java @@ -59,4 +59,6 @@ public interface IcPartyServiceCenterDao extends BaseDao getAllMatters(@Param("orgId")String orgId); + List getAllMattersByOrgId(@Param("matterIds")List matterIds); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java index 37d93ce41a..c8ef99388e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java @@ -133,6 +133,7 @@ public interface IcPartyServiceCenterService extends BaseService page(Map params) { @@ -1125,8 +1130,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -313,6 +318,59 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl l = new LambdaQueryWrapper<>(); + l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) + .eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getAppointmentDate()) + .eq(IcMatterAppointmentRecordEntity::getStatus,PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING) + .eq(BaseEpmetEntity::getDelFlag,NumConstant.ZERO); + List records = matterAppointmentRecordDao.selectList(l); + Result userInfoResult = userOpenFeignClient.selectUserBaseInfo(tokenDto); + if (!userInfoResult.success()){ + throw new EpmetException("查询用户信息失败..."); + } + formDTO.setAppointmentName(userInfoResult.getData().getRealName()); + formDTO.setAppointmentPhone(userInfoResult.getData().getMobile()); + if (CollectionUtils.isNotEmpty(records)){ + List timeIds = new ArrayList<>(); + records.forEach(r -> { + timeIds.addAll(Arrays.asList(r.getTimeId().split(","))); + }); + List formTimeId = Arrays.asList(formDTO.getTimeId().split(",")); + int before = timeIds.size() + formTimeId.size(); + List endTimeId = new ArrayList<>(); + endTimeId.addAll(timeIds);endTimeId.addAll(formTimeId); + List collect = endTimeId.stream().distinct().collect(Collectors.toList()); + if (collect.size() < before){ + throw new RenException(EpmetErrorCode.APPOINTMENT_TIME_ERROR.getCode()); + } + } + IcMatterAppointmentRecordEntity e = ConvertUtils.sourceToTarget(formDTO, IcMatterAppointmentRecordEntity.class); + e.setCustomerId(customerId); + e.setOrgId(formDTO.getOrgId()); + e.setOrgType(formDTO.getOrgType()); + if (e.getOrgType().equals(PartyServiceCenterConstant.ORG_TYPE_GRID)){ + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(e.getOrgId()); + if (null == gridInfo){ + throw new EpmetException(String.format("查询组织信息失败%s",e.getOrgId())); + } + e.setPid(gridInfo.getPid()); + e.setPids(gridInfo.getPids()); + }else { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(e.getOrgId()); + if (null == agencyInfo){ + throw new EpmetException(String.format("查询组织信息失败%s",e.getOrgId())); + } + e.setPid(agencyInfo.getPid()); + e.setPids(agencyInfo.getPids()); + } + e.setStatus(PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING); + matterAppointmentRecordDao.insert(e); + } + /** * @Description 党群服务中心列表 * @param formDTO @@ -473,10 +531,24 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl appointmentRecordMini(AppointmentRecordMiniFormDTO formDTO,TokenDto tokenDto) { List result = matterAppointmentRecordDao.appointmentRecordMini(formDTO.getGridId(), tokenDto.getUserId()); - if (CollectionUtils.isNotEmpty(result)){ - return result; + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); } - return new ArrayList<>(); + List allMatters = baseDao.getAllMattersByOrgId(result.stream().map(m -> m.getMatterId()).collect(Collectors.toList())); + allMatters.forEach(matter -> { + List timeList = getTimeList(matter.getStartTime(), matter.getEndTime(), NumConstant.THIRTY); + AtomicReference sort = new AtomicReference<>(NumConstant.ONE); + result.forEach(r -> { + if (r.getMatterId().equals(matter.getMatterId())){ + r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE)); + List time = new ArrayList<>(); + List list = Arrays.asList(r.getTimeId().split(",")); + list.forEach(l -> timeList.stream().filter( t -> l.equals(t.getTimeId())).forEach(t -> time.add(t.getTime()))); + r.setAppointmentTime(time); + } + }); + }); + return result; } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 13629cef31..79fad12d2c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -303,6 +303,26 @@ + + + + + + + + + + + + + + + + + + + + + + + \ 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/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-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 5b34c0e571..9c57423628 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 @@ -698,4 +698,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping(value = "/epmetuser/icresiuser/geticresiuser/{icResiUserId}") Result getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId); + + /** + * @Description 查询居民注册关系 + * @param userId + * @author zxc + * @date 2021/12/30 3:12 下午 + */ + @PostMapping("/epmetuser/userbaseinfo/resirelationinfo") + Result resiRelationInfo(@RequestParam("userId")String userId); + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 91b647c878..b434b30806 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -518,4 +518,8 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserDTO", icResiUserId); } + @Override + public Result resiRelationInfo(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java index 2438eae9c6..adc98f7a08 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.CommonUserIdFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO; @@ -203,5 +204,16 @@ public class UserBaseInfoController { ValidatorUtils.validateEntity(param, CommonUserIdFormDTO.CommonUserIdGroup.class); return new Result().ok(userBaseInfoService.extUserInfo(param)); } + + /** + * @Description 查询居民注册关系 + * @param userId + * @author zxc + * @date 2021/12/30 3:12 下午 + */ + @PostMapping("resirelationinfo") + public Result resiRelationInfo(@RequestParam("userId")String userId){ + return new Result().ok(userBaseInfoService.resiRelationInfo(userId)); + } } 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/dao/RegisterRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java index 160e1a4afc..480c8b52fa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.RegisterRelationDTO; import com.epmet.entity.RegisterRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -55,4 +56,12 @@ public interface RegisterRelationDao extends BaseDao { * @date 2021/3/16 下午3:05 */ String selectRegisterGridIdByUserId(@Param("userId")String userId); + + /** + * @Description 居民注册关系 + * @param userId + * @author zxc + * @date 2021/12/30 3:14 下午 + */ + RegisterRelationDTO resiRelationInfo(@Param("userId")String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java index efa3b0cda3..01bac74fc2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.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.commons.tools.utils.Result; +import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.CommonUserIdFormDTO; import com.epmet.dto.form.VolunteerRegResiFormDTO; @@ -194,4 +195,12 @@ public interface UserBaseInfoService extends BaseService { @Deprecated Integer checkIdNum(String idNum, String customerId, String excludeUserId); + + /** + * @Description 查询居民注册关系 + * @param userId + * @author zxc + * @date 2021/12/30 3:12 下午 + */ + RegisterRelationDTO resiRelationInfo(String userId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 6adada9a2b..898a7735d2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.*; +import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserWechatDTO; @@ -86,6 +87,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -490,4 +493,15 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl 0 ? ++pageCount : pageCount; - // 志愿者epmet user id - Set volunteerEpmetUserIds = new HashSet<>(); + // 志愿者epmet user id 集合 + List volunteerEpmetUserIds = new ArrayList<>(); // 分页查询志愿者的epmet user id - while (true) { - - VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); - volunteerForm.setCustomerId(customerId); - volunteerForm.setSuperiorAgencyId(agencyId); - volunteerForm.setPageNo(pageNo); - volunteerForm.setPageSize(pageSize); - - String errorMsg = "【志愿者分布】分页查询志愿者列表失败"; - List volunteerPage = getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm), - ServiceConstant.EPMET_HEART_SERVER, - EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), - errorMsg, - errorMsg); - - // 将本页userId添加到总集中去 - volunteerEpmetUserIds.addAll(volunteerPage.stream().map(v -> v.getUserId()).collect(Collectors.toSet())); - - if (volunteerPage.size() < pageSize) { - // 说明是最后一页了 - break; - } + List>> volsPageFutures = new ArrayList<>(); + + for (int pageNo = 1 ; pageNo <= pageCount ; pageNo ++) { + + int pageNoTemp = pageNo; + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listVolunteersByPage(customerId, agencyId, pageNoTemp, pageSize) + .stream() + .map(v -> v.getUserId()) + .collect(Collectors.toSet()); + }); - pageNo++; + volsPageFutures.add(future); } + // 阻塞,等待子线程返回结果,然后添加到志愿者userId集合中去 + for (CompletableFuture> future : volsPageFutures) { + try { + volunteerEpmetUserIds.addAll(future.get()); + } catch (InterruptedException e) { + log.error("【志愿者分布】异步获取志愿者userId列表被中断:{}", ExceptionUtils.getErrorStackTrace(e)); + } catch (ExecutionException e) { + log.error("【志愿者分布】异步获取志愿者userId列表失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } - VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); + log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size()); - // 2.填充ic居民信息 - for (String volunteerEpmetUserId : volunteerEpmetUserIds) { + // 2.==========异步填充ic居民信息========== + List>> volResiInfoFutures = new ArrayList<>(); - VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution(); + // 将所有的userId按100固定分割成多个部分,循环用每个部分去查询,然后填充 + List> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100); - 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; + for (List volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) { + + log.info("【志愿者分布】查询ic居民信息,切割后,本组的userId个数:{}", volunteerEpmetUserIdPart.size()); + + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + return listIcResiInfosByUserIds(volunteerEpmetUserIdPart); + }); + + 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)); } + } + + return r; + } - // 查询志愿者类别 - List volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId()); - //if (CollectionUtils.isEmpty(volunteerCategories)) { - // // 此人没有志愿者信息 - // continue; - //} + /** + * 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, String agencyId, Integer pageNo, Integer pageSize) { + VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); + volunteerForm.setCustomerId(customerId); + volunteerForm.setSuperiorAgencyId(agencyId); + volunteerForm.setPageNo(pageNo); + volunteerForm.setPageSize(pageSize); + + String errorMsg = "【志愿者分布】分页查询志愿者列表失败"; + return getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm), + ServiceConstant.EPMET_HEART_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + errorMsg, + errorMsg); } } 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 + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml index f6e9b17e34..74c1691615 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml @@ -82,5 +82,10 @@ SELECT GRID_ID FROM register_relation WHERE DEL_FLAG = 0 and USER_ID = #{userId} + + +