Browse Source

Merge branch 'dev_ic_mp' of http://git.elinkit.com.cn:7070/r/epmet-cloud into develop

 Conflicts:
	epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
dev
jianjun 4 years ago
parent
commit
2b5c03d904
  1. 10
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.9__add_data_type.sql
  2. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 3
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml
  4. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  5. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java
  6. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  7. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  9. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  10. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  11. 10
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  12. 7
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  13. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  14. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  15. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  16. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  17. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  18. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  19. 32
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  20. 36
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  21. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  22. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java
  23. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java
  24. 9
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java
  25. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java
  26. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  27. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java
  28. 46
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  29. 71
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  30. 64
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java
  31. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java
  32. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java
  33. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java
  34. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  35. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java
  36. 51
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  37. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java
  38. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java
  39. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  40. 78
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java
  41. 34
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  42. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml
  43. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml
  44. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java
  45. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java
  46. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java
  47. 10
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java
  48. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
  49. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java
  50. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  51. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  52. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  53. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  54. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java
  55. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  56. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  57. 177
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java
  58. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  59. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml

10
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');

6
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);
}
}

3
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

1
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();

4
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<String> 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();
}

3
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<ProjectEntity> {
* 获取已转项目事件事件
*
* @param customerId
* @param projectId
* @return
*/
List<ResiEventDTO> getEventList(@Param("customerId") String customerId);
List<ResiEventDTO> getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId);
}

27
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<ProjectDTO> projectList = projectService.getProjectInfo(customerId, dateString, projectId);
factOriginProjectMainDailyService.deleteByDate(customerId, dateString,projectId);
List<IssueDTO> issueList = new ArrayList<>();
List<ResiTopicDTO> topicList = new ArrayList<>();
if (!CollectionUtils.isEmpty(projectList)) {
Map<String, ResiEventDTO> projectEventMap = projectService.getEventList(customerId);
Map<String, ResiEventDTO> projectEventMap = projectService.getEventList(customerId, projectId);
//提取议题ID
List<String> issueIds =
projectList.stream().filter(item -> ProjectConstant.ISSUE.equals(item.getOrigin())).map(ProjectDTO::getOriginId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(issueIds)) {
//分批次获取
//获取议题信息
List<IssueDTO> issueList = issueService.getIssueInfoByIds(issueIds);
List<List<String>> partition = ListUtils.partition(issueIds, NumConstant.FIFTY);
partition.forEach(part -> issueList.addAll(issueService.getIssueInfoByIds(part)));
//提取话题ID
List<String> topicIds = issueList.stream().map(IssueDTO::getSourceId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(topicIds)) {
//获取话题信息
List<ResiTopicDTO> topicList = topicService.getTopicByIds(topicIds);
List<List<String>> topicPart = ListUtils.partition(topicIds, NumConstant.FIFTY);
topicPart.forEach(part -> topicList.addAll(topicService.getTopicByIds(part)));
}
}
//获取网格认证党员
List<PartyMemberDTO> partyMemberList = partyMemberService.getPartyMemberByCustomer(customerId);
//生成DTO
@ -231,7 +241,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
}
//满意度
long start = System.currentTimeMillis();
List<FactOriginProjectMainDailyEntity> 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<FactOriginProjectMainDailyEntity> mainList = list;
List<FactOriginProjectLogDailyEntity> logList = new ArrayList<>();
//节点发起人 部门流转退回结案
start = System.currentTimeMillis();
List<ProcessInfoDTO> 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<ProcessInfoDTO> 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<ProcessInfoDTO> 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<ProcessInfoDTO> 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());

2
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<ProjectEntity> {
* @param projectId
* @return
*/
Map<String, ResiEventDTO> getEventList(String customerId);
Map<String, ResiEventDTO> getEventList(String customerId, String projectId);
}

4
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<ProjectDao, ProjectEntit
}
@Override
public Map<String, ResiEventDTO> getEventList(String customerId) {
List<ResiEventDTO> list = baseDao.getEventList(customerId);
public Map<String, ResiEventDTO> getEventList(String customerId, String projectId) {
List<ResiEventDTO> list = baseDao.getEventList(customerId, projectId);
if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}

3
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'
<if test="projectId != null and projectId != ''">
AND re.PROJECT_ID = #{projectId}
</if>
and rero.CUSTOMER_ID = #{customerId}
</select>

10
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<Integer> getVolunteerCount(@RequestBody VolunteerCommonFormDTO input);
}

7
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<Integer> getVolunteerCount(VolunteerCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getVolunteerCount", input);
}
}

