| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -181,7 +181,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcVaccineRelationDao icVaccineRelationDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public static final List<String> ORG_FIELDS = Arrays.asList("AGENCY_IDS", "GRID_IDS", "AGENCY_ID", "GRID_ID"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String id = (String) params.get(FieldConstant.ID_HUMP); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -918,36 +918,61 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询结果列对应的表:
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> queryAgencyIdList = formDTO.getConditions().stream() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .filter(o -> IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        && CollectionUtils.isNotEmpty(o.getColumnValue()) && StringUtils.isNotBlank(o.getColumnValue().get(NumConstant.ZERO))) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .flatMap(o -> o.getColumnValue().stream()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // List<String> queryAgencyIdList = formDTO.getConditions().stream()
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //         .filter(o -> IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_IDS".equals(o.getColumnName())
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //                 && CollectionUtils.isNotEmpty(o.getColumnValue()) && StringUtils.isNotBlank(o.getColumnValue().get(NumConstant.ZERO)))
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //         .flatMap(o -> o.getColumnValue().stream()).collect(Collectors.toList());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 组织和网格单独处理
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> queryAgencyIdList = new HashSet<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> queryGridIdList = new HashSet<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 将以下几列单独提出来,组合起来,放入列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.getConditions().stream().forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (IcResiUserConstant.IC_RESI_USER.equals(c.getTableName()) && CollectionUtils.isNotEmpty(c.getColumnValue()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    && StringUtils.isNotBlank(c.getColumnValue().get(NumConstant.ZERO))) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if ("AGENCY_IDS".equals(c.getColumnName())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryAgencyIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("GRID_IDS".equals(c.getColumnName())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("AGENCY_ID".equals(c.getColumnName()) && ! queryAgencyIdList.contains(c.getColumnValue())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryAgencyIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("GRID_ID".equals(c.getColumnName()) && ! queryGridIdList.contains(c.getColumnValue())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 移除需要特殊处理的conditions
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && ORG_FIELDS.contains(o.getColumnName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //添加数据权限
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String staffOrgPath; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String agencyId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果查询条件中 有居民表的agencyId 则匹配查询该组织下的 数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (queryAgencyIdList.isEmpty()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> staffOrgPaths; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> agencyIds = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果查询条件中 没有有居民表的agencyId,则查询该工作人员所属组织的信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (queryAgencyIdList.isEmpty() && queryGridIdList.isEmpty()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyId = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyIds = Arrays.asList(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String op; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                op = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                op = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPaths = Arrays.asList(op); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(queryAgencyIdList.get(NumConstant.ZERO)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (agencyInfo == null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取组织信息失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyId = agencyInfo.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPath = agencyInfo.getPids(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(staffOrgPath)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = agencyId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffOrgPath+StrConstant.COLON+agencyInfo.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 将组织id列表,转化为组织orgIdPath列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPaths = queryAgencyIdList.stream().map(agId -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (agencyInfo == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    String errorMsg = "查询机关单位失败:" + agId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return PidUtils.convertPid2OrgIdPath(agId, agencyInfo.getPids()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询列表展示项需要用到哪些子表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -976,14 +1001,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == formDTO.getIsPage() || formDTO.getIsPage()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //分页
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String finalStaffOrgPath = staffOrgPath; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> finalStaffOrgPath = staffOrgPaths; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> finalAgencyIds = agencyIds; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            pageInfo = PageHelper.startPage(formDTO.getPageNo(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListResiMap(formDTO.getCustomerId(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getFormCode(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getConditions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    resultColumns, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalSubTables, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyId, finalStaffOrgPath,null, formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalAgencyIds, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalStaffOrgPath, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    groupByTables)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<Map<String, Object>> list = baseDao.selectListResiMap(formDTO.getCustomerId(), | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -991,8 +1021,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getConditions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    resultColumns, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalSubTables, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    staffOrgPath,null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyIds, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    staffOrgPaths, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    groupByTables); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            pageInfo.setTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -3320,37 +3352,58 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询结果列对应的表:
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> queryAgencyIdList = formDTO.getConditions().stream() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .filter(o -> IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        && CollectionUtils.isNotEmpty(o.getColumnValue()) && StringUtils.isNotBlank(o.getColumnValue().get(NumConstant.ZERO))) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .flatMap(o -> o.getColumnValue().stream()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 组织和网格单独处理
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> queryAgencyIdList = new HashSet<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> queryGridIdList = new HashSet<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 将以下几列单独提出来,组合起来,放入列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.getConditions().stream().forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (IcResiUserConstant.IC_RESI_USER.equals(c.getTableName()) && CollectionUtils.isNotEmpty(c.getColumnValue()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    && StringUtils.isNotBlank(c.getColumnValue().get(NumConstant.ZERO))) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if ("AGENCY_IDS".equals(c.getColumnName())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryAgencyIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("GRID_IDS".equals(c.getColumnName())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("AGENCY_ID".equals(c.getColumnName()) && ! queryAgencyIdList.contains(c.getColumnValue())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryAgencyIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else if ("GRID_ID".equals(c.getColumnName()) && ! queryGridIdList.contains(c.getColumnValue())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 移除需要特殊处理的conditions
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && ORG_FIELDS.contains(o.getColumnName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //添加数据权限
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String staffOrgPath; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String agencyId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果查询条件中 有居民表的agencyId 则匹配查询该组织下的 数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (queryAgencyIdList.isEmpty()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> staffOrgPaths; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> agencyIds = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果查询条件中 没有有居民表的agencyId,则查询该工作人员所属组织的信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (queryAgencyIdList.isEmpty() && queryGridIdList.isEmpty()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyId = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyIds = Arrays.asList(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String op; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                op = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                op = staffInfoCacheResult.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPaths = Arrays.asList(op); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(queryAgencyIdList.get(NumConstant.ZERO)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (agencyInfo == null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取组织信息失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyId = agencyInfo.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPath = agencyInfo.getPids(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(staffOrgPath)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = agencyId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                staffOrgPath = staffOrgPath+StrConstant.COLON+agencyInfo.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 将组织id列表,转化为组织orgIdPath列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            staffOrgPaths = queryAgencyIdList.stream().map(agId -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (agencyInfo == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    String errorMsg = "查询机关单位失败:" + agId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return PidUtils.convertPid2OrgIdPath(agId, agencyInfo.getPids()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询列表展示项需要用到哪些子表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<SubTableJoinDTO> subTables = subTablesRes.getData(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -3378,14 +3431,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == formDTO.getIsPage() || formDTO.getIsPage()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //分页
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String finalStaffOrgPath = staffOrgPath; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> finalStaffOrgPath = staffOrgPaths; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> finalAgencyIds = agencyIds; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            pageInfo = PageHelper.startPage(formDTO.getPageNo(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListResiMap(formDTO.getCustomerId(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getFormCode(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getConditions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    resultColumns, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalSubTables, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyId, finalStaffOrgPath,null, formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalAgencyIds, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalStaffOrgPath, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    groupByTables)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<Map<String, Object>> list = baseDao.selectListResiMap(formDTO.getCustomerId(), | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -3393,8 +3451,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getConditions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    resultColumns, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalSubTables, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    staffOrgPath,null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    agencyIds, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    staffOrgPaths, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    queryGridIdList, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    formDTO.getKeyword(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    groupByTables); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            pageInfo.setTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |