roo00 hace 6 años
padre
commit
75bdfc30a7
Se han modificado 41 ficheros con 1410 adiciones y 665 borrados
  1. 3 3
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileDownloadStream.java
  2. 3 4
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java
  3. 3 4
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAnonymousAction.java
  4. 3 3
      o2server/x_collaboration_service_message/src/main/java/x/collaboration/service/message/ThisApplication.java
  5. 1 0
      o2server/x_console/src/main/java/com/x/server/console/action/ActionUpdateFile.java
  6. 7 0
      o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInput.java
  7. 0 2
      o2server/x_organization_core_entity/src/main/java/com/x/organization/core/entity/Bind.java
  8. 26 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java
  9. 3 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java
  10. 87 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionEdit.java
  11. 10 20
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUpdate.java
  12. 15 5
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUpload.java
  13. 11 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
  14. 46 51
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java
  15. 143 1
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Attachment.java
  16. 23 3
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Task.java
  17. 2 10
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
  18. 22 8
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Embed.java
  19. 22 9
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Invoke.java
  20. 28 2
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Route.java
  21. 0 2
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Service.java
  22. 37 1
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ScriptHelperFactory.java
  23. 8 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java
  24. 29 1
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/WorkContext.java
  25. 10 7
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/WorkDataHelper.java
  26. 12 6
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionProcessing.java
  27. 23 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/EmbedExecutor.java
  28. 10 4
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/EmbedProcessor.java
  29. 32 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/ExecuteObject.java
  30. 13 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/SyncEmbedQueue.java
  31. 33 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/ExecuteObject.java
  32. 365 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeExecutor.java
  33. 326 342
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeProcessor.java
  34. 13 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/SyncInvokeQueue.java
  35. 26 12
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor.java
  36. 1 1
      o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/schema/Table.java
  37. 0 159
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ExtractTextTools.java
  38. 1 1
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionExtract.java
  39. 3 2
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/Crawl.java
  40. 5 1
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/CrawlWork.java
  41. 5 1
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/CrawlWorkCompleted.java

+ 3 - 3
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileDownloadStream.java

@@ -11,7 +11,7 @@ import com.x.cms.core.entity.FileInfo;
 
 public class ActionFileDownloadStream extends BaseAction {
 	
-	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id, Boolean stream ) throws Exception {
+	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
 		FileInfo attachment = fileInfoServiceAdv.get(id);
 		
@@ -20,8 +20,8 @@ public class ActionFileDownloadStream extends BaseAction {
 		}else {
 			StorageMapping mapping = ThisApplication.context().storageMappings().get(FileInfo.class, attachment.getStorage());
 			Wo wo = new Wo(attachment.readContent(mapping), 
-					this.contentType(stream, attachment.getName()), 
-					this.contentDisposition(stream, attachment.getName()));
+					this.contentType( true, attachment.getName()), 
+					this.contentDisposition( true, attachment.getName()));
 			result.setData(wo);
 		}
 		return result;

+ 3 - 4
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java