4
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<DemandRecResultDTO> res=icUserDemandRecService.pageListAnalysis(formDTO);
if (!CollectionUtils.isEmpty(res.getList())) {
ExcelUtils.exportExcelToTarget(response, null, res.getList(), DemandRecExcelResultDTO.class);
return new Result();
}
return new Result();
}
/**

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -145,4 +145,18 @@ public class ResiVolunteerController {
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, superiorAgencyId);
return new Result<List<PageVolunteerInfoResultDTO>>().ok(l);
}
/**
* 查询志愿者数量
* @param input
* @return
*/
@PostMapping("count")
public Result<Integer> getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) {
String customerId = input.getCustomerId();
String pidsPrefix = input.getSuperiorAgencyId();
Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, pidsPrefix);
return new Result<Integer>().ok(volunteerCount);
}
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -114,6 +114,15 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
*/
List<OptionDTO> option(IcPartyUnitDTO dto);
/**
* @Description 获取组织以及下级单位列表
* @Param dto
* @Return {@link List< OptionDTO>}
* @Author zhaoqifeng
* @Date 2021/11/22 14:35
*/
List<OptionDTO> options(IcPartyUnitDTO dto);
/**
* 导入数据
* @Param tokenDto

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -96,4 +96,11 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
List<OptionDTO> queryListVolunteer(String customerId,String staffId,String userRealName);
List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId);
/**
* 查询志愿者数量
* @param customerId
* @return
*/
Integer getVolunteerCount(String customerId, String pidsPrefix);
}

2
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<IcPartyActivityD
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
//获取联建单位
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
Map<String, String> option = icPartyUnitService.options(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取服务事项字典
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());

