Zhou Rui 5 лет назад
Родитель
Сommit
a34f39902f
21 измененных файлов с 321 добавлено и 731 удалено
  1. 124 51
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Components.java
  2. 0 117
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionBase.java
  3. 3 1
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionCreate.java
  4. 6 0
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionDelete.java
  5. 2 1
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionEdit.java
  6. 29 144
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionListAll.java
  7. 12 0
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ExceptionDeleteSystemComponent.java
  8. 44 28
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/schedule/InitComponents.java
  9. 4 4
      o2server/x_component_assemble_control/src/main/webapp/describe/describe.json
  10. 0 117
      o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionBase.java
  11. 3 1
      o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionCreate.java
  12. 6 0
      o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionDelete.java
  13. 2 1
      o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionEdit.java
  14. 29 144
      o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionListAll.java
  15. 16 8
      o2server/x_component_core_entity/src/main/java/com/x/component/core/entity/Component.java
  16. 2 4
      o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionCustomCreate.java
  17. 2 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionDraw.java
  18. 0 73
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionEdit.java
  19. 2 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionGet.java
  20. 31 15
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionSave.java
  21. 4 22
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java

+ 124 - 51
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Components.java

@@ -13,62 +13,134 @@ import org.apache.commons.io.FileUtils;
 
 
 public class Components extends ConfigObject {
 public class Components extends ConfigObject {
 
 
-	public static final String NAME_SETTINGS = "Settings";
+	public static final String NAME_SETTING = "Setting";
 	public static final String NAME_ORG = "Org";
 	public static final String NAME_ORG = "Org";
-	public static final String NAME_PROFILE = "Profile";
+	public static final String NAME_CMSMANAGER = "cmsManager";
+	public static final String NAME_APPLICATIONEXPLORER = "ApplicationExplorer";
+	public static final String NAME_PORTALEXPLORER = "PortalExplorer";
+	public static final String NAME_DATAEXPLORER = "DataExplorer";
+	public static final String NAME_SERVICEMANAGER = "service.ServiceManager";
 	public static final String NAME_APPMARKET = "AppMarket";
 	public static final String NAME_APPMARKET = "AppMarket";
-	public static final String NAME_FILE = "File";
+	public static final String NAME_APPCENTER = "AppCenter";
+	public static final String NAME_LOGVIEWER = "LogViewer";
+	public static final String NAME_PROFILE = "Profile";
 	public static final String NAME_BAM = "BAM";
 	public static final String NAME_BAM = "BAM";
+	public static final String NAME_CMS = "cms";
+	public static final String NAME_TASKCENTER = "TaskCenter";
+	public static final String NAME_HOMEPAGE = "Homepage";
+	public static final String NAME_HOTARTICLE = "HotArticle";
+	public static final String NAME_FILE = "File";
 	public static final String NAME_NOTE = "Note";
 	public static final String NAME_NOTE = "Note";
 	public static final String NAME_MEETING = "Meeting";
 	public static final String NAME_MEETING = "Meeting";
+	public static final String NAME_ONLINEMEETING = "OnlineMeeting";
 	public static final String NAME_ATTENDANCE = "Attendance";
 	public static final String NAME_ATTENDANCE = "Attendance";
 	public static final String NAME_FORUM = "Forum";
 	public static final String NAME_FORUM = "Forum";
-	public static final String NAME_HOTARTICLE = "HotArticle";
-	public static final String NAME_ONLINEMEETING = "OnlineMeeting";
-	public static final String NAME_ANN = "ANN";
 	public static final String NAME_MINDER = "Minder";
 	public static final String NAME_MINDER = "Minder";
 	public static final String NAME_CALENDAR = "Calendar";
 	public static final String NAME_CALENDAR = "Calendar";
+	public static final String NAME_ANN = "ANN";
 	public static final String NAME_SEARCH = "Search";
 	public static final String NAME_SEARCH = "Search";
-	public static final String NAME_HOMEPAGE = "Homepage";
 
 
-	
-
-	public static List<String> SYSTEM_NAME_NAMES = ListTools.toList(NAME_SETTINGS, NAME_ORG,
-			NAME_PROFILE, NAME_APPMARKET, NAME_FILE, NAME_BAM, NAME_NOTE, NAME_MEETING,
-			NAME_ATTENDANCE, NAME_FORUM, NAME_HOTARTICLE, NAME_ONLINEMEETING, NAME_ANN,
-			NAME_MINDER, NAME_CALENDAR, NAME_SEARCH, NAME_HOMEPAGE);
+	public static List<String> SYSTEM_NAME_NAMES = ListTools.toList(NAME_SETTING, NAME_ORG, NAME_CMSMANAGER,
+			NAME_APPLICATIONEXPLORER, NAME_PORTALEXPLORER, NAME_DATAEXPLORER, NAME_SERVICEMANAGER, NAME_APPMARKET,
+			NAME_APPCENTER, NAME_LOGVIEWER, NAME_PROFILE, NAME_BAM, NAME_CMS, NAME_TASKCENTER, NAME_HOMEPAGE,
+			NAME_HOTARTICLE, NAME_FILE, NAME_NOTE, NAME_MEETING, NAME_ONLINEMEETING, NAME_ATTENDANCE, NAME_FORUM,
+			NAME_MINDER, NAME_CALENDAR, NAME_ANN, NAME_SEARCH);
 
 
 	public static final String APPICON_PNG = "appicon.png";
 	public static final String APPICON_PNG = "appicon.png";
 
 
+	public static Component systemComponent(String name) {
+		switch (name) {
+			case NAME_SETTING:
+				return new Component(NAME_SETTING, NAME_SETTING, "系统设置", APPICON_PNG, 1, Component.TYPE_SYSTEM);
+			case NAME_ORG:
+				return new Component(NAME_ORG, NAME_ORG, "组织管理", APPICON_PNG, 2, Component.TYPE_SYSTEM);
+			case NAME_CMSMANAGER:
+				return new Component(NAME_CMSMANAGER, "cms.column", "内容管理平台", APPICON_PNG, 3, Component.TYPE_SYSTEM);
+			case NAME_APPLICATIONEXPLORER:
+				return new Component(NAME_APPLICATIONEXPLORER, "process.ApplicationExplorer", "流程管理平台", APPICON_PNG, 4,
+						Component.TYPE_SYSTEM);
+			case NAME_PORTALEXPLORER:
+				return new Component(NAME_PORTALEXPLORER, "portal.PortalExplorer", "门户管理平台", APPICON_PNG, 5,
+						Component.TYPE_SYSTEM);
+			case NAME_DATAEXPLORER:
+				return new Component(NAME_DATAEXPLORER, "query.QueryExplorer", "数据中心平台", APPICON_PNG, 6,
+						Component.TYPE_SYSTEM);
+			case NAME_SERVICEMANAGER:
+				return new Component(NAME_SERVICEMANAGER, NAME_SERVICEMANAGER, "服务管理平台", APPICON_PNG, 7,
+						Component.TYPE_SYSTEM);
+			case NAME_APPMARKET:
+				return new Component(NAME_APPMARKET, NAME_APPMARKET, "应用市场", APPICON_PNG, 8, Component.TYPE_SYSTEM);
+			case NAME_APPCENTER:
+				return new Component(NAME_APPCENTER, NAME_APPCENTER, "应用管理", APPICON_PNG, 9, Component.TYPE_SYSTEM);
+			case NAME_LOGVIEWER:
+				return new Component(NAME_LOGVIEWER, NAME_LOGVIEWER, "日志", APPICON_PNG, 10, Component.TYPE_SYSTEM);
+			case NAME_PROFILE:
+				return new Component(NAME_PROFILE, NAME_PROFILE, "个人设置", APPICON_PNG, 11, Component.TYPE_SYSTEM);
+			case NAME_BAM:
+				return new Component(NAME_BAM, NAME_BAM, "流程监控", APPICON_PNG, 12, Component.TYPE_SYSTEM);
+			case NAME_CMS:
+				return new Component(NAME_CMS, "cms.Index", "信息平台", APPICON_PNG, 12, Component.TYPE_SYSTEM);
+			case NAME_TASKCENTER:
+				return new Component(NAME_TASKCENTER, "process.TaskCenter", "办公中心", APPICON_PNG, 13,
+						Component.TYPE_SYSTEM);
+			case NAME_HOMEPAGE:
+				return new Component(NAME_HOMEPAGE, NAME_HOMEPAGE, "首页", APPICON_PNG, 14, Component.TYPE_SYSTEM);
+			case NAME_HOTARTICLE:
+				return new Component(NAME_HOTARTICLE, NAME_HOTARTICLE, "热点", APPICON_PNG, 15, Component.TYPE_SYSTEM);
+			case NAME_FILE:
+				return new Component(NAME_FILE, NAME_FILE, "云文件", APPICON_PNG, 16, Component.TYPE_SYSTEM);
+			case NAME_NOTE:
+				return new Component(NAME_NOTE, NAME_NOTE, "便签", APPICON_PNG, 17, Component.TYPE_SYSTEM);
+			case NAME_MEETING:
+				return new Component(NAME_MEETING, NAME_MEETING, "会议管理", APPICON_PNG, 18, Component.TYPE_SYSTEM);
+			case NAME_ONLINEMEETING:
+				return new Component(NAME_ONLINEMEETING, NAME_ONLINEMEETING, "网络会议", APPICON_PNG, 19,
+						Component.TYPE_SYSTEM);
+			case NAME_ATTENDANCE:
+				return new Component(NAME_ATTENDANCE, NAME_ATTENDANCE, "考勤管理", APPICON_PNG, 20, Component.TYPE_SYSTEM);
+			case NAME_FORUM:
+				return new Component(NAME_FORUM, NAME_FORUM, "论坛", APPICON_PNG, 21, Component.TYPE_SYSTEM);
+			case NAME_MINDER:
+				return new Component(NAME_MINDER, NAME_MINDER, "脑图编辑器", APPICON_PNG, 22, Component.TYPE_SYSTEM);
+			case NAME_CALENDAR:
+				return new Component(NAME_CALENDAR, NAME_CALENDAR, "日程安排", APPICON_PNG, 23, Component.TYPE_SYSTEM);
+			case NAME_ANN:
+				return new Component(NAME_ANN, NAME_ANN, "神经网络", APPICON_PNG, 24, Component.TYPE_SYSTEM);
+			case NAME_SEARCH:
+				return new Component(NAME_SEARCH, NAME_SEARCH, "搜索", APPICON_PNG, 25, Component.TYPE_SYSTEM);
+			default:
+				return null;
+		}
+	}
+
 	public static Components defaultInstance() {
 	public static Components defaultInstance() {
 		Components o = new Components();
 		Components o = new Components();
-		o.systems.add(
-				new Component(NAME_SETTINGS, NAME_SETTINGS, "系统设置", APPICON_PNG, 1, Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_APPMARKET, NAME_APPMARKET, "应用市场", APPICON_PNG, 2, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_ANN, NAME_ANN, "神经网络", APPICON_PNG, 3, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_ORG, NAME_ORG, "组织管理", APPICON_PNG, 4, Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_PROFILE, NAME_PROFILE, "个人设置", APPICON_PNG, 5, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_BAM, NAME_BAM, "流程监控", APPICON_PNG, 6, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_FILE, NAME_FILE, "云文件", APPICON_PNG, 7, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_NOTE, NAME_NOTE, "便签", APPICON_PNG, 8, Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_MEETING, NAME_MEETING, "会议管理", APPICON_PNG, 9, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_ATTENDANCE, NAME_ATTENDANCE, "考勤管理", APPICON_PNG, 10,
-				Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_FORUM, NAME_FORUM, "论坛", APPICON_PNG, 11, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_HOTARTICLE, NAME_HOTARTICLE, "热点", APPICON_PNG, 12,
-				Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_ONLINEMEETING, NAME_ONLINEMEETING, "网络会议", APPICON_PNG, 13,
-				Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_MINDER, NAME_MINDER, "脑图编辑器", APPICON_PNG, 14, Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_CALENDAR, NAME_CALENDAR, "日程安排", APPICON_PNG, 15, Component.TYPE_SYSTEM));
-		o.systems.add(new Component(NAME_SEARCH, NAME_SEARCH, "搜索", APPICON_PNG, 16, Component.TYPE_SYSTEM));
-		o.systems.add(
-				new Component(NAME_HOMEPAGE, NAME_HOMEPAGE, "首页", APPICON_PNG, 17, Component.TYPE_SYSTEM));
+		o.systems.add(systemComponent(NAME_SETTING));
+		o.systems.add(systemComponent(NAME_ORG));
+		o.systems.add(systemComponent(NAME_CMSMANAGER));
+		o.systems.add(systemComponent(NAME_CMS));
+		o.systems.add(systemComponent(NAME_APPLICATIONEXPLORER));
+		o.systems.add(systemComponent(NAME_PORTALEXPLORER));
+		o.systems.add(systemComponent(NAME_DATAEXPLORER));
+		o.systems.add(systemComponent(NAME_SERVICEMANAGER));
+		o.systems.add(systemComponent(NAME_APPMARKET));
+		o.systems.add(systemComponent(NAME_APPCENTER));
+		o.systems.add(systemComponent(NAME_LOGVIEWER));
+		o.systems.add(systemComponent(NAME_PROFILE));
+		o.systems.add(systemComponent(NAME_BAM));
+		o.systems.add(systemComponent(NAME_TASKCENTER));
+		o.systems.add(systemComponent(NAME_HOMEPAGE));
+		o.systems.add(systemComponent(NAME_HOTARTICLE));
+		o.systems.add(systemComponent(NAME_FILE));
+		o.systems.add(systemComponent(NAME_NOTE));
+		o.systems.add(systemComponent(NAME_MEETING));
+		o.systems.add(systemComponent(NAME_ONLINEMEETING));
+		o.systems.add(systemComponent(NAME_ATTENDANCE));
+		o.systems.add(systemComponent(NAME_FORUM));
+		o.systems.add(systemComponent(NAME_MINDER));
+		o.systems.add(systemComponent(NAME_CALENDAR));
+		o.systems.add(systemComponent(NAME_ANN));
+		o.systems.add(systemComponent(NAME_SEARCH));
 		return o;
 		return o;
 	}
 	}
 
 
@@ -93,12 +165,12 @@ public class Components extends ConfigObject {
 
 
 		}
 		}
 
 
-		public Component(String name, String path, String title, String iconPath, Integer order, String type) {
+		public Component(String name, String path, String title, String iconPath, Integer orderNumber, String type) {
 			this.name = name;
 			this.name = name;
 			this.path = path;
 			this.path = path;
 			this.title = title;
 			this.title = title;
 			this.iconPath = iconPath;
 			this.iconPath = iconPath;
-			this.order = order;
+			this.orderNumber = orderNumber;
 			this.type = type;
 			this.type = type;
 		}
 		}
 
 
@@ -115,7 +187,7 @@ public class Components extends ConfigObject {
 		private String iconPath;
 		private String iconPath;
 
 
 		@FieldDescribe("排序号")
 		@FieldDescribe("排序号")
-		private Integer order;
+		private Integer orderNumber;
 
 
 		@FieldDescribe("类型")
 		@FieldDescribe("类型")
 		private String type;
 		private String type;
@@ -173,14 +245,7 @@ public class Components extends ConfigObject {
 		public void setDentyList(List<String> dentyList) {
 		public void setDentyList(List<String> dentyList) {
 			this.dentyList = dentyList;
 			this.dentyList = dentyList;
 		}
 		}
-
-		public Integer getOrder() {
-			return order;
-		}
-
-		public void setOrder(Integer order) {
-			this.order = order;
-		}
+ 
 
 
 		public String getType() {
 		public String getType() {
 			return type;
 			return type;
@@ -190,6 +255,14 @@ public class Components extends ConfigObject {
 			this.type = type;
 			this.type = type;
 		}
 		}
 
 
+		public Integer getOrderNumber() {
+			return orderNumber;
+		}
+
+		public void setOrderNumber(Integer orderNumber) {
+			this.orderNumber = orderNumber;
+		}
+
 	}
 	}
 
 
 	public List<Component> getSystems() {
 	public List<Component> getSystems() {

+ 0 - 117
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionBase.java

@@ -1,10 +1,7 @@
 package com.x.component.assemble.control.jaxrs.component;
 package com.x.component.assemble.control.jaxrs.component;
 
 
-import java.util.List;
-
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
-import com.x.base.core.project.tools.ListTools;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
 import net.sf.ehcache.Ehcache;
 import net.sf.ehcache.Ehcache;
@@ -13,118 +10,4 @@ class ActionBase extends StandardJaxrsAction {
 
 
 	Ehcache cache = ApplicationCache.instance().getCache(Component.class);
 	Ehcache cache = ApplicationCache.instance().getCache(Component.class);
 
 
-	static final String COMPONENT_FILE = "File";
-	static final String COMPONENT_NOTE = "Note";
-	static final String COMPONENT_MEETING = "Meeting";
-	static final String COMPONENT_EXECUTION = "Execution";
-	static final String COMPONENT_ATTENDANCE = "Attendance";
-	static final String COMPONENT_FORUM = "Forum";
-	static final String COMPONENT_HOTARTICLE = "HotArticle";
-	static final String COMPONENT_EXEMANAGER = "ExeManager";
-	static final String COMPONENT_ONLINEMEETING = "OnlineMeeting";
-	static final String COMPONENT_ANN = "ANN";
-//	static final String COMPONENT_STRATEGY = "Strategy";
-//	static final String COMPONENT_REPORT = "Report";
-	static final String COMPONENT_MINDER = "Minder";
-	static final String COMPONENT_CALENDAR = "Calendar";
-	static final String COMPONENT_SEARCH = "Search";
-	static final String COMPONENT_HOMEPAGE = "Homepage";
-
-	List<String> DEFAULT_COMPONENT_LIST = ListTools.toList(COMPONENT_FILE, COMPONENT_NOTE, COMPONENT_MEETING,
-			COMPONENT_EXECUTION, COMPONENT_ATTENDANCE, COMPONENT_FORUM, COMPONENT_HOTARTICLE, COMPONENT_EXEMANAGER,
-			COMPONENT_ONLINEMEETING, COMPONENT_ANN, COMPONENT_MINDER, COMPONENT_CALENDAR, COMPONENT_HOMEPAGE);
-
-	// {
-	// "name": "File",
-	// "path": "File",
-	// "title": "云文件",
-	// "iconPath": "appicon.png",
-	// "visible":true
-	// },
-	//
-	// {
-	// "name": "Note",
-	// "path": "Note",
-	// "title": "便签",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Meeting",
-	// "path": "Meeting",
-	// "title": "会议管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Execution",
-	// "path": "Execution",
-	// "title": "执行力管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Attendance",
-	// "path": "Attendance",
-	// "title": "考勤管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Forum",
-	// "path": "Forum",
-	// "title": "论坛",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "HotArticle",
-	// "path": "HotArticle",
-	// "title": "热点",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "ExeManager",
-	// "path": "ExeManager",
-	// "title": "执行力管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "OnlineMeeting",
-	// "path": "OnlineMeeting",
-	// "title": "网络会议",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Strategy",
-	// "path": "Strategy",
-	// "title": "战略管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Report",
-	// "path": "Report",
-	// "title": "工作报告",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Minder",
-	// "path": "Minder",
-	// "title": "脑图编辑器",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Calendar",
-	// "path": "Calendar",
-	// "title": "日程安排",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// }
-
 }
 }

+ 3 - 1
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionCreate.java

@@ -12,6 +12,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.jaxrs.WrapBoolean;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
@@ -25,6 +26,7 @@ class ActionCreate extends ActionBase {
 			}
 			}
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			Component component = Wi.copier.copy(wi);
 			Component component = Wi.copier.copy(wi);
+			component.setType(Component.TYPE_CUSTOM);
 			emc.beginTransaction(Component.class);
 			emc.beginTransaction(Component.class);
 			emc.persist(component, CheckPersistType.all);
 			emc.persist(component, CheckPersistType.all);
 			emc.commit();
 			emc.commit();
@@ -40,7 +42,7 @@ class ActionCreate extends ActionBase {
 
 
 		private static final long serialVersionUID = 8867806242224800105L;
 		private static final long serialVersionUID = 8867806242224800105L;
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
-				JpaObject.FieldsUnmodify);
+				ListTools.toList(JpaObject.FieldsUnmodify, Component.type_FIELDNAME));
 
 
 	}
 	}
 
 

