Zhou Rui 5 лет назад
Родитель
Сommit
85de95c6b4
15 измененных файлов с 1701 добавлено и 159 удалено
  1. 1 1
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ProcessPlatform.java
  2. 2 2
      o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java
  3. 34 51
      o2server/x_console/src/main/java/com/x/server/console/Main.java
  4. 3 3
      o2server/x_console/src/main/java/com/x/server/console/action/ActionControl.java
  5. 1265 45
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/describe.json
  6. 84 4
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/element/factory/ProcessFactory.java
  7. 18 0
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java
  8. 19 0
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/input/ActionCreate.java
  9. 9 0
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionCreate.java
  10. 10 0
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionDelete.java
  11. 17 9
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionEdit.java
  12. 1 11
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionListWithApplication.java
  13. 14 14
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/BaseAction.java
  14. 145 0
      o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ProcessAction.java
  15. 79 19
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/schedule/DeleteDraft.java

+ 1 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ProcessPlatform.java

@@ -380,7 +380,7 @@ public class ProcessPlatform extends ConfigObject {
 
 		public final static Boolean DEFAULT_ENABLE = false;
 
-		public final static Integer DEFAULT_THRESHOLDMINUTES = 60 * 24 * 10;
+		public final static Integer DEFAULT_THRESHOLDMINUTES = 60 * 24 * 60;
 
 		@FieldDescribe("是否启用")
 		private Boolean enable = DEFAULT_ENABLE;

+ 2 - 2
o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java

@@ -59,7 +59,7 @@ public class CommandFactory {
 	public static final Pattern convert_dataItem_pattern = Pattern.compile("^ {0,}convert dataItem (.+)$",
 			Pattern.CASE_INSENSITIVE);
 
-	public static final Pattern debugDesignDetail_pattern = Pattern.compile("^(\\s*)ddd(\\s*)",
+	public static final Pattern control_pattern = Pattern.compile("^(\\s*)ctl(\\s*)",
 			Pattern.CASE_INSENSITIVE);
 
 	public static void printStartHelp() {
@@ -126,7 +126,7 @@ public class CommandFactory {
 			help += StringUtils.LF;
 			help += " exit                                   exit after stop.";
 			help += StringUtils.LF;
-			help += " ddd -<argument> option                 debug design detail command with argument.";
+			help += " ctl -<argument> option                 system control command, no argument display help.";
 			help += StringUtils.LF;
 			System.out.println(help);
 		} catch (Exception e) {

+ 34 - 51
o2server/x_console/src/main/java/com/x/server/console/Main.java

@@ -18,14 +18,6 @@ import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.regex.Matcher;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.jetty.deploy.App;
-import org.eclipse.jetty.deploy.DeploymentManager;
-import org.quartz.Scheduler;
-
 import com.x.base.core.project.config.ApplicationServer;
 import com.x.base.core.project.config.CenterServer;
 import com.x.base.core.project.config.Config;
@@ -35,14 +27,21 @@ import com.x.base.core.project.config.WebServer;
 import com.x.base.core.project.tools.DefaultCharset;
 import com.x.base.core.project.tools.StringTools;
 import com.x.server.console.action.ActionConfig;
+import com.x.server.console.action.ActionControl;
 import com.x.server.console.action.ActionCreateEncryptKey;
-import com.x.server.console.action.ActionDebugDesignDetail;
 import com.x.server.console.action.ActionSetPassword;
-import com.x.server.console.action.UpdateFile;
 import com.x.server.console.action.ActionVersion;
 import com.x.server.console.log.LogTools;
 import com.x.server.console.server.Servers;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jetty.deploy.App;
+import org.eclipse.jetty.deploy.DeploymentManager;
+import org.quartz.Scheduler;
+
 public class Main {
 
 	private static final String MANIFEST_FILENAME = "manifest.cfg";
@@ -219,9 +218,9 @@ public class Main {
 				continue;
 			}
 
-			matcher = CommandFactory.debugDesignDetail_pattern.matcher(cmd);
+			matcher = CommandFactory.control_pattern.matcher(cmd);
 			if (matcher.find()) {
-				debugDesignDetail(cmd);
+				control(cmd);
 				continue;
 			}
 
@@ -402,34 +401,26 @@ public class Main {
 	private static void startAll() {
 		try {
 			DataServer dataServer = Config.currentNode().getData();
-			if (null != dataServer) {
-				if (BooleanUtils.isTrue(dataServer.getEnable())) {
-					startDataServer();
-				}
+			if ((null != dataServer) && (BooleanUtils.isTrue(dataServer.getEnable()))) {
+				startDataServer();
 			}
+
 			StorageServer storageServer = Config.currentNode().getStorage();
-			if (null != storageServer) {
-				if (BooleanUtils.isTrue(storageServer.getEnable())) {
-					startStorageServer();
-				}
+			if ((null != storageServer) && (BooleanUtils.isTrue(storageServer.getEnable()))) {
+				startStorageServer();
 			}
+
 			CenterServer centerServer = Config.currentNode().getCenter();
-			if (null != centerServer) {
-				if (BooleanUtils.isTrue(centerServer.getEnable())) {
-					startCenterServer();
-				}
+			if ((null != centerServer) && (BooleanUtils.isTrue(centerServer.getEnable()))) {
+				startCenterServer();
 			}
 			ApplicationServer applicationServer = Config.currentNode().getApplication();
-			if (null != applicationServer) {
-				if (BooleanUtils.isTrue(applicationServer.getEnable())) {
-					startApplicationServer();
-				}
+			if ((null != applicationServer) && (BooleanUtils.isTrue(applicationServer.getEnable()))) {
+				startApplicationServer();
 			}
 			WebServer webServer = Config.currentNode().getWeb();
-			if (null != webServer) {
-				if (BooleanUtils.isTrue(webServer.getEnable())) {
-					startWebServer();
-				}
+			if ((null != webServer) && (BooleanUtils.isTrue(webServer.getEnable()))) {
+				startWebServer();
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -444,42 +435,34 @@ public class Main {
 	private static void stopAll() {
 		try {
 			WebServer webServer = Config.currentNode().getWeb();
-			if (null != webServer) {
-				if (BooleanUtils.isTrue(webServer.getEnable())) {
-					stopWebServer();
-				}
+			if ((null != webServer) && (BooleanUtils.isTrue(webServer.getEnable()))) {
+				stopWebServer();
 			}
 			ApplicationServer applicationServer = Config.currentNode().getApplication();
-			if (null != applicationServer) {
-				if (BooleanUtils.isTrue(applicationServer.getEnable())) {
-					stopApplicationServer();
-				}
+			if ((null != applicationServer) && (BooleanUtils.isTrue(applicationServer.getEnable()))) {
+				stopApplicationServer();
 			}
-			if (Config.currentNode().getIsPrimaryCenter()) {
+			if (BooleanUtils.isTrue(Config.currentNode().getIsPrimaryCenter())) {
 				stopCenterServer();
 			}
 			StorageServer storageServer = Config.currentNode().getStorage();
-			if (null != storageServer) {
-				if (BooleanUtils.isTrue(storageServer.getEnable())) {
-					stopStorageServer();
-				}
+			if ((null != storageServer) && (BooleanUtils.isTrue(storageServer.getEnable()))) {
+				stopStorageServer();
 			}
 			DataServer dataServer = Config.currentNode().getData();
-			if (null != dataServer) {
-				if (BooleanUtils.isTrue(dataServer.getEnable())) {
-					stopDataServer();
-				}
+			if ((null != dataServer) && (BooleanUtils.isTrue(dataServer.getEnable()))) {
+				stopDataServer();
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
 
-	private static void debugDesignDetail(String cmd) {
+	private static void control(String cmd) {
 		try {
 			String[] args = StringTools.translateCommandline(cmd);
 			args = Arrays.copyOfRange(args, 1, args.length);
-			ActionDebugDesignDetail action = new ActionDebugDesignDetail();
+			ActionControl action = new ActionControl();
 			action.execute(args);
 		} catch (Exception e) {
 			e.printStackTrace();

+ 3 - 3
o2server/x_console/src/main/java/com/x/server/console/action/ActionDebugDesignDetail.java → o2server/x_console/src/main/java/com/x/server/console/action/ActionControl.java

@@ -19,9 +19,9 @@ import org.apache.commons.lang3.math.NumberUtils;
 @author zhourui
 
 */
-public class ActionDebugDesignDetail extends ActionBase {
+public class ActionControl extends ActionBase {
 
-	private static Logger logger = LoggerFactory.getLogger(ActionDebugDesignDetail.class);
+	private static Logger logger = LoggerFactory.getLogger(ActionControl.class);
 
 	private static Options options = new Options();
 
@@ -71,7 +71,7 @@ public class ActionDebugDesignDetail extends ActionBase {
 				uf(cmd);
 			} else {
 				HelpFormatter formatter = new HelpFormatter();
-				formatter.printHelp("ddd (Debug Design Detail)", options);
+				formatter.printHelp("control command", options);
 			}
 		} catch (Exception e) {
 			e.printStackTrace();

+ 1265 - 45
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/describe.json

@@ -5074,6 +5074,98 @@
             }
           ]
         },
+        {
+          "name": "deleteEdition",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionDeleteEdition",
+          "description": "删除流程所有版本.",
+          "type": "DELETE",
+          "path": "jaxrs/process/{id}/{onlyRemoveNotCompleted}/edition",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "id",
+              "type": "String",
+              "description": "标识"
+            },
+            {
+              "name": "onlyRemoveNotCompleted",
+              "type": "boolean",
+              "description": "仅删除流转中Work"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "id"
+            }
+          ]
+        },
+        {
+          "name": "disableProcess",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionDisable",
+          "description": "停用当前版本流程.",
+          "type": "GET",
+          "path": "jaxrs/process/{id}/disable",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "id",
+              "type": "String",
+              "description": "标识"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "value",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "布尔值."
+            }
+          ]
+        },
+        {
+          "name": "enableProcess",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionEnable",
+          "description": "启用当前版本流程.",
+          "type": "GET",
+          "path": "jaxrs/process/{id}/enable",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "id",
+              "type": "String",
+              "description": "标识"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "value",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "布尔值."
+            }
+          ]
+        },
         {
           "name": "executeProjection",
           "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionExecuteProjection",
@@ -5398,7 +5490,7 @@
               "name": "edition",
               "type": "String",
               "isCollection": false,
-              "description": "版本,唯一编码."
+              "description": "版本编码,不同版本的流程编码需相同."
             },
             {
               "name": "editionName",
@@ -5416,7 +5508,19 @@
               "name": "editionNumber",
               "type": "Double",
               "isCollection": false,
-              "description": "版本名"
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
             },
             {
               "name": "distributeFactor",
@@ -5445,11 +5549,11 @@
           ]
         },
         {
-          "name": "leadOut",
-          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionLeadOut",
-          "description": "导出流程.",
+          "name": "getEnabled",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionGetEnabled",
+          "description": "获取启用版本流程内容.含所有节点和路由信息",
           "type": "GET",
-          "path": "jaxrs/process/{id}/lead/out",
+          "path": "jaxrs/process/{id}/enabled",
           "contentType": "application/json",
           "resultContentType": "application/json; charset\u003dUTF-8",
           "useJsonElementParameter": false,
@@ -5739,7 +5843,7 @@
               "name": "edition",
               "type": "String",
               "isCollection": false,
-              "description": "版本,唯一编码."
+              "description": "版本编码,不同版本的流程编码需相同."
             },
             {
               "name": "editionName",
@@ -5757,7 +5861,19 @@
               "name": "editionNumber",
               "type": "Double",
               "isCollection": false,
-              "description": "版本名"
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
             },
             {
               "name": "distributeFactor",
@@ -5786,20 +5902,20 @@
           ]
         },
         {
-          "name": "listWithApplication",
-          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionListWithApplication",
-          "description": "列示某个应用的所有流程.",
+          "name": "leadOut",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionLeadOut",
+          "description": "导出流程.",
           "type": "GET",
-          "path": "jaxrs/process/application/{applicationId}",
+          "path": "jaxrs/process/{id}/lead/out",
           "contentType": "application/json",
           "resultContentType": "application/json; charset\u003dUTF-8",
           "useJsonElementParameter": false,
           "useStringParameter": false,
           "pathParameters": [
             {
-              "name": "applicationId",
+              "name": "id",
               "type": "String",
-              "description": ""
+              "description": "标识"
             }
           ],
           "formParameters": [],
@@ -6080,7 +6196,7 @@
               "name": "edition",
               "type": "String",
               "isCollection": false,
-              "description": "版本,唯一编码."
+              "description": "版本编码,不同版本的流程编码需相同."
             },
             {
               "name": "editionName",
@@ -6098,7 +6214,25 @@
               "name": "editionNumber",
               "type": "Double",
               "isCollection": false,
-              "description": "版本名"
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
+            },
+            {
+              "name": "distributeFactor",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "分布式存储标识位."
             },
             {
               "name": "createTime",
@@ -6111,47 +6245,30 @@
               "type": "Date",
               "isCollection": false,
               "description": "修改时间,自动生成,索引创建在约束中."
-            }
-          ]
-        },
-        {
-          "name": "post",
-          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionCreate",
-          "description": "创建流程.",
-          "type": "POST",
-          "path": "jaxrs/process",
-          "contentType": "application/json",
-          "resultContentType": "application/json; charset\u003dUTF-8",
-          "useJsonElementParameter": true,
-          "useStringParameter": false,
-          "pathParameters": [],
-          "formParameters": [],
-          "queryParameters": [],
-          "ins": [],
-          "outs": [
+            },
             {
-              "name": "id",
+              "name": "sequence",
               "type": "String",
               "isCollection": false,
-              "description": "id"
+              "description": "列表序号,由创建时间以及ID组成.在保存时自动生成,索引创建在约束中."
             }
           ]
         },
         {
-          "name": "put",
-          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionEdit",
-          "description": "更新流程.",
-          "type": "PUT",
-          "path": "jaxrs/process/{id}",
+          "name": "listDisableEdition",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionListDisableEdition",
+          "description": "列示未启用的流程版本.",
+          "type": "GET",
+          "path": "jaxrs/process/application/{applicationId}/disable/edition",
           "contentType": "application/json",
           "resultContentType": "application/json; charset\u003dUTF-8",
-          "useJsonElementParameter": true,
+          "useJsonElementParameter": false,
           "useStringParameter": false,
           "pathParameters": [
             {
-              "name": "id",
+              "name": "applicationId",
               "type": "String",
-              "description": "标识"
+              "description": "应用标识"
             }
           ],
           "formParameters": [],
@@ -6162,7 +6279,1110 @@
               "name": "id",
               "type": "String",
               "isCollection": false,
-              "description": "id"
+              "description": "数据库主键,自动生成."
+            },
+            {
+              "name": "name",
+              "type": "String",
+              "isCollection": false,
+              "description": "名称."
+            },
+            {
+              "name": "alias",
+              "type": "String",
+              "isCollection": false,
+              "description": "别名."
+            },
+            {
+              "name": "description",
+              "type": "String",
+              "isCollection": false,
+              "description": "描述."
+            },
+            {
+              "name": "creatorPerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程创建者."
+            },
+            {
+              "name": "lastUpdatePerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "最后的编辑者."
+            },
+            {
+              "name": "lastUpdateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "最后的编辑时间."
+            },
+            {
+              "name": "application",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程所属应用."
+            },
+            {
+              "name": "controllerList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "流程管理者."
+            },
+            {
+              "name": "icon",
+              "type": "String",
+              "isCollection": false,
+              "description": "icon Base64编码后的文本."
+            },
+            {
+              "name": "beforeBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "beforeBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "afterBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "afterBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "beforeEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "beforeEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "afterEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "afterEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "startableIdentityList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的用户."
+            },
+            {
+              "name": "startableUnitList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的组织."
+            },
+            {
+              "name": "serialTexture",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号定义."
+            },
+            {
+              "name": "serialActivity",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动ID."
+            },
+            {
+              "name": "serialPhase",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动阶段可以选择arrive或者inquire,默认情况下为空为arrive"
+            },
+            {
+              "name": "expireType",
+              "type": "ExpireType",
+              "isCollection": false,
+              "description": "过期方式.可选值never,appoint,script"
+            },
+            {
+              "name": "expireDay",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期日期."
+            },
+            {
+              "name": "expireHour",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期小时."
+            },
+            {
+              "name": "expireWorkTime",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "过期是否是工作时间."
+            },
+            {
+              "name": "expireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本."
+            },
+            {
+              "name": "expireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本文本."
+            },
+            {
+              "name": "checkDraft",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "是否进行无内容的草稿删除校验."
+            },
+            {
+              "name": "projection",
+              "type": "String",
+              "isCollection": false,
+              "description": "字段映射配置."
+            },
+            {
+              "name": "projectionFully",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "执行完全映射,在每次流转时会将所有的工作,待办,已办,待阅,已阅,参阅执行全部字段映射,默认false"
+            },
+            {
+              "name": "routeNameAsOpinion",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "如果没有默认意见那么将路由名称作为默认意见."
+            },
+            {
+              "name": "beforeArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本."
+            },
+            {
+              "name": "beforeArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本文本."
+            },
+            {
+              "name": "afterArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本."
+            },
+            {
+              "name": "afterArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本文本."
+            },
+            {
+              "name": "beforeExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本."
+            },
+            {
+              "name": "beforeExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本文本."
+            },
+            {
+              "name": "afterExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本."
+            },
+            {
+              "name": "afterExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本文本."
+            },
+            {
+              "name": "beforeInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本."
+            },
+            {
+              "name": "beforeInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本文本."
+            },
+            {
+              "name": "afterInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本."
+            },
+            {
+              "name": "afterInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本文本."
+            },
+            {
+              "name": "edition",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本编码,不同版本的流程编码需相同."
+            },
+            {
+              "name": "editionName",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本名"
+            },
+            {
+              "name": "editionEnable",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "启用版本"
+            },
+            {
+              "name": "editionNumber",
+              "type": "Double",
+              "isCollection": false,
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
+            },
+            {
+              "name": "createTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "创建时间,自动生成,索引创建在约束中."
+            },
+            {
+              "name": "updateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "修改时间,自动生成,索引创建在约束中."
+            }
+          ]
+        },
+        {
+          "name": "listEdition",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionListEdition",
+          "description": "列示流程的所有版本.",
+          "type": "GET",
+          "path": "jaxrs/process/application/{applicationId}/edition/{edition}",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "applicationId",
+              "type": "String",
+              "description": "应用标识"
+            },
+            {
+              "name": "edition",
+              "type": "String",
+              "description": "流程版本标志"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "数据库主键,自动生成."
+            },
+            {
+              "name": "name",
+              "type": "String",
+              "isCollection": false,
+              "description": "名称."
+            },
+            {
+              "name": "alias",
+              "type": "String",
+              "isCollection": false,
+              "description": "别名."
+            },
+            {
+              "name": "description",
+              "type": "String",
+              "isCollection": false,
+              "description": "描述."
+            },
+            {
+              "name": "creatorPerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程创建者."
+            },
+            {
+              "name": "lastUpdatePerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "最后的编辑者."
+            },
+            {
+              "name": "lastUpdateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "最后的编辑时间."
+            },
+            {
+              "name": "application",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程所属应用."
+            },
+            {
+              "name": "controllerList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "流程管理者."
+            },
+            {
+              "name": "icon",
+              "type": "String",
+              "isCollection": false,
+              "description": "icon Base64编码后的文本."
+            },
+            {
+              "name": "beforeBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "beforeBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "afterBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "afterBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "beforeEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "beforeEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "afterEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "afterEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "startableIdentityList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的用户."
+            },
+            {
+              "name": "startableUnitList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的组织."
+            },
+            {
+              "name": "serialTexture",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号定义."
+            },
+            {
+              "name": "serialActivity",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动ID."
+            },
+            {
+              "name": "serialPhase",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动阶段可以选择arrive或者inquire,默认情况下为空为arrive"
+            },
+            {
+              "name": "expireType",
+              "type": "ExpireType",
+              "isCollection": false,
+              "description": "过期方式.可选值never,appoint,script"
+            },
+            {
+              "name": "expireDay",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期日期."
+            },
+            {
+              "name": "expireHour",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期小时."
+            },
+            {
+              "name": "expireWorkTime",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "过期是否是工作时间."
+            },
+            {
+              "name": "expireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本."
+            },
+            {
+              "name": "expireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本文本."
+            },
+            {
+              "name": "checkDraft",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "是否进行无内容的草稿删除校验."
+            },
+            {
+              "name": "projection",
+              "type": "String",
+              "isCollection": false,
+              "description": "字段映射配置."
+            },
+            {
+              "name": "projectionFully",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "执行完全映射,在每次流转时会将所有的工作,待办,已办,待阅,已阅,参阅执行全部字段映射,默认false"
+            },
+            {
+              "name": "routeNameAsOpinion",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "如果没有默认意见那么将路由名称作为默认意见."
+            },
+            {
+              "name": "beforeArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本."
+            },
+            {
+              "name": "beforeArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本文本."
+            },
+            {
+              "name": "afterArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本."
+            },
+            {
+              "name": "afterArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本文本."
+            },
+            {
+              "name": "beforeExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本."
+            },
+            {
+              "name": "beforeExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本文本."
+            },
+            {
+              "name": "afterExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本."
+            },
+            {
+              "name": "afterExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本文本."
+            },
+            {
+              "name": "beforeInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本."
+            },
+            {
+              "name": "beforeInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本文本."
+            },
+            {
+              "name": "afterInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本."
+            },
+            {
+              "name": "afterInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本文本."
+            },
+            {
+              "name": "edition",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本编码,不同版本的流程编码需相同."
+            },
+            {
+              "name": "editionName",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本名"
+            },
+            {
+              "name": "editionEnable",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "启用版本"
+            },
+            {
+              "name": "editionNumber",
+              "type": "Double",
+              "isCollection": false,
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
+            },
+            {
+              "name": "createTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "创建时间,自动生成,索引创建在约束中."
+            },
+            {
+              "name": "updateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "修改时间,自动生成,索引创建在约束中."
+            }
+          ]
+        },
+        {
+          "name": "listWithApplication",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionListWithApplication",
+          "description": "列示某个应用的所有流程.",
+          "type": "GET",
+          "path": "jaxrs/process/application/{applicationId}",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "applicationId",
+              "type": "String",
+              "description": ""
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "数据库主键,自动生成."
+            },
+            {
+              "name": "name",
+              "type": "String",
+              "isCollection": false,
+              "description": "名称."
+            },
+            {
+              "name": "alias",
+              "type": "String",
+              "isCollection": false,
+              "description": "别名."
+            },
+            {
+              "name": "description",
+              "type": "String",
+              "isCollection": false,
+              "description": "描述."
+            },
+            {
+              "name": "creatorPerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程创建者."
+            },
+            {
+              "name": "lastUpdatePerson",
+              "type": "String",
+              "isCollection": false,
+              "description": "最后的编辑者."
+            },
+            {
+              "name": "lastUpdateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "最后的编辑时间."
+            },
+            {
+              "name": "application",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程所属应用."
+            },
+            {
+              "name": "controllerList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "流程管理者."
+            },
+            {
+              "name": "icon",
+              "type": "String",
+              "isCollection": false,
+              "description": "icon Base64编码后的文本."
+            },
+            {
+              "name": "beforeBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "beforeBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "afterBeginScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本."
+            },
+            {
+              "name": "afterBeginScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程启动前事件脚本文本."
+            },
+            {
+              "name": "beforeEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "beforeEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "afterEndScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本."
+            },
+            {
+              "name": "afterEndScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "流程结束后事件脚本文本."
+            },
+            {
+              "name": "startableIdentityList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的用户."
+            },
+            {
+              "name": "startableUnitList",
+              "type": "List\u003cString\u003e",
+              "isCollection": true,
+              "description": "在指定启动时候,允许新建Work的组织."
+            },
+            {
+              "name": "serialTexture",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号定义."
+            },
+            {
+              "name": "serialActivity",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动ID."
+            },
+            {
+              "name": "serialPhase",
+              "type": "String",
+              "isCollection": false,
+              "description": "编号活动阶段可以选择arrive或者inquire,默认情况下为空为arrive"
+            },
+            {
+              "name": "expireType",
+              "type": "ExpireType",
+              "isCollection": false,
+              "description": "过期方式.可选值never,appoint,script"
+            },
+            {
+              "name": "expireDay",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期日期."
+            },
+            {
+              "name": "expireHour",
+              "type": "Integer",
+              "isCollection": false,
+              "description": "过期小时."
+            },
+            {
+              "name": "expireWorkTime",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "过期是否是工作时间."
+            },
+            {
+              "name": "expireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本."
+            },
+            {
+              "name": "expireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "过期时间设定脚本文本."
+            },
+            {
+              "name": "checkDraft",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "是否进行无内容的草稿删除校验."
+            },
+            {
+              "name": "projection",
+              "type": "String",
+              "isCollection": false,
+              "description": "字段映射配置."
+            },
+            {
+              "name": "projectionFully",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "执行完全映射,在每次流转时会将所有的工作,待办,已办,待阅,已阅,参阅执行全部字段映射,默认false"
+            },
+            {
+              "name": "routeNameAsOpinion",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "如果没有默认意见那么将路由名称作为默认意见."
+            },
+            {
+              "name": "beforeArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本."
+            },
+            {
+              "name": "beforeArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达前事件脚本文本."
+            },
+            {
+              "name": "afterArriveScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本."
+            },
+            {
+              "name": "afterArriveScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动到达后事件脚本文本."
+            },
+            {
+              "name": "beforeExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本."
+            },
+            {
+              "name": "beforeExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行前事件脚本文本."
+            },
+            {
+              "name": "afterExecuteScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本."
+            },
+            {
+              "name": "afterExecuteScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一活动执行后事件脚本文本."
+            },
+            {
+              "name": "beforeInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本."
+            },
+            {
+              "name": "beforeInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询前事件脚本文本."
+            },
+            {
+              "name": "afterInquireScript",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本."
+            },
+            {
+              "name": "afterInquireScriptText",
+              "type": "String",
+              "isCollection": false,
+              "description": "统一路由查询后事件脚本文本."
+            },
+            {
+              "name": "edition",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本编码,不同版本的流程编码需相同."
+            },
+            {
+              "name": "editionName",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本名"
+            },
+            {
+              "name": "editionEnable",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "启用版本"
+            },
+            {
+              "name": "editionNumber",
+              "type": "Double",
+              "isCollection": false,
+              "description": "版本号"
+            },
+            {
+              "name": "editionDes",
+              "type": "String",
+              "isCollection": false,
+              "description": "版本描述."
+            },
+            {
+              "name": "defaultStartMode",
+              "type": "String",
+              "isCollection": false,
+              "description": "默认启动方式,draft,instance"
+            },
+            {
+              "name": "createTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "创建时间,自动生成,索引创建在约束中."
+            },
+            {
+              "name": "updateTime",
+              "type": "Date",
+              "isCollection": false,
+              "description": "修改时间,自动生成,索引创建在约束中."
+            }
+          ]
+        },
+        {
+          "name": "post",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionCreate",
+          "description": "创建流程.",
+          "type": "POST",
+          "path": "jaxrs/process",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": true,
+          "useStringParameter": false,
+          "pathParameters": [],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "id"
+            }
+          ]
+        },
+        {
+          "name": "put",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionEdit",
+          "description": "更新流程.",
+          "type": "PUT",
+          "path": "jaxrs/process/{id}",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": true,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "id",
+              "type": "String",
+              "description": "标识"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "id"
+            }
+          ]
+        },
+        {
+          "name": "upgrade",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionUpgrade",
+          "description": "升级流程.",
+          "type": "POST",
+          "path": "jaxrs/process/{id}/upgrade",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": true,
+          "useStringParameter": false,
+          "pathParameters": [
+            {
+              "name": "id",
+              "type": "String",
+              "description": "标识"
+            }
+          ],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "id",
+              "type": "String",
+              "isCollection": false,
+              "description": "id"
+            }
+          ]
+        },
+        {
+          "name": "upgradeAll",
+          "className": "com.x.processplatform.assemble.designer.jaxrs.process.ActionUpgradeAll",
+          "description": "给所有流程打上版本信息.",
+          "type": "GET",
+          "path": "jaxrs/process/upgrade/all",
+          "contentType": "application/json",
+          "resultContentType": "application/json; charset\u003dUTF-8",
+          "useJsonElementParameter": false,
+          "useStringParameter": false,
+          "pathParameters": [],
+          "formParameters": [],
+          "queryParameters": [],
+          "ins": [],
+          "outs": [
+            {
+              "name": "value",
+              "type": "Boolean",
+              "isCollection": false,
+              "description": "布尔值."
             }
           ]
         }

+ 84 - 4
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/element/factory/ProcessFactory.java

@@ -5,15 +5,14 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 import javax.persistence.EntityManager;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import javax.persistence.criteria.*;
 
 import com.x.processplatform.assemble.designer.AbstractFactory;
 import com.x.processplatform.assemble.designer.Business;
+import com.x.processplatform.core.entity.element.Application;
 import com.x.processplatform.core.entity.element.Process;
 import com.x.processplatform.core.entity.element.Process_;
+import org.apache.commons.lang3.StringUtils;
 
 public class ProcessFactory extends AbstractFactory {
 
@@ -27,6 +26,8 @@ public class ProcessFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Process> root = cq.from(Process.class);
 		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)),
+				cb.isNull(root.get(Process_.editionEnable))));
 		cq.select(root.get(Process_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}
@@ -37,14 +38,93 @@ public class ProcessFactory extends AbstractFactory {
 		CriteriaQuery<Process> cq = cb.createQuery(Process.class);
 		Root<Process> root = cq.from(Process.class);
 		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)),
