Browse Source

Merge branch 'dev_ic_mp' into develop

master
wangxianzhang 4 years ago
parent
commit
037dcd1cec
  1. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  2. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java
  3. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  4. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  6. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  7. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  8. 10
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  9. 7
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  10. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  11. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  12. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  13. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java
  14. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java
  15. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  16. 243
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

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

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java

@ -131,7 +131,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
List<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());
@ -241,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);
}
@ -249,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 -> {
//获取日期相关维度
@ -301,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 -> {
//获取日期相关维度
@ -347,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());
@ -377,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);
}
}

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

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

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

@ -390,4 +390,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<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);
}
}

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

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

@ -1136,7 +1136,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
if (o == null){
ExtStaffPermissionResultDTO res = baseDao.selectAgencyAndGridById(rootAgency.getAgencyId());
convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList());
redisUtils.set(orgTreeCacheKey,result, 60 * 60 * 24L);
redisUtils.set(orgTreeCacheKey,result, RedisUtils.MINUTE_THIRTY_EXPIRE);
}else {
result = (AgencyTreeResultDTO) o;
}

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

@ -2,6 +2,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.UserBaseInfoDao;
@ -16,7 +17,6 @@ import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.VolunteerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -94,136 +96,157 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
* @return
*/
public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId, String agencyId) {
//epmetHeartOpenFeignClient.queryVolunteerPage()
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
// 1.==========分页查询出所有志愿者列表==========
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);
if (volunteerCount == null || volunteerCount == 0) {
// 没得志愿者,直接返回
return r;
}
// 1.分页查询出所有志愿者列表
int pageNo = 1;
// 计算页数
int pageSize = 200;
int pageCount = volunteerCount / pageSize;
int lastPageItems = volunteerCount % pageSize;
pageCount = lastPageItems > 0 ? ++pageCount : pageCount;
// 志愿者epmet user id
// 志愿者epmet user id 集合
List<String> 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<PageVolunteerInfoResultDTO> 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<CompletableFuture<Set<String>>> volsPageFutures = new ArrayList<>();
pageNo++;
}
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());
});
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
volsPageFutures.add(future);
}
// 阻塞,等待子线程返回结果,然后添加到志愿者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());
// 2.填充ic居民信息
// 2.==========异步填充ic居民信息==========
List<CompletableFuture<List<VolunteerDistributionResultDTO.Distribution>>> volResiInfoFutures = new ArrayList<>();
// 将所有的userId按100固定分割成多个部分,循环用每个部分去查询,然后填充
List<List<String>> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100);
for (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) {
List<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
// 填充志愿者类型
for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) {
// 将志愿者类型列表字符串,切割放到set中
Set<String> volunteerTypes = new HashSet();
String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr();
if (StringUtils.isNotEmpty(volunteerCategoriesStr)) {
String[] vTypes = volunteerCategoriesStr.split(",");
if (vTypes != null && vTypes.length > 0) {
volunteerTypes.addAll(Arrays.asList(vTypes));
}
icResiInfo.setVolunteerCategories(volunteerTypes);
} else {
icResiInfo.setVolunteerCategories(new HashSet<>());
}
log.info("【志愿者分布】查询ic居民信息,切割后,本组的userId个数:{}", volunteerEpmetUserIdPart.size());
// 填充建筑坐标
String msg = "【志愿者分布】查询楼栋信息失败";
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
CompletableFuture<List<VolunteerDistributionResultDTO.Distribution>> future = CompletableFuture.supplyAsync(() -> {
return listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
});
icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId());
icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId());
Optional.of(building).ifPresent(b -> {
icResiInfo.setLongitude(b.getLongitude());
icResiInfo.setLatitude(b.getLatitude());
});
volResiInfoFutures.add(future);
}
// 阻塞的,获取各个子线程计算结果
for (CompletableFuture<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));
}
r.getDistributions().addAll(icResiInfos);
}
// 就有代码,稳定之后可以删掉
//for (String volunteerEpmetUserId : volunteerEpmetUserIds) {
//
// VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution();
//
// ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId);
// if (userBaseInfo == null || StringUtils.isBlank(userBaseInfo.getIdNum())){
// log.warn("getVolunteerDistribution selecUserBaseInfoByUserId return null or idCard is null,volunteerEpmetUserId:{}", volunteerEpmetUserId);
// continue;
// }
// //使用身份证号查询ic resi信息
// IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null);
// if (icResiUserInfo == null) {
// continue;
// }
//
// // 查询志愿者类别
// List<String> volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId());
// //if (CollectionUtils.isEmpty(volunteerCategories)) {
// // // 此人没有志愿者信息
// // continue;
// //}
//
// // 将志愿者类型列表字符串,切割放到set中
// Set<String> volunteerTypes = new HashSet();
// for (String vTypesString : volunteerCategories) {
// String[] vTypes = vTypesString.split(",");
// if (vTypes != null && vTypes.length > 0) {
// volunteerTypes.addAll(Arrays.asList(vTypes));
// }
// }
//
//
// String msg = "【志愿者分布】查询楼栋信息失败";
// IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()),
// ServiceConstant.GOV_ORG_SERVER,
// EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
//
// distribution.setVolunteerCategories(volunteerTypes);
// distribution.setEpmetUserId(userBaseInfo.getUserId());
// distribution.setIcResiUserId(icResiUserInfo.getId());
// Optional.of(building).ifPresent(b -> {
// distribution.setLongitude(b.getLongitude());
// distribution.setLatitude(b.getLatitude());
// });
//
// r.getDistributions().add(distribution);
//}
return r;
}
/**
* userId列表批量获取他们对应的志愿者信息
* @param volunteerEpmetUserIdPart
* @return
*/
private List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(List<String> volunteerEpmetUserIdPart) {
List<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
// 填充志愿者类型
for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) {
// 将志愿者类型列表字符串,切割放到set中
Set<String> volunteerTypes = new HashSet();
String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr();
if (StringUtils.isNotEmpty(volunteerCategoriesStr)) {
String[] vTypes = volunteerCategoriesStr.split(",");
if (vTypes != null && vTypes.length > 0) {
volunteerTypes.addAll(Arrays.asList(vTypes));
}
icResiInfo.setVolunteerCategories(volunteerTypes);
} else {
icResiInfo.setVolunteerCategories(new HashSet<>());
}
// 填充建筑坐标
String msg = "【志愿者分布】查询楼栋信息失败";
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId());
icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId());
Optional.of(building).ifPresent(b -> {
icResiInfo.setLongitude(b.getLongitude());
icResiInfo.setLatitude(b.getLatitude());
});
}
return icResiInfos;
}
/**
* 分页查询志愿者列表
* @param customerId
* @param pageNo
* @param pageSize
* @return
*/
private List<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);
}
}

Loading…
Cancel
Save