Excel导入流程图review ,拓展属性导入不成功问题修复
This commit is contained in:
parent
bd889d2e38
commit
7c8e0d59b2
@ -355,7 +355,6 @@ public class BatchWeb extends ActionWeb {
|
||||
if (sheet!=null){
|
||||
//模型导入保存
|
||||
new Thread(()->{new ImportShapeExcel1().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);}) .start();
|
||||
// new ImportShapeExcel1().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);
|
||||
}else {
|
||||
new Thread(()->{new ImportShapeExcel().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);}) .start();
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class ImportShapeExcel1 {
|
||||
|
||||
LogUtil.appendLog("PAL 泳道图Excel批量导入模型 Begin " + UtilDate.datetimeFormat(startDate), simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog("若模型存在多版本,只与模型使用中版本进行匹配,过往版本忽略不进行任何处理,若最新版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog("若模型存在多版本,只与模型使用中版本进行匹配,过往版本忽略不进行任何处理,若使用中版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
|
||||
|
||||
//前端入参table数据读取
|
||||
JSONObject data = object.getJSONObject("data");
|
||||
@ -121,7 +121,6 @@ public class ImportShapeExcel1 {
|
||||
JSONObject drawBranchShape = this.drawBranchShape(repositoryId, branchData, offsetX, nodeMap, relationList);
|
||||
double maxRight = drawBranchShape.getDouble("rightMaxLine");
|
||||
int maxLevel = drawBranchShape.getInteger("maxLevel");
|
||||
|
||||
rightMaxLine = Math.max(rightMaxLine,maxRight);
|
||||
|
||||
offsetX = rightMaxLine + 150;
|
||||
@ -187,7 +186,11 @@ public class ImportShapeExcel1 {
|
||||
double offsetX = originOffsetX;
|
||||
int maxLevelNum = 0;
|
||||
|
||||
//repositoryId
|
||||
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(repositoryId);
|
||||
|
||||
for (Map.Entry<String, Map<String, Map<String, List<CellObject>>>> branch : branchData.entrySet()) {
|
||||
LogUtil.appendLog(BatchConst.LOG_DESC + "[执行阶段] 绘制["+ palModel.getName() +"] "+branch.getKey()+"分支图形", simpleLogFile, fullLogFile);
|
||||
// <层级,同级别map>
|
||||
Map<String, Map<String, List<CellObject>>> levelMap = branch.getValue();
|
||||
|
||||
@ -245,6 +248,9 @@ public class ImportShapeExcel1 {
|
||||
|
||||
//节点画图,
|
||||
JSONObject shape =this.drawShape(node, 0, offsetX, i, i);
|
||||
if (null == shape){
|
||||
continue;
|
||||
}
|
||||
//计算最右边界
|
||||
rightMaxLine = this.getRightMaxLine(shape,rightMaxLine);
|
||||
shapes.add(shape);
|
||||
@ -307,6 +313,9 @@ public class ImportShapeExcel1 {
|
||||
|
||||
//绘制当前节点图形
|
||||
JSONObject shape = this.drawShape(node, levelNodeIndex, offset, level, i);
|
||||
if(null == shape){
|
||||
continue;
|
||||
}
|
||||
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状,形状类型[" + node.getShapeType() + "]", fullLogFile);
|
||||
|
||||
@ -1244,13 +1253,16 @@ public class ImportShapeExcel1 {
|
||||
}
|
||||
|
||||
private String getCellObjectUUID(CellObject node){
|
||||
//名称+类型+序号
|
||||
//名称+类型+序号+分支
|
||||
return node.getShapeName()+"|"+node.getShapeType()+"|"+node.getShapeBranch()+"|"+node.getShapeNum();
|
||||
}
|
||||
|
||||
private JSONObject drawShape(CellObject node,int levelNodeIndex,double offset,int level,int zIndex){
|
||||
JSONObject shape = ShapeUtil.getProcessShapeDefinition("process.flowchart", node.getShapeType());
|
||||
//
|
||||
//特殊处理如果图形类型与图形不匹配
|
||||
if(null == shape){
|
||||
return shape;
|
||||
}
|
||||
shape.put("text", node.getShapeName());
|
||||
shape.put("id", UUIDGener.getUUID());
|
||||
shape.put("shapeNum", node.getShapeNum());
|
||||
@ -1334,8 +1346,6 @@ public class ImportShapeExcel1 {
|
||||
for (int rowIndex = 0; rowIndex < row.size(); rowIndex++) {
|
||||
JSONObject cell = row.getJSONObject(rowIndex);
|
||||
|
||||
JSONArray expandArr = new JSONArray();
|
||||
|
||||
if (cell.getString("name").equals(ShapeConst.TABLE_SHAPE_BRANCH)){
|
||||
//形状分支
|
||||
branch = cell.getString("value");
|
||||
@ -1360,8 +1370,7 @@ public class ImportShapeExcel1 {
|
||||
cellObject.setShapeNum(cell.getString("value"));
|
||||
}else {
|
||||
//拓展属性
|
||||
expandArr.add(cell);
|
||||
cellObject.setExpandArr(expandArr);
|
||||
cellObject.addExpandArr(cell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -975,79 +975,6 @@ public class ValidShapeExcel {
|
||||
}
|
||||
}
|
||||
|
||||
// 查询一些形状定义
|
||||
/*Map<String, List<JSONObject>> shapeObjMap = new HashMap<>();// 形状定义信息
|
||||
Map<String, Map<String, String>> shapeMap = new HashMap<>();// 形状名称类型与id的映射关系
|
||||
// 剩下的数据先获取下形状信息,做进一步判断
|
||||
iterator = excelShapeModels.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ExcelShapeModel row = iterator.next();
|
||||
String repositoryName = row.getRepositoryName();
|
||||
String repositoryType = row.getRepositoryType();
|
||||
String key = repositoryName + "|||" + repositoryType;
|
||||
String palId = repositoryMap.get(key);
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
|
||||
List<JSONObject> shapeList = CoeDesignerUtil.getShapeMessageJson5(palId);
|
||||
shapeObjMap.put(key, shapeList);
|
||||
}*/
|
||||
|
||||
// 形状名称+类型的数量统计 key:key,value:key:shapeName+shapeType,value:count
|
||||
/*Map<String, Map<String, Integer>> sameShapeMap = new HashMap<>();
|
||||
for (Map.Entry<String, List<JSONObject>> entry : shapeObjMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<JSONObject> shapeList = entry.getValue();
|
||||
for (JSONObject shapeObj : shapeList) {
|
||||
String shapeId = shapeObj.getString("id");
|
||||
String shapeName = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("text")).replace(" ", "");
|
||||
String shapeType = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("title")).replace(" ", "");
|
||||
String shapeKey = shapeName + "|||" + shapeType;
|
||||
// 形状名称+类型与对应的形状id映射记录
|
||||
if (!shapeMap.containsKey(key)) {
|
||||
shapeMap.put(key, new HashMap<>());
|
||||
}
|
||||
shapeMap.get(key).put(shapeKey, shapeId);
|
||||
|
||||
// 形状名称+类型的数量记录
|
||||
if (!sameShapeMap.containsKey(key)) {
|
||||
sameShapeMap.put(key, new HashMap<>());
|
||||
}
|
||||
if (!sameShapeMap.get(key).containsKey(shapeKey)) {
|
||||
sameShapeMap.get(key).put(shapeKey, 0);
|
||||
}
|
||||
sameShapeMap.get(key).put(shapeKey, sameShapeMap.get(key).get(shapeKey) + 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
// 7.模型形状存在但是出现了多个匹配
|
||||
// 借用moreMatchList,不再创建新的,统一归为匹配出现多个类型
|
||||
/*iterator = excelShapeModels.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ExcelShapeModel row = iterator.next();
|
||||
String repositoryName = row.getRepositoryName();
|
||||
String repositoryType = row.getRepositoryType();
|
||||
String shapeName = row.getShapeName();
|
||||
String shapeType = row.getShapeType();
|
||||
String key = repositoryName + "|||" + repositoryType;
|
||||
String palId = repositoryMap.get(key);
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
|
||||
String shapeKey = shapeName + "|||" + shapeType;
|
||||
if (sameShapeMap.containsKey(key) && sameShapeMap.get(key).containsKey(shapeKey) && sameShapeMap.get(key).get(shapeKey) > 1) {
|
||||
RepositoryShapeInfoModel moreMatchModel = new RepositoryShapeInfoModel();
|
||||
moreMatchModel.setRepositoryId(palId);
|
||||
moreMatchModel.setRepositoryName(repositoryName);
|
||||
moreMatchModel.setMethodName(repositoryType);
|
||||
moreMatchModel.setMethodId(plModel.getMethodId());
|
||||
moreMatchModel.setShapeName(shapeName);
|
||||
moreMatchModel.setShapeType(shapeType);
|
||||
moreMatchModel.setExcelShapeModel(row);
|
||||
moreMatchModel.setResult("moreMatch");
|
||||
moreMatchModel.setRowOk(false);
|
||||
moreMatchModel.setRowMsg("出现PAL多个符合条件的模型形状");
|
||||
moreMatchList.add(moreMatchModel);
|
||||
iterator.remove();
|
||||
}
|
||||
}*/
|
||||
|
||||
// 剩下的都是基本信息校验通过的
|
||||
List<RepositoryShapeInfoModel> matchShapeList = new ArrayList<>();
|
||||
iterator = excelShapeModels.iterator();
|
||||
|
||||
@ -2,6 +2,7 @@ package com.actionsoft.apps.coe.pal.batch.web.create.shape.model;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 前后入参table解析后cell对象
|
||||
@ -35,7 +36,7 @@ public class CellObject {
|
||||
/**
|
||||
* 拓展属性数组
|
||||
*/
|
||||
private JSONArray expandArr;
|
||||
private JSONArray expandArr = new JSONArray();
|
||||
|
||||
public CellObject() {
|
||||
}
|
||||
@ -105,4 +106,8 @@ public class CellObject {
|
||||
public void setExpandArr(JSONArray expandArr) {
|
||||
this.expandArr = expandArr;
|
||||
}
|
||||
|
||||
public void addExpandArr(JSONObject expand){
|
||||
this.expandArr.add(expand);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user