+ 6 - 0
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionDelete.java

@@ -12,6 +12,8 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
+import org.apache.commons.codec.binary.StringUtils;
+
 class ActionDelete extends ActionBase {
 class ActionDelete extends ActionBase {
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
@@ -24,6 +26,10 @@ class ActionDelete extends ActionBase {
 			if (null == component) {
 			if (null == component) {
 				throw new ExceptionEntityNotExist(flag, Component.class);
 				throw new ExceptionEntityNotExist(flag, Component.class);
 			}
 			}
+			if (StringUtils.equals(component.getType(),Component.TYPE_SYSTEM)) {
+				throw new ExceptionDeleteSystemComponent();
+			}
+
 			emc.beginTransaction(Component.class);
 			emc.beginTransaction(Component.class);
 			emc.remove(component, CheckRemoveType.all);
 			emc.remove(component, CheckRemoveType.all);
 			emc.commit();
 			emc.commit();

+ 2 - 1
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionEdit.java

@@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.jaxrs.WrapBoolean;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
@@ -46,7 +47,7 @@ class ActionEdit extends ActionBase {
 
 
 		private static final long serialVersionUID = 8867806242224800105L;
 		private static final long serialVersionUID = 8867806242224800105L;
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
-				JpaObject.FieldsUnmodify);
+				ListTools.toList(JpaObject.FieldsUnmodify, Component.type_FIELDNAME));
 
 
 	}
 	}
 
 

