Excel导入流程图日志完善

This commit is contained in:
anhc 2022-09-16 17:32:43 +08:00
parent 7bf27bd05b
commit beceab7742
2 changed files with 32 additions and 4 deletions

View File

@ -44,7 +44,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
/**
* 导入模型结
* 导入模型结
* @author sunlh
*
*/
@ -97,6 +97,7 @@ public class ImportShapeExcel1 {
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile);
LogUtil.appendLog("若模型存在多版本,只与模型使用中版本进行匹配,过往版本忽略不进行任何处理,若最新版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
JSONObject data = object.getJSONObject("data");
@ -114,6 +115,12 @@ public class ImportShapeExcel1 {
this.transformCollectBranchToCellMap(fileData,fileDataMap,specialMap);
// 放入cache
int totalCount = fileDataMap.size();
LogRealTimeCountModel countModel = new LogRealTimeCountModel();
countModel.setTotalCount(totalCount);
countModel.setSuccessCount(0);
LogRealTimeCountCache.getCache().put(logId, countModel, true);
//根据基准数据绘制图形+连线关系
@ -191,8 +198,23 @@ public class ImportShapeExcel1 {
}
endTime = System.currentTimeMillis();
Timestamp endDate = new Timestamp(endTime);
LogRealTimeCountModel model = LogRealTimeCountCache.getCache().get(logId);
String takeTimeText = takeTime(endTime, startTime);
String resultMsg = "导入完成,总耗时" + takeTimeText + ",模型清单总共[" + model.getTotalCount() + "],导入成功[" + model.getSuccessCount() + "]条,导入失败[" + (model.getTotalCount() - model.getSuccessCount())
+ "]条)";
LogUtil.appendLog("\n" + BatchConst.LOG_END + resultMsg, simpleLogFile, fullLogFile);
LogUtil.appendLog("\n" + "PAL批量导入模型 End " + UtilDate.datetimeFormat(endDate), simpleLogFile, fullLogFile);
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.END_LOG, simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.LOG_END + "[执行结束][Excel导入完成]", simpleLogFile, fullLogFile);
LogRealTimeCountCache.getCache().remove(logId);
// 关联属性缓存重新刷新
DesignerShapeRelationCache.getCache().reload();
}
@ -288,6 +310,8 @@ public class ImportShapeExcel1 {
//绘制当前节点图形
JSONObject shape = this.drawShape(node, levelNodeIndex, offset, level, i);
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状", simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状,形状类型[" + node.getShapeType() + "]", fullLogFile);
//计算最右边边界
rightMaxLine = this.getrightMaxLine(shape, rightMaxLine);
@ -325,8 +349,6 @@ public class ImportShapeExcel1 {
Double changeLeftMinLine = object.getDouble("leftMinLine");
Double changeRightMaxLine = object.getDouble("rightMaxLine");
rightMaxLine = Math.max(changeRightMaxLine,rightMaxLine);
// leftMinLine = Math.min(leftMinLine,changeLeftMinLine);
//比较返回左边界<leftMinLine 则需要将分支整体向右调整offset = leftMinLine - 左边界
if (changeLeftMinLine <= leftMinLine){
@ -339,7 +361,6 @@ public class ImportShapeExcel1 {
rightMaxLine = Math.max(moveToRightOffset,rightMaxLine);
}
offsetX = rightMaxLine + ShapeConst.SHAPE_BRANCH_INTERVAL;
}
@ -1196,6 +1217,7 @@ public class ImportShapeExcel1 {
object2.put("value", attrValue);
attributesJsonArray.add(object2);
}
LogUtil.appendLog(BatchConst.LOG_END + "形状["+ shape.getString("text") +"]扩展属性<" + attrName + ">的属性内容设置为: " + cellData.getString("value"), simpleLogFile, fullLogFile);
}
if (attributesJsonArray.size() > 0) {
@ -1255,8 +1277,14 @@ public class ImportShapeExcel1 {
definition.put("elements",element);
defineModel.setDefinition(definition.toString());
LogUtil.appendLog(BatchConst.LOG_START + "[执行阶段][保存处理模型内容]模型" + I18nRes.findValue(CoEConstant.APP_ID, palModel.getMethodId()) + "[" + palModel.getName() + "]模型模型ID[" + palModel.getId() + "]", simpleLogFile, fullLogFile);
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
LogUtil.appendLog(BatchConst.LOG_END + "[执行阶段][处理模型内容]", simpleLogFile, fullLogFile);
// 记录成功日志记录
LogRealTimeCountCache.getCache().get(logId).setSuccessCount(LogRealTimeCountCache.getCache().get(logId).getSuccessCount() + 1);
}
private String getCellObjectUUID(CellObject node){