wangxianzhang 4 years ago
parent
commit
f2de67f574
  1. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  2. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  3. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  4. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  5. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  6. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  7. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  8. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  9. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  10. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ResiBuzzLeftPieChartFormDTO.java
  11. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  12. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  13. 5
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  14. 241
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

22
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, projectId);
//提取议题ID
List<String> issueIds =
projectList.stream().filter(item -> ProjectConstant.ISSUE.equals(item.getOrigin())).map(ProjectDTO::getOriginId).collect(Collectors.toList());
//获取议题信息
List<IssueDTO> issueList = issueService.getIssueInfoByIds(issueIds);
//提取话题ID
List<String> topicIds = issueList.stream().map(IssueDTO::getSourceId).collect(Collectors.toList());
//获取话题信息
List<ResiTopicDTO> topicList = topicService.getTopicByIds(topicIds);
if (CollectionUtils.isNotEmpty(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<List<String>> topicPart = ListUtils.partition(topicIds, NumConstant.FIFTY);
topicPart.forEach(part -> topicList.addAll(topicService.getTopicByIds(part)));
}
}
//获取网格认证党员
List<PartyMemberDTO> partyMemberList = partyMemberService.getPartyMemberByCustomer(customerId);
//生成DTO

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -66,4 +66,12 @@ public interface EpmetHeartOpenFeignClient {
*/
@PostMapping("/heart/resi/volunteer/page")
Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input);
/**
* 查询志愿者数量
* @param input
* @return
*/
@PostMapping("/heart/resi/volunteer/count")
Result<Integer> getVolunteerCount(@RequestBody VolunteerCommonFormDTO input);
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java

@ -60,4 +60,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(VolunteerCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryVolunteerPage", input);
}
@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

@ -144,4 +144,18 @@ public class ResiVolunteerController {
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize);
return new Result<List<PageVolunteerInfoResultDTO>>().ok(l);
}
/**
* 查询志愿者数量
* @param input
* @return
*/
@PostMapping("count")
public Result<Integer> getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) {
ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.VolunteerPage.class);
String customerId = input.getCustomerId();
Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId);
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

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

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());
}
/**
* 导入数据
*

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

@ -278,4 +278,11 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
return list;
}
@Override
public Integer getVolunteerCount(String customerId) {
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId, customerId);
return baseDao.selectCount(query);
}
}

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

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

@ -272,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 查询组织下每个网格的项目数

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -1667,7 +1667,7 @@ 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<>();
}

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

@ -645,7 +645,7 @@
<!-- 查询组织下每个网格的项目数 -->
<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'
@ -684,6 +684,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>

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

@ -2,6 +2,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.UserBaseInfoDao;
@ -16,7 +17,6 @@ import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.VolunteerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -94,135 +96,154 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
* @return
*/
public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId) {
//epmetHeartOpenFeignClient.queryVolunteerPage()
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
// 1.==========分页查询出所有志愿者列表==========
String vcErrorMsg = "【志愿者分布】查询志愿者总数出错";
VolunteerCommonFormDTO volunteerCountForm = new VolunteerCommonFormDTO();
volunteerCountForm.setCustomerId(customerId);
Integer volunteerCount = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getVolunteerCount(volunteerCountForm),
ServiceConstant.EPMET_HEART_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
vcErrorMsg,
vcErrorMsg);
if (volunteerCount == null || volunteerCount == 0) {
// 没得志愿者,直接返回
return r;
}
// 1.分页查询出所有志愿者列表
int pageNo = 1;
// 计算页数
int pageSize = 200;
int pageCount = volunteerCount / pageSize;
int lastPageItems = volunteerCount % pageSize;
pageCount = lastPageItems > 0 ? ++pageCount : pageCount;
// 志愿者epmet user id
// 志愿者epmet user id 集合
List<String> volunteerEpmetUserIds = new ArrayList<>();
// 分页查询志愿者的epmet user id
while (true) {
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO();
volunteerForm.setCustomerId(customerId);
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;
}
pageNo++;
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, pageNoTemp, pageSize)
.stream()
.map(v -> v.getUserId())
.collect(Collectors.toSet());
});
volsPageFutures.add(future);
}
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
// 阻塞,等待子线程返回结果,然后添加到志愿者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 (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) {
// 填充志愿者类型
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, Integer pageNo, Integer pageSize) {
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO();
volunteerForm.setCustomerId(customerId);
volunteerForm.setPageNo(pageNo);
volunteerForm.setPageSize(pageSize);
String errorMsg = "【志愿者分布】分页查询志愿者列表失败";
return getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm),
ServiceConstant.EPMET_HEART_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
errorMsg,
errorMsg);
}
}

Loading…
Cancel
Save