+ 29 - 144
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ActionListAll.java

@@ -2,56 +2,62 @@ package com.x.component.assemble.control.jaxrs.component;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
-import java.util.stream.Collectors;
 
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.entity.JpaObject;
-import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.project.bean.WrapCopier;
 import com.x.base.core.project.bean.WrapCopier;
 import com.x.base.core.project.bean.WrapCopierFactory;
 import com.x.base.core.project.bean.WrapCopierFactory;
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.config.Components;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
 import net.sf.ehcache.Element;
 import net.sf.ehcache.Element;
 
 
 class ActionListAll extends ActionBase {
 class ActionListAll extends ActionBase {
 
 
+	private static Logger logger = LoggerFactory.getLogger(ActionListAll.class);
+
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			ActionResult<List<Wo>> result = new ActionResult<>();
-			List<Wo> wos = new ArrayList<>();
 			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
 			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
 			Element element = cache.get(cacheKey);
 			Element element = cache.get(cacheKey);
 			if (null != element && (null != element.getObjectValue())) {
 			if (null != element && (null != element.getObjectValue())) {
-				wos = (List<Wo>) element.getObjectValue();
+				result.setData((List<Wo>) element.getObjectValue());
 			} else {
 			} else {
+				final List<Wo> wos = new ArrayList<>();
 				List<Component> os = emc.listAll(Component.class);
 				List<Component> os = emc.listAll(Component.class);
-				if (os.isEmpty()) {
-					/* 一个模块都没有新建默认 */
-					synchronized (ActionListAll.class) {
-						if (emc.listAll(Component.class).isEmpty()) {
-							emc.beginTransaction(Component.class);
-							for (String name : DEFAULT_COMPONENT_LIST) {
-								Component o = this.createComponent(name);
-								emc.persist(o, CheckPersistType.all);
-								os.add(o);
+				os.stream().filter(o -> ListTools.contains(Components.SYSTEM_NAME_NAMES, o.getName()))
+						.sorted(Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+								.thenComparing(Component::getCreateTime, Comparator.nullsLast(Date::compareTo)))
+						.forEach(o -> {
+							try {
+								wos.add(Wo.copier.copy(o));
+							} catch (Exception e) {
+								logger.error(e);
+							}
+						});
+				os.stream().filter(o -> !ListTools.contains(Components.SYSTEM_NAME_NAMES, o.getName()))
+						.sorted(Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+								.thenComparing(Component::getCreateTime, Comparator.nullsLast(Date::compareTo)))
+						.forEach(o -> {
+							try {
+								wos.add(Wo.copier.copy(o));
+							} catch (Exception e) {
+								logger.error(e);
 							}
 							}
-							emc.commit();
-							ApplicationCache.notify(Component.class);
-						}
-					}
-				}
-				wos = Wo.copier.copy(os);
-				wos = wos.stream().sorted(
-						Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo)))
-						.collect(Collectors.toList());
+						});
 				cache.put(new Element(cacheKey, wos));
 				cache.put(new Element(cacheKey, wos));
+				result.setData(wos);
 			}
 			}