21
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<IcPartyUnitDao, IcPa
}
insert(entity);
} else {
if (CollectionUtils.isNotEmpty(list) && list.get(0).getId().equals(entity.getId())) {
if (CollectionUtils.isNotEmpty(list) && !list.get(0).getId().equals(entity.getId())) {
throw new EpmetException(EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getCode(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg());
}
updateById(entity);
@ -261,6 +261,25 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
}).collect(Collectors.toList());
}
@Override
public List<OptionDTO> options(IcPartyUnitDTO dto) {
LambdaQueryWrapper<IcPartyUnitEntity> 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<IcPartyUnitEntity> 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());
}
/**
* 导入数据
*

32
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<IcUserDemandRecD
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName));
}
//查询字典表
Result<Map<String, String>> reportTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode());
Map<String,String> reportTypeMap=reportTypeRes.success()&& MapUtils.isNotEmpty(reportTypeRes.getData())?reportTypeRes.getData():new HashMap<>();
Result<Map<String, String>> statusRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode());
Map<String,String> statusMap=statusRes.success()&& MapUtils.isNotEmpty(statusRes.getData())?statusRes.getData():new HashMap<>();
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode());
Map<String,String> 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<IcUserDemandRecD
res.setServiceName(userInfoMap.get(res.getServerId()));
}
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
res.setReportTypeName(reportTypeMap.containsKey(res.getReportType())?reportTypeMap.get(res.getReportType()):StrConstant.EPMETY_STR);
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR);
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"):StrConstant.EPMETY_STR);
switch (res.getServiceType())
{
case UserDemandConstant.PARTY_UNIT:
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)"));
break;
case UserDemandConstant.SOCIAL_ORG:
res.setServiceShowName(res.getServiceName().concat("(社会组织)"));
break;
case UserDemandConstant.COMMUNITY_ORG:
res.setServiceShowName(res.getServiceName().concat("(社区自组织)"));
break;
case UserDemandConstant.VOLUNTEER:
res.setServiceShowName(res.getServiceName().concat("(志愿者)"));
break;
default:
res.setServiceShowName(res.getServiceName());
log.warn("serviceType 错误");
break;
}
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()));
}
}

36
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -24,10 +24,8 @@ import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
@ -38,7 +36,6 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.SystemMessageType;
import com.epmet.dao.VolunteerInfoDao;
@ -46,11 +43,7 @@ import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.SendVerificationCodeFormDTO;
import com.epmet.dto.form.VolunteerRegResiFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
@ -74,12 +67,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.Optional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -105,7 +93,6 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@ -236,10 +223,10 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
if (userBaseInfo.success()){
resultDTO = ConvertUtils.sourceToTarget(userBaseInfo.getData(), ResiVolunteerInfoResultDTO.class);
// 判断是不是志愿者
Integer volunteerFlag = baseDao.queryVolunteerFlagByUserId(tokenDto.getUserId());
if (volunteerFlag > NumConstant.ZERO){
// 获取志愿者信息
// 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,前端重新获取 网格信息
@ -396,4 +383,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
return list;
}
@Override
public Integer getVolunteerCount(String customerId, String pidsPrefix) {
LambdaQueryWrapper<VolunteerInfoEntity> 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);
}
}

17
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,

2
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);
}
}

5
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";
}

9
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;
}
}

5
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,6 +50,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-05-11
*/
@Slf4j
@RestController
@RequestMapping("issuevotestatistical")
public class IssueVoteStatisticalController {
@ -129,7 +131,8 @@ public class IssueVoteStatisticalController {
**/
@PostMapping("syncvotingcacheanddb")
public Result syncVotingCacheAndDb(){
issueVoteStatisticalService.syncVotingCacheToDb();
//issueVoteStatisticalService.syncVotingCacheToDb();
log.error("syncvotingcacheanddb 又执行了");
return new Result();
}

7
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java

@ -262,6 +262,9 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/
List<ResiBuzzLeftPieChartResultDTO> resiBuzzLeftPieChartByIssueIds(@Param("length")Integer length,@Param("issueIds")List<String> issueIds);
List<ResiBuzzLeftPieChartResultDTO> resiBuzzIssueCategoryByIssueIds(@Param("length")Integer length,@Param("issueIds")List<String> issueIds);
List<ResiBuzzLeftPieChartResultDTO> resiBuzzIssueCategoryNameByIssueIds(List<ResiBuzzLeftPieChartResultDTO> categories,@Param("customerId")String customerId);
/**
* @Description 查询前50名的议题ID
* @param orgId
@ -269,7 +272,7 @@ public interface IssueDao extends BaseDao<IssueEntity> {
* @author zxc
* @date 2021/12/30 9:16 上午
*/
List<String> resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType);
List<String> resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status);
/**
* @Description 查询组织下每个网格的项目数
@ -287,4 +290,6 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/
List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueIds(@Param("issueIds")List<String> issueIds);
List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueList(List<ResiBuzzLeftPieChartResultDTO> issueIds,@Param("customerId")String customerId);
}

5
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);

46
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<IssueDao, IssueEntity> imp
}
List<ResiBuzzDTO> list = allList.stream().skip(formDTO.getPageSize() * (formDTO.getPageNo() - NumConstant.ONE))
.limit(formDTO.getPageSize()).collect(Collectors.toList());
List<ResiBuzzIssueCategoryDTO> names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
List<ResiBuzzLeftPieChartResultDTO> categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
List<ResiBuzzLeftPieChartResultDTO> pieChat = getPieChat(list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
Iterator<ResiBuzzLeftPieChartResultDTO> 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<ResiBuzzIssueCategoryDTO> names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
List<ResiBuzzIssueCategoryDTO> 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<IssueDao, IssueEntity> imp
// 分类编码长度
Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId());
// List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId());
List<String> issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType());
List<String> issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType(),formDTO.getStatus());
if(CollectionUtils.isEmpty(issueIds)){
return new ArrayList<>();
}
List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds);
List<ResiBuzzLeftPieChartResultDTO> categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, issueIds);
List<ResiBuzzLeftPieChartResultDTO> pieChat = getPieChat(issueIds);
Iterator<ResiBuzzLeftPieChartResultDTO> 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<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds);
List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzIssueCategoryNameByIssueIds(categories, tokenDto.getCustomerId());
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
return result;
}
public List<ResiBuzzLeftPieChartResultDTO> getPieChat(List<String> issueIds){
List<ResiBuzzLeftPieChartResultDTO> resultDTOS = new ArrayList<>();
issueIds.forEach(i -> {
ResiBuzzLeftPieChartResultDTO dto = new ResiBuzzLeftPieChartResultDTO();
dto.setIssueId(i);
resultDTOS.add(dto);
});
return resultDTOS;
}
/**
* @Description 查询组织下每个网格的项目数
* @param formDTO

71
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml

@ -617,16 +617,13 @@
<!-- 查询居民热议左侧饼图 -->
<select id="resiBuzzLeftPieChart" resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
SELECT COUNT(issueId) AS count,categoryCode,categoryName,color FROM
SELECT COUNT(t2.issueId) AS count,cd.CATEGORY_CODE,IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName, IFNULL(cd.COLOR,'#0091ed') AS color FROM
(SELECT t1.issueId AS issueId,IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode FROM
(SELECT
i.ID AS issueId,
IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode,
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.color,'#0091ed') AS color
i.ID AS issueId
FROM issue i
INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
LEFT JOIN issue_category ic ON (ic.ISSUE_ID = i.ID AND ic.DEL_FLAG = '0' AND ic.CUSTOMER_ID = i.CUSTOMER_ID)
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
WHERE i.DEL_FLAG = '0'
<if test='orgType == "grid" '>
AND i.GRID_ID = #{orgId}
@ -634,14 +631,17 @@
<if test='orgType == "agency" '>
AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50)temp
GROUP BY categoryName
ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50)t1
LEFT JOIN issue_category ic ON (t1.issueId = ic.ISSUE_ID AND ic.DEL_FLAG = '0')
GROUP BY t1.issueId,categoryCode)t2
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t2.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
GROUP BY cd.CATEGORY_NAME
</select>
<!-- 查询组织下每个网格的项目数 -->
<select id="getProjectCountByGrid" resultType="com.epmet.dto.result.ProjectDistributionAnalysisRightDTO">
SELECT
GRID_ID,
GRID_ID AS orgId,
COUNT(ID) AS count
FROM issue
WHERE DEL_FLAG = '0'
@ -680,6 +680,9 @@
FROM issue i
INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
WHERE i.DEL_FLAG = '0'
<if test='status != "all" '>
AND i.ISSUE_STATUS = #{status}
</if>
<if test='orgType == "grid" '>
AND i.GRID_ID = #{orgId}
</if>
@ -696,11 +699,55 @@
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.color,'#0091ed') AS color
FROM issue_category ic
INNER JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
AND ic.ISSUE_ID IN (
<foreach collection="issueIds" item="issueId" separator=",">
#{issueId}
</foreach>
) GROUP BY categoryName
) GROUP BY categoryCode
</select>
<select id="resiBuzzIssueCategoryByIssueIds"
resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
SELECT
ISSUE_ID ,
IFNULL(LEFT(CATEGORY_CODE,#{length}),'') AS categoryCode
FROM issue_category
WHERE DEL_FLAG = '0'
AND ISSUE_ID IN(
<foreach collection="issueIds" item="issueId" separator=",">
#{issueId}
</foreach>
)
GROUP BY issue_id,categoryCode
</select>
<select id="resiBuzzIssueCategoryNameByIssueIds"
resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
select count(t2.issueId) as count , t2.categoryCode,t2.categoryName,t2.color from
(<foreach collection="categories" item="c" separator="UNION ALL">
select
t1.issueId as issueId,
cd.CATEGORY_CODE as categoryCode,
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.COLOR,'#0091ed') AS color
from (select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
</foreach>)t2
group by t2.categoryName
</select>
<resultMap id="selectCategoryNameByIssueListMap" type="com.epmet.dto.result.ResiBuzzIssueCategoryDTO">
<result property="issueId" column="issueId"/>
<collection property="cn" ofType="java.lang.String">
<result column="categoryName"/>
</collection>
</resultMap>
<select id="selectCategoryNameByIssueList" resultMap="selectCategoryNameByIssueListMap">
<foreach collection="issueIds" item="c" separator="UNION ALL">
SELECT
t1.issueId AS issueId,
IFNULL(cd.CATEGORY_NAME,'其他') as categoryName
FROM ( select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = #{customerId})
</foreach>
</select>
</mapper>

64
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;
}

7
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 = "";

4
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;

1
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";

15
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<AgencyTreeResultDTO> 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<AgencyTreeResultDTO>().ok(result);
return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId()));
}
/**

7
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

51
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -58,6 +58,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 组织首页-下级机关列表
**/
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum);
List<SubListResultDTO> selectSubAgencyByAgencyId(@Param("pId") String pId);
/**
@ -79,8 +80,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
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<CustomerAgencyEntity> {
/**
* 查询客户根级组织
*
* @param customerId
* @return
*/
@ -111,10 +113,11 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/**
* 获取所属机关单位名称上级-所属
* @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,43 +130,45 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<ArticleGridResultDTO> 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<ExtStaffPermissionResultDTO> 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
**/
@ -186,30 +191,33 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
/**
* @Description 返回elementTree结构的agency树
* @param customerId
* @param pid
* @return java.util.List<com.epmet.dto.result.AgencyElementTreeResultDTO.Agency>
* @Description 返回elementTree结构的agency树
* @Author liushaowen
* @Date 2020/11/6 14:57
*/
List<AgencyElementTreeResultDTO.Agency> getAgencyElementTree(@Param("customerId") String customerId,@Param("pid") String pid);
List<AgencyElementTreeResultDTO.Agency> getAgencyElementTree(@Param("customerId") String customerId, @Param("pid") String pid);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
@ -236,6 +244,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/**
* 根据新增人员类型判断查询机关信息
*
* @author sun
*/
OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType);
@ -247,41 +256,47 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<StaffOrgsResultDTO> 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<MapSonOrgResultDTO> selectSonOrg(@Param("pid")String pid,@Param("type")String type);
List<MapSonOrgResultDTO> selectSonOrg(@Param("pid") String pid, @Param("type") String type);
/**
* @Description 查询下级agencyId
* @param orgId
* @Description 查询下级agencyId
* @author zxc
* @date 2021/12/9 4:42 下午
*/
List<String> getSonAgencyId(@Param("orgId") String orgId);
/**
* desc:获取组织和网格的数据 树形sql
* @param agencyId
* @return
*/
ExtStaffPermissionResultDTO selectAgencyAndGridById(@Param("agencyId") String agencyId);
/**
* @Description 事件社区服务热线
* @author sun

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java

@ -59,4 +59,6 @@ public interface IcPartyServiceCenterDao extends BaseDao<IcPartyServiceCenterEnt
*/
List<AllMattersResultDTO> getAllMatters(@Param("orgId")String orgId);
List<AllMattersResultDTO> getAllMattersByOrgId(@Param("matterIds")List<String> matterIds);
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java

