diff --git a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar
index eb6189fd..4b5db017 100644
Binary files a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar and b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar differ
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml b/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml
index 82daaf07..e4241611 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml
+++ b/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml
@@ -1,18 +1,18 @@
- 端到端(SubProcess)建模方法
+ 端到端(SubProcess)建模方法
1.0
29
北京炎黄盈动科技发展有限责任公司
- false
+ false
2022-06-13
-
-
+
+
2022-06-08 21:10:35
2022-06-13 09:36:32
- com.actionsoft.apps.coe.method.process.subprocess.Plugins
+ com.actionsoft.apps.coe.method.process.subprocess.plugin.Plugins
@@ -23,5 +23,8 @@
- {"process.epc":{"code": "","color": "#4E7FF9"}}
+ {"process.epc":{"code": "","color": "#4E7FF9"}}
+
+ process/3d2f5b3d-3e66-4777-808a-2c56e91dc8cc
+
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java
new file mode 100644
index 00000000..6377716c
--- /dev/null
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java
@@ -0,0 +1,95 @@
+package com.actionsoft.apps.coe.method.process.subprocess;
+
+import com.actionsoft.apps.coe.method.process.subprocess.web.SubProcessWeb;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+import com.actionsoft.exception.AWSException;
+import com.alibaba.fastjson.JSONArray;
+
+/**
+ * @author oYang
+ * @create 2023-05-09 15:37
+ */
+@Controller
+public class SubProcessController {
+
+ /**
+ * 功能入口->获取部分初始数据
+ * @param uc
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.coe.method.process.subprocess.init_data")
+ public String initData(UserContext uc){
+ try {
+ SubProcessWeb processWeb = new SubProcessWeb(uc);
+ return processWeb.initData();
+ } catch (AWSException e) {
+ return ResponseObject.newErrResponse(e.getMessage()).toString();
+ }
+ }
+
+ /**
+ * 功能入口->子流程树加载接口
+ * 端到端功能入口处 加载流程文件树 调用资产库主界面左侧树方法API
+ * 在此基础上保留 EPC与泳道图 其它建模类型的模型过滤掉
+ * @param uc
+ * @param wsId
+ * @param teamId
+ * @param pid
+ * @param createUsers
+ * @param orgIds
+ * @param methodIds
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.coe.method.process.subprocess.find_tree_node")
+ public String findSubProcessModelTreeNode(UserContext uc, String wsId, String teamId, String pid, String createUsers, String orgIds, String methodIds){
+ SubProcessWeb processWeb = new SubProcessWeb(uc);
+ return processWeb.findSubProcessTreeNode(wsId, teamId, pid, createUsers, orgIds, methodIds);
+ }
+
+ /**
+ * 功能入口->子流程选择接口
+ * 根据选择的树节点 返回节点下所有子级节点(不限于一级子节点)
+ * @param uc
+ * @param nodeKeyJsonArr
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.coe.method.process.subprocess.find_tree_child_node_all")
+ public String findModeTreeChildNodeAll(UserContext uc, String nodeKeyJsonArr){
+ try {
+ SubProcessWeb processWeb = new SubProcessWeb(uc);
+ JSONArray childNodeAll = processWeb.findModeTreeChildNodeAll(nodeKeyJsonArr);
+ ResponseObject ro = ResponseObject.newOkResponse("查询成功");
+ ro.setData(childNodeAll);
+ return ro.toString();
+ } catch (AWSException e) {
+ return ResponseObject.newErrResponse(e.getMessage()).toString();
+ }
+ }
+
+ /**
+ * 功能入口->加载位置树
+ * @param uc
+ * @param wsId
+ * @param teamId
+ * @param pid
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.coe.method.process.subprocess.construct_position_tree")
+ public String constructPositionTree(UserContext uc, String wsId, String teamId, String pid){
+ try {
+ SubProcessWeb processWeb = new SubProcessWeb(uc);
+ JSONArray data = processWeb.constructPositionTree(wsId, teamId, pid);
+ ResponseObject ro = ResponseObject.newOkResponse("查询成功");
+ ro.setData(data);
+ return ro.toString();
+ } catch (AWSException e) {
+ return ResponseObject.newErrResponse(e.getMessage()).toString();
+ }
+ }
+
+
+
+}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/constant/SubProcessConst.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/constant/SubProcessConst.java
new file mode 100644
index 00000000..8c24c8e4
--- /dev/null
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/constant/SubProcessConst.java
@@ -0,0 +1,14 @@
+package com.actionsoft.apps.coe.method.process.subprocess.constant;
+
+/**
+ * @author oYang
+ * @create 2023-05-10 15:35
+ */
+public interface SubProcessConst {
+
+ // 应用ID
+ String APP_ID = "com.actionsoft.apps.coe.method.process.subprocess";
+
+ // 端到端流程存放父节点 参数名
+ String SUB_PROCESS_MODEL_LOCATION = "SUB_PROCESS_MODEL_LOCATION";
+}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/model/vo/SubProcessTagVo.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/model/vo/SubProcessTagVo.java
new file mode 100644
index 00000000..e2373791
--- /dev/null
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/model/vo/SubProcessTagVo.java
@@ -0,0 +1,40 @@
+package com.actionsoft.apps.coe.method.process.subprocess.model.vo;
+
+/**
+ * @author oYang
+ * @create 2023-05-10 11:06
+ */
+public class SubProcessTagVo {
+
+ private String label;
+ private String value;
+
+ public SubProcessTagVo(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "SubProcessTagVo{" +
+ "label='" + label + '\'' +
+ ", value='" + value + '\'' +
+ '}';
+ }
+}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/Plugins.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/plugin/Plugins.java
similarity index 94%
rename from com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/Plugins.java
rename to com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/plugin/Plugins.java
index c1b18a9e..1ee4c5ae 100644
--- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/Plugins.java
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/plugin/Plugins.java
@@ -1,4 +1,4 @@
-package com.actionsoft.apps.coe.method.process.subprocess;
+package com.actionsoft.apps.coe.method.process.subprocess.plugin;
import com.actionsoft.apps.listener.PluginListener;
import com.actionsoft.apps.resource.AppContext;
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java
new file mode 100644
index 00000000..87a7784f
--- /dev/null
+++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java
@@ -0,0 +1,201 @@
+package com.actionsoft.apps.coe.method.process.subprocess.web;
+
+import com.actionsoft.apps.coe.method.process.subprocess.constant.SubProcessConst;
+import com.actionsoft.apps.coe.method.process.subprocess.model.vo.SubProcessTagVo;
+import com.actionsoft.apps.coe.pal.constant.CoEConstant;
+import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
+import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
+import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
+import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
+import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UtilString;
+import com.actionsoft.exception.AWSException;
+import com.actionsoft.i18n.I18nRes;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.collections4.IteratorUtils;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author oYang
+ * @create 2023-05-09 15:49
+ */
+public class SubProcessWeb extends ActionWeb {
+
+ private UserContext uc;
+
+ public SubProcessWeb(UserContext uc) {
+ super(uc);
+ this.uc = uc;
+ }
+
+ public String initData() throws AWSException{
+ // 获取端到端文件存储的根目录
+ String property = SDK.getAppAPI().getProperty(SubProcessConst.APP_ID, SubProcessConst.SUB_PROCESS_MODEL_LOCATION);
+ if (UtilString.isEmpty(property))
+ throw new AWSException("应用参数【" + SubProcessConst.SUB_PROCESS_MODEL_LOCATION + "】异常");
+ String[] locationIds = property.split("/");
+
+ StringBuffer dirName = new StringBuffer(I18nRes.findValue(CoEConstant.APP_ID, locationIds[0]) + "/");
+ for (int i = 1; i < locationIds.length; i++) {
+ PALRepositoryModel model = PALRepositoryCache.getCache().get(locationIds[i]);
+ dirName.append(model.getName()).append("/");
+ }
+
+ ResponseObject ro = ResponseObject.newOkResponse();
+ ro.put("dirRootName", dirName.toString());
+ ro.put("dirRootPath", property);
+ return ro.toString();
+ }
+
+ /**
+ * 资产库主界面左侧树适配
+ * @param wsId
+ * @param teamId
+ * @param pid
+ * @param createUsers
+ * @param orgIds
+ * @param methodIds
+ * @return
+ * @throws AWSException
+ */
+ public String findSubProcessTreeNode(String wsId, String teamId, String pid, String createUsers, String orgIds, String methodIds) throws AWSException{
+ // 调用资产库主界面左侧树的API
+ CoeProcessLevelWeb processLevelWeb = new CoeProcessLevelWeb(uc);
+ String result = processLevelWeb.getPalProcesslevelTreeData(wsId, teamId, pid, createUsers, orgIds, methodIds);
+ // 解析API返回结果
+ ResponseObject ro = ResponseObject.parse(result);
+ JSONArray data = ro.getData(JSONArray.class);
+ if (UtilString.isEmpty(pid)){
+ data = data.stream()
+ .filter(item -> "process".equals(((JSONObject)item).getString("plCategory")))
+ .collect(Collectors.toCollection(JSONArray::new));
+ }else {
+ // 保留EPC 与 泳道图 其它过滤掉
+ data = data.stream()
+ .filter(item -> {
+ JSONObject model = (JSONObject) item;
+ boolean flag = false;
+ if ("process.framework".equals(model.getString("plMethodId")) || "default".equals(model.getString("plMethodId"))){
+ // 递归判断该架构或者该文件夹是否保留
+ flag = this.isContainEpcOrFlowChart(model.getString("wsId"),model.getString("versionId"));
+ }else if ("process.epc".equals(model.getString("plMethodId")) || "process.flowchart".equals(model.getString("plMethodId"))){
+ flag = true;
+ }
+ return flag;
+ })
+ .collect(Collectors.toCollection(JSONArray::new));
+ }
+ ro.setData(data);
+ return ro.toString();
+ }
+
+ /**
+ * 递归判断当前架构或者文件夹是否包含 EPC或者泳道图
+ * @param wsId
+ * @param pid
+ * @return
+ */
+ private boolean isContainEpcOrFlowChart(String wsId, String pid){
+ boolean flag = false;
+ Iterator iterator = PALRepositoryCache.getByPid(wsId, pid);
+ if (!iterator.hasNext()) return flag;
+ while (iterator.hasNext()){
+ PALRepositoryModel currentModel = iterator.next();
+ if ("process.framework".equals(currentModel.getMethodId()) || "default".equals(currentModel.getMethodId())){
+ flag = this.isContainEpcOrFlowChart(wsId, currentModel.getVersionId());
+ }else if ("process.epc".equals(currentModel.getMethodId()) || "process.flowchart".equals(currentModel.getMethodId())){
+ flag = true;
+ }
+ if (flag) break;
+ }
+ return flag;
+ }
+
+ /**
+ * 查询当前节点下的所有子级节点
+ * @param nodeKeyJsonArr nodeKey的JSONArray字符串
+ * @return JSONArray
+ * @throws AWSException
+ */
+ public JSONArray findModeTreeChildNodeAll(String nodeKeyJsonArr) throws AWSException{
+ if (UtilString.isEmpty(nodeKeyJsonArr)) {
+ throw new AWSException("参数异常");
+ }
+ List tagVoList = new ArrayList<>();
+ Set filterKeySet = new HashSet<>();
+ List nodeKeys = JSONArray.parseArray(nodeKeyJsonArr, String.class);
+ List modelList = new ArrayList<>();
+ for (String nodeKey : nodeKeys) {
+ PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(nodeKey);
+ modelList.add(repositoryModel);
+ }
+ this.handleModelTreeChildNode(modelList, tagVoList, filterKeySet);
+ return (JSONArray) JSONArray.toJSON(tagVoList);
+ }
+
+ private void handleModelTreeChildNode(List modelList, List tagVoList, Set filterKeySet){
+
+ for (PALRepositoryModel model : modelList) {
+ if (!("process.framework".equals(model.getMethodId())
+ || "default".equals(model.getMethodId()))){
+ // 当前模型不是架构或者文件夹 则直接放入返回列表中
+ if (!filterKeySet.contains(model.getId())){
+ SubProcessTagVo tagVo = new SubProcessTagVo(model.getName(), model.getId());
+ tagVoList.add(tagVo);
+ filterKeySet.add(model.getId());
+ }
+ continue;
+ }
+ // 获取当前模型的一级子节点
+ Iterator iterator = PALRepositoryCache.getByPid(model.getWsId(), model.getId());
+ List list = IteratorUtils.toList(iterator);
+ handleModelTreeChildNode(list, tagVoList, filterKeySet);
+ }
+ }
+
+ /**
+ * 调用资产库主界面左侧树 API
+ * 在此基础上保留文件夹与架构
+ * 其它模型文件过滤掉
+ * @param wsId
+ * @param teamId
+ * @param pid
+ * @return
+ * @throws AWSException
+ */
+ public JSONArray constructPositionTree(String wsId, String teamId, String pid) throws AWSException {
+ String property = SDK.getAppAPI().getProperty(SubProcessConst.APP_ID, SubProcessConst.SUB_PROCESS_MODEL_LOCATION);
+ if (UtilString.isEmpty(property))
+ throw new AWSException("应用参数【" + SubProcessConst.SUB_PROCESS_MODEL_LOCATION + "】异常");
+ String[] locationIds = property.split("/");
+ if (UtilString.isEmpty(pid)){
+ JSONArray result = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeRoot(uc, wsId, null, teamId);
+ result = result.stream()
+ .filter(item -> {
+ JSONObject model = (JSONObject) item;
+ return locationIds[0].equals(model.getString("id"));
+ }).collect(Collectors.toCollection(JSONArray :: new));
+ return result;
+ }
+ JSONArray result = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPidNew(uc, wsId, teamId, pid);
+ if (locationIds[0].equals(pid)){
+ result = result.stream()
+ .filter(item -> locationIds[1].equals(((JSONObject)item).getString("id")))
+ .collect(Collectors.toCollection(JSONArray :: new));
+ return result;
+ }
+ result = result.stream()
+ .filter(item -> {
+ boolean flag = false;
+ JSONObject model = (JSONObject) item;
+ return flag = "default".equals(model.getString("plMethodId")) || "".equals(model.getString("plMethodId"));
+ }).collect(Collectors.toCollection(JSONArray :: new));
+ return result;
+ }
+}
diff --git a/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml
new file mode 100644
index 00000000..46184d28
--- /dev/null
+++ b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file