-			result.setData(wos);
 			return result;
 			return result;
 		}
 		}
 	}
 	}
@@ -65,125 +71,4 @@ class ActionListAll extends ActionBase {
 
 
 	}
 	}
 
 
-	private Component createComponent(String name) {
-		Component o = new Component();
-		switch (name) {
-		case COMPONENT_FILE:
-			o.setName(COMPONENT_FILE);
-			o.setPath(COMPONENT_FILE);
-			o.setTitle("云文件");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_NOTE:
-			o.setName(COMPONENT_NOTE);
-			o.setPath(COMPONENT_NOTE);
-			o.setTitle("便签");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_MEETING:
-			o.setName(COMPONENT_MEETING);
-			o.setPath(COMPONENT_MEETING);
-			o.setTitle("会议管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_EXECUTION:
-			o.setName(COMPONENT_EXECUTION);
-			o.setPath(COMPONENT_EXECUTION);
-			o.setTitle("执行力管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ATTENDANCE:
-			o.setName(COMPONENT_ATTENDANCE);
-			o.setPath(COMPONENT_ATTENDANCE);
-			o.setTitle("考勤管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_FORUM:
-			o.setName(COMPONENT_FORUM);
-			o.setPath(COMPONENT_FORUM);
-			o.setTitle("论坛");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_HOTARTICLE:
-			o.setName(COMPONENT_HOTARTICLE);
-			o.setPath(COMPONENT_HOTARTICLE);
-			o.setTitle("热点");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_EXEMANAGER:
-			o.setName(COMPONENT_EXEMANAGER);
-			o.setPath(COMPONENT_EXEMANAGER);
-			o.setTitle("执行力配置");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ONLINEMEETING:
-			o.setName(COMPONENT_ONLINEMEETING);
-			o.setPath(COMPONENT_ONLINEMEETING);
-			o.setTitle("网络会议");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-//		case COMPONENT_STRATEGY:
-//			o.setName(COMPONENT_STRATEGY);
-//			o.setPath(COMPONENT_STRATEGY);
-//			o.setTitle("战略管理");
-//			o.setIconPath("appicon.png");
-//			o.setVisible(true);
-//			break;
-//		case COMPONENT_REPORT:
-//			o.setName(COMPONENT_REPORT);
-//			o.setPath(COMPONENT_REPORT);
-//			o.setTitle("工作报告");
-//			o.setIconPath("appicon.png");
-//			o.setVisible(true);
-//			break;
-		case COMPONENT_MINDER:
-			o.setName(COMPONENT_MINDER);
-			o.setPath(COMPONENT_MINDER);
-			o.setTitle("脑图编辑器");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_CALENDAR:
-			o.setName(COMPONENT_CALENDAR);
-			o.setPath(COMPONENT_CALENDAR);
-			o.setTitle("日程安排");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ANN:
-			o.setName(COMPONENT_ANN);
-			o.setPath(COMPONENT_ANN);
-			o.setTitle("神经网络");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_SEARCH:
-			o.setName(COMPONENT_SEARCH);
-			o.setPath(COMPONENT_SEARCH);
-			o.setTitle("搜索");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_HOMEPAGE:
-			o.setName(COMPONENT_HOMEPAGE);
-			o.setPath(COMPONENT_HOMEPAGE);
-			o.setTitle("首页");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		default:
-			break;
-		}
-		return o;
-	}
-
 }
 }

+ 12 - 0
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/jaxrs/component/ExceptionDeleteSystemComponent.java

@@ -0,0 +1,12 @@
+package com.x.component.assemble.control.jaxrs.component;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionDeleteSystemComponent extends PromptException {
+
+	private static final long serialVersionUID = 4132300948670472899L;
+
+	ExceptionDeleteSystemComponent() {
+		super("不能删除系统组件.");
+	}
+}

+ 44 - 28
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/schedule/InitComponents.java

@@ -1,12 +1,12 @@
 package com.x.component.assemble.control.schedule;
 package com.x.component.assemble.control.schedule;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.List;
 
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.entity.annotation.CheckPersistType;
+import com.x.base.core.entity.annotation.CheckRemoveType;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.logger.LoggerFactory;
@@ -23,42 +23,58 @@ public class InitComponents extends AbstractJob {
 
 
 	@Override
 	@Override
 	public void schedule(JobExecutionContext jobExecutionContext) throws Exception {
 	public void schedule(JobExecutionContext jobExecutionContext) throws Exception {
-		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			emc.beginTransaction(Component.class);
-			this.init(emc);
-			emc.commit();
+		try {
+			this.init();
 		} catch (Exception e) {
 		} catch (Exception e) {
 			logger.error(e);
 			logger.error(e);
 			throw new JobExecutionException(e);
 			throw new JobExecutionException(e);
 		}
 		}
 	}
 	}
 
 
-	private void init(EntityManagerContainer emc) throws Exception {
-		List<String> names = ListTools.extractProperty(Config.components().getSystems(), "name", String.class, true,
-				true);
-		List<Component> os = emc.listEqual(Component.class, Component.type_FIELDNAME, Component.TYPE_SYSTEM);
-		for (Component o : os) {
-			names.remove(o.getName());
-		}
-		for (com.x.base.core.project.config.Components.Component o : Config.components().getSystems()) {
-			if (names.contains(o.getName())) {
-				Component component = new Component();
-				component.setName(o.getName());
-				component.setPath(o.getPath());
-				component.setTitle(o.getTitle());
-				component.setIconPath(o.getIconPath());
-				component.setOrder(o.getOrder());
-				component.setVisible(true);
-				emc.persist(component, CheckPersistType.all);
+	private void init() throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			List<String> names = ListTools.extractProperty(Config.components().getSystems(), "name", String.class, true,
+					true);
+			List<Component> os = emc.listEqual(Component.class, Component.type_FIELDNAME, Component.TYPE_SYSTEM);
+			List<Component> removes = new ArrayList<>();
+			for (Component o : os) {
+				if (!names.contains(o.getName())) {
+					removes.add(o);
+				}
 			}
 			}
-		}
-		Iterator<Component> iterator = os.iterator();
-		while (iterator.hasNext()) {
-			Component o = iterator.next();
-			if (!names.contains(o.getName())) {
-				iterator.remove();
+			if (!removes.isEmpty()) {
+				emc.beginTransaction(Component.class);
+				for (Component o : removes) {
+					emc.remove(o, CheckRemoveType.all);
+				}
+				emc.commit();
+			}
+			for (Component o : os) {
+				names.remove(o.getName());
+			}
+			List<Component> adds = new ArrayList<>();
+			for (com.x.base.core.project.config.Components.Component o : Config.components().getSystems()) {
+				if (!names.contains(o.getName())) {
+					Component component = new Component();
+					component.setName(o.getName());
+					component.setPath(o.getPath());
+					component.setTitle(o.getTitle());
+					component.setIconPath(o.getIconPath());
+					component.setOrderNumber(o.getOrderNumber());
+					component.setVisible(true);
+					component.setType(Component.TYPE_SYSTEM);
+					adds.add(component);
+				}
+			}
+			if (!adds.isEmpty()) {
+				emc.beginTransaction(Component.class);
+				for (Component o : adds) {
+					emc.persist(o, CheckPersistType.all);
+				}
+				emc.commit();
 			}
 			}
 		}
 		}
+
 	}
 	}
 
 
 }
 }

