针对端到端功能 也就是建模类型为process.subprocess的模型文件 设计器保存接口加入子节点展开与闭合状态记忆的逻辑
This commit is contained in:
parent
0430aa6205
commit
83424f1af9
Binary file not shown.
@ -197,6 +197,10 @@ public class CoeDesignerFile {
|
|||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
|
File subProcessPath = new File(model.getPath() + "/" + model.getMethodId().substring(model.getMethodId().indexOf(".") + 1));
|
||||||
|
if (!subProcessPath.exists()){
|
||||||
|
subProcessPath.mkdirs();
|
||||||
|
}
|
||||||
UtilFile utilFile = new UtilFile(getChildProcessPathName(childProcessId));
|
UtilFile utilFile = new UtilFile(getChildProcessPathName(childProcessId));
|
||||||
if (!utilFile.exists()){
|
if (!utilFile.exists()){
|
||||||
try {
|
try {
|
||||||
@ -228,7 +232,7 @@ public class CoeDesignerFile {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getChildProcessPathName(String childProcessId){
|
public String getChildProcessPathName(String childProcessId){
|
||||||
return model.getPath() + childProcessId;
|
return model.getPath() + model.getMethodId().substring(model.getMethodId().indexOf(".") + 1) + "/" + childProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -6086,6 +6086,59 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
defineModel.setUpdateTime(now);
|
defineModel.setUpdateTime(now);
|
||||||
defineModel.setDefinition(define);
|
defineModel.setDefinition(define);
|
||||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// 保存文件
|
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// 保存文件
|
||||||
|
|
||||||
|
// 针对端到端的模型文件 保存时 将已展开的范围框对应子流程模型 保存到总图的同级目录下
|
||||||
|
JSONObject elements = definition.getJSONObject("elements");
|
||||||
|
Set<String> scopeShapeIdSet = elements.keySet().stream().filter(key -> "scopeLimitation".equals(elements.getJSONObject(key).getString("name"))).collect(Collectors.toSet());
|
||||||
|
if (scopeShapeIdSet.size() > 0){ // 说明有展开的节点
|
||||||
|
for (String scopeShapeId : scopeShapeIdSet) {
|
||||||
|
// 存放范围框内部元素
|
||||||
|
JSONArray inScopeShapeRangeEles = new JSONArray();
|
||||||
|
// 获取当前范围框内的元素信息
|
||||||
|
JSONObject scopeShapeProps = elements.getJSONObject(scopeShapeId).getJSONObject("props");
|
||||||
|
double scopeX = scopeShapeProps.getDoubleValue("x"), scopeY = scopeShapeProps.getDoubleValue("y"), scopeW = scopeShapeProps.getDoubleValue("w"), scopeH = scopeShapeProps.getDoubleValue("h");
|
||||||
|
for (String key : elements.keySet()) {
|
||||||
|
if (scopeShapeId.equals(key)) continue; // 范围框本身不算作其内部元素
|
||||||
|
JSONObject shape = elements.getJSONObject(key);
|
||||||
|
if ("linker".equals(shape.getString("name"))){ // 连线
|
||||||
|
JSONObject from = shape.getJSONObject("from");
|
||||||
|
JSONObject to = shape.getJSONObject("to");
|
||||||
|
double fromX = from.getDoubleValue("x"), fromY = from.getDoubleValue("y"), toX = to.getDoubleValue("x"), toY = to.getDoubleValue("y");
|
||||||
|
if ((scopeX < fromX && fromX < scopeX + scopeW && scopeY < fromY && fromY < scopeY + scopeH) || (scopeX < toX && toX < scopeX + scopeW && scopeY < toY && toY < scopeY + scopeH)){
|
||||||
|
inScopeShapeRangeEles.add(shape);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
double x = shape.getJSONObject("props").getDoubleValue("x");
|
||||||
|
double y = shape.getJSONObject("props").getDoubleValue("y");
|
||||||
|
if (scopeX <= x && x < scopeX + scopeW && scopeY <= y && y < scopeY + scopeH){
|
||||||
|
inScopeShapeRangeEles.add(shape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取当前范围框所对应的子流程文件信息
|
||||||
|
if (inScopeShapeRangeEles.size() > 0){
|
||||||
|
List<DesignerShapeRelationModel> relationModelList = DesignerShapeRelationCache.getListByAttrId(uuid, scopeShapeId, "child_process");
|
||||||
|
DesignerShapeRelationModel relationModel = relationModelList.stream().findFirst().orElse(null);
|
||||||
|
if (relationModel == null)
|
||||||
|
throw new AWSException("未找到当前节点所标识的子流程文件信息");
|
||||||
|
String relationFileId = relationModel.getRelationFileId();
|
||||||
|
|
||||||
|
BaseModel relationBaseModel = CoeDesignerAPIManager.getInstance().getDefinition(relationFileId, 0);
|
||||||
|
|
||||||
|
JSONObject childProcessObj = JSONObject.parseObject(relationBaseModel.getDefinition());
|
||||||
|
JSONObject newElements = new JSONObject();
|
||||||
|
for (Object o : inScopeShapeRangeEles) {
|
||||||
|
JSONObject ele = (JSONObject) o;
|
||||||
|
newElements.put(ele.getString("id"), ele);
|
||||||
|
}
|
||||||
|
childProcessObj.put("elements", newElements);
|
||||||
|
|
||||||
|
// 保存展开的子流程信息到 总图的同级目录下
|
||||||
|
CoeDesignerAPIManager.getInstance().storeChildProcessDefine(defineModel, relationFileId, childProcessObj.toJSONString());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关联/被关联图形的名称更新
|
// 关联/被关联图形的名称更新
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user