@ -133,6 +133,7 @@ public interface IcPartyServiceCenterService extends BaseService<IcPartyServiceC
* @date 2021/11/22 2:06 下午
*/
void appointment(AppointmentFormDTO formDTO,TokenDto tokenDto);
void appointmentMini(AppointmentMiniFormDTO formDTO,TokenDto tokenDto);
/**
* @Description 党群服务中心列表

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -16,6 +16,7 @@
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -24,6 +25,8 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
@ -81,6 +84,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private RedisUtils redisUtils;
@Override
public PageData<CustomerAgencyDTO> page(Map<String, Object> params) {
@ -1125,8 +1130,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
result.setOrgLevel(rootAgency.getAgencyId().concat("-").concat(rootAgency.getLevel()));
result.setLongitude(rootAgency.getLongitude());
result.setLatitude(rootAgency.getLatitude());
ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(rootAgency.getAgencyId());
String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(rootAgency.getAgencyId());
Object o = redisUtils.get(orgTreeCacheKey);
if (o == null){
ExtStaffPermissionResultDTO res = baseDao.selectAgencyAndGridById(rootAgency.getAgencyId());
convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList());
redisUtils.set(orgTreeCacheKey,result, RedisUtils.MINUTE_THIRTY_EXPIRE);
}else {
result = (AgencyTreeResultDTO) o;
}
return result;
}
/**

78
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

@ -35,16 +35,19 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
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.Result;
import com.epmet.constant.PartyServiceCenterConstant;
import com.epmet.dao.IcMatterAppointmentRecordDao;
import com.epmet.dao.IcPartyServiceCenterDao;
import com.epmet.dto.IcPartyServiceCenterDTO;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.TimeDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IcMatterAppointmentRecordEntity;
import com.epmet.entity.IcPartyServiceCenterEntity;
import com.epmet.entity.IcPartyServiceCenterMatterEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.IcPartyServiceCenterMatterService;
import com.epmet.service.IcPartyServiceCenterService;
import org.apache.commons.collections4.CollectionUtils;
@ -75,6 +78,8 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
private IcPartyServiceCenterMatterService matterService;
@Autowired
private IcMatterAppointmentRecordDao matterAppointmentRecordDao;
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Override
public PageData<IcPartyServiceCenterDTO> page(Map<String, Object> params) {
@ -313,6 +318,59 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
matterAppointmentRecordDao.insert(e);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void appointmentMini(AppointmentMiniFormDTO formDTO, TokenDto tokenDto) {
String customerId = tokenDto.getCustomerId();
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> 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<IcMatterAppointmentRecordEntity> records = matterAppointmentRecordDao.selectList(l);
Result<ResiUserBaseInfoResultDTO> 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<String> timeIds = new ArrayList<>();
records.forEach(r -> {
timeIds.addAll(Arrays.asList(r.getTimeId().split(",")));
});
List<String> formTimeId = Arrays.asList(formDTO.getTimeId().split(","));
int before = timeIds.size() + formTimeId.size();
List<String> endTimeId = new ArrayList<>();
endTimeId.addAll(timeIds);endTimeId.addAll(formTimeId);
List<String> 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,11 +531,25 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
@Override
public List<AppointmentRecordResultDTO> appointmentRecordMini(AppointmentRecordMiniFormDTO formDTO,TokenDto tokenDto) {
List<AppointmentRecordResultDTO> result = matterAppointmentRecordDao.appointmentRecordMini(formDTO.getGridId(), tokenDto.getUserId());
if (CollectionUtils.isNotEmpty(result)){
return result;
}
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
List<AllMattersResultDTO> allMatters = baseDao.getAllMattersByOrgId(result.stream().map(m -> m.getMatterId()).collect(Collectors.toList()));
allMatters.forEach(matter -> {
List<TimeDTO> timeList = getTimeList(matter.getStartTime(), matter.getEndTime(), NumConstant.THIRTY);
AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE);
result.forEach(r -> {
if (r.getMatterId().equals(matter.getMatterId())){
r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE));
List<String> time = new ArrayList<>();
List<String> 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;
}
/**
* @Description 党群服务中心详情

34
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -303,6 +303,26 @@
</collection>
</resultMap>
<resultMap id="agencyAndGridMap" type="com.epmet.dto.result.ExtStaffPermissionResultDTO">
<id column="agencyId" property="agencyId" />
<result column="agencyName" property="agencyName"/>
<result column="level" property="level" />
<result column="longitude" property="longitude" />
<result column="latitude" property="latitude" />
<result column="customerId" property="customerId"/>
<collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.ExtGridResultDTO" select="selectGridList">
<id column="gridId" property="gridId" />
<result column="gridName" property="gridName" />
<result column="customerId" property="customerId"/>
<result column="longitude" property="longitude" />
<result column="latitude" property="latitude" />
</collection>
<collection property="subAgencyList" column="agencyId"
ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectSubAgencyByPid">
</collection>
</resultMap>
<select id="selectAgencyById" resultMap="treeMap">
SELECT
@ -672,6 +692,20 @@
DEL_FLAG = '0'
AND PID = #{orgId}
</select>
<select id="selectAgencyAndGridById" resultMap="agencyAndGridMap">
SELECT
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level,
agency.CUSTOMER_ID as customerId,
agency.longitude,
agency.latitude
FROM
CUSTOMER_AGENCY agency
WHERE
agency.DEL_FLAG = '0'
AND agency.ID = #{agencyId}
</select>
<select id="getAgencyMobile" resultType="com.epmet.dto.result.OrgMobileResultDTO">
SELECT

9
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml

@ -21,7 +21,8 @@
ar.REMARK,
ar.TIME_ID,
cm.MATTER_NAME,
ar.ID AS recordId
ar.ID AS recordId,
ar.matter_id as matterId
FROM ic_matter_appointment_record ar
LEFT JOIN ic_party_service_center_matter cm ON (cm.ID = ar.MATTER_ID AND cm.DEL_FLAG = 0)
WHERE ar.DEL_FLAG = 0
@ -55,9 +56,13 @@
ar.TIME_ID,
cm.MATTER_NAME,
ar.ID AS recordId,
ar.APPOINTMENT_DATE
ar.APPOINTMENT_DATE,
ar.MATTER_ID as matterId,
c.CENTER_NAME,
c.ADDRESS
FROM ic_matter_appointment_record ar
LEFT JOIN ic_party_service_center_matter cm ON (cm.ID = ar.MATTER_ID AND cm.DEL_FLAG = 0)
LEFT JOIN ic_party_service_center c ON (c.ID = cm.PARTY_SERVICE_CENTER_ID AND c.DEL_FLAG = 0)
WHERE ar.DEL_FLAG = 0
AND ar.ORG_ID = #{orgId}
AND ar.CREATED_BY = #{userId}

15
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml

@ -102,4 +102,19 @@
WHERE sc.DEL_FLAG = 0
AND ID = #{centerId}
</select>
<select id="getAllMattersByOrgId" resultType="com.epmet.dto.result.AllMattersResultDTO">
SELECT
cm.ID AS matterId,
cm.start_time,
cm.end_time
FROM ic_party_service_center_matter cm
where cm.DEL_FLAG = 0
AND cm.ID in (
<foreach collection="matterIds" item="m" separator=",">
#{m}
</foreach>
)
</select>
</mapper>

2
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();
}

4
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);

2
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<BaseGridDailyworkE
* @param patrolRecordForm
* @return
*/
Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm);
Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm);
/**
* desc重新加载数据

10
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java

@ -21,6 +21,8 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
@ -64,14 +66,14 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
private ExUserService exUserService;
@Override
public Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) {
log.info("upsertPatrolRecord param:{}", JSON.toJSONString(patrolRecordForm));
public Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm) {
log.info("insertBaseGridWorkRecord param:{}", JSON.toJSONString(patrolRecordForm));
ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class);
PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<PatrolRoutineWorkResult>> 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<String, ExDeptDTO> deptMap = exDeptService.getDeptDTOMap(patrolRecordForm.getCustomerId());
Map<String, ExUserDTO> userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId());
@ -82,7 +84,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow);
return true;
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
}
insertRecordBatch(data, deptMap, userMap);
return true;

18
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java

@ -21,6 +21,8 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.user.param.MidPatrolFormDTO;
@ -64,17 +66,17 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl<UserPatrolRecor
MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<MidPatrolRecordResult>> 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<MidPatrolRecordResult> 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<UserPatrolRecordEntity> insertList = new ArrayList<>();
data.forEach(o-> insertList.add(buildEntity(o)));
@ -94,17 +96,17 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl<UserPatrolRecor
MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<MidPatrolRecordResult>> 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<MidPatrolRecordResult> 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);

2
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<String> volunteerCategories;
private String volunteerCategoriesStr;
private String buildingId;
private String epmetUserId;
private String icResiUserId;
private String longitude;

10
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<IcResiUserDTO> getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId);
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@PostMapping("/epmetuser/userbaseinfo/resirelationinfo")
Result<RegisterRelationDTO> resiRelationInfo(@RequestParam("userId")String userId);
}

4
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<RegisterRelationDTO> resiRelationInfo(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId);
}
}

12
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<ExtUserInfoResultDTO>().ok(userBaseInfoService.extUserInfo(param));
}
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@PostMapping("resirelationinfo")
public Result<RegisterRelationDTO> resiRelationInfo(@RequestParam("userId")String userId){
return new Result<RegisterRelationDTO>().ok(userBaseInfoService.resiRelationInfo(userId));
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -226,4 +226,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
*/
List<PartyMemberEducationResultDTO> getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId,
@Param("code") String code);
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
}

