| 
						
						
							
								
							
						
						
					 | 
					@ -20,7 +20,9 @@ import com.epmet.commons.tools.enums.FormItemTypeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.enums.IcFormCodeEnum; | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.IcFormCodeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.*; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -159,14 +161,49 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); | 
					 | 
					 | 
					                writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            String staffOrgPath = null; | 
					 | 
					 | 
					            allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()); | 
					 | 
					 | 
					            // 组织和网格单独处理
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Set<String> queryAgencyIdList = new HashSet<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Set<String> queryGridIdList = new HashSet<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 将以下几列单独提出来,组合起来,放入集合,自动去重
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            searchForm.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.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } else if ("GRID_ID".equals(c.getColumnName())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        queryGridIdList.addAll(c.getColumnValue()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 移除grid grids agencyId agencyIds四种字段,改为
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            searchForm.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && IcResiUserServiceImpl.ORG_FIELDS.contains(o.getColumnName())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //添加数据权限
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<String> staffOrgPaths; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //如果查询条件中 没有有居民表的agencyId,则查询该工作人员所属组织的信息
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (queryAgencyIdList.isEmpty() && queryGridIdList.isEmpty()){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                String staffOrgPath = PidUtils.convertPid2OrgIdPath(staffInfoCacheResult.getAgencyId(), staffInfoCacheResult.getAgencyPIds()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                staffOrgPaths = Arrays.asList(staffOrgPath); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                staffOrgPath = staffInfoCacheResult.getAgencyId(); | 
					 | 
					 | 
					                // 将组织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()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            do { | 
					 | 
					 | 
					            do { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if(StringUtils.isNotBlank(exportResiUserFormDTO.getId())){ | 
					 | 
					 | 
					                if(StringUtils.isNotBlank(exportResiUserFormDTO.getId())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    ResiUserQueryValueDTO idCondition=new ResiUserQueryValueDTO(); | 
					 | 
					 | 
					                    ResiUserQueryValueDTO idCondition=new ResiUserQueryValueDTO(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -183,9 +220,17 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        searchForm.setConditions(conditions); | 
					 | 
					 | 
					                        searchForm.setConditions(conditions); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                String finalStaffOrgPath = staffOrgPath; | 
					 | 
					 | 
					                List<String> finalStaffOrgPath = staffOrgPaths; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<String> finalGridIds = new ArrayList<>(queryGridIdList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { | 
					 | 
					 | 
					                mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); | 
					 | 
					 | 
					                    icResiUserService.dynamicQuery(searchForm.getCustomerId(), | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            searchForm.getFormCode(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            IcResiUserConstant.IC_RESI_USER, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            allShowColumns, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            searchForm.getConditions(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            staffInfoCacheResult.getAgencyId(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            finalStaffOrgPath, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            finalGridIds); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (!searchForm.getIsPage()){ | 
					 | 
					 | 
					                if (!searchForm.getIsPage()){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); | 
					 | 
					 | 
					                    searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |