|  |  | @ -86,7 +86,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response) { | 
			
		
	
		
			
				
					|  |  |  |         //校验参数
 | 
			
		
	
		
			
				
					|  |  |  |         validateSearchForm(tokenDto, exportResiUserFormDTO); | 
			
		
	
		
			
				
					|  |  |  |         this.validateSearchForm(tokenDto, exportResiUserFormDTO); | 
			
		
	
		
			
				
					|  |  |  |         IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         String templateId = exportResiUserFormDTO.getTemplateId(); | 
			
		
	
	
		
			
				
					|  |  | @ -94,7 +94,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |         ExcelWriter excelWriter = null; | 
			
		
	
		
			
				
					|  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |             //获取用户配置的导出条件
 | 
			
		
	
		
			
				
					|  |  |  |             Result<IcCustomExportResultDTO> exportConfigResult = getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); | 
			
		
	
		
			
				
					|  |  |  |             Result<IcCustomExportResultDTO> exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             Map<String, ExportResiUserItemDTO> itemOriginMap = getItemMap(searchForm.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); | 
			
		
	
	
		
			
				
					|  |  | @ -107,7 +107,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             List<IcCustomExportResultDTO.SqlColumn> allShowColumns = new ArrayList<>(exportConfigData.getShowSqlColumns()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             //需要合并的列
 | 
			
		
	
		
			
				
					|  |  |  |             List<Integer> mergeColumnIndexList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |             for (int i = 0; i < allShowColumns.size(); i++) { | 
			
		
	
	
		
			
				
					|  |  | @ -162,44 +161,46 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |                 List<IcCustomExportResultDTO.SqlColumn> showSqlColumns = exportConfigData.getShowSqlColumns(); | 
			
		
	
		
			
				
					|  |  |  |                 Set<String> hiddenColumnSet = exportConfigData.getHiddenSqlColumns().stream().map(IcCustomExportResultDTO.SqlColumn::getColumnName).collect(Collectors.toSet()); | 
			
		
	
		
			
				
					|  |  |  |                 result.forEach(o -> { | 
			
		
	
		
			
				
					|  |  |  |                     List<Object> singleResult = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                     List<Object> singleRowData = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, Object> originalConditionMap = new ConcurrentHashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |                     o.forEach((key, value) -> { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                         Map<String, IcCustomExportResultDTO.SqlColumn> itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                         IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); | 
			
		
	
		
			
				
					|  |  |  |                         if (singleResult.size() < showSqlColumns.size()) { | 
			
		
	
		
			
				
					|  |  |  |                             IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); | 
			
		
	
		
			
				
					|  |  |  |                             String tableName = sqlColumn.getTableName(); | 
			
		
	
		
			
				
					|  |  |  |                             String itemId = sqlColumn.getItemId(); | 
			
		
	
		
			
				
					|  |  |  |                             String columnName = columnDTO.getColumnName(); | 
			
		
	
		
			
				
					|  |  |  |                             if (hiddenColumnSet.contains(columnName)) { | 
			
		
	
		
			
				
					|  |  |  |                                 return; | 
			
		
	
		
			
				
					|  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |                             String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); | 
			
		
	
		
			
				
					|  |  |  |                             //保留原始值 便于remote条件获取
 | 
			
		
	
		
			
				
					|  |  |  |                             originalConditionMap.putIfAbsent(columnName, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                             ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); | 
			
		
	
		
			
				
					|  |  |  |                             FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); | 
			
		
	
		
			
				
					|  |  |  |                         //忽略 不需要显示的列的值得设置 要不然数据会写入到excel中
 | 
			
		
	
		
			
				
					|  |  |  |                         if (singleRowData.size() >= showSqlColumns.size()) { | 
			
		
	
		
			
				
					|  |  |  |                             return; | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                             String newValue = vauleStr; | 
			
		
	
		
			
				
					|  |  |  |                             if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { | 
			
		
	
		
			
				
					|  |  |  |                                 putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                                 newValue = String.valueOf(o.get(columnName)); | 
			
		
	
		
			
				
					|  |  |  |                             } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { | 
			
		
	
		
			
				
					|  |  |  |                                 newValue = putOptionValue(formItemResult, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |                             singleResult.add(newValue); | 
			
		
	
		
			
				
					|  |  |  |                         IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); | 
			
		
	
		
			
				
					|  |  |  |                         String tableName = sqlColumn.getTableName(); | 
			
		
	
		
			
				
					|  |  |  |                         String itemId = sqlColumn.getItemId(); | 
			
		
	
		
			
				
					|  |  |  |                         String columnName = columnDTO.getColumnName(); | 
			
		
	
		
			
				
					|  |  |  |                         if (hiddenColumnSet.contains(columnName)) { | 
			
		
	
		
			
				
					|  |  |  |                             return; | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                         String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); | 
			
		
	
		
			
				
					|  |  |  |                         //保留原始值 便于remote条件获取
 | 
			
		
	
		
			
				
					|  |  |  |                         originalConditionMap.putIfAbsent(columnName, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                         ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); | 
			
		
	
		
			
				
					|  |  |  |                         FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                         String newValue = vauleStr; | 
			
		
	
		
			
				
					|  |  |  |                         if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { | 
			
		
	
		
			
				
					|  |  |  |                             putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                             newValue = String.valueOf(o.get(columnName)); | 
			
		
	
		
			
				
					|  |  |  |                         } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { | 
			
		
	
		
			
				
					|  |  |  |                             newValue = putOptionValue(formItemResult, vauleStr); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                         singleRowData.add(newValue); | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                     resultData.add(singleResult); | 
			
		
	
		
			
				
					|  |  |  |                     resultData.add(singleRowData); | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |                 excelWriter.write(resultData, writeSheet); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             } while (mapListPage.getResult().size() == searchForm.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |         } catch (IOException e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("exportIcResiUser exception", e); | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMessage(), "导出失败"); | 
			
		
	
		
			
				
					|  |  |  |         } finally { | 
			
		
	
		
			
				
					|  |  |  |             if (excelWriter != null) { | 
			
		
	
		
			
				
					|  |  |  |                 excelWriter.finish(); | 
			
		
	
	
		
			
				
					|  |  | @ -231,7 +232,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |         param.setExportConfig(exportConfig); | 
			
		
	
		
			
				
					|  |  |  |         Result<IcCustomExportResultDTO> exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); | 
			
		
	
		
			
				
					|  |  |  |         if (!exportConfigResult.success() || exportConfigResult.getData() == null) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("获取模板失败"); | 
			
		
	
		
			
				
					|  |  |  |             log.error("获取模板失败,internalMsg:{},msg:{}" + exportConfigResult.getInternalMsg(), exportConfigResult.getMsg()); | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取模板失败" + exportConfigResult.getInternalMsg()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         IcCustomExportResultDTO data = exportConfigResult.getData(); | 
			
		
	
	
		
			
				
					|  |  | @ -289,7 +290,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |                 map.put(columnName, join); | 
			
		
	
		
			
				
					|  |  |  |                 return; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //todo 不支持多个itemId
 | 
			
		
	
		
			
				
					|  |  |  |             Map<String, String> remoteOptions = icResiUserImportService.listRemoteOptions(parts[0], parts[1], columnWrappers, currentStaffAgencyId, "query"); | 
			
		
	
		
			
				
					|  |  |  |             if (FormItemTypeEnum.CHECKBOX.getCode().equals(e.getItemType())) { | 
			
		
	
		
			
				
					|  |  |  |                 remoteOptions.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? StrConstant.YES : StrConstant.NO)); | 
			
		
	
	
		
			
				
					|  |  | @ -319,13 +319,12 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
			
		
	
		
			
				
					|  |  |  |                 //如果是多选 则返回顿号隔开
 | 
			
		
	
		
			
				
					|  |  |  |                 if (e.getMultiSelect()) { | 
			
		
	
		
			
				
					|  |  |  |                     List<String> valueList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                     e.getOptions().forEach(option -> { | 
			
		
	
		
			
				
					|  |  |  |                     e.getOptions().stream().forEach(option -> { | 
			
		
	
		
			
				
					|  |  |  |                         if (valueStr.contains(option.getValue())) { | 
			
		
	
		
			
				
					|  |  |  |                             valueList.add(option.getLabel()); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                     return Joiner.on("、").join(valueList); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 for (OptionDTO dto : e.getOptions()) { | 
			
		
	
		
			
				
					|  |  |  |                     return valueStr.contains(dto.getValue()) ? StrConstant.YES : StrConstant.NO; | 
			
		
	
	
		
			
				
					|  |  | 
 |