+				cb.isNull(root.get(Process_.editionEnable))));
 		cq.select(root).where(p);
 		return em.createQuery(cq).getResultList();
 	}
 
+	public List<String> listProcessEdition(String application, String edition) throws Exception {
+		EntityManager em = this.entityManagerContainer().get(Process.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<String> cq = cb.createQuery(String.class);
+		Root<Process> root = cq.from(Process.class);
+		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.equal(root.get(Process_.edition), edition));
+		cq.select(root.get(Process_.id)).where(p).orderBy(cb.desc(root.get(Process_.editionNumber)));
+		return em.createQuery(cq).getResultList();
+	}
+
+	public List<Process> listProcessEditionObject(String application, String edition) throws Exception {
+		EntityManager em = this.entityManagerContainer().get(Process.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<Process> cq = cb.createQuery(Process.class);
+		Root<Process> root = cq.from(Process.class);
+		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.equal(root.get(Process_.edition), edition));
+		cq.select(root).where(p).orderBy(cb.desc(root.get(Process_.editionNumber)));
+		return em.createQuery(cq).getResultList();
+	}
+
+	public List<String> listProcessDisableEdition(String application) throws Exception {
+		EntityManager em = this.entityManagerContainer().get(Process.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<String> cq = cb.createQuery(String.class);
+		Root<Process> root = cq.from(Process.class);
+		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.isNotNull(root.get(Process_.edition)));
+		p = cb.and(p, cb.notEqual(root.get(Process_.edition), ""));
+
+		Subquery<Process> subquery = cq.subquery(Process.class);
+		Root<Process> subRoot = subquery.from(Process.class);
+		Predicate subP = cb.conjunction();
+		subP = cb.and(subP, cb.equal(root.get(Process_.edition), subRoot.get(Process_.edition)));
+		subP = cb.and(subP, cb.isTrue(subRoot.get(Process_.editionEnable)));
+		subquery.select(subRoot).where(subP);
+		p = cb.and(p, cb.not(cb.exists(subquery)));
+
+		cq.distinct(true).select(root.get(Process_.edition)).where(p);
+		return em.createQuery(cq).getResultList();
+	}
+
+	public Process getEnabledProcess(String application, String edition) throws Exception {
+		EntityManager em = this.entityManagerContainer().get(Process.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<Process> cq = cb.createQuery(Process.class);
+		Root<Process> root = cq.from(Process.class);
+		Predicate p = cb.equal(root.get(Process_.application), application);
+		p = cb.and(p, cb.equal(root.get(Process_.edition), edition));
+		p = cb.and(p, cb.isTrue(root.get(Process_.editionEnable)));
+		cq.select(root).where(p).orderBy(cb.desc(root.get(Process_.editionNumber)));
+		List<Process> list = em.createQuery(cq).getResultList();
+		if(list!=null && !list.isEmpty()){
+			return list.get(0);
+		}
+		return null;
+	}
+
 	public <T extends Process> List<T> sort(List<T> list) {
 		list = list.stream().sorted(Comparator.comparing(Process::getName, Comparator.nullsLast(String::compareTo)))
 				.collect(Collectors.toList());
 		return list;
 	}
 
+	public Double getMaxEditionNumber(String application, String edition) throws Exception {
+		if (StringUtils.isNotEmpty(edition)){
+			EntityManager em = this.entityManagerContainer().get(Process.class);
+			CriteriaBuilder cb = em.getCriteriaBuilder();
+			CriteriaQuery<Double> cq = cb.createQuery(Double.class);
+			Root<Process> root = cq.from(Process.class);
+			Predicate p = cb.equal(root.get(Process_.application), application);
+			p = cb.and(p,cb.equal(root.get(Process_.edition), edition));
+			cq.select(cb.max(root.get(Process_.editionNumber))).where(p);
+			Double max = em.createQuery(cq).getSingleResult();
+			if(max == null || max < 1.0){
+				max = 1.0;
+			}
+			return max;
+		}
+		return 1.0;
+	}
+
 }