9
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<RegisterRelationEntity> {
* @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);
}

9
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<UserBaseInfoEntity> {
@Deprecated
Integer checkIdNum(String idNum, String customerId, String excludeUserId);
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
RegisterRelationDTO resiRelationInfo(String userId);
}

14
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<UserBaseInfoDao, Us
private RegisterRelationService registerRelationService;
@Autowired
private UserResiInfoService userResiInfoService;
@Autowired
private RegisterRelationDao registerRelationDao;
@Override
public PageData<UserBaseInfoDTO> page(Map<String, Object> params) {
@ -490,4 +493,15 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
public Integer checkIdNum(String idNum, String customerId, String excludeUserId) {
return baseDao.selectCountIdNum(idNum,customerId,excludeUserId);
}
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@Override
public RegisterRelationDTO resiRelationInfo(String userId) {
return registerRelationDao.resiRelationInfo(userId);
}
}

177
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

@ -2,15 +2,14 @@ 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;
@ -22,7 +21,11 @@ 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;
/**
@ -93,95 +96,157 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
* @return
*/
public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId, String agencyId) {
//epmetHeartOpenFeignClient.queryVolunteerPage()
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
// 1.分页查询出所有志愿者列表
int pageNo = 1;
int pageSize = 100;
// 1.==========分页查询出所有志愿者列表==========
// 志愿者epmet user id
Set<String> volunteerEpmetUserIds = new HashSet<>();
String vcErrorMsg = "【志愿者分布】查询志愿者总数出错";
VolunteerCommonFormDTO volunteerCountForm = new VolunteerCommonFormDTO();
volunteerCountForm.setCustomerId(customerId);
volunteerCountForm.setSuperiorAgencyId(agencyId);
Integer volunteerCount = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getVolunteerCount(volunteerCountForm),
ServiceConstant.EPMET_HEART_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
vcErrorMsg,
vcErrorMsg);
// 分页查询志愿者的epmet user id
while (true) {
if (volunteerCount == null || volunteerCount == 0) {
// 没得志愿者,直接返回
return r;
}
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO();
volunteerForm.setCustomerId(customerId);
volunteerForm.setSuperiorAgencyId(agencyId);
volunteerForm.setPageNo(pageNo);
volunteerForm.setPageSize(pageSize);
// 计算页数
int pageSize = 200;
int pageCount = volunteerCount / pageSize;
int lastPageItems = volunteerCount % pageSize;
pageCount = lastPageItems > 0 ? ++pageCount : pageCount;
String errorMsg = "【志愿者分布】分页查询志愿者列表失败";
List<PageVolunteerInfoResultDTO> volunteerPage = getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm),
ServiceConstant.EPMET_HEART_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
errorMsg,
errorMsg);
// 志愿者epmet user id 集合
List<String> volunteerEpmetUserIds = new ArrayList<>();
// 将本页userId添加到总集中去
volunteerEpmetUserIds.addAll(volunteerPage.stream().map(v -> v.getUserId()).collect(Collectors.toSet()));
// 分页查询志愿者的epmet user id
List<CompletableFuture<Set<String>>> volsPageFutures = new ArrayList<>();
for (int pageNo = 1 ; pageNo <= pageCount ; pageNo ++) {
int pageNoTemp = pageNo;
CompletableFuture<Set<String>> future = CompletableFuture.supplyAsync(() -> {
return listVolunteersByPage(customerId, agencyId, pageNoTemp, pageSize)
.stream()
.map(v -> v.getUserId())
.collect(Collectors.toSet());
});
if (volunteerPage.size() < pageSize) {
// 说明是最后一页了
break;
volsPageFutures.add(future);
}
pageNo++;
// 阻塞,等待子线程返回结果,然后添加到志愿者userId集合中去
for (CompletableFuture<Set<String>> 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());
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
// 2.==========异步填充ic居民信息==========
List<CompletableFuture<List<VolunteerDistributionResultDTO.Distribution>>> volResiInfoFutures = new ArrayList<>();
// 将所有的userId按100固定分割成多个部分,循环用每个部分去查询,然后填充
List<List<String>> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100);
// 2.填充ic居民信息
for (String volunteerEpmetUserId : volunteerEpmetUserIds) {
for (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) {
log.info("【志愿者分布】查询ic居民信息,切割后,本组的userId个数:{}", volunteerEpmetUserIdPart.size());
CompletableFuture<List<VolunteerDistributionResultDTO.Distribution>> future = CompletableFuture.supplyAsync(() -> {
return listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
});
VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution();
volResiInfoFutures.add(future);
}
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;
// 阻塞的,获取各个子线程计算结果
for (CompletableFuture<List<VolunteerDistributionResultDTO.Distribution>> volResiInfoFuture : volResiInfoFutures) {
try {
List<VolunteerDistributionResultDTO.Distribution> distributions = volResiInfoFuture.get();
r.getDistributions().addAll(distributions);
} catch (InterruptedException e) {
log.error("【志愿者分布】异步获取志愿者的居民信息被中断:{}", ExceptionUtils.getErrorStackTrace(e));
} catch (ExecutionException e) {
log.error("【志愿者分布】异步获取志愿者的居民信息失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
//使用身份证号查询ic resi信息
IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null);
if (icResiUserInfo == null) {
continue;
return r;
}
// 查询志愿者类别
List<String> volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId());
//if (CollectionUtils.isEmpty(volunteerCategories)) {
// // 此人没有志愿者信息
// continue;
//}
/**
* userId列表批量获取他们对应的志愿者信息
* @param volunteerEpmetUserIdPart
* @return
*/
private List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(List<String> volunteerEpmetUserIdPart) {
List<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
// 填充志愿者类型
for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) {
// 将志愿者类型列表字符串,切割放到set中
Set<String> 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<PageVolunteerInfoResultDTO> 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);
}
}

