|
|
@ -7,10 +7,8 @@ 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; |
|
|
@ -18,10 +16,11 @@ import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
|
import com.epmet.service.VolunteerService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -100,7 +99,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve |
|
|
|
int pageSize = 100; |
|
|
|
|
|
|
|
// 志愿者epmet user id
|
|
|
|
Set<String> volunteerEpmetUserIds = new HashSet<>(); |
|
|
|
List<String> volunteerEpmetUserIds = new ArrayList<>(); |
|
|
|
|
|
|
|
// 分页查询志愿者的epmet user id
|
|
|
|
while (true) { |
|
|
@ -131,55 +130,90 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve |
|
|
|
|
|
|
|
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); |
|
|
|
|
|
|
|
// 2.填充ic居民信息
|
|
|
|
for (String volunteerEpmetUserId : volunteerEpmetUserIds) { |
|
|
|
log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size()); |
|
|
|
|
|
|
|
VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution(); |
|
|
|
// 2.填充ic居民信息
|
|
|
|
List<List<String>> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100); |
|
|
|
for (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) { |
|
|
|
|
|
|
|
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<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart); |
|
|
|
|
|
|
|
// 查询志愿者类别
|
|
|
|
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(","); |
|
|
|
// 填充志愿者类型
|
|
|
|
for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) { |
|
|
|
// 将志愿者类型列表字符串,切割放到set中
|
|
|
|
Set<String> volunteerTypes = new HashSet(); |
|
|
|
String[] vTypes = icResiInfo.getVolunteerCategoriesStr().split(","); |
|
|
|
if (vTypes != null && vTypes.length > 0) { |
|
|
|
volunteerTypes.addAll(Arrays.asList(vTypes)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
icResiInfo.setVolunteerCategories(volunteerTypes); |
|
|
|
|
|
|
|
String msg = "【志愿者分布】查询楼栋信息失败"; |
|
|
|
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()), |
|
|
|
ServiceConstant.GOV_ORG_SERVER, |
|
|
|
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
// 填充建筑坐标
|
|
|
|
String msg = "【志愿者分布】查询楼栋信息失败"; |
|
|
|
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()); |
|
|
|
Optional.of(building).ifPresent(b -> { |
|
|
|
distribution.setLongitude(b.getLongitude()); |
|
|
|
distribution.setLatitude(b.getLatitude()); |
|
|
|
}); |
|
|
|
icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId()); |
|
|
|
icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId()); |
|
|
|
Optional.of(building).ifPresent(b -> { |
|
|
|
icResiInfo.setLongitude(b.getLongitude()); |
|
|
|
icResiInfo.setLatitude(b.getLatitude()); |
|
|
|
}); |
|
|
|
|
|
|
|
r.getDistributions().add(distribution); |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|