|
|
@ -36,32 +36,65 @@ public class ResiEventServiceImpl implements ResiEventService, ResultDataResolve |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ResiEventNpcResultDTO> listNpcByGrid(String gridId) { |
|
|
|
public List<ResiEventNpcResultDTO> listNpcByGrid(String customerId) { |
|
|
|
|
|
|
|
// 查询网格所属的组织信息
|
|
|
|
Result<GridInfoResultDTO> gridInfoResult = govOrgOpenFeignClient.queryGridInfo(gridId); |
|
|
|
GridInfoResultDTO gridInfoData = getResultDataOrThrowsException(gridInfoResult, ServiceConstant.GOV_ORG_SERVER, null, null); |
|
|
|
String parentAgencyId = gridInfoData.getParentAgencyId(); |
|
|
|
String pids = gridInfoData.getPids(); |
|
|
|
//Result<GridInfoResultDTO> gridInfoResult = govOrgOpenFeignClient.queryGridInfo(customerId);
|
|
|
|
//GridInfoResultDTO gridInfoData = getResultDataOrThrowsException(gridInfoResult, ServiceConstant.GOV_ORG_SERVER, null, null);
|
|
|
|
//String parentAgencyId = gridInfoData.getParentAgencyId();
|
|
|
|
//String pids = gridInfoData.getPids();
|
|
|
|
|
|
|
|
//查询人大代表列表
|
|
|
|
ListUserByBadgeFormDTO npcForm = new ListUserByBadgeFormDTO(gridId, BadgeConstant.BADGE_KEY_NPC); |
|
|
|
ListUserByBadgeFormDTO npcForm = new ListUserByBadgeFormDTO(customerId, BadgeConstant.BADGE_KEY_NPC); |
|
|
|
Result<List<ListUserByBadgeResultDTO>> npcResult = epmetUserOpenFeignClient.listUsersByBadge(npcForm); |
|
|
|
List<ListUserByBadgeResultDTO> npcData = getResultDataOrThrowsException(npcResult, ServiceConstant.EPMET_USER_SERVER, null, null); |
|
|
|
|
|
|
|
List<ResiEventNpcResultDTO> npcResultList = npcData.stream() |
|
|
|
.map(npc -> new ResiEventNpcResultDTO(npc.getUserId(), gridId, "人大代表-".concat(npc.getRealName()), npc.getHeadImgUrl(), parentAgencyId, pids)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
//批量查询人大代表所在的网格信息
|
|
|
|
List<String> npcGridIds = npcData.stream().map(d -> d.getGridId()).collect(Collectors.toList()); |
|
|
|
OrgInfoFormDTO form = new OrgInfoFormDTO(OrgInfoConstant.GRID, npcGridIds); |
|
|
|
Result<List<OrgInfoResultDTO>> npcGridInfoResult = govOrgOpenFeignClient.selectOrgInfo(form); |
|
|
|
List<OrgInfoResultDTO> npcGridInfos = getResultDataOrThrowsException(npcGridInfoResult, ServiceConstant.GOV_ORG_SERVER, null, null); |
|
|
|
|
|
|
|
Map<String, OrgInfoResultDTO> npcGridInfoMap = convertNpcGridInfos2Map(npcGridInfos); |
|
|
|
|
|
|
|
List<ResiEventNpcResultDTO> npcResultList = new ArrayList<>(); |
|
|
|
npcData.stream().forEach(npc -> { |
|
|
|
OrgInfoResultDTO gridInfo = npcGridInfoMap.get(npc.getGridId()); |
|
|
|
ResiEventNpcResultDTO resiEventNpcInfo = new ResiEventNpcResultDTO( |
|
|
|
npc.getUserId(), |
|
|
|
npc.getGridId(), |
|
|
|
"人大代表-".concat(npc.getRealName()), |
|
|
|
npc.getRealName(), |
|
|
|
npc.getHeadImgUrl(), |
|
|
|
gridInfo != null ? gridInfo.getAgencyId() : null, |
|
|
|
gridInfo != null ? gridInfo.getPids().concat(":").concat(gridInfo.getAgencyId()) : null); |
|
|
|
npcResultList.add(resiEventNpcInfo); |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
return npcResultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 此处会调用org上游接口批量获取父级组织信息,由于上游接口排序不可控,因此此处需要使用TreeSet做排序 |
|
|
|
* @return |
|
|
|
* @Description 将网格信息转化为map |
|
|
|
* @author wxz |
|
|
|
* @date 2021.08.04 14:25 |
|
|
|
*/ |
|
|
|
private Map<String, OrgInfoResultDTO> convertNpcGridInfos2Map(List<OrgInfoResultDTO> npcGridInfos) { |
|
|
|
HashMap<String, OrgInfoResultDTO> result = new HashMap<>(); |
|
|
|
npcGridInfos.stream().forEach(i -> { |
|
|
|
result.put(i.getOrgId(), i); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return |
|
|
|
* @Description 此处会调用org上游接口批量获取父级组织信息,由于上游接口排序不可控,因此此处需要使用TreeSet做排序 |
|
|
|
* @author wxz |
|
|
|
* @date 2021.08.03 15:51 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public TreeSet<ResiEventTargetLevelResultDTO> listReportTargetLevels(String gridId) { |
|
|
|
TreeSet<ResiEventTargetLevelResultDTO> targetLevels = new TreeSet<>(); |
|
|
|