+ 4 - 4
o2server/x_component_assemble_control/src/main/webapp/describe/describe.json

@@ -116,7 +116,7 @@
               "isBaseType": true
               "isBaseType": true
             },
             },
             {
             {
-              "name": "order",
+              "name": "orderNumber",
               "type": "Integer",
               "type": "Integer",
               "isCollection": false,
               "isCollection": false,
               "description": "排序号,升序排列,为空在最后",
               "description": "排序号,升序排列,为空在最后",
@@ -254,7 +254,7 @@
               "isBaseType": true
               "isBaseType": true
             },
             },
             {
             {
-              "name": "order",
+              "name": "orderNumber",
               "type": "Integer",
               "type": "Integer",
               "isCollection": false,
               "isCollection": false,
               "description": "排序号,升序排列,为空在最后",
               "description": "排序号,升序排列,为空在最后",
@@ -344,7 +344,7 @@
               "description": "是否是可见的应用."
               "description": "是否是可见的应用."
             },
             },
             {
             {
-              "name": "order",
+              "name": "orderNumber",
               "type": "Integer",
               "type": "Integer",
               "isCollection": false,
               "isCollection": false,
               "description": "排序号,升序排列,为空在最后"
               "description": "排序号,升序排列,为空在最后"
@@ -433,7 +433,7 @@
               "description": "是否是可见的应用."
               "description": "是否是可见的应用."
             },
             },
             {
             {
-              "name": "order",
+              "name": "orderNumber",
               "type": "Integer",
               "type": "Integer",
               "isCollection": false,
               "isCollection": false,
               "description": "排序号,升序排列,为空在最后"
               "description": "排序号,升序排列,为空在最后"

+ 0 - 117
o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionBase.java

@@ -1,10 +1,7 @@
 package com.x.component.assemble.control.jaxrs.component;
 package com.x.component.assemble.control.jaxrs.component;
 
 
-import java.util.List;
-
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
-import com.x.base.core.project.tools.ListTools;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
 import net.sf.ehcache.Ehcache;
 import net.sf.ehcache.Ehcache;
@@ -13,118 +10,4 @@ class ActionBase extends StandardJaxrsAction {
 
 
 	Ehcache cache = ApplicationCache.instance().getCache(Component.class);
 	Ehcache cache = ApplicationCache.instance().getCache(Component.class);
 
 
-	static final String COMPONENT_FILE = "File";
-	static final String COMPONENT_NOTE = "Note";
-	static final String COMPONENT_MEETING = "Meeting";
-	static final String COMPONENT_EXECUTION = "Execution";
-	static final String COMPONENT_ATTENDANCE = "Attendance";
-	static final String COMPONENT_FORUM = "Forum";
-	static final String COMPONENT_HOTARTICLE = "HotArticle";
-	static final String COMPONENT_EXEMANAGER = "ExeManager";
-	static final String COMPONENT_ONLINEMEETING = "OnlineMeeting";
-	static final String COMPONENT_ANN = "ANN";
-//	static final String COMPONENT_STRATEGY = "Strategy";
-//	static final String COMPONENT_REPORT = "Report";
-	static final String COMPONENT_MINDER = "Minder";
-	static final String COMPONENT_CALENDAR = "Calendar";
-	static final String COMPONENT_SEARCH = "Search";
-	static final String COMPONENT_HOMEPAGE = "Homepage";
-
-	List<String> DEFAULT_COMPONENT_LIST = ListTools.toList(COMPONENT_FILE, COMPONENT_NOTE, COMPONENT_MEETING,
-			COMPONENT_EXECUTION, COMPONENT_ATTENDANCE, COMPONENT_FORUM, COMPONENT_HOTARTICLE, COMPONENT_EXEMANAGER,
-			COMPONENT_ONLINEMEETING, COMPONENT_ANN, COMPONENT_MINDER, COMPONENT_CALENDAR, COMPONENT_HOMEPAGE);
-
-	// {
-	// "name": "File",
-	// "path": "File",
-	// "title": "云文件",
-	// "iconPath": "appicon.png",
-	// "visible":true
-	// },
-	//
-	// {
-	// "name": "Note",
-	// "path": "Note",
-	// "title": "便签",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Meeting",
-	// "path": "Meeting",
-	// "title": "会议管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Execution",
-	// "path": "Execution",
-	// "title": "执行力管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Attendance",
-	// "path": "Attendance",
-	// "title": "考勤管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Forum",
-	// "path": "Forum",
-	// "title": "论坛",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "HotArticle",
-	// "path": "HotArticle",
-	// "title": "热点",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "ExeManager",
-	// "path": "ExeManager",
-	// "title": "执行力管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "OnlineMeeting",
-	// "path": "OnlineMeeting",
-	// "title": "网络会议",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Strategy",
-	// "path": "Strategy",
-	// "title": "战略管理",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Report",
-	// "path": "Report",
-	// "title": "工作报告",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Minder",
-	// "path": "Minder",
-	// "title": "脑图编辑器",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// },
-	// {
-	// "name": "Calendar",
-	// "path": "Calendar",
-	// "title": "日程安排",
-	// "iconPath": "appicon.png",
-	// "visible": true
-	// }
-
 }
 }

+ 3 - 1
o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionCreate.java

@@ -12,6 +12,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.jaxrs.WrapBoolean;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
@@ -25,6 +26,7 @@ class ActionCreate extends ActionBase {
 			}
 			}
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			Component component = Wi.copier.copy(wi);
 			Component component = Wi.copier.copy(wi);
