端到端功能 子流程节点关联的源文件节点发生变动 端到端总图收到通知

This commit is contained in:
qinoy 2023-07-04 15:43:27 +08:00
parent e5d4d4a1df
commit 73f340ccee
8 changed files with 154 additions and 5 deletions

View File

@ -182,4 +182,16 @@ public class SubProcessController {
return processWeb.shapeExpandAndCloseIconShow(repositoryId, elements); return processWeb.shapeExpandAndCloseIconShow(repositoryId, elements);
} }
/**
* 将当前总图中关于 源文件节点变动的提示信息删除
* @param uc
* @param repositoryId
* @return
*/
@Mapping("com.actionsoft.apps.coe.method.process.subprocess_source_node_diff_msg_clear")
public String sourceNodeDiffMsgClear(UserContext uc, String repositoryId){
SubProcessWeb processWeb = new SubProcessWeb(uc);
return processWeb.sourceNodeDiffMsgClear(repositoryId);
}
} }

View File

@ -391,7 +391,12 @@ public class SubProcessWeb extends ActionWeb {
return ro.toString(); return ro.toString();
} }
// 判断一键展开与闭合的快捷操作按钮是否显示 /**
* 判断一键展开与闭合的快捷操作按钮是否显示
* @param repositoryId
* @param elements
* @return
*/
public String shapeExpandAndCloseIconShow(String repositoryId, String elements){ public String shapeExpandAndCloseIconShow(String repositoryId, String elements){
boolean showExpandFlag = false; boolean showExpandFlag = false;
@ -426,4 +431,21 @@ public class SubProcessWeb extends ActionWeb {
return ro.toString(); return ro.toString();
} }
/**
* 将当前总图中关于 源文件节点变动的提示信息删除
* @param repositoryId
* @return
*/
public String sourceNodeDiffMsgClear(String repositoryId){
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(repositoryId, 0);
String definition = baseModel.getDefinition();
JSONObject defineObj = JSONObject.parseObject(definition);
if (defineObj.containsKey("sourceNodeDiffMsg")){
defineObj.remove("sourceNodeDiffMsg");
}
baseModel.setDefinition(defineObj.toJSONString());
CoeDesignerAPIManager.getInstance().storeDefinition(baseModel);
return ResponseObject.newOkResponse().toString();
}
} }

View File

@ -46,4 +46,7 @@
<param name="repositoryId"/> <param name="repositoryId"/>
<param name="elements"/> <param name="elements"/>
</cmd-bean> </cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.method.process.subprocess_source_node_diff_msg_clear">
<param name="repositoryId"/>
</cmd-bean>
</aws-actions> </aws-actions>

View File