@@ -153,16 +153,15 @@ public class FileInfoAction extends StandardJaxrsAction{
 
 	@JaxrsMethodDescribe(value = "根据附件ID下载附件,设定是否使用stream输出", action = ActionFileDownloadStream.class)
 	@GET
-	@Path("download/document/{id}/stream/{stream}")
+	@Path("download/document/{id}/stream")
 	@Consumes(MediaType.APPLICATION_JSON)
 	public void attachmentDownloadStream(@Suspended final AsyncResponse asyncResponse, 
 			@Context HttpServletRequest request, 
-			@JaxrsParameterDescribe("附件标识") @PathParam("id") String id, 
-			@JaxrsParameterDescribe("用.APPLICATION_OCTET_STREAM头输出") @PathParam("stream") Boolean stream) {
+			@JaxrsParameterDescribe("附件标识") @PathParam("id") String id) {
 		ActionResult<ActionFileDownloadStream.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		try {
-			result = new ActionFileDownloadStream().execute(request, effectivePerson, id, stream);
+			result = new ActionFileDownloadStream().execute(request, effectivePerson, id );
 		} catch (Exception e) {
 			logger.error(e, effectivePerson, request, null);
 			result.error(e);

+ 3 - 4
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAnonymousAction.java

@@ -90,16 +90,15 @@ public class FileInfoAnonymousAction extends StandardJaxrsAction{
 
 	@JaxrsMethodDescribe(value = "根据附件ID下载附件,设定是否使用stream输出", action = ActionFileDownloadStream.class)
 	@GET
-	@Path("download/document/{id}/stream/{stream}")
+	@Path("download/document/{id}/stream")
 	@Consumes(MediaType.APPLICATION_JSON)
 	public void attachmentDownloadStream(@Suspended final AsyncResponse asyncResponse, 
 			@Context HttpServletRequest request, 
-			@JaxrsParameterDescribe("附件标识") @PathParam("id") String id, 
-			@JaxrsParameterDescribe("用.APPLICATION_OCTET_STREAM头输出") @PathParam("stream") Boolean stream) {
+			@JaxrsParameterDescribe("附件标识") @PathParam("id") String id ) {
 		ActionResult<ActionFileDownloadStream.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		try {
-			result = new ActionFileDownloadStream().execute(request, effectivePerson, id, stream);
+			result = new ActionFileDownloadStream().execute(request, effectivePerson, id );
 		} catch (Exception e) {
 			logger.error(e, effectivePerson, request, null);
 			result.error(e);

+ 3 - 3
o2server/x_collaboration_service_message/src/main/java/x/collaboration/service/message/ThisApplication.java

@@ -12,7 +12,7 @@ public class ThisApplication {
 		return context;
 	}
 
-    public static SmsQueue smsQueue;
+	public static SmsQueue smsQueue;
 
 	public static WsQueue wsQueue;
 
@@ -21,10 +21,10 @@ public class ThisApplication {
 	public static void init() {
 		try {
 			LoggerFactory.setLevel(Config.logLevel().x_collaboration_service_message());
-            smsQueue = new SmsQueue(context());
+			smsQueue = new SmsQueue(context());
 			wsQueue = new WsQueue(context());
 			pushMessageQueue = new PushMessageQueue(context());
-            context().startQueue(smsQueue);
+			context().startQueue(smsQueue);
 			context().startQueue(wsQueue);
 			context().startQueue(pushMessageQueue);
 		} catch (Exception e) {

+ 1 - 0
o2server/x_console/src/main/java/com/x/server/console/action/ActionUpdateFile.java

@@ -36,6 +36,7 @@ public class ActionUpdateFile extends ActionUpdate {
 			File file = new File(path);
 			if (!file.exists() || file.isDirectory()) {
 				logger.print("zip file not exist path:{}.", path);
+				return false;
 			}
 			if (backup) {
 				this.backup();

+ 7 - 0
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInput.java

@@ -92,6 +92,13 @@ class ActionInput extends BaseAction {
 			ScriptingEngine engine = Scripting.getEngine();
 			for (PersonItem o : people) {
 				engine.binding("person", o);
+				System.out.println("!!!!!!!!!!!!!!!!!");
+				System.out.println(engine);
+				System.out.println("!!!!!!!!!!!!!!!!!");
+				System.out.println(eval);
+				System.out.println("!!!!!!!!!!!!!!!!!");
+				System.out.println(o);
+				System.out.println("!!!!!!!!!!!!!!!!!");
 				String pass = engine.eval(eval).toString();
 				o.setPassword(pass);
 			}

+ 0 - 2
o2server/x_organization_core_entity/src/main/java/com/x/organization/core/entity/Bind.java

@@ -1,7 +1,5 @@
 package com.x.organization.core.entity;
 
-import java.util.Date;
-
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;

+ 26 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java

@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.organization.OrganizationDefinition;
+import com.x.base.core.project.tools.ListTools;
 import com.x.organization.core.express.Organization;
 import com.x.processplatform.assemble.surface.factory.content.AttachmentFactory;
 import com.x.processplatform.assemble.surface.factory.content.ItemFactory;
@@ -46,6 +47,7 @@ import com.x.processplatform.assemble.surface.factory.element.RouteFactory;
 import com.x.processplatform.assemble.surface.factory.element.ScriptFactory;
 import com.x.processplatform.assemble.surface.factory.element.ServiceFactory;
 import com.x.processplatform.assemble.surface.factory.element.SplitFactory;
+import com.x.processplatform.core.entity.content.Attachment;
 import com.x.processplatform.core.entity.content.Read;
 import com.x.processplatform.core.entity.content.ReadCompleted;
 import com.x.processplatform.core.entity.content.Review;
@@ -1344,4 +1346,28 @@ public class Business {
 		}
 		return false;
 	}
+
+	public boolean controllerable(Business business, EffectivePerson effectivePerson, Application application,
+			Process process, Attachment attachment) throws Exception {
+		if (ListTools.isEmpty(attachment.getControllerIdentityList(), attachment.getControllerUnitList())) {
+			return true;
+		}
+		if (this.canManageApplicationOrProcess(effectivePerson, application, process)) {
+			return true;
+		}
+		if (!ListTools.isEmpty(attachment.getControllerIdentityList())) {
+			List<String> identities = business.organization().identity().listWithPerson(effectivePerson);
+			if (ListTools.containsAny(identities, attachment.getControllerIdentityList())) {
+				return true;
+			}
+		}
+		if (!ListTools.isEmpty(attachment.getControllerUnitList())) {
+			List<String> units = business.organization().unit().listWithPersonSupNested(effectivePerson);
+			if (ListTools.containsAny(units, attachment.getControllerUnitList())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
 }

+ 3 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java

@@ -1,6 +1,8 @@
 package com.x.processplatform.assemble.surface;
 
 import com.x.base.core.project.Context;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.logger.LoggerFactory;
 
 public class ThisApplication {
 
@@ -12,6 +14,7 @@ public class ThisApplication {
 
 	public static void init() {
 		try {
+			LoggerFactory.setLevel(Config.logLevel().x_processplatform_assemble_surface());
 		} catch (Exception e) {
 			e.printStackTrace();
 		}

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

@@ -0,0 +1,87 @@
+package com.x.processplatform.assemble.surface.jaxrs.attachment;
+
+import java.util.Arrays;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+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.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+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.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.assemble.surface.WorkControl;
+import com.x.processplatform.core.entity.content.Attachment;
+import com.x.processplatform.core.entity.content.Work;
+import com.x.processplatform.core.entity.element.Application;
+import com.x.processplatform.core.entity.element.Process;
+
+class ActionEdit extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionEdit.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String workId, JsonElement jsonElement)
+			throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			logger.debug("receive id:{}, jsonElement:{}.", id, jsonElement);
+			ActionResult<Wo> result = new ActionResult<>();
+			Business business = new Business(emc);
+			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+			Work work = emc.find(workId, Work.class);
+			/** 判断work是否存在 */
+			if (null == work) {
+				throw new ExceptionWorkNotExist(workId);
+			}
+			Attachment attachment = emc.find(id, Attachment.class);
+			if (null == attachment) {
+				throw new ExceptionAttachmentNotExist(id);
+			}
+			WoControl control = business.getControl(effectivePerson, work, WoControl.class);
+			if (BooleanUtils.isNotTrue(control.getAllowSave())) {
+				throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
+						work.getId());
+			}
+			Application application = business.application().pick(work.getApplication());
+			Process process = business.process().pick(work.getProcess());
+			if (business.controllerable(business, effectivePerson, application, process, attachment)) {
+				throw new ExceptionAccessDenied(effectivePerson, attachment);
+			}
+			emc.beginTransaction(Attachment.class);
+			Wi.copier.copy(wi, attachment);
+			emc.check(attachment, CheckPersistType.all);
+			emc.commit();
+			Wo wo = new Wo();
+			wo.setId(attachment.getId());
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wi extends Attachment {
+
+		private static final long serialVersionUID = 4243967432624425952L;
+
+		static WrapCopier<Wi, Attachment> copier = WrapCopierFactory.wi(Wi.class, Attachment.class,
+				Arrays.asList(Attachment.readIdentityList_FIELDNAME, Attachment.readUnitList_FIELDNAME,
+						Attachment.editIdentityList_FIELDNAME, Attachment.editUnitList_FIELDNAME,
+						Attachment.controllerIdentityList_FIELDNAME, Attachment.controllerUnitList_FIELDNAME),
+				null);
+
+	}
+
+	public static class Wo extends WoId {
+
+	}
+
+	public static class WoControl extends WorkControl {
+
+	}
+
+}

+ 10 - 20
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUpdate.java

@@ -7,12 +7,14 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.StorageMapping;
 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.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ExtractTextTools;
 import com.x.processplatform.assemble.surface.Business;
 import com.x.processplatform.assemble.surface.ThisApplication;
 import com.x.processplatform.assemble.surface.WorkControl;
@@ -39,34 +41,15 @@ class ActionUpdate extends BaseAction {
 			if (null == attachment) {
 				throw new ExceptionAttachmentNotExist(id);
 			}
-			// if (!work.getAttachmentList().contains(id)) {
-			// throw new ExceptionWorkNotContainsAttachment(work.getTitle(), work.getId(),
-			// attachment.getName(),
-			// attachment.getId());
-			// }
 			if (StringUtils.isEmpty(fileName)) {
 				fileName = this.fileName(disposition);
 			}
-			/** 禁止不带扩展名的文件上传 */
-			// if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) {
-			// throw new ExceptionEmptyExtension(fileName);
-			// }
-			/** 禁止不同的扩展名上传 */
-			// if
-			// (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)),
-			// attachment.getExtension())) {
-			// throw new ExceptionExtensionNotMatch(fileName, attachment.getExtension());
-			// }
-			/** 统计待办数量判断用户是否可以上传附件 */
+			/* 统计待办数量判断用户是否可以上传附件 */
 			WoControl control = business.getControl(effectivePerson, work, WoControl.class);
 			if (BooleanUtils.isNotTrue(control.getAllowSave())) {
 				throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
 						work.getId());
 			}
-			// if (business.attachment().multiReferenced(attachment)) {
-			// throw new ExceptionMultiReferenced(attachment.getName(),
-			// attachment.getId());
-			// }
 			/* 天印扩展 */
 			if (StringUtils.isNotEmpty(extraParam)) {
 				WiExtraParam wiExtraParam = gson.fromJson(extraParam, WiExtraParam.class);
@@ -80,6 +63,13 @@ class ActionUpdate extends BaseAction {
 			emc.beginTransaction(Attachment.class);
 			attachment.updateContent(mapping, bytes, fileName);
 			attachment.setType((new Tika()).detect(bytes, fileName));
+			logger.debug("filename:{}, file type:{}.", attachment.getName(), attachment.getType());
+			if (Config.query().getExtractImage() && ExtractTextTools.supportImage(attachment.getName())
+					&& ExtractTextTools.available(bytes)) {
+				attachment.setText(ExtractTextTools.image(bytes));
+				logger.debug("filename:{}, file type:{}, text:{}.", attachment.getName(), attachment.getType(),
+						attachment.getText());
+			}
 			emc.commit();
 			Wo wo = new Wo();
 			wo.setId(attachment.getId());

+ 15 - 5
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUpload.java

@@ -2,16 +2,21 @@ package com.x.processplatform.assemble.surface.jaxrs.attachment;
 
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.tika.Tika;
 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 
 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.config.Config;
 import com.x.base.core.project.config.StorageMapping;
 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.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ExtractTextTools;
 import com.x.processplatform.assemble.surface.Business;
 import com.x.processplatform.assemble.surface.ThisApplication;
 import com.x.processplatform.assemble.surface.WorkControl;
@@ -19,6 +24,9 @@ import com.x.processplatform.core.entity.content.Attachment;
 import com.x.processplatform.core.entity.content.Work;
 
 class ActionUpload extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionUpload.class);
+
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId, String site, String fileName, byte[] bytes,
 			FormDataContentDisposition disposition, String extraParam) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
@@ -49,17 +57,19 @@ class ActionUpload extends BaseAction {
 					site = wiExtraParam.getSite();
 				}
 			}
-			/** 禁止不带扩展名的文件上传 */
-			// if (StringUtils.isEmpty(fileName)) {
-			// throw new ExceptionEmptyExtension(fileName);
-			// }
 			StorageMapping mapping = ThisApplication.context().storageMappings().random(Attachment.class);
 			Attachment attachment = this.concreteAttachment(work, effectivePerson, site);
 			attachment.saveContent(mapping, bytes, fileName);
 			attachment.setType((new Tika()).detect(bytes, fileName));
+			logger.debug("filename:{}, file type:{}.", attachment.getName(), attachment.getType());
+			if (Config.query().getExtractImage() && ExtractTextTools.supportImage(attachment.getName())
+					&& ExtractTextTools.available(bytes)) {
+				attachment.setText(ExtractTextTools.image(bytes));
+				logger.debug("filename:{}, file type:{}, text:{}.", attachment.getName(), attachment.getType(),
+						attachment.getText());
+			}
 			emc.beginTransaction(Attachment.class);
 			emc.persist(attachment, CheckPersistType.all);
-			// work.getAttachmentList().add(attachment.getId());
 			emc.commit();
 			Wo wo = new Wo();
 			wo.setId(attachment.getId());

+ 11 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java

@@ -174,6 +174,9 @@ class ActionProcessing extends BaseAction {
 		@FieldDescribe("多媒体意见")
 		private String mediaOpinion;
 
+		@FieldDescribe("多媒体意见")
+		private JsonElement routeData;
+
 		public String getRouteName() {
 			return routeName;
 		}
@@ -198,6 +201,14 @@ class ActionProcessing extends BaseAction {
 			this.mediaOpinion = mediaOpinion;
 		}
 
+		public JsonElement getRouteData() {
+			return routeData;
+		}
+
+		public void setRouteData(JsonElement routeData) {
+			this.routeData = routeData;
+		}
+
 	}
 
 }

+ 46 - 51
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java

@@ -281,12 +281,14 @@ abstract class BaseAction extends StandardJaxrsAction {
 
 		private String position;
 
-		private ActivityType activityType;
+		//private ActivityType activityType;
 
 		private String resetRange;
 
 		private Integer resetCount;
 
+		private Boolean allowReset;
+
 		public String getName() {
 			return name;
 		}
@@ -319,13 +321,13 @@ abstract class BaseAction extends StandardJaxrsAction {
 			this.position = position;
 		}
 
-		public ActivityType getActivityType() {
-			return activityType;
-		}
-
-		public void setActivityType(ActivityType activityType) {
-			this.activityType = activityType;
-		}
+//		public ActivityType getActivityType() {
+//			return activityType;
+//		}
+//
+//		public void setActivityType(ActivityType activityType) {
+//			this.activityType = activityType;
+//		}
 
 		public String getId() {
 			return id;
@@ -351,6 +353,14 @@ abstract class BaseAction extends StandardJaxrsAction {
 			this.resetRange = resetRange;
 		}
 
+		public Boolean getAllowReset() {
+			return allowReset;
+		}
+
+		public void setAllowReset(Boolean allowReset) {
+			this.allowReset = allowReset;
+		}
+
 	}
 
 	public static class WoWork extends Work {
@@ -471,20 +481,6 @@ abstract class BaseAction extends StandardJaxrsAction {
 		public static WrapCopier<Attachment, WoAttachment> copier = WrapCopierFactory.wo(Attachment.class,
 				WoAttachment.class, null, JpaObject.FieldsInvisible);
 
-		// private String contentType;
-		//
-		// public String getContentType() {
-		// return contentType;
-		// }
-		//
-		// public void setContentType(String contentType) {
-		// this.contentType = contentType;
-		// }
-		//
-		// public void contentType() throws Exception {
-		// this.contentType = Config.mimeTypes(this.getExtension());
-		// }
-
 	}
 
 	public static class WoControl extends GsonPropertyObject {
@@ -617,18 +613,19 @@ abstract class BaseAction extends StandardJaxrsAction {
 			}
 		});
 
-		CompletableFuture<Void> future_taskCompleteds = CompletableFuture.runAsync(() -> {
-			try {
-				List<TaskCompleted> os = business.entityManagerContainer()
-						.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, work.getJob()).stream()
-						.sorted(Comparator.comparing(TaskCompleted::getStartTime,
-								Comparator.nullsLast(Date::compareTo)))
-						.collect(Collectors.toList());
-				woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os));
-			} catch (Exception e) {
-				logger.error(e);
-			}
-		});
+//		CompletableFuture<Void> future_taskCompleteds = CompletableFuture.runAsync(() -> {
+//			try {
+//				List<TaskCompleted> os = business.entityManagerContainer()
+//						.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, work.getJob()).stream()
+//						.sorted(Comparator.comparing(TaskCompleted::getStartTime,
+//								Comparator.nullsLast(Date::compareTo)))
+//						.collect(Collectors.toList());
+//				woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os));
+//			} catch (Exception e) {
+//				logger.error(e);
+//			}
+//		});
+		
 		CompletableFuture<Void> future_reads = CompletableFuture.runAsync(() -> {
 			try {
 				List<Read> os = business.entityManagerContainer()
@@ -648,18 +645,18 @@ abstract class BaseAction extends StandardJaxrsAction {
 				logger.error(e);
 			}
 		});
-		CompletableFuture<Void> future_readCompleteds = CompletableFuture.runAsync(() -> {
-			try {
-				List<ReadCompleted> os = business.entityManagerContainer()
-						.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, work.getJob()).stream()
-						.sorted(Comparator.comparing(ReadCompleted::getStartTime,
-								Comparator.nullsLast(Date::compareTo)))
-						.collect(Collectors.toList());
-				woReadCompleteds.addAll(WoReadCompleted.copier.copy(os));
-			} catch (Exception e) {
-				logger.error(e);
-			}
-		});
+//		CompletableFuture<Void> future_readCompleteds = CompletableFuture.runAsync(() -> {
+//			try {
+//				List<ReadCompleted> os = business.entityManagerContainer()
+//						.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, work.getJob()).stream()
+//						.sorted(Comparator.comparing(ReadCompleted::getStartTime,
+//								Comparator.nullsLast(Date::compareTo)))
+//						.collect(Collectors.toList());
+//				woReadCompleteds.addAll(WoReadCompleted.copier.copy(os));
+//			} catch (Exception e) {
+//				logger.error(e);
+//			}
+//		});
 		CompletableFuture<Void> future_attachments = CompletableFuture.runAsync(() -> {
 			try {
 				List<Attachment> os = business.entityManagerContainer()
@@ -737,9 +734,9 @@ abstract class BaseAction extends StandardJaxrsAction {
 			return o;
 		});
 		future_tasks.get(300, TimeUnit.SECONDS);
-		future_taskCompleteds.get(300, TimeUnit.SECONDS);
+		//future_taskCompleteds.get(300, TimeUnit.SECONDS);
 		future_reads.get(300, TimeUnit.SECONDS);
-		future_readCompleteds.get(300, TimeUnit.SECONDS);
+		//future_readCompleteds.get(300, TimeUnit.SECONDS);
 		future_attachments.get(300, TimeUnit.SECONDS);
 		future_workLogs.get(300, TimeUnit.SECONDS);
 		future_data.get(300, TimeUnit.SECONDS);
@@ -797,9 +794,7 @@ abstract class BaseAction extends StandardJaxrsAction {
 			control.setAllowSave(true);
 		}
 		/** 设置 allowReset */
-		if (Objects.equals(t.getActivity().getActivityType(), ActivityType.manual)
-				&& BooleanUtils
-						.isTrue((Boolean) PropertyUtils.getProperty(t.getActivity(), Manual.allowReset_FIELDNAME))
+		if (BooleanUtils.isTrue((Boolean) PropertyUtils.getProperty(t.getActivity(), Manual.allowReset_FIELDNAME))
 				&& (t.getCurrentTaskIndex() > -1)) {
 			control.setAllowReset(true);
 		}

+ 143 - 1
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Attachment.java

@@ -3,18 +3,27 @@ package com.x.processplatform.core.entity.content;
 import static com.x.base.core.entity.StorageType.processPlatform;
 
 import java.util.Date;
+import java.util.List;
 
+import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
 import javax.persistence.Id;
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
+import javax.persistence.Lob;
+import javax.persistence.OrderColumn;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.openjpa.persistence.PersistentCollection;
+import org.apache.openjpa.persistence.jdbc.ContainerTable;
+import org.apache.openjpa.persistence.jdbc.ElementColumn;
+import org.apache.openjpa.persistence.jdbc.ElementIndex;
 import org.apache.openjpa.persistence.jdbc.Index;
 
 import com.x.base.core.entity.AbstractPersistenceProperties;
@@ -24,7 +33,6 @@ import com.x.base.core.entity.StorageObject;
 import com.x.base.core.entity.annotation.CheckPersist;
 import com.x.base.core.entity.annotation.ContainerEntity;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.config.Config;
 import com.x.base.core.project.tools.DateTools;
 import com.x.processplatform.core.entity.PersistenceProperties;
 import com.x.processplatform.core.entity.element.ActivityType;
@@ -296,6 +304,84 @@ public class Attachment extends StorageObject {
 	@CheckPersist(allowEmpty = true)
 	private String type;
 
+	public static final String text_FIELDNAME = "text";
+	@FieldDescribe("文本.")
+	@Lob
+	@Basic(fetch = FetchType.EAGER)
+	@Column(length = JpaObject.length_100M, name = ColumnNamePrefix + text_FIELDNAME)
+	@CheckPersist(allowEmpty = true)
+	private String text;
+
+	public static final String readIdentityList_FIELDNAME = "readIdentityList";
+	@FieldDescribe("可以访问的身份.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle
+			+ readIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME
+					+ JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readIdentityList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> readIdentityList;
+
+	public static final String readUnitList_FIELDNAME = "readUnitList";
+	@FieldDescribe("可以访问的组织.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
+			+ IndexNameMiddle + readUnitList_FIELDNAME + JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readUnitList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + readUnitList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> readUnitList;
+
+	public static final String editIdentityList_FIELDNAME = "editIdentityList";
+	@FieldDescribe("可以修改的用户.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle
+			+ editIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + editIdentityList_FIELDNAME
+					+ JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + editIdentityList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + editIdentityList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> editIdentityList;
+
+	public static final String editUnitList_FIELDNAME = "editUnitList";
+	@FieldDescribe("可以修改的组织.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle + editUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
+			+ IndexNameMiddle + editUnitList_FIELDNAME + JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + editUnitList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + editUnitList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> editUnitList;
+
+	public static final String controllerIdentityList_FIELDNAME = "controllerIdentityList";
+	@FieldDescribe("可以修改的用户.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle
+			+ controllerIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+					+ controllerIdentityList_FIELDNAME + JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + controllerIdentityList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + controllerIdentityList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> controllerIdentityList;
+
+	public static final String controllerUnitList_FIELDNAME = "controllerUnitList";
+	@FieldDescribe("可以修改的组织.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle
+			+ controllerUnitList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+					+ controllerUnitList_FIELDNAME + JoinIndexNameSuffix))
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + controllerUnitList_FIELDNAME)
+	@ElementIndex(name = TABLE + IndexNameMiddle + controllerUnitList_FIELDNAME + ElementIndexNameSuffix)
+	@CheckPersist(allowEmpty = true)
+	private List<String> controllerUnitList;
+
 	public String getJob() {
 		return job;
 	}
@@ -416,4 +502,60 @@ public class Attachment extends StorageObject {
 		this.type = type;
 	}
 
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public List<String> getReadIdentityList() {
+		return readIdentityList;
+	}
+
+	public void setReadIdentityList(List<String> readIdentityList) {
+		this.readIdentityList = readIdentityList;
+	}
+
+	public List<String> getReadUnitList() {
+		return readUnitList;
+	}
+
+	public void setReadUnitList(List<String> readUnitList) {
+		this.readUnitList = readUnitList;
+	}
+
+	public List<String> getEditIdentityList() {
+		return editIdentityList;
+	}
+
+	public void setEditIdentityList(List<String> editIdentityList) {
+		this.editIdentityList = editIdentityList;
+	}
+
+	public List<String> getEditUnitList() {
+		return editUnitList;
+	}
+
+	public void setEditUnitList(List<String> editUnitList) {
+		this.editUnitList = editUnitList;
+	}
+
+	public List<String> getControllerIdentityList() {
+		return controllerIdentityList;
+	}
+
+	public void setControllerIdentityList(List<String> controllerIdentityList) {
+		this.controllerIdentityList = controllerIdentityList;
+	}
+
+	public List<String> getControllerUnitList() {
+		return controllerUnitList;
+	}
+
+	public void setControllerUnitList(List<String> controllerUnitList) {
+		this.controllerUnitList = controllerUnitList;
+	}
+
 }

+ 23 - 3
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Task.java

@@ -135,6 +135,7 @@ public class Task extends SliceJpaObject {
 						this.routeList.add(o.getId());
 						this.routeNameList.add(o.getName());
 						this.routeOpinionList.add(StringUtils.trimToEmpty(o.getOpinion()));
+						this.routeDecisionOpinionList.add(StringUtils.trimToEmpty(o.getDecisionOpinion()));
 					});
 		}
 		this.routeName = "";
@@ -352,7 +353,7 @@ public class Task extends SliceJpaObject {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + routeList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + routeList_FIELDNAME + JoinIndexNameSuffix))
 	@ElementColumn(length = JpaObject.length_id, name = ColumnNamePrefix + routeList_FIELDNAME)
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@CheckPersist(allowEmpty = true)
 	private List<String> routeList = new ArrayList<String>();
 
@@ -362,7 +363,7 @@ public class Task extends SliceJpaObject {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + routeNameList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + routeNameList_FIELDNAME + JoinIndexNameSuffix))
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + routeNameList_FIELDNAME)
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@CheckPersist(allowEmpty = true)
 	private List<String> routeNameList = new ArrayList<String>();
 
@@ -373,10 +374,21 @@ public class Task extends SliceJpaObject {
 			+ routeOpinionList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + routeOpinionList_FIELDNAME
 					+ JoinIndexNameSuffix))
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + routeOpinionList_FIELDNAME)
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@CheckPersist(allowEmpty = true)
 	private List<String> routeOpinionList = new ArrayList<String>();
 
+	public static final String routeDecisionOpinionList_FIELDNAME = "routeDecisionOpinionList";
+	@FieldDescribe("决策性意见列表,使用#分割.")
+	@PersistentCollection(fetch = FetchType.EAGER)
+	@ContainerTable(name = TABLE + ContainerTableNameMiddle
+			+ routeDecisionOpinionList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+					+ routeDecisionOpinionList_FIELDNAME + JoinIndexNameSuffix))
+	@ElementColumn(length = length_255B, name = ColumnNamePrefix + routeDecisionOpinionList_FIELDNAME)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
+	@CheckPersist(allowEmpty = true)
+	private List<String> routeDecisionOpinionList = new ArrayList<String>();
+
 	public static final String routeName_FIELDNAME = "routeName";
 	@FieldDescribe("选择的路由名称.")
 	@Column(length = length_255B, name = ColumnNamePrefix + routeName_FIELDNAME)
@@ -726,4 +738,12 @@ public class Task extends SliceJpaObject {
 		this.mediaOpinion = mediaOpinion;
 	}
 
+	public List<String> getRouteDecisionOpinionList() {
+		return routeDecisionOpinionList;
+	}
+
+	public void setRouteDecisionOpinionList(List<String> routeDecisionOpinionList) {
+		this.routeDecisionOpinionList = routeDecisionOpinionList;
+	}
+
 }

+ 2 - 10
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java

@@ -282,7 +282,7 @@ public class Work extends SliceJpaObject {
 	public static final String manualTaskIdentityList_FIELDNAME = "manualTaskIdentityList";
 	@FieldDescribe("预期的处理人")
 	@PersistentCollection(fetch = FetchType.EAGER)
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ manualTaskIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
 					+ manualTaskIdentityList_FIELDNAME + JoinIndexNameSuffix))
@@ -308,7 +308,7 @@ public class Work extends SliceJpaObject {
 	public static final String splitTokenList_FIELDNAME = "splitTokenList";
 	@FieldDescribe("拆分工作产生的Token")
 	@PersistentCollection(fetch = FetchType.EAGER)
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + splitTokenList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + splitTokenList_FIELDNAME + JoinIndexNameSuffix))
 	@ElementColumn(length = JpaObject.length_id, name = ColumnNamePrefix + splitTokenList_FIELDNAME)
@@ -692,14 +692,6 @@ public class Work extends SliceJpaObject {
 		this.form = form;
 	}
 
-	// public Boolean getExecuted() {
-	// return executed;
-	// }
-	//
-	// public void setExecuted(Boolean executed) {
-	// this.executed = executed;
-	// }
-
 	public Integer getErrorRetry() {
 		return errorRetry;
 	}

+ 22 - 8
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Embed.java

@@ -116,7 +116,7 @@ public class Embed extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ readIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME
 					+ JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readIdentityList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -126,7 +126,7 @@ public class Embed extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + readUnitList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readUnitList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readUnitList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -136,7 +136,7 @@ public class Embed extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readGroupList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + readGroupList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readGroupList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readGroupList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -167,7 +167,7 @@ public class Embed extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ readDataPathList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + readDataPathList_FIELDNAME
 					+ JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = JpaObject.length_255B, name = ColumnNamePrefix + readDataPathList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readDataPathList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -178,7 +178,7 @@ public class Embed extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ reviewIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
 					+ reviewIdentityList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewIdentityList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewIdentityList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -188,7 +188,7 @@ public class Embed extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + reviewUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + reviewUnitList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewUnitList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewUnitList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -198,7 +198,7 @@ public class Embed extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + reviewGroupList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + reviewGroupList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewGroupList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewGroupList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -229,7 +229,7 @@ public class Embed extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ reviewDataPathList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
 					+ reviewDataPathList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = JpaObject.length_255B, name = ColumnNamePrefix + reviewDataPathList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewDataPathList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -455,6 +455,12 @@ public class Embed extends Activity {
 	@CheckPersist(allowEmpty = true)
 	private String targetAssginDataScriptText;
 
+	public static final String async_FIELDNAME = "async";
+	@FieldDescribe("是否是异步调用")
+	@Column(name = ColumnNamePrefix + async_FIELDNAME)
+	@CheckPersist(allowEmpty = true)
+	private Boolean async;
+
 	public String getName() {
 		return name;
 	}
@@ -871,4 +877,12 @@ public class Embed extends Activity {
 		this.reviewGroupList = reviewGroupList;
 	}
 
+	public Boolean getAsync() {
+		return async;
+	}
+
+	public void setAsync(Boolean async) {
+		this.async = async;
+	}
+
 }

+ 22 - 9
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Invoke.java

@@ -1,6 +1,5 @@
 package com.x.processplatform.core.entity.element;
 
-import java.util.Date;
 import java.util.List;
 
 import javax.persistence.Basic;
@@ -116,7 +115,7 @@ public class Invoke extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ readIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME
 					+ JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readIdentityList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readIdentityList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -126,7 +125,7 @@ public class Invoke extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + readUnitList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readUnitList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readUnitList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -136,7 +135,7 @@ public class Invoke extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readGroupList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + readGroupList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + readGroupList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readGroupList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -167,7 +166,7 @@ public class Invoke extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ readDataPathList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + readDataPathList_FIELDNAME
 					+ JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = JpaObject.length_255B, name = ColumnNamePrefix + readDataPathList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + readDataPathList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -178,7 +177,7 @@ public class Invoke extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ reviewIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
 					+ reviewIdentityList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewIdentityList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewIdentityList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -188,7 +187,7 @@ public class Invoke extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + reviewUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + reviewUnitList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewUnitList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewUnitList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -198,7 +197,7 @@ public class Invoke extends Activity {
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + reviewGroupList_FIELDNAME, joinIndex = @Index(name = TABLE
 			+ IndexNameMiddle + reviewGroupList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = length_255B, name = ColumnNamePrefix + reviewGroupList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewGroupList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -229,7 +228,7 @@ public class Invoke extends Activity {
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle
 			+ reviewDataPathList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
 					+ reviewDataPathList_FIELDNAME + JoinIndexNameSuffix))
-	@OrderColumn(name =  ORDERCOLUMNCOLUMN)
+	@OrderColumn(name = ORDERCOLUMNCOLUMN)
 	@ElementColumn(length = JpaObject.length_255B, name = ColumnNamePrefix + reviewDataPathList_FIELDNAME)
 	@ElementIndex(name = TABLE + IndexNameMiddle + reviewDataPathList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
@@ -467,6 +466,12 @@ public class Invoke extends Activity {
 	@CheckPersist(allowEmpty = true)
 	private String internalProject;
 
+	public static final String async_FIELDNAME = "async";
+	@FieldDescribe("是否是异步调用")
+	@Column(name = ColumnNamePrefix + async_FIELDNAME)
+	@CheckPersist(allowEmpty = true)
+	private Boolean async;
+
 	public String getName() {
 		return name;
 	}
@@ -907,4 +912,12 @@ public class Invoke extends Activity {
 		this.reviewGroupList = reviewGroupList;
 	}
 
+	public Boolean getAsync() {
+		return async;
+	}
+
+	public void setAsync(Boolean async) {
+		this.async = async;
+	}
+
 }

+ 28 - 2
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Route.java

@@ -1,7 +1,5 @@
 package com.x.processplatform.core.entity.element;
 
-import java.util.Date;
-
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -165,6 +163,18 @@ public class Route extends SliceJpaObject {
 	@CheckPersist(allowEmpty = true)
 	private String opinion;
 
+	public static final String decisionOpinion_FIELDNAME = "decisionOpinion";
+	@FieldDescribe("决策性意见,使用#分割.")
+	@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + decisionOpinion_FIELDNAME)
+	@CheckPersist(allowEmpty = true)
+	private String decisionOpinion;
+
+	public static final String sole_FIELDNAME = "sole";
+	@FieldDescribe("唯一路由,当多人处理时,如果有人选择此路由将通过此路由,一票否决.")
+	@CheckPersist(allowEmpty = true)
+	@Column(name = ColumnNamePrefix + sole_FIELDNAME)
+	private Boolean sole;
+
 	public String getName() {
 		return name;
 	}
@@ -277,4 +287,20 @@ public class Route extends SliceJpaObject {
 		this.opinion = opinion;
 	}
 
+	public String getDecisionOpinion() {
+		return decisionOpinion;
+	}
+
+	public void setDecisionOpinion(String decisionOpinion) {
+		this.decisionOpinion = decisionOpinion;
+	}
+
+	public Boolean getSole() {
+		return sole;
+	}
+
+	public void setSole(Boolean sole) {
+		this.sole = sole;
+	}
+
 }

+ 0 - 2
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Service.java

@@ -1,6 +1,5 @@
 package com.x.processplatform.core.entity.element;
 
-import java.util.Date;
 import java.util.List;
 
 import javax.persistence.Basic;
@@ -21,7 +20,6 @@ import org.apache.openjpa.persistence.jdbc.ElementColumn;
 import org.apache.openjpa.persistence.jdbc.ElementIndex;
 import org.apache.openjpa.persistence.jdbc.Index;
 
-import com.x.base.core.entity.AbstractPersistenceProperties;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.entity.annotation.CheckPersist;
 import com.x.base.core.entity.annotation.ContainerEntity;

+ 37 - 1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ScriptHelperFactory.java

@@ -6,6 +6,8 @@ import java.util.Map;
 import com.x.base.core.project.gson.XGsonBuilder;
 import com.x.organization.core.express.Organization;
 import com.x.processplatform.core.entity.content.Data;
+import com.x.processplatform.core.entity.content.Task;
+import com.x.processplatform.core.entity.content.TaskCompleted;
 import com.x.processplatform.core.entity.content.Work;
 import com.x.processplatform.core.entity.element.Activity;
 import com.x.processplatform.service.processing.processor.AeiObjects;
@@ -41,7 +43,6 @@ public class ScriptHelperFactory {
 		return sh;
 	}
 
-
 	/**
 	 * 用于单独生成脚本运行环境,ManualBeforeTaskScript,ManualAfterTaskScript
 	 * 
@@ -69,6 +70,41 @@ public class ScriptHelperFactory {
 		}
 		ScriptHelper sh = new ScriptHelper(business, map, initialScriptText);
 		return sh;
+	}
+
+	public static ScriptHelper create(Business business, Work work, Data data, Activity activity, Task task,
+			BindingPair... bindingPairs) throws Exception {
+		WorkContext workContext = new WorkContext(business, work, activity, task);
+		Map<String, Object> map = new HashMap<>();
+		map.put(workContext_binding_name, workContext);
+		map.put(data_binding_name, data);
+		map.put(organization_binding_name, new Organization(ThisApplication.context()));
+		map.put(webservicesClient_binding_name, new WebservicesClient());
+		map.put(dictionary_binding_name,
+				new ApplicationDictHelper(business.entityManagerContainer(), work.getApplication()));
+		map.put(applications_binding_name, ThisApplication.context().applications());
+		for (BindingPair o : bindingPairs) {
+			map.put(o.getName(), o.getValue());
+		}
+		ScriptHelper sh = new ScriptHelper(business, map, initialScriptText);
+		return sh;
+	}
 
+	public static ScriptHelper create(Business business, Work work, Data data, Activity activity,
+			TaskCompleted taskCompleted, BindingPair... bindingPairs) throws Exception {
+		WorkContext workContext = new WorkContext(business, work, activity, taskCompleted);
+		Map<String, Object> map = new HashMap<>();
+		map.put(workContext_binding_name, workContext);
+		map.put(data_binding_name, data);
+		map.put(organization_binding_name, new Organization(ThisApplication.context()));
+		map.put(webservicesClient_binding_name, new WebservicesClient());
+		map.put(dictionary_binding_name,
+				new ApplicationDictHelper(business.entityManagerContainer(), work.getApplication()));
+		map.put(applications_binding_name, ThisApplication.context().applications());
+		for (BindingPair o : bindingPairs) {
+			map.put(o.getName(), o.getValue());
+		}
+		ScriptHelper sh = new ScriptHelper(business, map, initialScriptText);
+		return sh;
 	}
 }

+ 8 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java

@@ -7,6 +7,8 @@ import com.x.base.core.project.config.Config;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.message.MessageConnector;
 import com.x.collaboration.core.message.Collaboration;
+import com.x.processplatform.service.processing.processor.embed.SyncEmbedQueue;
+import com.x.processplatform.service.processing.processor.invoke.SyncInvokeQueue;
 import com.x.processplatform.service.processing.schedule.Delay;
 import com.x.processplatform.service.processing.schedule.Expire;
 import com.x.processplatform.service.processing.schedule.Reorganize;
@@ -16,6 +18,10 @@ public class ThisApplication {
 
 	protected static Context context;
 
+	public static SyncInvokeQueue syncInvokeQueue = new SyncInvokeQueue();
+
+	public static SyncEmbedQueue syncEmbedQueue = new SyncEmbedQueue();
+
 	public static Context context() {
 		return context;
 	}
@@ -26,6 +32,8 @@ public class ThisApplication {
 			ScriptHelperFactory.initialScriptText = Config.initialScriptText();
 			Collaboration.start(context());
 			MessageConnector.start(context());
+			context().startQueue(syncInvokeQueue);
+			context().startQueue(syncEmbedQueue);
 			if (BooleanUtils.isTrue(Config.processPlatform().getUrge().getEnable())) {
 				context.schedule(Urge.class, Config.processPlatform().getUrge().getCron());
 			}

+ 29 - 1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/WorkContext.java

@@ -32,6 +32,8 @@ public class WorkContext {
 	private Gson gson = XGsonBuilder.instance();
 	private ProcessingAttributes processingAttributes;
 	private AeiObjects aeiObjects = null;
+	private Task task;
+	private TaskCompleted taskCompleted;
 
 	public WorkContext(AeiObjects aeiObjects) throws Exception {
 		this.aeiObjects = aeiObjects;
@@ -48,6 +50,22 @@ public class WorkContext {
 		this.gson = XGsonBuilder.instance();
 	}
 
+	WorkContext(Business business, Work work, Activity activity, Task task) throws Exception {
+		this.business = business;
+		this.work = work;
+		this.activity = activity;
+		this.gson = XGsonBuilder.instance();
+		this.task = task;
+	}
+
+	WorkContext(Business business, Work work, Activity activity, TaskCompleted taskCompleted) throws Exception {
+		this.business = business;
+		this.work = work;
+		this.activity = activity;
+		this.gson = XGsonBuilder.instance();
+		this.taskCompleted = taskCompleted;
+	}
+
 	public String getWork() throws Exception {
 		return gson.toJson(work);
 	}
@@ -82,6 +100,16 @@ public class WorkContext {
 		}
 	}
 
+	public String getTaskOrTaskCompleted() {
+		if (null != task) {
+			return gson.toJson(task);
+		}
+		if (null != taskCompleted) {
+			return gson.toJson(taskCompleted);
+		}
+		return "";
+	}
+
 	public String getReadList() throws Exception {
 		try {
 			List<Read> list = new ArrayList<>();
@@ -201,7 +229,7 @@ public class WorkContext {
 			List<String> libs = new ArrayList<>();
 			for (Script o : list) {
 				buffer.append(o.getText());
-				buffer.append(SystemUtils.LINE_SEPARATOR);
+				buffer.append(System.lineSeparator());
 				if (StringUtils.isNotEmpty(o.getId())) {
 					libs.add(o.getId());
 				}

+ 10 - 7
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/WorkDataHelper.java

@@ -78,29 +78,29 @@ public class WorkDataHelper {
 		}
 	}
 
-	public void update(JsonElement jsonElement) throws Exception {
+	public boolean update(JsonElement jsonElement) throws Exception {
 		if (jsonElement.isJsonNull()) {
 			// throw new Exception("can not update data null.");
 			/** 如果是空数据就不更新,避免数据被清空 */
-			return;
+			return false;
 		}
 		if (jsonElement.isJsonPrimitive()) {
 			// throw new Exception("can not update data primitive.");
 			/** 如果是空数据就不更新,避免数据被清空 */
-			return;
+			return false;
 		}
 		if (jsonElement.isJsonObject()) {
 			if (jsonElement.getAsJsonObject().size() == 0) {
 				// throw new Exception("can not update data object size ==0.");
 				/** 如果是空数据就不更新,避免数据被清空 */
-				return;
+				return false;
 			}
 		}
 		if (jsonElement.isJsonArray()) {
 			if (jsonElement.getAsJsonArray().size() == 0) {
 				// throw new Exception("can not update data array size ==0.");
 				/** 如果是空数据就不更新,避免数据被清空 */
-				return;
+				return false;
 			}
 		}
 		List<Item> currents = converter.disassemble(jsonElement);
@@ -127,12 +127,15 @@ public class WorkDataHelper {
 			list.addAll(adds);
 			converter.sort(list);
 			items = list;
+			return true;
+		} else {
+			return false;
 		}
 	}
 
-	public void update(Data data) throws Exception {
+	public boolean update(Data data) throws Exception {
 		JsonElement jsonElement = gson.toJsonTree(data);
-		this.update(jsonElement);
+		return this.update(jsonElement);
 	}
 
 	public void remove() throws Exception {

+ 12 - 6
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionProcessing.java

@@ -66,10 +66,13 @@ class ActionProcessing extends BaseAction {
 						if (null != work) {
 							WorkDataHelper workDataHelper = new WorkDataHelper(business.entityManagerContainer(), work);
 							data = workDataHelper.get();
+							ScriptHelper sh = ScriptHelperFactory.create(business, work, data, manual, task);
+							sh.eval(work.getApplication(), manual.getManualBeforeTaskScript(),
+									manual.getManualBeforeTaskScriptText());
+							if (workDataHelper.update(data)) {
+								emc.commit();
+							}
 						}
-						ScriptHelper sh = ScriptHelperFactory.create(business, work, data, manual);
-						sh.eval(work.getApplication(), manual.getManualBeforeTaskScript(),
-								manual.getManualBeforeTaskScriptText());
 					}
 				}
 			}
@@ -96,10 +99,13 @@ class ActionProcessing extends BaseAction {
 					if (null != work) {
 						WorkDataHelper workDataHelper = new WorkDataHelper(business.entityManagerContainer(), work);
 						data = workDataHelper.get();
+						ScriptHelper sh = ScriptHelperFactory.create(business, work, data, manual, taskCompleted);
+						sh.eval(work.getApplication(), manual.getManualAfterTaskScript(),
+								manual.getManualAfterTaskScriptText());
+						if (workDataHelper.update(data)) {
+							emc.commit();
+						}
 					}
-					ScriptHelper sh = ScriptHelperFactory.create(business, work, data, manual);
-					sh.eval(work.getApplication(), manual.getManualAfterTaskScript(),
-							manual.getManualAfterTaskScriptText());
 				}
 			}
 			MessageFactory.taskCompleted_create(taskCompleted);

+ 23 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/EmbedExecutor.java

@@ -0,0 +1,23 @@
+package com.x.processplatform.service.processing.processor.embed;
+
+import com.x.base.core.project.x_processplatform_service_processing;
+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.processplatform.service.processing.ThisApplication;
+
+public class EmbedExecutor {
+
+	private static Logger logger = LoggerFactory.getLogger(EmbedExecutor.class);
+
+	public String execute(AssginData assginData) throws Exception {
+		Wo wo = ThisApplication.context().applications()
+				.postQuery(x_processplatform_service_processing.class, "work", assginData).getData(Wo.class);
+		return wo.getId();
+	}
+
+	public static class Wo extends WoId {
+
+	}
+
+}

+ 10 - 4
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/EmbedProcessor.java

@@ -7,7 +7,6 @@ import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.container.EntityManagerContainer;
-import com.x.base.core.project.x_processplatform_service_processing;
 import com.x.base.core.project.jaxrs.WoId;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
@@ -81,9 +80,16 @@ public class EmbedProcessor extends AbstractEmbedProcessor {
 		}
 		logger.debug("embed:{}, process:{} try to embed application:{}, process:{}, assginData:{}", embed.getName(),
 				embed.getProcess(), embed.getTargetApplication(), embed.getTargetProcess(), gson.toJson(assginData));
-		WoWorkId woWorkId = ThisApplication.context().applications()
-				.postQuery(x_processplatform_service_processing.class, "work", assginData).getData(WoWorkId.class);
-		aeiObjects.getWork().setEmbedTargetWork(woWorkId.getId());
+		if (BooleanUtils.isTrue(embed.getAsync())) {
+			ThisApplication.syncEmbedQueue.send(assginData);
+		} else {
+			EmbedExecutor executor = new EmbedExecutor();
+			String embedWorkId = executor.execute(assginData);
+			aeiObjects.getWork().setEmbedTargetWork(embedWorkId);
+//			WoWorkId woWorkId = ThisApplication.context().applications()
+//					.postQuery(x_processplatform_service_processing.class, "work", assginData).getData(WoWorkId.class);
+		}
+
 		List<Work> results = new ArrayList<>();
 		results.add(aeiObjects.getWork());
 		return results;

+ 32 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/ExecuteObject.java

@@ -0,0 +1,32 @@
+package com.x.processplatform.service.processing.processor.embed;
+
+import com.x.processplatform.core.entity.element.Embed;
+
+public class ExecuteObject {
+
+	public ExecuteObject(AssginData assginData, Embed embed) {
+		this.assginData = assginData;
+		this.embed = embed;
+	}
+
+	private AssginData assginData;
+
+	private Embed embed;
+
+	public AssginData getAssginData() {
+		return assginData;
+	}
+
+	public void setAssginData(AssginData assginData) {
+		this.assginData = assginData;
+	}
+
+	public Embed getEmbed() {
+		return embed;
+	}
+
+	public void setEmbed(Embed embed) {
+		this.embed = embed;
+	}
+
+}

+ 13 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/embed/SyncEmbedQueue.java

@@ -0,0 +1,13 @@
+package com.x.processplatform.service.processing.processor.embed;
+
+import com.x.base.core.project.queue.AbstractQueue;
+
+public class SyncEmbedQueue extends AbstractQueue<AssginData> {
+
+	@Override
+	protected void execute(AssginData o) throws Exception {
+		EmbedExecutor executor = new EmbedExecutor();
+		executor.execute(o);
+	}
+
+}

+ 33 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/ExecuteObject.java

@@ -0,0 +1,33 @@
+package com.x.processplatform.service.processing.processor.invoke;
+
+import com.x.processplatform.core.entity.element.Invoke;
+import com.x.processplatform.service.processing.processor.AeiObjects;
+
+public class ExecuteObject {
+
+	public ExecuteObject(AeiObjects aeiObjects, Invoke invoke) {
+		this.aeiObjects = aeiObjects;
+		this.invoke = invoke;
+	}
+
+	private AeiObjects aeiObjects;
+
+	private Invoke invoke;
+
+	public AeiObjects getAeiObjects() {
+		return aeiObjects;
+	}
+
+	public void setAeiObjects(AeiObjects aeiObjects) {
+		this.aeiObjects = aeiObjects;
+	}
+
+	public Invoke getInvoke() {
+		return invoke;
+	}
+
+	public void setInvoke(Invoke invoke) {
+		this.invoke = invoke;
+	}
+
+}

+ 365 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeExecutor.java

@@ -0,0 +1,365 @@
+package com.x.processplatform.service.processing.processor.invoke;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.connection.ActionResponse;
+import com.x.base.core.project.exception.RunningException;
+import com.x.base.core.project.gson.XGsonBuilder;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.http.HttpToken;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.processplatform.core.entity.element.Invoke;
+import com.x.processplatform.service.processing.BindingPair;
+import com.x.processplatform.service.processing.ScriptHelper;
+import com.x.processplatform.service.processing.ScriptHelperFactory;
+import com.x.processplatform.service.processing.ThisApplication;
+import com.x.processplatform.service.processing.WebservicesClient;
+import com.x.processplatform.service.processing.WrapScriptObject;
+import com.x.processplatform.service.processing.processor.AeiObjects;
+
+public class InvokeExecutor {
+
+	private static Logger logger = LoggerFactory.getLogger(InvokeExecutor.class);
+
+	public void execute(ExecuteObject o) throws Exception {
+		switch (o.getInvoke().getInvokeMode()) {
+		case jaxws:
+			this.jaxws(o.getAeiObjects(), o.getInvoke());
+			break;
+		case jaxrs:
+			this.jaxrs(o.getAeiObjects(), o.getInvoke());
+			break;
+		default:
+			break;
+		}
+	}
+
+	private void jaxws(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		if (BooleanUtils.isTrue(invoke.getInternal())) {
+			this.jaxwsInternal(aeiObjects, invoke);
+		} else {
+			this.jaxwsExternal(aeiObjects, invoke);
+		}
+	}
+
+	private void jaxwsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+	}
+
+	private void jaxwsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		Object[] parameters = this.jaxwsEvalParameters(aeiObjects, invoke);
+		WebservicesClient client = new WebservicesClient();
+		Object response = client.jaxws(invoke.getJaxwsAddress(), invoke.getJaxwsMethod(), parameters);
+		if ((StringUtils.isNotEmpty(invoke.getJaxwsResponseScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxwsResponseScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("response", response));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsResponseScript(),
+					invoke.getJaxwsResponseScriptText());
+		}
+	}
+
+	private Object[] jaxwsEvalParameters(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		List<?> parameters = new ArrayList<>();
+		if ((StringUtils.isNotEmpty(invoke.getJaxwsParameterScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxwsParameterScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+					new BindingPair("parameters", parameters));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsParameterScript(),
+					invoke.getJaxwsParameterScriptText());
+		}
+		return parameters.toArray();
+	}
+
+	private void jaxrs(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		if (BooleanUtils.isTrue(invoke.getInternal())) {
+			this.jaxrsInternal(aeiObjects, invoke);
+		} else {
+			this.jaxrsExternal(aeiObjects, invoke);
+		}
+	}
+
+	private void jaxrsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		ActionResponse resp = null;
+		Class<?> clz = Class.forName("com.x.base.core.project." + invoke.getInternalProject());
+		String uri = this.jaxrsUrl(aeiObjects, invoke);
+		String body = null;
+		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
+		case "post":
+			body = this.jaxrsEvalBody(aeiObjects, invoke);
+			resp = ThisApplication.context().applications().postQuery(clz, uri, body);
+			break;
+		case "put":
+			body = this.jaxrsEvalBody(aeiObjects, invoke);
+			resp = ThisApplication.context().applications().putQuery(clz, uri, body);
+			break;
+		case "get":
+			resp = ThisApplication.context().applications().getQuery(clz, uri);
+			break;
+		case "delete":
+			resp = ThisApplication.context().applications().deleteQuery(clz, uri);
+			break;
+		case "head":
+			// resp = ThisApplication.context().applications().headQuery(clz,
+			// uri);
+			break;
+		case "options":
+			// result = this.httpOptions(business, attributes, work, data,
+			// invoke);
+			break;
+		case "patch":
+			// result = this.httpPatch(business, attributes, work, data,
+			// invoke);
+			break;
+		case "trace":
+			// result = this.httpTrace(business, attributes, work, data,
+			// invoke);
+			break;
+		default:
+			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
+		}
+		/** 进行错误监测 */
+		if (!Objects.equals(resp.getType(), ActionResponse.Type.success)) {
+			throw new RunningException("invoke url:{} not success, because:{}, work:{}.", uri, resp.getMessage(),
+					aeiObjects.getWork().getId());
+		}
+		WrapScriptObject jaxrsResponse = new WrapScriptObject();
+		// LinkedHashMap<?, ?> map = resp.getData(LinkedHashMap.class);
+		jaxrsResponse.set(XGsonBuilder.toJson(resp.getData()));
+		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+					new BindingPair("jaxrsResponse", jaxrsResponse));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
+					invoke.getJaxrsResponseScriptText());
+		}
+	}
+
+	private void jaxrsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String result;
+		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
+		case "post":
+			result = this.httpPost(aeiObjects, invoke);
+			break;
+		case "put":
+			result = this.httpPut(aeiObjects, invoke);
+			break;
+		case "get":
+			result = this.httpGet(aeiObjects, invoke);
+			break;
+		case "delete":
+			result = this.httpDelete(aeiObjects, invoke);
+			break;
+		case "head":
+			result = this.httpHead(aeiObjects, invoke);
+			break;
+		case "options":
+			result = this.httpOptions(aeiObjects, invoke);
+			break;
+		case "patch":
+			result = this.httpPatch(aeiObjects, invoke);
+			break;
+		case "trace":
+			result = this.httpTrace(aeiObjects, invoke);
+			break;
+		default:
+			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
+		}
+		WrapScriptObject jaxrsResponse = new WrapScriptObject();
+		jaxrsResponse.set(result);
+		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+					new BindingPair("jaxrsResponse", jaxrsResponse));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
+					invoke.getJaxrsResponseScriptText());
+		}
+	}
+
+	private String jaxrsUrl(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String url = invoke.getJaxrsAddress();
+		Map<String, String> parameters = new HashMap<>();
+		if ((StringUtils.isNotEmpty(invoke.getJaxrsParameterScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxrsParameterScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+					new BindingPair("parameters", parameters));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsParameterScript(),
+					invoke.getJaxrsParameterScriptText());
+		}
+		for (Entry<String, String> entry : parameters.entrySet()) {
+			url = StringUtils.replace(url, "{" + entry.getKey() + "}", entry.getValue());
+		}
+		return url;
+	}
+
+	private String jaxrsEvalBody(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		JaxrsBody jaxrsBody = new JaxrsBody();
+		if ((StringUtils.isNotEmpty(invoke.getJaxrsBodyScript()))
+				|| (StringUtils.isNotEmpty(invoke.getJaxrsBodyScriptText()))) {
+			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("jaxrsBody", jaxrsBody));
+			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsBodyScript(),
+					invoke.getJaxrsBodyScriptText());
+
+		}
+		return jaxrsBody.get();
+	}
+
+	private String httpPost(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, true, invoke.getJaxrsContentType());
+		connection.setRequestMethod("POST");
+		connection.setDoOutput(true);
+		connection.setDoInput(true);
+		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
+		connection.connect();
+		this.doOutput(connection, o);
+		return this.readResultString(connection);
+	}
+
+	private String httpPut(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("PUT");
+		connection.setDoOutput(true);
+		connection.setDoInput(true);
+		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
+		connection.connect();
+		this.doOutput(connection, o);
+		return this.readResultString(connection);
+	}
+
+	private String httpGet(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("GET");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+
+	}
+
+	private String httpDelete(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("DELETE");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+	}
+
+	private String httpHead(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("HEAD");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+	}
+
+	private String httpOptions(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("OPTIONS");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+	}
+
+	private String httpPatch(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("PATCH");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+	}
+
+	private String httpTrace(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+		String address = this.jaxrsUrl(aeiObjects, invoke);
+		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+				invoke.getJaxrsContentType());
+		connection.setRequestMethod("TRACE");
+		connection.setDoOutput(false);
+		connection.setDoInput(true);
+		connection.connect();
+		return this.readResultString(connection);
+	}
+
+	public class JaxrsBody {
+
+		private String value;
+
+		private String get() {
+			return Objects.toString(value, "");
+		}
+
+		public void set(String value) throws Exception {
+			this.value = value;
+		}
+
+	}
+
+	private HttpURLConnection prepareConnection(String address, boolean withCipher, String contentType)
+			throws Exception {
+		try {
+			URL url = new URL(address);
+			HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
+			httpUrlConnection.setUseCaches(false);
+			httpUrlConnection.setRequestProperty("Content-Type", contentType);
+			if (BooleanUtils.isTrue(withCipher)) {
+				EffectivePerson effectivePerson = EffectivePerson.cipher(Config.token().getCipher());
+				httpUrlConnection.setRequestProperty(HttpToken.X_Token, effectivePerson.getToken());
+			}
+			return httpUrlConnection;
+		} catch (Exception e) {
+			throw new Exception("prepareConnection error", e);
+		}
+	}
+
+	private void doOutput(HttpURLConnection connection, Object data) throws Exception {
+		try (OutputStream output = connection.getOutputStream()) {
+			if (null != data) {
+				if (data instanceof String) {
+					IOUtils.write(data.toString(), output, StandardCharsets.UTF_8);
+				} else {
+					IOUtils.write(XGsonBuilder.toJson(data), output, StandardCharsets.UTF_8);
+				}
+				output.flush();
+			}
+		}
+	}
+
+	private String readResultString(HttpURLConnection connection) throws Exception {
+		String result = "";
+		try (InputStream input = connection.getInputStream()) {
+			result = IOUtils.toString(input, StandardCharsets.UTF_8);
+		}
+		return result;
+	}
+
+}