+			component.setType(Component.TYPE_CUSTOM);
 			emc.beginTransaction(Component.class);
 			emc.beginTransaction(Component.class);
 			emc.persist(component, CheckPersistType.all);
 			emc.persist(component, CheckPersistType.all);
 			emc.commit();
 			emc.commit();
@@ -40,7 +42,7 @@ class ActionCreate extends ActionBase {
 
 
 		private static final long serialVersionUID = 8867806242224800105L;
 		private static final long serialVersionUID = 8867806242224800105L;
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
-				JpaObject.FieldsUnmodify);
+				ListTools.toList(JpaObject.FieldsUnmodify, Component.type_FIELDNAME));
 
 
 	}
 	}
 
 

+ 6 - 0
o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionDelete.java

@@ -12,6 +12,8 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
+import org.apache.commons.codec.binary.StringUtils;
+
 class ActionDelete extends ActionBase {
 class ActionDelete extends ActionBase {
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
@@ -24,6 +26,10 @@ class ActionDelete extends ActionBase {
 			if (null == component) {
 			if (null == component) {
 				throw new ExceptionEntityNotExist(flag, Component.class);
 				throw new ExceptionEntityNotExist(flag, Component.class);
 			}
 			}
+			if (StringUtils.equals(component.getType(),Component.TYPE_SYSTEM)) {
+				throw new ExceptionDeleteSystemComponent();
+			}
+
 			emc.beginTransaction(Component.class);
 			emc.beginTransaction(Component.class);
 			emc.remove(component, CheckRemoveType.all);
 			emc.remove(component, CheckRemoveType.all);
 			emc.commit();
 			emc.commit();

+ 2 - 1
o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionEdit.java

@@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.jaxrs.WrapBoolean;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.assemble.control.Business;
 import com.x.component.assemble.control.Business;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
@@ -46,7 +47,7 @@ class ActionEdit extends ActionBase {
 
 
 		private static final long serialVersionUID = 8867806242224800105L;
 		private static final long serialVersionUID = 8867806242224800105L;
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
 		static WrapCopier<Wi, Component> copier = WrapCopierFactory.wi(Wi.class, Component.class, null,
-				JpaObject.FieldsUnmodify);
+				ListTools.toList(JpaObject.FieldsUnmodify, Component.type_FIELDNAME));
 
 
 	}
 	}
 
 

+ 29 - 144
o2server/x_component_assemble_control/src/main/webapp/describe/sources/com/x/component/assemble/control/jaxrs/component/ActionListAll.java

@@ -2,56 +2,62 @@ package com.x.component.assemble.control.jaxrs.component;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
-import java.util.stream.Collectors;
 
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.entity.JpaObject;
-import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.project.bean.WrapCopier;
 import com.x.base.core.project.bean.WrapCopier;
 import com.x.base.core.project.bean.WrapCopierFactory;
 import com.x.base.core.project.bean.WrapCopierFactory;
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.config.Components;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
 import com.x.component.core.entity.Component;
 import com.x.component.core.entity.Component;
 
 
 import net.sf.ehcache.Element;
 import net.sf.ehcache.Element;
 
 
 class ActionListAll extends ActionBase {
 class ActionListAll extends ActionBase {
 
 
+	private static Logger logger = LoggerFactory.getLogger(ActionListAll.class);
+
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			ActionResult<List<Wo>> result = new ActionResult<>();
-			List<Wo> wos = new ArrayList<>();
 			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
 			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
 			Element element = cache.get(cacheKey);
 			Element element = cache.get(cacheKey);
 			if (null != element && (null != element.getObjectValue())) {
 			if (null != element && (null != element.getObjectValue())) {
-				wos = (List<Wo>) element.getObjectValue();
+				result.setData((List<Wo>) element.getObjectValue());
 			} else {
 			} else {
+				final List<Wo> wos = new ArrayList<>();
 				List<Component> os = emc.listAll(Component.class);
 				List<Component> os = emc.listAll(Component.class);
-				if (os.isEmpty()) {
-					/* 一个模块都没有新建默认 */
-					synchronized (ActionListAll.class) {
-						if (emc.listAll(Component.class).isEmpty()) {
-							emc.beginTransaction(Component.class);
-							for (String name : DEFAULT_COMPONENT_LIST) {
-								Component o = this.createComponent(name);
-								emc.persist(o, CheckPersistType.all);
-								os.add(o);
+				os.stream().filter(o -> ListTools.contains(Components.SYSTEM_NAME_NAMES, o.getName()))
+						.sorted(Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+								.thenComparing(Component::getCreateTime, Comparator.nullsLast(Date::compareTo)))
+						.forEach(o -> {
+							try {
+								wos.add(Wo.copier.copy(o));
+							} catch (Exception e) {
+								logger.error(e);
+							}
+						});
+				os.stream().filter(o -> !ListTools.contains(Components.SYSTEM_NAME_NAMES, o.getName()))
+						.sorted(Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+								.thenComparing(Component::getCreateTime, Comparator.nullsLast(Date::compareTo)))
+						.forEach(o -> {
+							try {
+								wos.add(Wo.copier.copy(o));
+							} catch (Exception e) {
+								logger.error(e);
 							}
 							}
-							emc.commit();
-							ApplicationCache.notify(Component.class);
-						}
-					}
-				}
-				wos = Wo.copier.copy(os);
-				wos = wos.stream().sorted(
-						Comparator.comparing(Component::getOrderNumber, Comparator.nullsLast(Integer::compareTo)))
-						.collect(Collectors.toList());
+						});
 				cache.put(new Element(cacheKey, wos));
 				cache.put(new Element(cacheKey, wos));
+				result.setData(wos);
 			}
 			}
-			result.setData(wos);
 			return result;
 			return result;
 		}
 		}
 	}
 	}
@@ -65,125 +71,4 @@ class ActionListAll extends ActionBase {
 
 
 	}
 	}
 
 