@ -466,6 +466,17 @@ public class DesignerShapeRelationDao extends DaoObject<DesignerShapeRelationMod
} }
} }
/**
* 根据指定属性及被关联的文件查询源文件
* @param relationFileId
* @param attrId
* @return
*/
public List<DesignerShapeRelationModel> getModelListByRelationFileIdAndAttrId(String relationFileId, String attrId){
String sql = "SELECT * FROM " + entityName() + " WHERE RELATIONFILEID = ? AND ATTRID = ?";
return DBSql.query(sql, rowMapper(), relationFileId, attrId);
}
/** /**
* 根据指定属性及被关联的文件查询源文件 * 根据指定属性及被关联的文件查询源文件
* @param relationFileId * @param relationFileId

View File

@ -6116,6 +6116,63 @@ public class CoeProcessLevelWeb extends ActionWeb {
} }
} }
} }
}else if (repositoryModel.getMethodId().equals("process.epc") || repositoryModel.getMethodId().equals("process.flowchart")){
// 判断当前模型是否被某一个总图引用
DesignerShapeRelationDao shapeRelationDao = new DesignerShapeRelationDao();
List<DesignerShapeRelationModel> subProcessModelList = shapeRelationDao.getModelListByRelationFileIdAndAttrId(uuid, "child_process");
if (subProcessModelList.size() > 0){ // 说明当前文件作为子流程节点存在若干端到端总图中
// 获取当前文件存储前的信息
BaseModel historyDefineModel = CoeDesignerAPIManager.getInstance().getDefinition(uuid, 0);
StringBuffer resultMsg = new StringBuffer();
if (historyDefineModel != null){
String historyDefine = historyDefineModel.getDefinition();
JSONObject historyDefineObj = JSONObject.parseObject(historyDefine);
// 之前保存的信息
JSONObject historyElements = historyDefineObj.getJSONObject("elements");
List<String> historyEleKeyList = historyElements.keySet().stream().filter(key -> !"linker".equals(historyElements.getJSONObject(key).getString("name"))).collect(Collectors.toList());
// 当前要保存的信息
JSONObject currentElements = definition.getJSONObject("elements");
List<String> currentEleKeyList = currentElements.keySet().stream().filter(key -> !"linker".equals(currentElements.getJSONObject(key).getString("name"))).collect(Collectors.toList());
// 对比之前保存的信息
StringBuffer scopeMsg = new StringBuffer();
for (String key : currentEleKeyList) {
if (!historyEleKeyList.contains(key)){ // 增加节点信息
scopeMsg.append("<br>");
scopeMsg.append("新增节点【" + currentElements.getJSONObject(key).getString("text") + "");
}else {
historyEleKeyList.remove(key);
}
}
if (historyEleKeyList.size() > 0){
for (String key : historyEleKeyList) {
scopeMsg.append("<br>");
scopeMsg.append("删除节点【" + historyElements.getJSONObject(key).getString("text") + "");
}
}
if (UtilString.isNotEmpty(scopeMsg.toString())){
resultMsg.append("源文件【"+repositoryModel.getName() + "").append(scopeMsg);
}
}
if (UtilString.isNotEmpty(resultMsg.toString())){
// 将当前文件节点变动的信息 存放到所有引用当前文件的端到端总图中
for (DesignerShapeRelationModel subProcessNode : subProcessModelList) {
BaseModel subProcessBaseModel = CoeDesignerAPIManager.getInstance().getDefinition(subProcessNode.getFileId(), 0);
if (subProcessBaseModel == null) continue;
String subProcessDefine = subProcessBaseModel.getDefinition();
JSONObject subProcessDefineObj = JSONObject.parseObject(subProcessDefine);
JSONObject subProcessSourceNodeDiffMsg = new JSONObject();
if (subProcessDefineObj.containsKey("sourceNodeDiffMsg")){
subProcessSourceNodeDiffMsg = subProcessDefineObj.getJSONObject("sourceNodeDiffMsg");
}
subProcessSourceNodeDiffMsg.put(subProcessNode.getShapeId(), resultMsg.toString());
subProcessDefineObj.put("sourceNodeDiffMsg", subProcessSourceNodeDiffMsg);
subProcessBaseModel.setDefinition(subProcessDefineObj.toJSONString());
CoeDesignerAPIManager.getInstance().storeDefinition(subProcessBaseModel);
}
}
}
} }
define = definition.toString(); define = definition.toString();

View File

@ -2,9 +2,6 @@ $(function(){
if (methodId != 'process.subprocess') { // 如果当前打开的模型不是端到端总图 那么整个js也没有执行的必要 if (methodId != 'process.subprocess') { // 如果当前打开的模型不是端到端总图 那么整个js也没有执行的必要
return; return;
} }
// 1. 子流程展开 事件:获取当前子流程所代表的模型文件
// (function (Model, ruuid, sid) {
// })(Model, ruuid, sid);
const subProcess = new SubProcess(Model, ruuid, sid); const subProcess = new SubProcess(Model, ruuid, sid);
@ -28,7 +25,9 @@ class SubProcess {
this.shapeIconRender(); this.shapeIconRender();
this.handleScopeShapeEvent(); this.handleScopeShapeEvent();
this.linkerBoxPointerEvent(); this.linkerBoxPointerEvent();
this.scopeShapeRenderTitle(this.Model.define.elements) this.scopeShapeRenderTitle(this.Model.define.elements);
this.sourceNodeDiffMsgHandle();
} }
linkerBoxPointerEvent(){ linkerBoxPointerEvent(){
@ -416,5 +415,50 @@ class SubProcess {
leadNodeArr.push(fromId); leadNodeArr.push(fromId);
toShape.extendAttr.leadNodeArr = leadNodeArr; toShape.extendAttr.leadNodeArr = leadNodeArr;
} }
// 子流程节点关联的源文件中的节点发生变动 给出提示
sourceNodeDiffMsgHandle(){
if (definition.sourceNodeDiffMsg){
let multipleMsg = "";
let toDeleteMsgKey = [];
for (let shapeKey in definition.sourceNodeDiffMsg) {
if (Model.define.elements[shapeKey] != undefined){
// 提示
multipleMsg = multipleMsg.concat('<br><br>', definition.sourceNodeDiffMsg[shapeKey]);
}
toDeleteMsgKey.push(shapeKey);
}
if (toDeleteMsgKey.length){
for (let shapeKey in toDeleteMsgKey) {
delete definition.sourceNodeDiffMsg[shapeKey];
}
awsui.ajax.request({
url: './jd',
method: 'POST',
data: {
cmd: 'com.actionsoft.apps.coe.method.process.subprocess_source_node_diff_msg_clear',
sid: this.sid,
repositoryId: this.repositoryId
},
ok: function (r){
},
err: function (r) {
$.simpleAlert(r.msg);
}
});
}
if (multipleMsg){
$.notification({
title:'源文件节点变动提示',
description: multipleMsg,
position: "topRight",
delay: 0,
distance: 100
});
$('.awsui-public-box-main').css('width', '325px');
}
}
}
} }