+ 326 - 342
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeProcessor.java

@@ -1,39 +1,17 @@
 package com.x.processplatform.service.processing.processor.invoke;
 
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.container.EntityManagerContainer;
-import com.x.base.core.project.config.Config;
-import com.x.base.core.project.connection.ActionResponse;
-import com.x.base.core.project.exception.RunningException;
-import com.x.base.core.project.gson.XGsonBuilder;
-import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.http.HttpToken;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.processplatform.core.entity.content.Work;
 import com.x.processplatform.core.entity.element.Invoke;
 import com.x.processplatform.core.entity.element.Route;
-import com.x.processplatform.service.processing.BindingPair;
-import com.x.processplatform.service.processing.ScriptHelper;
-import com.x.processplatform.service.processing.ScriptHelperFactory;
 import com.x.processplatform.service.processing.ThisApplication;
-import com.x.processplatform.service.processing.WebservicesClient;
-import com.x.processplatform.service.processing.WrapScriptObject;
 import com.x.processplatform.service.processing.processor.AeiObjects;
 
 public class InvokeProcessor extends AbstractInvokeProcessor {
@@ -52,15 +30,21 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
 	@Override
 	protected List<Work> executing(AeiObjects aeiObjects, Invoke invoke) throws Exception {
 		List<Work> results = new ArrayList<>();
-		switch (invoke.getInvokeMode()) {
-		case jaxws:
-			this.jaxws(aeiObjects, invoke);
-			break;
-		case jaxrs:
-			this.jaxrs(aeiObjects, invoke);
-			break;
-		default:
-			break;
+		if (BooleanUtils.isTrue(invoke.getAsync())) {
+			ThisApplication.syncInvokeQueue.send(new ExecuteObject(aeiObjects, invoke));
+		} else {
+			InvokeExecutor executor = new InvokeExecutor();
+			executor.execute(new ExecuteObject(aeiObjects, invoke));
+//			switch (invoke.getInvokeMode()) {
+//			case jaxws:
+//				this.jaxws(aeiObjects, invoke);
+//				break;
+//			case jaxrs:
+//				this.jaxrs(aeiObjects, invoke);
+//				break;
+//			default:
+//				break;
+//			}
 		}
 		results.add(aeiObjects.getWork());
 		return results;
@@ -73,317 +57,317 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
 		return results;
 	}
 
-	private void jaxws(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		if (BooleanUtils.isTrue(invoke.getInternal())) {
-			this.jaxwsInternal(aeiObjects, invoke);
-		} else {
-			this.jaxwsExternal(aeiObjects, invoke);
-		}
-	}
-
-	private void jaxwsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-	}
-
-	private void jaxwsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		Object[] parameters = this.jaxwsEvalParameters(aeiObjects, invoke);
-		WebservicesClient client = new WebservicesClient();
-		Object response = client.jaxws(invoke.getJaxwsAddress(), invoke.getJaxwsMethod(), parameters);
-		if ((StringUtils.isNotEmpty(invoke.getJaxwsResponseScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxwsResponseScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("response", response));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsResponseScript(),
-					invoke.getJaxwsResponseScriptText());
-		}
-	}
-
-	private Object[] jaxwsEvalParameters(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		List<?> parameters = new ArrayList<>();
-		if ((StringUtils.isNotEmpty(invoke.getJaxwsParameterScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxwsParameterScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
-					new BindingPair("parameters", parameters));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsParameterScript(),
-					invoke.getJaxwsParameterScriptText());
-		}
-		return parameters.toArray();
-	}
-
-	private void jaxrs(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		if (BooleanUtils.isTrue(invoke.getInternal())) {
-			this.jaxrsInternal(aeiObjects, invoke);
-		} else {
-			this.jaxrsExternal(aeiObjects, invoke);
-		}
-	}
-
-	private void jaxrsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		ActionResponse resp = null;
-		Class<?> clz = Class.forName("com.x.base.core.project." + invoke.getInternalProject());
-		String uri = this.jaxrsUrl(aeiObjects, invoke);
-		String body = null;
-		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
-		case "post":
-			body = this.jaxrsEvalBody(aeiObjects, invoke);
-			resp = ThisApplication.context().applications().postQuery(clz, uri, body);
-			break;
-		case "put":
-			body = this.jaxrsEvalBody(aeiObjects, invoke);
-			resp = ThisApplication.context().applications().putQuery(clz, uri, body);
-			break;
-		case "get":
-			resp = ThisApplication.context().applications().getQuery(clz, uri);
-			break;
-		case "delete":
-			resp = ThisApplication.context().applications().deleteQuery(clz, uri);
-			break;
-		case "head":
-			// resp = ThisApplication.context().applications().headQuery(clz,
-			// uri);
-			break;
-		case "options":
-			// result = this.httpOptions(business, attributes, work, data,
-			// invoke);
-			break;
-		case "patch":
-			// result = this.httpPatch(business, attributes, work, data,
-			// invoke);
-			break;
-		case "trace":
-			// result = this.httpTrace(business, attributes, work, data,
-			// invoke);
-			break;
-		default:
-			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
-		}
-		/** 进行错误监测 */
-		if (!Objects.equals(resp.getType(), ActionResponse.Type.success)) {
-			throw new RunningException("invoke url:{} not success, because:{}, work:{}.", uri, resp.getMessage(),
-					aeiObjects.getWork().getId());
-		}
-		WrapScriptObject jaxrsResponse = new WrapScriptObject();
-		// LinkedHashMap<?, ?> map = resp.getData(LinkedHashMap.class);
-		jaxrsResponse.set(gson.toJson(resp.getData()));
-		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
-					new BindingPair("jaxrsResponse", jaxrsResponse));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
-					invoke.getJaxrsResponseScriptText());
-		}
-	}
-
-	private void jaxrsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String result;
-		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
-		case "post":
-			result = this.httpPost(aeiObjects, invoke);
-			break;
-		case "put":
-			result = this.httpPut(aeiObjects, invoke);
-			break;
-		case "get":
-			result = this.httpGet(aeiObjects, invoke);
-			break;
-		case "delete":
-			result = this.httpDelete(aeiObjects, invoke);
-			break;
-		case "head":
-			result = this.httpHead(aeiObjects, invoke);
-			break;
-		case "options":
-			result = this.httpOptions(aeiObjects, invoke);
-			break;
-		case "patch":
-			result = this.httpPatch(aeiObjects, invoke);
-			break;
-		case "trace":
-			result = this.httpTrace(aeiObjects, invoke);
-			break;
-		default:
-			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
-		}
-		WrapScriptObject jaxrsResponse = new WrapScriptObject();
-		jaxrsResponse.set(result);
-		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
-					new BindingPair("jaxrsResponse", jaxrsResponse));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
-					invoke.getJaxrsResponseScriptText());
-		}
-	}
-
-	private String jaxrsUrl(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String url = invoke.getJaxrsAddress();
-		Map<String, String> parameters = new HashMap<>();
-		if ((StringUtils.isNotEmpty(invoke.getJaxrsParameterScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxrsParameterScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
-					new BindingPair("parameters", parameters));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsParameterScript(),
-					invoke.getJaxrsParameterScriptText());
-		}
-		for (Entry<String, String> entry : parameters.entrySet()) {
-			url = StringUtils.replace(url, "{" + entry.getKey() + "}", entry.getValue());
-		}
-		return url;
-	}
-
-	private String jaxrsEvalBody(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		JaxrsBody jaxrsBody = new JaxrsBody();
-		if ((StringUtils.isNotEmpty(invoke.getJaxrsBodyScript()))
-				|| (StringUtils.isNotEmpty(invoke.getJaxrsBodyScriptText()))) {
-			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("jaxrsBody", jaxrsBody));
-			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsBodyScript(),
-					invoke.getJaxrsBodyScriptText());
-
-		}
-		return jaxrsBody.get();
-	}
-
-	private String httpPost(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, true, invoke.getJaxrsContentType());
-		connection.setRequestMethod("POST");
-		connection.setDoOutput(true);
-		connection.setDoInput(true);
-		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
-		connection.connect();
-		this.doOutput(connection, o);
-		return this.readResultString(connection);
-	}
-
-	private String httpPut(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("PUT");
-		connection.setDoOutput(true);
-		connection.setDoInput(true);
-		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
-		connection.connect();
-		this.doOutput(connection, o);
-		return this.readResultString(connection);
-	}
-
-	private String httpGet(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("GET");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-
-	}
-
-	private String httpDelete(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("DELETE");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-	}
-
-	private String httpHead(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("HEAD");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-	}
-
-	private String httpOptions(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("OPTIONS");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-	}
-
-	private String httpPatch(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("PATCH");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-	}
-
-	private String httpTrace(AeiObjects aeiObjects, Invoke invoke) throws Exception {
-		String address = this.jaxrsUrl(aeiObjects, invoke);
-		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
-				invoke.getJaxrsContentType());
-		connection.setRequestMethod("TRACE");
-		connection.setDoOutput(false);
-		connection.setDoInput(true);
-		connection.connect();
-		return this.readResultString(connection);
-	}
-
-	public class JaxrsBody {
-
-		private String value;
-
-		private String get() {
-			return Objects.toString(value, "");
-		}
-
-		public void set(String value) throws Exception {
-			this.value = value;
-		}
-
-	}
-
-	private HttpURLConnection prepareConnection(String address, boolean withCipher, String contentType)
-			throws Exception {
-		try {
-			URL url = new URL(address);
-			HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
-			httpUrlConnection.setUseCaches(false);
-			httpUrlConnection.setRequestProperty("Content-Type", contentType);
-			if (BooleanUtils.isTrue(withCipher)) {
-				EffectivePerson effectivePerson = EffectivePerson.cipher(Config.token().getCipher());
-				httpUrlConnection.setRequestProperty(HttpToken.X_Token, effectivePerson.getToken());
-			}
-			return httpUrlConnection;
-		} catch (Exception e) {
-			throw new Exception("prepareConnection error", e);
-		}
-	}
-
-	private void doOutput(HttpURLConnection connection, Object data) throws Exception {
-		try (OutputStream output = connection.getOutputStream()) {
-			if (null != data) {
-				if (data instanceof String) {
-					IOUtils.write(data.toString(), output, StandardCharsets.UTF_8);
-				} else {
-					IOUtils.write(XGsonBuilder.toJson(data), output, StandardCharsets.UTF_8);
-				}
-				output.flush();
-			}
-		}
-	}
-
-	private String readResultString(HttpURLConnection connection) throws Exception {
-		String result = "";
-		try (InputStream input = connection.getInputStream()) {
-			result = IOUtils.toString(input, StandardCharsets.UTF_8);
-		}
-		return result;
-	}
+//	private void jaxws(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		if (BooleanUtils.isTrue(invoke.getInternal())) {
+//			this.jaxwsInternal(aeiObjects, invoke);
+//		} else {
+//			this.jaxwsExternal(aeiObjects, invoke);
+//		}
+//	}
+//
+//	private void jaxwsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//	}
+//
+//	private void jaxwsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		Object[] parameters = this.jaxwsEvalParameters(aeiObjects, invoke);
+//		WebservicesClient client = new WebservicesClient();
+//		Object response = client.jaxws(invoke.getJaxwsAddress(), invoke.getJaxwsMethod(), parameters);
+//		if ((StringUtils.isNotEmpty(invoke.getJaxwsResponseScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxwsResponseScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("response", response));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsResponseScript(),
+//					invoke.getJaxwsResponseScriptText());
+//		}
+//	}
+//
+//	private Object[] jaxwsEvalParameters(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		List<?> parameters = new ArrayList<>();
+//		if ((StringUtils.isNotEmpty(invoke.getJaxwsParameterScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxwsParameterScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+//					new BindingPair("parameters", parameters));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxwsParameterScript(),
+//					invoke.getJaxwsParameterScriptText());
+//		}
+//		return parameters.toArray();
+//	}
+//
+//	private void jaxrs(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		if (BooleanUtils.isTrue(invoke.getInternal())) {
+//			this.jaxrsInternal(aeiObjects, invoke);
+//		} else {
+//			this.jaxrsExternal(aeiObjects, invoke);
+//		}
+//	}
+//
+//	private void jaxrsInternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		ActionResponse resp = null;
+//		Class<?> clz = Class.forName("com.x.base.core.project." + invoke.getInternalProject());
+//		String uri = this.jaxrsUrl(aeiObjects, invoke);
+//		String body = null;
+//		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
+//		case "post":
+//			body = this.jaxrsEvalBody(aeiObjects, invoke);
+//			resp = ThisApplication.context().applications().postQuery(clz, uri, body);
+//			break;
+//		case "put":
+//			body = this.jaxrsEvalBody(aeiObjects, invoke);
+//			resp = ThisApplication.context().applications().putQuery(clz, uri, body);
+//			break;
+//		case "get":
+//			resp = ThisApplication.context().applications().getQuery(clz, uri);
+//			break;
+//		case "delete":
+//			resp = ThisApplication.context().applications().deleteQuery(clz, uri);
+//			break;
+//		case "head":
+//			// resp = ThisApplication.context().applications().headQuery(clz,
+//			// uri);
+//			break;
+//		case "options":
+//			// result = this.httpOptions(business, attributes, work, data,
+//			// invoke);
+//			break;
+//		case "patch":
+//			// result = this.httpPatch(business, attributes, work, data,
+//			// invoke);
+//			break;
+//		case "trace":
+//			// result = this.httpTrace(business, attributes, work, data,
+//			// invoke);
+//			break;
+//		default:
+//			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
+//		}
+//		/** 进行错误监测 */
+//		if (!Objects.equals(resp.getType(), ActionResponse.Type.success)) {
+//			throw new RunningException("invoke url:{} not success, because:{}, work:{}.", uri, resp.getMessage(),
+//					aeiObjects.getWork().getId());
+//		}
+//		WrapScriptObject jaxrsResponse = new WrapScriptObject();
+//		// LinkedHashMap<?, ?> map = resp.getData(LinkedHashMap.class);
+//		jaxrsResponse.set(gson.toJson(resp.getData()));
+//		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+//					new BindingPair("jaxrsResponse", jaxrsResponse));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
+//					invoke.getJaxrsResponseScriptText());
+//		}
+//	}
+//
+//	private void jaxrsExternal(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String result;
+//		switch (StringUtils.lowerCase(invoke.getJaxrsMethod())) {
+//		case "post":
+//			result = this.httpPost(aeiObjects, invoke);
+//			break;
+//		case "put":
+//			result = this.httpPut(aeiObjects, invoke);
+//			break;
+//		case "get":
+//			result = this.httpGet(aeiObjects, invoke);
+//			break;
+//		case "delete":
+//			result = this.httpDelete(aeiObjects, invoke);
+//			break;
+//		case "head":
+//			result = this.httpHead(aeiObjects, invoke);
+//			break;
+//		case "options":
+//			result = this.httpOptions(aeiObjects, invoke);
+//			break;
+//		case "patch":
+//			result = this.httpPatch(aeiObjects, invoke);
+//			break;
+//		case "trace":
+//			result = this.httpTrace(aeiObjects, invoke);
+//			break;
+//		default:
+//			throw new Exception("unknown http method " + invoke.getJaxrsMethod());
+//		}
+//		WrapScriptObject jaxrsResponse = new WrapScriptObject();
+//		jaxrsResponse.set(result);
+//		if ((StringUtils.isNotEmpty(invoke.getJaxrsResponseScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxrsResponseScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+//					new BindingPair("jaxrsResponse", jaxrsResponse));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsResponseScript(),
+//					invoke.getJaxrsResponseScriptText());
+//		}
+//	}
+//
+//	private String jaxrsUrl(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String url = invoke.getJaxrsAddress();
+//		Map<String, String> parameters = new HashMap<>();
+//		if ((StringUtils.isNotEmpty(invoke.getJaxrsParameterScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxrsParameterScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
+//					new BindingPair("parameters", parameters));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsParameterScript(),
+//					invoke.getJaxrsParameterScriptText());
+//		}
+//		for (Entry<String, String> entry : parameters.entrySet()) {
+//			url = StringUtils.replace(url, "{" + entry.getKey() + "}", entry.getValue());
+//		}
+//		return url;
+//	}
+//
+//	private String jaxrsEvalBody(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		JaxrsBody jaxrsBody = new JaxrsBody();
+//		if ((StringUtils.isNotEmpty(invoke.getJaxrsBodyScript()))
+//				|| (StringUtils.isNotEmpty(invoke.getJaxrsBodyScriptText()))) {
+//			ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects, new BindingPair("jaxrsBody", jaxrsBody));
+//			scriptHelper.eval(aeiObjects.getWork().getApplication(), invoke.getJaxrsBodyScript(),
+//					invoke.getJaxrsBodyScriptText());
+//
+//		}
+//		return jaxrsBody.get();
+//	}
+//
+//	private String httpPost(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, true, invoke.getJaxrsContentType());
+//		connection.setRequestMethod("POST");
+//		connection.setDoOutput(true);
+//		connection.setDoInput(true);
+//		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
+//		connection.connect();
+//		this.doOutput(connection, o);
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpPut(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("PUT");
+//		connection.setDoOutput(true);
+//		connection.setDoInput(true);
+//		Object o = this.jaxrsEvalBody(aeiObjects, invoke);
+//		connection.connect();
+//		this.doOutput(connection, o);
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpGet(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("GET");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//
+//	}
+//
+//	private String httpDelete(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("DELETE");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpHead(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("HEAD");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpOptions(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("OPTIONS");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpPatch(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("PATCH");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//	}
+//
+//	private String httpTrace(AeiObjects aeiObjects, Invoke invoke) throws Exception {
+//		String address = this.jaxrsUrl(aeiObjects, invoke);
+//		HttpURLConnection connection = this.prepareConnection(address, invoke.getJaxrsWithCipher(),
+//				invoke.getJaxrsContentType());
+//		connection.setRequestMethod("TRACE");
+//		connection.setDoOutput(false);
+//		connection.setDoInput(true);
+//		connection.connect();
+//		return this.readResultString(connection);
+//	}
+//
+//	public class JaxrsBody {
+//
+//		private String value;
+//
+//		private String get() {
+//			return Objects.toString(value, "");
+//		}
+//
+//		public void set(String value) throws Exception {
+//			this.value = value;
+//		}
+//
+//	}
+//
+//	private HttpURLConnection prepareConnection(String address, boolean withCipher, String contentType)
+//			throws Exception {
+//		try {
+//			URL url = new URL(address);
+//			HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
+//			httpUrlConnection.setUseCaches(false);
+//			httpUrlConnection.setRequestProperty("Content-Type", contentType);
+//			if (BooleanUtils.isTrue(withCipher)) {
+//				EffectivePerson effectivePerson = EffectivePerson.cipher(Config.token().getCipher());
+//				httpUrlConnection.setRequestProperty(HttpToken.X_Token, effectivePerson.getToken());
+//			}
+//			return httpUrlConnection;
+//		} catch (Exception e) {
+//			throw new Exception("prepareConnection error", e);
+//		}
+//	}
+//
+//	private void doOutput(HttpURLConnection connection, Object data) throws Exception {
+//		try (OutputStream output = connection.getOutputStream()) {
+//			if (null != data) {
+//				if (data instanceof String) {
+//					IOUtils.write(data.toString(), output, StandardCharsets.UTF_8);
+//				} else {
+//					IOUtils.write(XGsonBuilder.toJson(data), output, StandardCharsets.UTF_8);
+//				}
+//				output.flush();
+//			}
+//		}
+//	}
+//
+//	private String readResultString(HttpURLConnection connection) throws Exception {
+//		String result = "";
+//		try (InputStream input = connection.getInputStream()) {
+//			result = IOUtils.toString(input, StandardCharsets.UTF_8);
+//		}
+//		return result;
+//	}
 
 	@Override
 	protected void arrivingCommitted(AeiObjects aeiObjects, Invoke invoke) throws Exception {

+ 13 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/SyncInvokeQueue.java

@@ -0,0 +1,13 @@
+package com.x.processplatform.service.processing.processor.invoke;
+
+import com.x.base.core.project.queue.AbstractQueue;
+
+public class SyncInvokeQueue extends AbstractQueue<ExecuteObject> {
+
+	@Override
+	protected void execute(ExecuteObject o) throws Exception {
+		InvokeExecutor executor = new InvokeExecutor();
+		executor.execute(o);
+	}
+
+}

+ 26 - 12
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor.java

@@ -231,7 +231,7 @@ public class ManualProcessor extends AbstractManualProcessor {
 							&& (!Objects.equals(o.getProcessingType(), ProcessingType.retract))
 							&& (!Objects.equals(o.getProcessingType(), ProcessingType.reset)))
 					.collect(Collectors.toList());
-			String name = this.choiceRouteName(taskCompletedList);
+			String name = this.choiceRouteName(taskCompletedList, aeiObjects.getRoutes());
 			for (Route o : aeiObjects.getRoutes()) {
 				if (o.getName().equalsIgnoreCase(name)) {
 					results.add(o);
@@ -242,18 +242,32 @@ public class ManualProcessor extends AbstractManualProcessor {
 		return results;
 	}
 
-	/** 通过已办存根选择某条路由 */
-	private String choiceRouteName(List<TaskCompleted> list) throws Exception {
+	/* 通过已办存根选择某条路由 */
+	private String choiceRouteName(List<TaskCompleted> list, List<Route> routes) throws Exception {
 		String result = "";
 		List<String> os = new ArrayList<>();
-		for (TaskCompleted o : ListTools.trim(list, false, false)) {
-			if ((!o.getProcessingType().equals(ProcessingType.reset))
-					&& (!o.getProcessingType().equals(ProcessingType.retract))) {
-				/** 跳过重置处理人的路由 */
-				os.add(o.getRouteName());
-			}
-		}
-		result = ListTools.maxCountElement(os);
+		ListTools.trim(list, false, false).stream()
+				.filter(o -> (!Objects.equals(o.getProcessingType(), ProcessingType.reset))
+						&& (!Objects.equals(o.getProcessingType(), ProcessingType.retract)))
+				.forEach(o -> {
+					/* 跳过重置处理人的路由 */
+					os.add(o.getRouteName());
+				});
+		/* 进行独占路由的判断 */
+		Route soleRoute = routes.stream().filter(o -> BooleanUtils.isTrue(o.getSole())).findFirst().orElseGet(null);
+		if (null != soleRoute) {
+			result = soleRoute.getName();
+		} else {
+			/* 进行默认的策略,选择占比多的 */
+			result = ListTools.maxCountElement(os);
+		}
+//		for (TaskCompleted o : ListTools.trim(list, false, false)) {
+//			if ((!o.getProcessingType().equals(ProcessingType.reset))
+//					&& (!o.getProcessingType().equals(ProcessingType.retract))) {
+//				/** 跳过重置处理人的路由 */
+//				os.add(o.getRouteName());
+//			}
+//		}
 		if (StringUtils.isEmpty(result)) {
 			throw new ExceptionChoiceRouteNameError(
 					ListTools.extractProperty(list, JpaObject.id_FIELDNAME, String.class, false, false));
@@ -263,7 +277,7 @@ public class ManualProcessor extends AbstractManualProcessor {
 
 	private boolean single(AeiObjects aeiObjects, Manual manual) throws Exception {
 		boolean passThrough = false;
-		/** 找到所有的已办 */
+		/* 找到所有的已办 */
 		Long count = aeiObjects.getTaskCompleteds().stream().filter(o -> {
 			if (StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
 					&& (!o.getProcessingType().equals(ProcessingType.retract))

+ 1 - 1
o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/schema/Table.java

@@ -107,7 +107,7 @@ public class Table extends SliceJpaObject {
 	@CheckPersist(allowEmpty = true)
 	private List<String> readPersonList;
 
-	public static final String readUnitList_FIELDNAME = "readPersonList";
+	public static final String readUnitList_FIELDNAME = "readUnitList";
 	@FieldDescribe("可以访问数据的组织.")
 	@PersistentCollection(fetch = FetchType.EAGER)
 	@ContainerTable(name = TABLE + ContainerTableNameMiddle + readUnitList_FIELDNAME, joinIndex = @Index(name = TABLE

+ 0 - 159
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ExtractTextTools.java

@@ -1,159 +0,0 @@
-package com.x.query.service.processing;
-
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.util.List;
-
-import javax.imageio.ImageIO;
-
-import org.apache.commons.collections4.list.UnmodifiableList;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.pdfbox.cos.COSDocument;
-import org.apache.pdfbox.io.RandomAccessBuffer;
-import org.apache.pdfbox.pdfparser.PDFParser;
-import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.text.PDFTextStripper;
-import org.apache.tika.Tika;
-import org.junit.Test;
-
-import com.x.base.core.project.config.Config;
-import com.x.base.core.project.logger.Logger;
-import com.x.base.core.project.logger.LoggerFactory;
-import com.x.base.core.project.tools.DefaultCharset;
-import com.x.base.core.project.tools.ListTools;
-
-import net.sourceforge.tess4j.Tesseract;
-
-public class ExtractTextTools {
-
-	private static Logger logger = LoggerFactory.getLogger(ExtractTextTools.class);
-
-	private static Tesseract tesseract = null;
-
-	private static Tika tika = null;
-
-	public static boolean support(String name) {
-		String ext = StringUtils.substringAfterLast(name, ".");
-		if (StringUtils.isNotEmpty(ext)) {
-			ext = "." + StringUtils.lowerCase(ext);
-			return SUPPORT_TYPES.contains(ext);
-		}
-		return false;
-	}
-
-	public static final List<String> SUPPORT_TYPES = UnmodifiableList.unmodifiableList(
-			ListTools.toList(".doc", ".docx", ".pdf", ".xls", ".xlsx", ".txt", ".jpg", ".png", ".gif"));
-
-	public static String extract(byte[] bytes, String name, Boolean office, Boolean pdf, Boolean txt, Boolean image) {
-		if ((null != bytes) && bytes.length > 0 && bytes.length < 1024 * 1024 * 10) {
-			if (office) {
-				if (StringUtils.endsWithIgnoreCase(name, ".doc") || StringUtils.endsWithIgnoreCase(name, ".docx")) {
-					return word(bytes);
-				}
-				if (StringUtils.endsWithIgnoreCase(name, ".xls") || StringUtils.endsWithIgnoreCase(name, ".xlsx")) {
-					return excel(bytes);
-				}
-			}
-			if (pdf) {
-				if (StringUtils.endsWithIgnoreCase(name, ".pdf")) {
-					return pdf(bytes);
-				}
-			}
-			if (txt) {
-				if (StringUtils.endsWithIgnoreCase(name, ".txt")) {
-					return text(bytes);
-				}
-			}
-			if (image) {
-				if (StringUtils.endsWithIgnoreCase(name, ".jpg") || StringUtils.endsWithIgnoreCase(name, ".png")
-						|| StringUtils.endsWithIgnoreCase(name, ".gif")) {
-					return image(bytes);
-				}
-			}
-		}
-		return null;
-	}
-
-	public static String pdf(byte[] bytes) {
-		try {
-			PDFParser parser = new PDFParser(new RandomAccessBuffer(bytes));
-			parser.parse();
-			try (COSDocument cos = parser.getDocument(); PDDocument pd = new PDDocument(cos)) {
-				PDFTextStripper stripper = new PDFTextStripper();
-				stripper.setStartPage(1);
-				stripper.setEndPage(pd.getNumberOfPages());
-				return stripper.getText(pd);
-			}
-		} catch (Exception e) {
-			logger.error(e);
-		}
-		return null;
-	}
-
-	public static String word(byte[] bytes) {
-		try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) {
-			return tikaInstance().parseToString(in);
-		} catch (Exception e) {
-			logger.error(e);
-		}
-		return null;
-	}
-
-	public static String excel(byte[] bytes) {
-		try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) {
-			return tikaInstance().parseToString(in);
-		} catch (Exception e) {
-			logger.error(e);
-		}
-		return null;
-	}
-
-	public static String text(byte[] bytes) {
-		return new String(bytes, DefaultCharset.charset);
-	}
-
-	public static String image(byte[] bytes) {
-		try {
-
-			try (ByteArrayInputStream in = new ByteArrayInputStream(bytes);) {
-				BufferedImage image = ImageIO.read(in);
-				return tesseractInstance().doOCR(image);
-			}
-		} catch (Exception e) {
-			logger.error(e);
-		}
-		return null;
-	}
-
-	private static Tesseract tesseractInstance() throws Exception {
-		if (null == tesseract) {
-			synchronized (ExtractTextTools.class) {
-				if (null == tesseract) {
-					tesseract = new Tesseract();
-					tesseract.setDatapath(Config.base() + "/commons/tess4j/tessdata");// 设置训练库的位置
-					tesseract.setLanguage(Config.query().getTessLanguage());// 中文识别
-				}
-			}
-		}
-		return tesseract;
-	}
-
-	private static Tika tikaInstance() throws Exception {
-		if (null == tika) {
-			synchronized (ExtractTextTools.class) {
-				if (null == tika) {
-					tika = new Tika();
-				}
-			}
-		}
-		return tika;
-	}
-
-	@Test
-	public void test1() throws Exception {
-		System.out.println(word(FileUtils.readFileToByteArray(new File("d:/1.html"))));
-	}
-
-}

+ 1 - 1
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionExtract.java

@@ -10,7 +10,7 @@ import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapString;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
-import com.x.query.service.processing.ExtractTextTools;
+import com.x.base.core.project.tools.ExtractTextTools;
 
 class ActionExtract extends BaseAction {
 

+ 3 - 2
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/Crawl.java

@@ -9,8 +9,8 @@ import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.StorageMapping;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ExtractTextTools;
 import com.x.processplatform.core.entity.content.Attachment;
-import com.x.query.service.processing.ExtractTextTools;
 import com.x.query.service.processing.ThisApplication;
 import com.x.query.service.processing.helper.LanguageProcessingHelper;
 import com.x.query.service.processing.helper.LanguageProcessingHelper.Item;
@@ -31,7 +31,8 @@ public abstract class Crawl implements Job {
 	}
 
 	protected String text(StorageObject storageObject) throws Exception {
-		if (storageObject.getLength() < MAX_ATTACHMENT_BYTE_LENGTH) {
+		if ((null != storageObject.getLength()) && (storageObject.getLength() > 0)
+				&& (storageObject.getLength() < MAX_ATTACHMENT_BYTE_LENGTH)) {
 			if (ExtractTextTools.support(storageObject.getName())) {
 				try {
 					StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class,

+ 5 - 1
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/CrawlWork.java

@@ -245,7 +245,11 @@ public class CrawlWork extends Crawl {
 		StringBuffer buffer = new StringBuffer();
 		EntityManagerContainer emc = business.entityManagerContainer();
 		for (Attachment o : emc.listEqual(Attachment.class, Work.job_FIELDNAME, work.getJob())) {
-			buffer.append(this.text(o));
+			if (StringUtils.isNotEmpty(o.getText())) {
+				buffer.append(o.getText());
+			} else {
+				buffer.append(this.text(o));
+			}
 		}
 		return buffer.toString();
 	}

+ 5 - 1
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/schedule/CrawlWorkCompleted.java

@@ -247,7 +247,11 @@ public class CrawlWorkCompleted extends Crawl {
 		StringBuffer buffer = new StringBuffer();
 		EntityManagerContainer emc = business.entityManagerContainer();
 		for (Attachment o : emc.listEqual(Attachment.class, WorkCompleted.job_FIELDNAME, workCompleted.getJob())) {
-			buffer.append(this.text(o));
+			if (StringUtils.isNotEmpty(o.getText())) {
+				buffer.append(o.getText());
+			} else {
+				buffer.append(this.text(o));
+			}
 		}
 		return buffer.toString();
 	}