17
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -489,4 +489,21 @@
</choose>
GROUP BY CULTURE
</select>
<select id="listIcResiInfosByUserIds"
resultType="com.epmet.dto.result.VolunteerDistributionResultDTO$Distribution">
select userbaseinfo.USER_ID as epmetUserId,
icuser.ID as icResiUserId,
icuser.BUILD_ID as buildingId,
icvol.VOLUNTEER_CATEGORY as volunteerCategoriesStr
from user_base_info userbaseinfo
inner join ic_resi_user icuser on (userbaseinfo.ID_NUM = icuser.ID_CARD and icuser.DEL_FLAG = '0')
inner join ic_volunteer icvol on (icuser.ID = icvol.IC_RESI_USER and icvol.DEL_FLAG = '0')
where userbaseinfo.DEL_FLAG = '0'
and userbaseinfo.ID_NUM is not null
and userbaseinfo.USER_ID in
<foreach collection="userIds" open="(" separator="," close=")" item="userId">
#{userId}
</foreach>
</select>
</mapper>

5
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}
</select>
<!-- 居民注册关系 -->
<select id="resiRelationInfo" resultType="com.epmet.dto.RegisterRelationDTO">
SELECT * FROM register_relation WHERE DEL_FLAG = 0 AND USER_ID = #{userId}
</select>
</mapper>

Loading…
Cancel
Save