|
|
@ -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,14 +161,16 @@ 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()) { |
|
|
|
//忽略 不需要显示的列的值得设置 要不然数据会写入到excel中
|
|
|
|
if (singleRowData.size() >= showSqlColumns.size()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); |
|
|
|
String tableName = sqlColumn.getTableName(); |
|
|
|
String itemId = sqlColumn.getItemId(); |
|
|
@ -190,16 +191,16 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { |
|
|
|
} else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { |
|
|
|
newValue = putOptionValue(formItemResult, vauleStr); |
|
|
|
} |
|
|
|
singleResult.add(newValue); |
|
|
|
} |
|
|
|
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(); |
|
|
@ -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; |
|
|
|