流程清单 历史导出 去掉测试代码 加上打印信息

This commit is contained in:
qinoy 2023-11-10 10:39:13 +08:00
parent 195c8f7ff2
commit 4aafb9a27a
2 changed files with 37 additions and 33 deletions

View File

@ -1121,15 +1121,15 @@ public class PALRepositoryListWeb extends ActionWeb {
try {
String fileName = exportAPIManager.buildFileName(_uc, createTime); // 构建文件名称
exportModel = exportAPIManager.saveExportInitInfo(wsId, _uc.getUID(), fileName, createTime); // 初始保存导出记录信息
ProcessListExportModel tempModel = exportModel;
new Thread(() -> {
exportSheetData2(wb, sheet, rowIndex, (short) 0, wsId, teamId, conditions, tempModel);
}).start();
} catch (Exception e) {
if (exportModel == null){
return ResponseObject.newErrResponse("导出记录数据初始化失败").toString();
}
}
ProcessListExportModel tempModel = exportModel;
new Thread(() -> {
exportSheetData2(wb, sheet, rowIndex, (short) 0, wsId, teamId, conditions, tempModel);
}).start();
ResponseObject ro = ResponseObject.newOkResponse("文档生成中,后续可以在历史记录中查看");
return ro.toString();
@ -1197,6 +1197,8 @@ public class PALRepositoryListWeb extends ActionWeb {
}
tempArr.add(obj);
}
ConsolePrinter.info("流程清单扩展列信息[" + tempArr.toJSONString() + "]");
ConsolePrinter.info("流程清单表头信息[" + tableHeadConfigArr.toJSONString() + "]");
// 获取符合条件数据的maxLevel
int maxLevel = getMaxLevelByList(palList);
// 获取Excel表头信息
@ -1254,9 +1256,9 @@ public class PALRepositoryListWeb extends ActionWeb {
progressStageMap.put(stage3DataCount, 30);
progressStageMap.put(stage4DataCount, 70);
try {
for (int i = 0; i < palList.size(); i++) {
Thread.sleep(600);
ConsolePrinter.info("流程清单文档开始导出");
for (int i = 0; i < palList.size(); i++) {
try {
// 更新进度
if (progressStageMap.containsKey(i)){
ExportAPIManager.getInstance().updateProgressInfo(exportModel.getId(), progressStageMap.get(i));
@ -1370,37 +1372,39 @@ public class PALRepositoryListWeb extends ActionWeb {
}
tempCell.setCellStyle(styleData);
}
} catch (Exception e) {
ConsolePrinter.info("流程清单导出文档生成中异常信息 " + e.getMessage());
ConsolePrinter.info("流程清单导出文档生成中异常 模型ID " + palList.get(i).getId());
ExportAPIManager.getInstance().updateExportStatusAndErrInfo(exportModel.getId(), ProcessListConstant.EXPORT_ERR_STATUS_CODE, "数据异常");
}
ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));
long e3 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--非合并时间: " + (e3 - s3));
long s4 = System.currentTimeMillis();
// 将已经存在的数据进行合并单元格
if (columMap.size() > 0) {
for (int i = 0; i < columMap.size(); i++) {
Map data = (Map) columMap.get(i);
if (data.size() > 0) {
int rowindex = (Integer) data.get(0);
int fromColumnIndex = (Integer) data.get(1);
int toColumnIndex = (Integer) data.get(2);
if (rowindex >= 0){
CellRangeAddress region = new CellRangeAddress((short) rowindex, (short) rowindex, (short) fromColumnIndex, (short) toColumnIndex);// 合并从第rowFrom行columnFrom列
sheet.addMergedRegion(region);// 到rowTo行columnTo的区域
}
}
ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));
long e3 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--非合并时间: " + (e3 - s3));
long s4 = System.currentTimeMillis();
// 将已经存在的数据进行合并单元格
if (columMap.size() > 0) {
for (int i = 0; i < columMap.size(); i++) {
Map data = (Map) columMap.get(i);
if (data.size() > 0) {
int rowindex = (Integer) data.get(0);
int fromColumnIndex = (Integer) data.get(1);
int toColumnIndex = (Integer) data.get(2);
if (rowindex >= 0){
CellRangeAddress region = new CellRangeAddress((short) rowindex, (short) rowindex, (short) fromColumnIndex, (short) toColumnIndex);// 合并从第rowFrom行columnFrom列
sheet.addMergedRegion(region);// 到rowTo行columnTo的区域
}
}
}
long e4 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--合并时间 " + (e4 - s4));
ExportAPIManager.getInstance().updateExportStatusAndProgressInfo(exportModel.getId(), ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE, 100);
ConsolePrinter.info("流程清单导出当前进度 100%");
ExportAPIManager.getInstance().exportComplateAfter(_uc, exportModel, wb);
} catch (Exception e) {
ConsolePrinter.info("流程清单导出文档生成中异常信息 " + e.getMessage());
ExportAPIManager.getInstance().updateExportStatusAndErrInfo(exportModel.getId(), ProcessListConstant.EXPORT_ERR_STATUS_CODE, "数据异常");
}
long e4 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--合并时间 " + (e4 - s4));
ExportAPIManager.getInstance().updateExportStatusAndProgressInfo(exportModel.getId(), ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE, 100);
ConsolePrinter.info("流程清单导出当前进度 100%");
ExportAPIManager.getInstance().exportComplateAfter(_uc, exportModel, wb);
ConsolePrinter.info("流程清单写入文档完毕");
}
/**