处理导出数据取消掉树形结构问题

This commit is contained in:
袁东强 2025-07-24 13:56:48 +08:00 committed by zhaolei
parent d514f7b7fa
commit 0702e1393d

View File

@ -1211,7 +1211,21 @@ public class PALRepositoryListWeb extends ActionWeb {
// 获取符合条件数据的maxLevel // 获取符合条件数据的maxLevel
int maxLevel = getMaxLevelByList(palList); int maxLevel = getMaxLevelByList(palList);
// 获取Excel表头信息 // 获取Excel表头信息
List<String> excelTableHeadList = getExcelTableHeadData(wsId, palList, maxLevel, tempArr); boolean treeVisible = true;
boolean idVisible = true;
try{
JSONObject jsonObject = JSONObject.parseObject(customFilter);
if (jsonObject != null&& jsonObject.containsKey("treeVisible")&&"false".equals(jsonObject.getString("treeVisible"))){
treeVisible = false;
}
if (jsonObject != null&& jsonObject.containsKey("idVisible")&&"false".equals(jsonObject.getString("idVisible"))){
idVisible = false;
}
}catch (Exception e){
e.getMessage() ;
}
List<String> excelTableHeadList = getExcelTableHeadData(wsId, palList, maxLevel, tempArr, treeVisible, idVisible);
ConsolePrinter.info("流程清单表头信息 " + excelTableHeadList.toString().replaceAll("\n","")); ConsolePrinter.info("流程清单表头信息 " + excelTableHeadList.toString().replaceAll("\n",""));
short column = columnIndex; short column = columnIndex;
// 设置默认的两行 通栏 // 设置默认的两行 通栏
@ -1298,6 +1312,7 @@ public class PALRepositoryListWeb extends ActionWeb {
String cellValue = getDefaultFixedValueById("type", model.getId()); String cellValue = getDefaultFixedValueById("type", model.getId());
cell.setCellValue(I18nRes.findValue(ProcessListConstant.PROCESSLIST, cellValue.trim())); cell.setCellValue(I18nRes.findValue(ProcessListConstant.PROCESSLIST, cellValue.trim()));
// 名称 // 名称
if (treeVisible) {
int level = model.getLevel(); int level = model.getLevel();
HSSFCell levelCell = row.createCell(level); HSSFCell levelCell = row.createCell(level);
String levelCellValue = ""; String levelCellValue = "";
@ -1315,7 +1330,7 @@ public class PALRepositoryListWeb extends ActionWeb {
columMap.put(count, map); columMap.put(count, map);
count++; count++;
cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列 cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列
}
// 模型名称 // 模型名称
HSSFCell modelNameCell = row.createCell(++cellIndex); HSSFCell modelNameCell = row.createCell(++cellIndex);
modelNameCell.setCellValue(model.getName()); modelNameCell.setCellValue(model.getName());
@ -1462,17 +1477,18 @@ public class PALRepositoryListWeb extends ActionWeb {
* @param tableHeadConfigArr * @param tableHeadConfigArr
* @return * @return
*/ */
private List<String> getExcelTableHeadData(String wsId, List<PALRepositoryModel> palList, int maxLevel, JSONArray tableHeadConfigArr) { private List<String> getExcelTableHeadData(String wsId, List<PALRepositoryModel> palList, int maxLevel, JSONArray tableHeadConfigArr,boolean treeVisible,boolean idVisible) {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
for (int i = 0; i <= maxLevel; i++) { for (int i = 0; i <= maxLevel; i++) {
if (i == 0) { if (i == 0) {
result.add(getExcelTitleName(I18nRes.findValue(CoEConstant.APP_ID, "流程分类"))); result.add(getExcelTitleName(I18nRes.findValue(CoEConstant.APP_ID, "流程分类")));
} else { } else if (treeVisible){
result.add("\n" + I18nRes.findValue(CoEConstant.APP_ID, com.actionsoft.apps.coe.pal.pal.repository.util.Number2ChineseNumUtil.convertChineseStr(String.valueOf(i))) + getExcelTitleName(I18nRes.findValue(CoEConstant.APP_ID, "级流程"))); result.add("\n" + I18nRes.findValue(CoEConstant.APP_ID, com.actionsoft.apps.coe.pal.pal.repository.util.Number2ChineseNumUtil.convertChineseStr(String.valueOf(i))) + getExcelTitleName(I18nRes.findValue(CoEConstant.APP_ID, "级流程")));
} }
} }
if(treeVisible){
result.add("");// 空一列 result.add("");// 空一列
}
// 伊利定制化需求23-11-21 空白列与扩展列之间增加 模型名称与版本号两列 // 伊利定制化需求23-11-21 空白列与扩展列之间增加 模型名称与版本号两列
result.add("模型名称"); result.add("模型名称");
result.add("版本号"); result.add("版本号");