+ 18 - 0
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java

@@ -1,6 +1,7 @@
 package com.x.processplatform.assemble.designer.jaxrs.input;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import javax.persistence.EntityManager;
@@ -11,6 +12,7 @@ import javax.persistence.criteria.Root;
 
 import com.x.base.core.project.cache.ApplicationCache;
 import org.apache.commons.collections4.ListUtils;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.reflect.FieldUtils;
 
@@ -209,6 +211,22 @@ class ActionCover extends BaseAction {
 						Process.class, process.getId()));
 			}
 			process.setApplication(application.getId());
+			if (StringUtils.isNotEmpty(process.getEdition())) {
+				if(BooleanUtils.isTrue(process.getEditionEnable())) {
+					for (Process p : business.entityManagerContainer().listEqualAndEqual(Process.class, Process.application_FIELDNAME,
+							process.getApplication(), Process.edition_FIELDNAME, process.getEdition())) {
+						if (!process.getId().equals(p.getId()) && BooleanUtils.isTrue(p.getEditionEnable())) {
+							p.setLastUpdateTime(new Date());
+							p.setEditionEnable(false);
+						}
+					}
+				}
+			}else{
+				process.setEdition(process.getId());
+				process.setEditionEnable(true);
+				process.setEditionNumber(1.0);
+				process.setEditionName(process.getName() + "_V" + process.getEditionNumber());
+			}
 			persistObjects.addAll(this.coverProcessElement(business, process, WrapAgent.inCopier,
 					wrapProcess.getAgentList(), Agent.class));
 			persistObjects.addAll(this.coverProcessElement(business, process, WrapBegin.inCopier,

+ 19 - 0
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/input/ActionCreate.java

@@ -1,6 +1,7 @@
 package com.x.processplatform.assemble.designer.jaxrs.input;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import com.google.gson.JsonElement;
@@ -59,6 +60,8 @@ import com.x.processplatform.core.entity.element.wrap.WrapRoute;
 import com.x.processplatform.core.entity.element.wrap.WrapScript;
 import com.x.processplatform.core.entity.element.wrap.WrapService;
 import com.x.processplatform.core.entity.element.wrap.WrapSplit;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
 
 class ActionCreate extends BaseAction {
 
@@ -153,6 +156,22 @@ class ActionCreate extends BaseAction {
 			process = WrapProcess.inCopier.copy(wrapProcess);
 			process.setApplication(application.getId());
 			persistObjects.add(process);
+			if (StringUtils.isNotEmpty(process.getEdition())) {
+				if(BooleanUtils.isTrue(process.getEditionEnable())) {
+					for (Process p : business.entityManagerContainer().listEqualAndEqual(Process.class, Process.application_FIELDNAME,
+							process.getApplication(), Process.edition_FIELDNAME, process.getEdition())) {
+						if (!process.getId().equals(p.getId()) && BooleanUtils.isTrue(p.getEditionEnable())) {
+							p.setLastUpdateTime(new Date());
+							p.setEditionEnable(false);
+						}
+					}
+				}
+			}else{
+				process.setEdition(process.getId());
+				process.setEditionEnable(true);
+				process.setEditionNumber(1.0);
+				process.setEditionName(process.getName() + "_V" + process.getEditionNumber());
+			}
 			for (WrapAgent _o : wrapProcess.getAgentList()) {
 				Agent obj = business.entityManagerContainer().find(_o.getId(), Agent.class);
 				if (null != obj) {

+ 9 - 0
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionCreate.java

@@ -32,6 +32,7 @@ import com.x.processplatform.core.entity.element.Route;
 import com.x.processplatform.core.entity.element.Service;
 import com.x.processplatform.core.entity.element.Split;
 import com.x.processplatform.core.entity.element.wrap.WrapProcess;
+import org.apache.commons.lang3.StringUtils;
 
 class ActionCreate extends BaseAction {
 
@@ -54,6 +55,7 @@ class ActionCreate extends BaseAction {
 			process.setCreatorPerson(effectivePerson.getDistinguishedName());
 			process.setLastUpdatePerson(effectivePerson.getDistinguishedName());
 			process.setLastUpdateTime(new Date());
+			this.updateEdition(process);
 			jpaObjects.add(process);
 			jpaObjects.addAll(create_agent(wrapIn.getAgentList(), process));
 			jpaObjects.add(create_begin(wrapIn.getBegin(), process));
@@ -103,4 +105,11 @@ class ActionCreate extends BaseAction {
 
 	}
 
+	private void updateEdition(Process process) throws Exception {
+		process.setEdition(process.getId());
+		process.setEditionEnable(true);
+		process.setEditionNumber(1.0);
+		process.setEditionName(process.getName() + "_V" + process.getEditionNumber());
+	}
+
 }

+ 10 - 0
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionDelete.java

@@ -24,6 +24,10 @@ import com.x.processplatform.core.entity.element.Process;
 import com.x.processplatform.core.entity.element.Route;
 import com.x.processplatform.core.entity.element.Service;
 import com.x.processplatform.core.entity.element.Split;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
 
 class ActionDelete extends BaseAction {
 
@@ -44,6 +48,12 @@ class ActionDelete extends BaseAction {
 				throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(),
 						application.getName(), application.getId());
 			}
+			if(StringUtils.isNotEmpty(process.getEdition()) && BooleanUtils.isTrue(process.getEditionEnable())){
+				List<String> list = business.process().listProcessEdition(process.getApplication(), process.getEdition());
+				if(list.size()>1){
+					throw new ExceptionProcessEnabled(id);
+				}
+			}
 			/* 先删除content内容 */
 			this.delete_task(business, process);
 			this.delete_taskCompleted(business, process, onlyRemoveNotCompleted);

+ 17 - 9
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionEdit.java

@@ -1,7 +1,9 @@
 package com.x.processplatform.assemble.designer.jaxrs.process;
 
 import java.util.Date;
+import java.util.UUID;
 
+import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 
@@ -54,6 +56,7 @@ class ActionEdit extends BaseAction {
 				throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(),
 						application.getName(), application.getId());
 			}
+			Process oldProcess = (Process) BeanUtils.cloneBean(process);
 			emc.beginTransaction(Process.class);
 			emc.beginTransaction(Agent.class);
 			emc.beginTransaction(Begin.class);
@@ -71,7 +74,8 @@ class ActionEdit extends BaseAction {
 			emc.beginTransaction(Service.class);
 			emc.beginTransaction(Split.class);
 			WrapProcess.inCopier.copy(wrap, process);
-			updateCreatePersonLastUpdatePerson(effectivePerson, business, process);
+			this.updateCreatePersonLastUpdatePerson(effectivePerson, business, process);
+			this.updateEdition(oldProcess, process);
 			process.setLastUpdateTime(new Date());
 			emc.check(process, CheckPersistType.all);
 			update_agent(business, wrap.getAgentList(), process);
@@ -89,7 +93,6 @@ class ActionEdit extends BaseAction {
 			update_route(business, wrap.getRouteList(), process);
 			update_service(business, wrap.getServiceList(), process);
 			update_split(business, wrap.getSplitList(), process);
-			this.updateEdition(business, process);
 			emc.commit();
 			cacheNotify();
 			/* 保存历史版本 */
@@ -117,13 +120,18 @@ class ActionEdit extends BaseAction {
 		}
 	}
 
-	private void updateEdition(Business business, Process process) throws Exception {
-		if (StringUtils.isNotEmpty(process.getEdition()) && BooleanUtils.isTrue(process.getEditionEnable())) {
-			for (Process p : business.entityManagerContainer().listEqual(Process.class, Process.edition_FIELDNAME,
-					process.getEdition())) {
-				p.setEditionEnable(false);
-				p.setEditionName(process.getEditionName());
-			}
+	private void updateEdition(Process oldProcess, Process process) throws Exception {
+		//更新流程时保持流程的版本信息不变,但当不存在版本信息则添加版本信息
+		if (StringUtils.isEmpty(oldProcess.getEdition())) {
+			process.setEdition(process.getId());
+			process.setEditionEnable(true);
+			process.setEditionNumber(1.0);
+			process.setEditionName(process.getName() + "_V" + process.getEditionNumber());
+		}else{
+			process.setEdition(oldProcess.getEdition());
+			process.setEditionEnable(oldProcess.getEditionEnable());
+			process.setEditionNumber(oldProcess.getEditionNumber());
+			process.setEditionName(process.getName() + "_V" + process.getEditionNumber());
 		}
 	}
 }

+ 1 - 11
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ActionListWithApplication.java

@@ -35,7 +35,7 @@ class ActionListWithApplication extends BaseAction {
 				throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(),
 						application.getName(), application.getId());
 			}
-			List<Wo> wos = Wo.copier.copy(this.listWithApplication(business, application));
+			List<Wo> wos = Wo.copier.copy(business.process().listWithApplicationObject(applicationId));
 			wos = business.process().sort(wos);
 			result.setData(wos);
 			return result;
@@ -50,14 +50,4 @@ class ActionListWithApplication extends BaseAction {
 				JpaObject.FieldsInvisible);
 	}
 
-	private List<Process> listWithApplication(Business business, Application application) throws Exception {
-		EntityManager em = business.entityManagerContainer().get(Process.class);
-		CriteriaBuilder cb = em.getCriteriaBuilder();
-		CriteriaQuery<Process> cq = cb.createQuery(Process.class);
-		Root<Process> root = cq.from(Process.class);
-		Predicate p = cb.equal(root.get(Process_.application), application.getId());
-		cq.select(root).where(p);
-		return em.createQuery(cq).getResultList();
-	}
-
 }

+ 14 - 14
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/BaseAction.java

@@ -205,8 +205,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapAgent w : wraps) {
 				Agent o = new Agent();
-				o.setProcess(process.getId());
 				WrapAgent.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -218,8 +218,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		Begin o = null;
 		if (wrap != null) {
 			o = new Begin();
-			o.setProcess(process.getId());
 			WrapBegin.inCopier.copy(wrap, o);
+			o.setProcess(process.getId());
 			o.setDistributeFactor(process.getDistributeFactor());
 		}
 		return o;
@@ -230,8 +230,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapCancel w : wraps) {
 				Cancel o = new Cancel();
-				o.setProcess(process.getId());
 				WrapCancel.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -244,8 +244,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapChoice w : wraps) {
 				Choice o = new Choice();
-				o.setProcess(process.getId());
 				WrapChoice.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -258,8 +258,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapDelay w : wraps) {
 				Delay o = new Delay();
-				o.setProcess(process.getId());
 				WrapDelay.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -272,8 +272,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapEmbed w : wraps) {
 				Embed o = new Embed();
-				o.setProcess(process.getId());
 				WrapEmbed.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -286,8 +286,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapEnd w : wraps) {
 				End o = new End();
-				o.setProcess(process.getId());
 				WrapEnd.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -300,8 +300,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapInvoke w : wraps) {
 				Invoke o = new Invoke();
-				o.setProcess(process.getId());
 				WrapInvoke.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -314,8 +314,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapManual w : wraps) {
 				Manual o = new Manual();
-				o.setProcess(process.getId());
 				WrapManual.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -328,8 +328,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapMerge w : wraps) {
 				Merge o = new Merge();
-				o.setProcess(process.getId());
 				WrapMerge.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -342,8 +342,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapMessage w : wraps) {
 				Message o = new Message();
-				o.setProcess(process.getId());
 				WrapMessage.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -356,8 +356,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapParallel w : wraps) {
 				Parallel o = new Parallel();
-				o.setProcess(process.getId());
 				WrapParallel.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -370,8 +370,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (int i = 0; i < wraps.size(); i++) {
 				Route o = new Route();
-				o.setProcess(process.getId());
 				WrapRoute.inCopier.copy(wraps.get(i), o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}
@@ -399,8 +399,8 @@ abstract class BaseAction extends StandardJaxrsAction {
 		if (null != wraps) {
 			for (WrapSplit w : wraps) {
 				Split o = new Split();
-				o.setProcess(process.getId());
 				WrapSplit.inCopier.copy(w, o);
+				o.setProcess(process.getId());
 				o.setDistributeFactor(process.getDistributeFactor());
 				list.add(o);
 			}

+ 145 - 0
o2server/x_processplatform_assemble_designer/src/main/webapp/describe/sources/com/x/processplatform/assemble/designer/jaxrs/process/ProcessAction.java

@@ -52,6 +52,24 @@ public class ProcessAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
+	@JaxrsMethodDescribe(value = "获取启用版本流程内容.含所有节点和路由信息", action = ActionGetEnabled.class)
+	@GET
+	@Path("{id}/enabled")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getEnabled(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+					@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<ActionGetEnabled.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetEnabled().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
 	@JaxrsMethodDescribe(value = "创建流程.", action = ActionCreate.class)
 	@POST
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@@ -87,6 +105,24 @@ public class ProcessAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
+	@JaxrsMethodDescribe(value = "升级流程.", action = ActionUpgrade.class)
+	@POST
+	@Path("{id}/upgrade")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void upgrade(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+						@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
+		ActionResult<ActionUpgrade.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionUpgrade().execute(effectivePerson, id, jsonElement);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, jsonElement);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
 	@JaxrsMethodDescribe(value = "删除流程.", action = ActionDelete.class)
 	@DELETE
 	@Path("{id}/{onlyRemoveNotCompleted}")
@@ -106,6 +142,25 @@ public class ProcessAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
+	@JaxrsMethodDescribe(value = "删除流程所有版本.", action = ActionDeleteEdition.class)
+	@DELETE
+	@Path("{id}/{onlyRemoveNotCompleted}/edition")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void deleteEdition(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+					   @JaxrsParameterDescribe("标识") @PathParam("id") String id,
+					   @JaxrsParameterDescribe("仅删除流转中Work") @PathParam("onlyRemoveNotCompleted") boolean onlyRemoveNotCompleted) {
+		ActionResult<ActionDeleteEdition.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionDeleteEdition().execute(effectivePerson, id, onlyRemoveNotCompleted);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
 	@JaxrsMethodDescribe(value = "列示某个应用的所有流程.", action = ActionListWithApplication.class)
 	@GET
 	@Path("application/{applicationId}")
@@ -160,4 +215,94 @@ public class ProcessAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
+	@JaxrsMethodDescribe(value = "列示流程的所有版本.", action = ActionListEdition.class)
+	@GET
+	@Path("application/{applicationId}/edition/{edition}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void listEdition(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+							@JaxrsParameterDescribe("应用标识") @PathParam("applicationId") String applicationId,
+							@JaxrsParameterDescribe("流程版本标志") @PathParam("edition") String edition) {
+		ActionResult<List<ActionListEdition.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionListEdition().execute(effectivePerson, applicationId, edition);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "给所有流程打上版本信息.", action = ActionUpgradeAll.class)
+	@GET
+	@Path("upgrade/all")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void upgradeAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
+		ActionResult<ActionUpgradeAll.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionUpgradeAll().execute(effectivePerson);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "启用当前版本流程.", action = ActionEnable.class)
+	@GET
+	@Path("{id}/enable")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void enableProcess(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+							  @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<ActionEnable.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionEnable().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "列示未启用的流程版本.", action = ActionListDisableEdition.class)
+	@GET
+	@Path("application/{applicationId}/disable/edition")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void listDisableEdition(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+							@JaxrsParameterDescribe("应用标识") @PathParam("applicationId") String applicationId) {
+		ActionResult<List<ActionListDisableEdition.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionListDisableEdition().execute(effectivePerson, applicationId);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "停用当前版本流程.", action = ActionDisable.class)
+	@GET
+	@Path("{id}/disable")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void disableProcess(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+							  @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<ActionDisable.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionDisable().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
 }

+ 79 - 19
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/schedule/DeleteDraft.java

@@ -13,24 +13,27 @@ import javax.persistence.criteria.Path;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.time.DateUtils;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject_;
 import com.x.base.core.project.Applications;
 import com.x.base.core.project.x_processplatform_service_processing;
+import com.x.base.core.project.x_processplatform_assemble_surface;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.jaxrs.WoId;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.schedule.AbstractJob;
 import com.x.base.core.project.utils.time.TimeStamp;
+import com.x.processplatform.core.entity.content.Draft;
 import com.x.processplatform.core.entity.content.Work;
 import com.x.processplatform.core.entity.content.Work_;
 import com.x.processplatform.service.processing.ThisApplication;
 
+import org.apache.commons.lang3.time.DateUtils;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
 import fr.opensagres.poi.xwpf.converter.core.utils.StringUtils;
 
 public class DeleteDraft extends AbstractJob {
@@ -41,12 +44,40 @@ public class DeleteDraft extends AbstractJob {
 	public void schedule(JobExecutionContext jobExecutionContext) throws Exception {
 		try {
 			TimeStamp stamp = new TimeStamp();
-			List<Work> targets = new ArrayList<>();
-			String sequence = null;
-			AtomicInteger count = new AtomicInteger();
+			String draftSequence = null;
+			String workSequence = null;
+			AtomicInteger draftCount = new AtomicInteger();
+			AtomicInteger workCount = new AtomicInteger();
+			List<Draft> drafts = new ArrayList<>();
 			do {
+			
 				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-					targets = this.list(emc, sequence);
+					drafts = this.listDraft(emc, draftSequence);
+				}
+				if (!drafts.isEmpty()) {
+					draftSequence = drafts.get(drafts.size() - 1).getSequence();
+					for (Draft draft : drafts) {
+						try {
+							try {
+								ThisApplication.context().applications()
+										.deleteQuery(x_processplatform_assemble_surface.class,
+												Applications.joinQueryUri("draft", draft.getId()), draft.getId())
+										.getData(WoId.class);
+								draftCount.incrementAndGet();
+							} catch (Exception e) {
+								throw new ExceptionDeleteDraft(e, draft.getId(), draft.getTitle(), draft.getSequence());
+							}
+						} catch (Exception e) {
+							logger.error(e);
+						}
+					}
+				}
+			} while (!drafts.isEmpty());
+
+			
+			do {
+				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+					targets = this.listWork(emc, sequence);
 				}
 				if (!targets.isEmpty()) {
 					sequence = targets.get(targets.size() - 1).getSequence();
@@ -73,34 +104,63 @@ public class DeleteDraft extends AbstractJob {
 		}
 	}
 
-	private List<Work> list(EntityManagerContainer emc, String sequence) throws Exception {
+	private List<Work> listWork(EntityManagerContainer emc, String sequence) throws Exception {
 		Date date = new Date();
 		date = DateUtils.addMinutes(date, 0 - Config.processPlatform().getDeleteDraft().getThresholdMinutes());
 		EntityManager em = emc.get(Work.class);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
 		Root<Work> root = cq.from(Work.class);
-		Path<String> id_path = root.get(Work_.id);
-		Path<String> job_path = root.get(Work_.job);
-		Path<String> sequence_path = root.get(Work_.sequence);
-		Path<Date> sequence_activityArrivedTime = root.get(Work_.activityArrivedTime);
-		Predicate p = cb.lessThan(sequence_activityArrivedTime, date);
+		Path<String> idPath = root.get(Work_.id);
+		Path<String> jobPath = root.get(Work_.job);
+		Path<String> sequencePath = root.get(JpaObject_.sequence);
+		Path<Date> sequenceActivityArrivedTime = root.get(Work_.activityArrivedTime);
+		Predicate p = cb.lessThan(sequenceActivityArrivedTime, date);
 		p = cb.and(p, cb.equal(root.get(Work_.workThroughManual), false));
 		p = cb.and(p, cb.equal(root.get(Work_.workCreateType), Work.WORKCREATETYPE_SURFACE));
 		if (StringUtils.isNotEmpty(sequence)) {
-			p = cb.and(p, cb.greaterThan(sequence_path, sequence));
+			p = cb.and(p, cb.greaterThan(sequencePath, sequence));
 		}
-		cq.multiselect(id_path, job_path, sequence_path).where(p).orderBy(cb.asc(sequence_path));
+		cq.multiselect(idPath, jobPath, sequencePath).where(p).orderBy(cb.asc(sequencePath));
 		List<Tuple> os = em.createQuery(cq).setMaxResults(200).getResultList();
 		List<Work> list = new ArrayList<>();
 		for (Tuple o : os) {
 			Work work = new Work();
-			work.setId(o.get(id_path));
-			work.setJob(o.get(job_path));
-			work.setSequence(o.get(sequence_path));
+			work.setId(o.get(idPath));
+			work.setJob(o.get(jobPath));
+			work.setSequence(o.get(sequencePath));
 			list.add(work);
 		}
 		return list;
 	}
 
+	private List<Draft> listDraft(EntityManagerContainer emc, String sequence) throws Exception {
+		Date date = new Date();
+		date = DateUtils.addMinutes(date, 0 - Config.processPlatform().getDeleteDraft().getThresholdMinutes());
+		EntityManager em = emc.get(Draft.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
+		Root<Work> root = cq.from(Work.class);
+		Path<String> idPath = root.get(Work_.id);
+		Path<String> jobPath = root.get(Work_.job);
+		Path<String> sequencePath = root.get(JpaObject_.sequence);
+		Path<Date> sequenceActivityArrivedTime = root.get(Work_.activityArrivedTime);
+		Predicate p = cb.lessThan(sequenceActivityArrivedTime, date);
+		p = cb.and(p, cb.equal(root.get(Work_.workThroughManual), false));
+		p = cb.and(p, cb.equal(root.get(Work_.workCreateType), Work.WORKCREATETYPE_SURFACE));
+		if (StringUtils.isNotEmpty(sequence)) {
+			p = cb.and(p, cb.greaterThan(sequencePath, sequence));
+		}
+		cq.multiselect(idPath, jobPath, sequencePath).where(p).orderBy(cb.asc(sequencePath));
+		List<Tuple> os = em.createQuery(cq).setMaxResults(200).getResultList();
+		List<Draft> list = new ArrayList<>();
+		for (Tuple o : os) {
+			Draft draft= new Draft();
+			draft.setId(o.get(idPath));
+			draft.setSequence(o.get(sequencePath));
+			list.add(draft);
+		}
+		return list;
+		
+
 }