|  |  | @ -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,13 @@ 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; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.google.common.collect.Lists; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -97,10 +98,10 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 1.分页查询出所有志愿者列表
 | 
			
		
	
		
			
				
					|  |  |  |         int pageNo = 1; | 
			
		
	
		
			
				
					|  |  |  |         int pageSize = 100; | 
			
		
	
		
			
				
					|  |  |  |         int pageSize = 200; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 志愿者epmet user id
 | 
			
		
	
		
			
				
					|  |  |  |         Set<String> volunteerEpmetUserIds = new HashSet<>(); | 
			
		
	
		
			
				
					|  |  |  |         List<String> volunteerEpmetUserIds = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 分页查询志愿者的epmet user id
 | 
			
		
	
		
			
				
					|  |  |  |         while (true) { | 
			
		
	
	
		
			
				
					|  |  | @ -132,54 +133,95 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size()); | 
			
		
	
		
			
				
					|  |  |  |          | 
			
		
	
		
			
				
					|  |  |  |         // 2.填充ic居民信息
 | 
			
		
	
		
			
				
					|  |  |  |         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)); | 
			
		
	
		
			
				
					|  |  |  |         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<>()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 // 填充建筑坐标
 | 
			
		
	
		
			
				
					|  |  |  |                 String msg = "【志愿者分布】查询楼栋信息失败"; | 
			
		
	
		
			
				
					|  |  |  |                 IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()), | 
			
		
	
		
			
				
					|  |  |  |                         ServiceConstant.GOV_ORG_SERVER, | 
			
		
	
		
			
				
					|  |  |  |                         EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             String msg = "【志愿者分布】查询楼栋信息失败"; | 
			
		
	
		
			
				
					|  |  |  |             IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()), | 
			
		
	
		
			
				
					|  |  |  |                     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()); | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             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); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             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; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | 
 |