-	private Component createComponent(String name) {
-		Component o = new Component();
-		switch (name) {
-		case COMPONENT_FILE:
-			o.setName(COMPONENT_FILE);
-			o.setPath(COMPONENT_FILE);
-			o.setTitle("云文件");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_NOTE:
-			o.setName(COMPONENT_NOTE);
-			o.setPath(COMPONENT_NOTE);
-			o.setTitle("便签");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_MEETING:
-			o.setName(COMPONENT_MEETING);
-			o.setPath(COMPONENT_MEETING);
-			o.setTitle("会议管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_EXECUTION:
-			o.setName(COMPONENT_EXECUTION);
-			o.setPath(COMPONENT_EXECUTION);
-			o.setTitle("执行力管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ATTENDANCE:
-			o.setName(COMPONENT_ATTENDANCE);
-			o.setPath(COMPONENT_ATTENDANCE);
-			o.setTitle("考勤管理");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_FORUM:
-			o.setName(COMPONENT_FORUM);
-			o.setPath(COMPONENT_FORUM);
-			o.setTitle("论坛");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_HOTARTICLE:
-			o.setName(COMPONENT_HOTARTICLE);
-			o.setPath(COMPONENT_HOTARTICLE);
-			o.setTitle("热点");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_EXEMANAGER:
-			o.setName(COMPONENT_EXEMANAGER);
-			o.setPath(COMPONENT_EXEMANAGER);
-			o.setTitle("执行力配置");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ONLINEMEETING:
-			o.setName(COMPONENT_ONLINEMEETING);
-			o.setPath(COMPONENT_ONLINEMEETING);
-			o.setTitle("网络会议");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-//		case COMPONENT_STRATEGY:
-//			o.setName(COMPONENT_STRATEGY);
-//			o.setPath(COMPONENT_STRATEGY);
-//			o.setTitle("战略管理");
-//			o.setIconPath("appicon.png");
-//			o.setVisible(true);
-//			break;
-//		case COMPONENT_REPORT:
-//			o.setName(COMPONENT_REPORT);
-//			o.setPath(COMPONENT_REPORT);
-//			o.setTitle("工作报告");
-//			o.setIconPath("appicon.png");
-//			o.setVisible(true);
-//			break;
-		case COMPONENT_MINDER:
-			o.setName(COMPONENT_MINDER);
-			o.setPath(COMPONENT_MINDER);
-			o.setTitle("脑图编辑器");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_CALENDAR:
-			o.setName(COMPONENT_CALENDAR);
-			o.setPath(COMPONENT_CALENDAR);
-			o.setTitle("日程安排");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_ANN:
-			o.setName(COMPONENT_ANN);
-			o.setPath(COMPONENT_ANN);
-			o.setTitle("神经网络");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_SEARCH:
-			o.setName(COMPONENT_SEARCH);
-			o.setPath(COMPONENT_SEARCH);
-			o.setTitle("搜索");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		case COMPONENT_HOMEPAGE:
-			o.setName(COMPONENT_HOMEPAGE);
-			o.setPath(COMPONENT_HOMEPAGE);
-			o.setTitle("首页");
-			o.setIconPath("appicon.png");
-			o.setVisible(true);
-			break;
-		default:
-			break;
-		}
-		return o;
-	}
-
 }
 }

+ 16 - 8
o2server/x_component_core_entity/src/main/java/com/x/component/core/entity/Component.java

@@ -87,11 +87,11 @@ public class Component extends SliceJpaObject {
 	@CheckPersist(allowEmpty = true)
 	@CheckPersist(allowEmpty = true)
 	private Boolean visible;
 	private Boolean visible;
 
 
-	public static final String order_FIELDNAME = "order";
+	public static final String orderNumber_FIELDNAME = "orderNumber";
 	@FieldDescribe("排序号,升序排列,为空在最后")
 	@FieldDescribe("排序号,升序排列,为空在最后")
-	@Column(name = ColumnNamePrefix + order_FIELDNAME)
-	@Index(name = TABLE + IndexNameMiddle + order_FIELDNAME)
-	private Integer order;
+	@Column(name = ColumnNamePrefix + orderNumber_FIELDNAME)
+	@Index(name = TABLE + IndexNameMiddle + orderNumber_FIELDNAME)
+	private Integer orderNumber;
 
 
 	public static final String path_FIELDNAME = "path";
 	public static final String path_FIELDNAME = "path";
 	@FieldDescribe("应用路径.")
 	@FieldDescribe("应用路径.")
@@ -189,12 +189,20 @@ public class Component extends SliceJpaObject {
 		this.iconPath = iconPath;
 		this.iconPath = iconPath;
 	}
 	}
 
 
-	public Integer getOrder() {
-		return order;
+	public String getType() {
+		return type;
 	}
 	}
 
 
-	public void setOrder(Integer order) {
-		this.order = order;
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public Integer getOrderNumber() {
+		return orderNumber;
+	}
+
+	public void setOrderNumber(Integer orderNumber) {
+		this.orderNumber = orderNumber;
 	}
 	}
 
 
 }
 }

+ 2 - 4
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionCustomCreate.java

@@ -1,7 +1,5 @@
 package com.x.message.assemble.communicate.jaxrs.message;
 package com.x.message.assemble.communicate.jaxrs.message;
 
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
@@ -14,13 +12,13 @@ import com.x.base.core.project.config.Config;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.jaxrs.WoId;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.jaxrs.WrapBoolean;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.message.MessageConnector;
 import com.x.base.core.project.message.MessageConnector;
 import com.x.message.assemble.communicate.ThisApplication;
 import com.x.message.assemble.communicate.ThisApplication;
-import com.x.message.core.entity.Message;
+
+import org.apache.commons.lang3.StringUtils;
 
 
 class ActionCustomCreate extends BaseAction {
 class ActionCustomCreate extends BaseAction {
 
 

+ 2 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionDraw.java

@@ -46,6 +46,8 @@ class ActionDraw extends BaseAction {
 				throw new ExceptionAccessDenied(effectivePerson, application);
 				throw new ExceptionAccessDenied(effectivePerson, application);
 			}
 			}
 			Work work = this.mockWork(application, process, person, identity, unit, wi.getTitle());
 			Work work = this.mockWork(application, process, person, identity, unit, wi.getTitle());
+			//设置id值与workid相同.save可以判断
+			work.setId("");
 			String form = this.findForm(business, process);
 			String form = this.findForm(business, process);
 			if (StringUtils.isEmpty(form)) {
 			if (StringUtils.isEmpty(form)) {
 				throw new ExceptionNoneForm();
 				throw new ExceptionNoneForm();

+ 0 - 73
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionEdit.java

@@ -1,73 +0,0 @@
-package com.x.processplatform.assemble.surface.jaxrs.draft;
-
-import com.google.gson.JsonElement;
-import com.x.base.core.container.EntityManagerContainer;
-import com.x.base.core.container.factory.EntityManagerContainerFactory;
-import com.x.base.core.entity.annotation.CheckPersistType;
-import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.exception.ExceptionAccessDenied;
-import com.x.base.core.project.exception.ExceptionEntityNotExist;
-import com.x.base.core.project.gson.GsonPropertyObject;
-import com.x.base.core.project.http.ActionResult;
-import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.jaxrs.WoId;
-import com.x.processplatform.core.entity.content.Data;
-import com.x.processplatform.core.entity.content.Draft;
-import com.x.processplatform.core.entity.content.Work;
-
-class ActionEdit extends BaseAction {
-
-	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
-		ActionResult<Wo> result = new ActionResult<>();
-		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
-			Draft draft = emc.find(id, Draft.class);
-			if (null == draft) {
-				throw new ExceptionEntityNotExist(id, Draft.class);
-			}
-			if (effectivePerson.isNotPerson(draft.getPerson())) {
-				throw new ExceptionAccessDenied(effectivePerson, draft);
-			}
-			emc.beginTransaction(Draft.class);
-			draft.setTitle(wi.getWork().getTitle());
-			draft.getProperties().setData(wi.getData());
-			emc.check(draft, CheckPersistType.all);
-			emc.commit();
-			Wo wo = new Wo();
-			wo.setId(draft.getId());
-			result.setData(wo);
-			return result;
-		}
-	}
-
-	public static class Wi extends GsonPropertyObject {
-
-		@FieldDescribe("数据")
-		private Data data;
-
-		@FieldDescribe("工作")
-		private Work work;
-
-		public Data getData() {
-			return data;
-		}
-
-		public void setData(Data data) {
-			this.data = data;
-		}
-
-		public Work getWork() {
-			return work;
-		}
-
-		public void setWork(Work work) {
-			this.work = work;
-		}
-
-	}
-
-	public static class Wo extends WoId {
-
-	}
-
-}

+ 2 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionGet.java

@@ -48,6 +48,8 @@ class ActionGet extends BaseAction {
 			wo.setData(draft.getProperties().getData());
 			wo.setData(draft.getProperties().getData());
 			Work work = this.mockWork(application, process, draft.getPerson(), draft.getIdentity(), draft.getUnit(),
 			Work work = this.mockWork(application, process, draft.getPerson(), draft.getIdentity(), draft.getUnit(),
 					draft.getTitle());
 					draft.getTitle());
+//设置id值与workid相同.save可以判断
+			work.setId(draft.getId());
 			String form = this.findForm(business, process);
 			String form = this.findForm(business, process);
 			if (StringUtils.isEmpty(form)) {
 			if (StringUtils.isEmpty(form)) {
 				throw new ExceptionNoneForm();
 				throw new ExceptionNoneForm();

+ 31 - 15
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionCreate.java → o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionSave.java

@@ -20,7 +20,9 @@ import com.x.processplatform.core.entity.content.Work;
 import com.x.processplatform.core.entity.element.Application;
 import com.x.processplatform.core.entity.element.Application;
 import com.x.processplatform.core.entity.element.Process;
 import com.x.processplatform.core.entity.element.Process;
 
 
-class ActionCreate extends BaseAction {
+import org.apache.commons.lang3.StringUtils;
+
+class ActionSave extends BaseAction {
 
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
 		ActionResult<Wo> result = new ActionResult<>();
@@ -47,20 +49,20 @@ class ActionCreate extends BaseAction {
 			if (!business.process().startable(effectivePerson, identities, units, process)) {
 			if (!business.process().startable(effectivePerson, identities, units, process)) {
 				throw new ExceptionAccessDenied(effectivePerson, process);
 				throw new ExceptionAccessDenied(effectivePerson, process);
 			}
 			}
-			Draft draft = new Draft();
 			emc.beginTransaction(Draft.class);
 			emc.beginTransaction(Draft.class);
-			draft.setApplication(application.getId());
-			draft.setApplicationAlias(application.getAlias());
-			draft.setApplicationName(application.getName());
-			draft.setProcess(process.getId());
-			draft.setProcessAlias(process.getAlias());
-			draft.setProcessName(process.getName());
-			draft.setPerson(person);
-			draft.setIdentity(identity);
-			draft.setUnit(unit);
-			draft.setTitle(wi.getWork().getTitle());
-			draft.getProperties().setData(wi.getData());
-			emc.persist(draft,CheckPersistType.all);
+			Draft draft = null;
+			if (StringUtils.isEmpty(wi.getWork().getId())) {
+				draft = new Draft();
+				this.update(draft, wi, application, process, person, identity, unit);
+				emc.check(draft, CheckPersistType.all);
+			} else {
+				draft = emc.find(wi.getWork().getId(), Draft.class);
+				if (null == draft) {
+					throw new ExceptionEntityNotExist(wi.getWork().getId(), Draft.class);
+				}
+				this.update(draft, wi, application, process, person, identity, unit);
+				emc.persist(draft, CheckPersistType.all);
+			}
 			emc.commit();
 			emc.commit();
 			Wo wo = new Wo();
 			Wo wo = new Wo();
 			wo.setId(draft.getId());
 			wo.setId(draft.getId());
@@ -69,6 +71,21 @@ class ActionCreate extends BaseAction {
 		}
 		}
 	}
 	}
 
 
+	private void update(Draft draft, Wi wi, Application application, Process process, String person, String identity,
+			String unit) {
+		draft.setApplication(application.getId());
+		draft.setApplicationAlias(application.getAlias());
+		draft.setApplicationName(application.getName());
+		draft.setProcess(process.getId());
+		draft.setProcessAlias(process.getAlias());
+		draft.setProcessName(process.getName());
+		draft.setPerson(person);
+		draft.setIdentity(identity);
+		draft.setUnit(unit);
+		draft.setTitle(wi.getWork().getTitle());
+		draft.getProperties().setData(wi.getData());
+	}
+
 	public static class Wi extends GsonPropertyObject {
 	public static class Wi extends GsonPropertyObject {
 
 
 		@FieldDescribe("数据")
 		@FieldDescribe("数据")
@@ -103,7 +120,6 @@ class ActionCreate extends BaseAction {
 		public void setIdentity(String identity) {
 		public void setIdentity(String identity) {
 			this.identity = identity;
 			this.identity = identity;
 		}
 		}
-
 	}
 	}
 
 
 	public static class Wo extends WoId {
 	public static class Wo extends WoId {

+ 4 - 22
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java

@@ -88,34 +88,16 @@ public class DraftAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 	}
 
 
-	@POST
-	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
-	@Consumes(MediaType.APPLICATION_JSON)
-	@JaxrsMethodDescribe(value = "创建草稿.", action = ActionCreate.class)
-	public void create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
-			JsonElement jsonElement) {
-		ActionResult<ActionCreate.Wo> result = new ActionResult<>();
-		EffectivePerson effectivePerson = this.effectivePerson(request);
-		try {
-			result = new ActionCreate().execute(effectivePerson, jsonElement);
-		} catch (Exception e) {
-			logger.error(e, effectivePerson, request, jsonElement);
-			result.error(e);
-		}
-		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
-	}
-
 	@PUT
 	@PUT
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
 	@Consumes(MediaType.APPLICATION_JSON)
 	@Consumes(MediaType.APPLICATION_JSON)
-	@Path("{id}")
-	@JaxrsMethodDescribe(value = "编辑草稿.", action = ActionEdit.class)
+	@JaxrsMethodDescribe(value = "保存草稿.", action = ActionSave.class)
 	public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
 	public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
-			@JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
-		ActionResult<ActionEdit.Wo> result = new ActionResult<>();
+			JsonElement jsonElement) {
+		ActionResult<ActionSave.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		try {
 		try {
-			result = new ActionEdit().execute(effectivePerson, id, jsonElement);
+			result = new ActionSave().execute(effectivePerson, jsonElement);
 		} catch (Exception e) {
 		} catch (Exception e) {
 			logger.error(e, effectivePerson, request, jsonElement);
 			logger.error(e, effectivePerson, request, jsonElement);
 			result.error(e);
 			result.error(e);