diff --git a/o2server/pom.xml b/o2server/pom.xml
index 3963a3560aef7c7ab1447724b597c7bdd96c01a8..7351b289578031ad47aae05313f2f0002eff61f8 100644
--- a/o2server/pom.xml
+++ b/o2server/pom.xml
@@ -27,7 +27,6 @@
x_portal_core_entity
x_processplatform_core_entity
x_teamwork_core_entity
-
x_program_center_core_entity
x_organization_core_express
x_query_core_express
@@ -59,7 +58,6 @@
x_query_assemble_surface
x_query_service_processing
x_teamwork_assemble_control
-
x_program_center
x_console
@@ -335,38 +333,6 @@
maven-resources-plugin
3.1.0
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
-
- org.codehaus.mojo
-
-
- exec-maven-plugin
-
-
- [1.6.0,)
-
-
- java
-
-
-
-
-
-
-
-
-
-
org.apache.maven.plugins
maven-compiler-plugin
@@ -409,6 +375,28 @@
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.13.0
+
+ true
+ utf-8
+ 100
+ 1.8
+ false
+ ${basedir}
+
+
+
+ pmd-check
+ verify
+
+ check
+
+
+
+
@@ -702,20 +690,6 @@
org.neuroph
neuroph-core
2.96
-
-
- ch.qos.logback
- logback-core
-
-
- ch.qos.logback
- logback-classic
-
-
- javax.visrec
- visrec-api
-
-
org.slf4j
diff --git a/o2server/x_base_core_project/pom.xml b/o2server/x_base_core_project/pom.xml
index 718bd78ea9bd4672ef7302017edb30ea63f58564..c1f55ca74b6c2da60e252e340bd4457087bdfbd8 100644
--- a/o2server/x_base_core_project/pom.xml
+++ b/o2server/x_base_core_project/pom.xml
@@ -1,7 +1,6 @@
-
4.0.0
@@ -15,7 +14,7 @@
-
+
diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/executor/ProcessPlatformExecutorFactory.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/executor/ProcessPlatformExecutorFactory.java
index 33459cab0f05b211e3a470485dd8cd489519803c..5994cc63e2f2e94c97684fb889dd61a491494075 100644
--- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/executor/ProcessPlatformExecutorFactory.java
+++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/executor/ProcessPlatformExecutorFactory.java
@@ -8,35 +8,15 @@ import com.x.base.core.project.config.Config;
public class ProcessPlatformExecutorFactory {
- private static ExecutorService[] executors;
+ private ProcessPlatformExecutorFactory() {
+ throw new IllegalStateException("ProcessPlatformExecutorFactory class");
+ }
-// private static int count;
-//
-// public static ExecutorService get(String seed) throws Exception {
-// if (null == executors) {
-// synchronized (ProcessPlatformExecutorServiceFactory.class) {
-// if (null == executors) {
-// count = Config.processPlatform().getExecutorCount();
-// executors = new ExecutorService[count];
-// for (int i = 0; i < count; i++) {
-// executors[i] = Executors.newSingleThreadExecutor();
-// }
-// }
-// }
-// }
-// CRC32 crc32 = new CRC32();
-// crc32.update(Objects.toString(seed, "").getBytes());
-// int idx = (int) (crc32.getValue() % count);
-// return executors[idx];
-// }
+ private static ExecutorService[] executors;
- public static ExecutorService get(String seed) throws Exception {
+ public static synchronized ExecutorService get(String seed) throws Exception {
if (null == executors) {
- synchronized (ProcessPlatformExecutorFactory.class) {
- if (null == executors) {
- executors = Config.resource_node_processPlatformExecutors();
- }
- }
+ executors = Config.resource_node_processPlatformExecutors();
}
CRC32 crc32 = new CRC32();
crc32.update(Objects.toString(seed, "").getBytes());
@@ -44,4 +24,4 @@ public class ProcessPlatformExecutorFactory {
return executors[idx];
}
-}
+}
\ No newline at end of file
diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java b/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
index a98496974801ee305ba38193515ef275141cfc85..f893ee9109269061d5905475adcd811ed0687534 100644
--- a/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
+++ b/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
@@ -126,7 +126,6 @@ public class ApplicationServerTools extends JettySeverTools {
webApp.setResourceBase(dir.getAbsolutePath());
webApp.setDescriptor(new File(dir, "WEB-INF/web.xml").getAbsolutePath());
webApp.setExtraClasspath(calculateExtraClassPath(clz));
- webApp.getMimeTypes().addMimeMapping("vcf", "text/x-vcard");
//webApp.getMimeTypes().addMimeMapping("wcss", "application/json");
webApp.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
webApp.getInitParams().put("org.eclipse.jetty.jsp.precompiled", "true");
diff --git a/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/jaxrs/okrworkreportbaseinfo/ActionSaveDraftReport.java b/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/jaxrs/okrworkreportbaseinfo/ActionSaveDraftReport.java
index 1251e2eea002a2bdd0d725dce379049e0baaf7a9..4a31cf24e801d70c97469b9118e04be87781c9ee 100644
--- a/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/jaxrs/okrworkreportbaseinfo/ActionSaveDraftReport.java
+++ b/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/jaxrs/okrworkreportbaseinfo/ActionSaveDraftReport.java
@@ -64,7 +64,7 @@ public class ActionSaveDraftReport extends BaseAction {
}
//设置当前登录用户为创建工作汇报的用户
- if (check) {
+ if( Boolean.TRUE.equals( check ) ){
try {
wrapIn.setCreatorName( effectivePerson.getDistinguishedName() );
wrapIn.setCreatorIdentity( okrUserManagerService.getIdentityWithPerson(effectivePerson.getDistinguishedName()) );
@@ -75,7 +75,7 @@ public class ActionSaveDraftReport extends BaseAction {
logger.error( e, effectivePerson, request, null);
}
}
- if (check) {
+ if( Boolean.TRUE.equals( check ) ){
try {
wrapIn.setCreatorUnitName( okrUserManagerService.getUnitNameByIdentity(wrapIn.getCreatorIdentity()));
} catch (Exception e) {
@@ -85,7 +85,7 @@ public class ActionSaveDraftReport extends BaseAction {
logger.error( e, effectivePerson, request, null);
}
}
- if (check) {
+ if( Boolean.TRUE.equals( check ) ){
try {
wrapIn.setCreatorTopUnitName( okrUserManagerService.getTopUnitNameByIdentity(wrapIn.getCreatorIdentity()) );
} catch (Exception e) {
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ActionApplication.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ActionApplication.java
index 85ac288ff54ccf779752e3e7c2d01aa405ddcd38..211d37b3c592e27a066f90c04d594ec96da68242 100644
--- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ActionApplication.java
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ActionApplication.java
@@ -23,6 +23,7 @@ import com.x.processplatform.assemble.surface.jaxrs.review.ReviewAction;
import com.x.processplatform.assemble.surface.jaxrs.route.RouteAction;
import com.x.processplatform.assemble.surface.jaxrs.script.ScriptAction;
import com.x.processplatform.assemble.surface.jaxrs.serialnumber.SerialNumberAction;
+import com.x.processplatform.assemble.surface.jaxrs.service.ServiceAction;
import com.x.processplatform.assemble.surface.jaxrs.task.TaskAction;
import com.x.processplatform.assemble.surface.jaxrs.taskcompleted.TaskCompletedAction;
import com.x.processplatform.assemble.surface.jaxrs.work.WorkAction;
@@ -57,6 +58,7 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(KeyLockAction.class);
classes.add(DocumentVersionAction.class);
classes.add(RecordAction.class);
+ classes.add(ServiceAction.class);
return classes;
}
}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ApplicationServiceFilter.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ApplicationServiceFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..788a9177c6ba92b3f38fb7edb8e327cf7efc88f7
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/ApplicationServiceFilter.java
@@ -0,0 +1,10 @@
+package com.x.processplatform.assemble.surface.jaxrs;
+
+import javax.servlet.annotation.WebFilter;
+
+import com.x.base.core.project.jaxrs.AnonymousCipherManagerUserJaxrsFilter;
+
+@WebFilter(urlPatterns = "/jaxrs/service/*", asyncSupported = true)
+public class ApplicationServiceFilter extends AnonymousCipherManagerUserJaxrsFilter {
+
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/BaseAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..8588eac9e9ce4bf9d0a8f3f4f713f19d4b62775d
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/BaseAction.java
@@ -0,0 +1,7 @@
+package com.x.processplatform.assemble.surface.jaxrs.draft;
+
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+
+abstract class BaseAction extends StandardJaxrsAction {
+
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..73bfa5d6768a972cb160fe6e988a98d2d7b0ed55
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java
@@ -0,0 +1,35 @@
+package com.x.processplatform.assemble.surface.jaxrs.draft;
+
+import javax.ws.rs.Path;
+
+import com.x.base.core.project.annotation.JaxrsDescribe;
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+
+@Path("draft")
+@JaxrsDescribe("草稿")
+public class DraftAction extends StandardJaxrsAction {
+
+ private static Logger logger = LoggerFactory.getLogger(DraftAction.class);
+
+ // @JaxrsMethodDescribe(value = "列示指定工作或已完成工作的版式文件历史版本.", action = ActionListWithWorkOrWorkCompleted.class)
+ // @GET
+ // @Path("list/workorworkcompleted/{workOrWorkCompleted}")
+ // @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+ // @Consumes(MediaType.APPLICATION_JSON)
+ // public void listWithWorkOrWorkCompleted(@Suspended final AsyncResponse asyncResponse,
+ // @Context HttpServletRequest request,
+ // @JaxrsParameterDescribe("标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) {
+ // ActionResult> result = new ActionResult<>();
+ // EffectivePerson effectivePerson = this.effectivePerson(request);
+ // try {
+ // result = new ActionListWithWorkOrWorkCompleted().execute(effectivePerson, workOrWorkCompleted);
+ // } catch (Exception e) {
+ // logger.error(e, effectivePerson, request, null);
+ // result.error(e);
+ // }
+ // asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+ // }
+
+}
\ No newline at end of file
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ActionTouch.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ActionTouch.java
new file mode 100644
index 0000000000000000000000000000000000000000..eccb6d1a25b702336bf79ec7b4c02e194c43d530
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ActionTouch.java
@@ -0,0 +1,134 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+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.JpaObject;
+import com.x.base.core.project.Applications;
+import com.x.base.core.project.x_processplatform_service_processing;
+import com.x.base.core.project.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.exception.ExceptionEntityNotExist;
+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.jaxrs.WrapBoolean;
+import com.x.base.core.project.tools.ListTools;
+import com.x.base.core.project.tools.StringTools;
+import com.x.processplatform.assemble.surface.ThisApplication;
+import com.x.processplatform.core.entity.content.Record;
+import com.x.processplatform.core.entity.content.RecordProperties.NextManual;
+import com.x.processplatform.core.entity.content.Task;
+import com.x.processplatform.core.entity.content.Work;
+import com.x.processplatform.core.entity.content.WorkLog;
+import com.x.processplatform.core.entity.element.ActivityType;
+import com.x.processplatform.core.express.ProcessingAttributes;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+class ActionTouch extends BaseAction {
+
+ private Work work;
+
+ private String series = StringTools.uniqueToken();
+
+ ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
+ WorkLog workLog;
+ ActionResult result = new ActionResult<>();
+ try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+ work = emc.find(id, Work.class);
+ if (null == work) {
+ throw new ExceptionEntityNotExist(id, Work.class);
+ }
+ if (!Objects.equals(ActivityType.service, work.getActivityType())) {
+ throw new ExceptionActivityNotService(work.getId());
+ }
+ workLog = emc.firstEqualAndEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob(),
+ WorkLog.fromActivityToken_FIELDNAME, work.getActivityToken());
+ if (null == workLog) {
+ throw new ExceptionWorkLogWithActivityTokenNotExist(work.getActivityToken());
+ }
+ }
+
+ WrapBoolean resp = ThisApplication.context().applications()
+ .putQuery(x_processplatform_service_processing.class,
+ Applications.joinQueryUri("service", "work", work.getId(), "touch"), jsonElement, work.getJob())
+ .getData(WrapBoolean.class);
+
+ if (BooleanUtils.isTrue(resp.getValue())) {
+ ProcessingAttributes req = new ProcessingAttributes();
+ req.setType(ProcessingAttributes.TYPE_SERVICE);
+ req.setSeries(this.series);
+ ThisApplication.context().applications()
+ .putQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
+ Applications.joinQueryUri("work", work.getId(), "processing","nonblocking"), null, work.getJob())
+ .getData(Wo.class);
+ }
+
+ Record record = this.record(workLog);
+
+ this.concreteRecord(record);
+
+ result.setData(Wo.copier.copy(record));
+
+ return result;
+ }
+
+ private Record record(WorkLog workLog) throws Exception {
+ try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+ final List nextTaskIdentities = new ArrayList<>();
+ final Record record = new Record(workLog);
+ record.getProperties().setElapsed(
+ Config.workTime().betweenMinutes(record.getProperties().getStartTime(), record.getRecordTime()));
+ record.setType(Record.TYPE_SERVICE);
+ List list = emc.fetchEqualAndEqual(Task.class,
+ ListTools.toList(Task.person_FIELDNAME, Task.identity_FIELDNAME, Task.unit_FIELDNAME,
+ Task.job_FIELDNAME, Task.work_FIELDNAME, Task.activity_FIELDNAME,
+ Task.activityAlias_FIELDNAME, Task.activityName_FIELDNAME, Task.activityToken_FIELDNAME,
+ Task.activityType_FIELDNAME, Task.empowerFromIdentity_FIELDNAME),
+ Task.job_FIELDNAME, workLog.getJob(), Task.series_FIELDNAME, this.series);
+ list.stream().collect(Collectors.groupingBy(Task::getActivity, Collectors.toList())).entrySet().stream()
+ .forEach(o -> {
+ Task task = o.getValue().get(0);
+ NextManual nextManual = new NextManual();
+ nextManual.setActivity(task.getActivity());
+ nextManual.setActivityAlias(task.getActivityAlias());
+ nextManual.setActivityName(task.getActivityName());
+ nextManual.setActivityToken(task.getActivityToken());
+ nextManual.setActivityType(task.getActivityType());
+ for (Task t : o.getValue()) {
+ nextManual.getTaskIdentityList().add(t.getIdentity());
+ nextTaskIdentities.add(t.getIdentity());
+ }
+ record.getProperties().getNextManualList().add(nextManual);
+ });
+ /* 去重 */
+ record.getProperties().setNextManualTaskIdentityList(ListTools.trim(nextTaskIdentities, true, true));
+ return record;
+ }
+ }
+
+ private void concreteRecord(Record record) throws Exception {
+ WoId resp = ThisApplication.context().applications()
+ .postQuery(x_processplatform_service_processing.class,
+ Applications.joinQueryUri("record", "job", this.work.getJob()), record, work.getJob())
+ .getData(WoId.class);
+ if (StringUtils.isBlank(resp.getId())) {
+ throw new ExceptionService(this.work.getId());
+ }
+ }
+
+ public static class Wo extends Record {
+ private static final long serialVersionUID = -1771383649634969945L;
+ static WrapCopier copier = WrapCopierFactory.wo(Record.class, Wo.class, null,
+ JpaObject.FieldsInvisible);
+ }
+
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/BaseAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee8c55a492a9a88b6b7c7ab850f291a2f88c301c
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/BaseAction.java
@@ -0,0 +1,7 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+
+abstract class BaseAction extends StandardJaxrsAction {
+
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionActivityNotService.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionActivityNotService.java
new file mode 100644
index 0000000000000000000000000000000000000000..f15d6da5b81dc13d562ba45f60e87b394161b55d
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionActivityNotService.java
@@ -0,0 +1,13 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionActivityNotService extends PromptException {
+
+ private static final long serialVersionUID = -7038279889683420366L;
+
+ ExceptionActivityNotService(String id) {
+ super("工作:{}, 未处于服务活动环节.", id);
+ }
+
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionService.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionService.java
new file mode 100644
index 0000000000000000000000000000000000000000..e0fca148cd4461baee0e17b6d821b13f263e4a08
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionService.java
@@ -0,0 +1,12 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionService extends PromptException {
+
+ private static final long serialVersionUID = 1040883405179987063L;
+
+ ExceptionService(String workId) {
+ super("服务执行失败,工作:{}.", workId);
+ }
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java
new file mode 100644
index 0000000000000000000000000000000000000000..23ddb2818a9cc0968b16c6d141e3057eaa7af402
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java
@@ -0,0 +1,12 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionWorkLogWithActivityTokenNotExist extends PromptException {
+
+ private static final long serialVersionUID = -9089355008820123519L;
+
+ ExceptionWorkLogWithActivityTokenNotExist(String str) {
+ super("无法根据活动令牌获取工作日志:{}.", str);
+ }
+}
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..28abd94e55ec3b749950e892df572f6528eac693
--- /dev/null
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java
@@ -0,0 +1,50 @@
+package com.x.processplatform.assemble.surface.jaxrs.service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.container.Suspended;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import com.google.gson.JsonElement;
+import com.x.base.core.project.annotation.JaxrsDescribe;
+import com.x.base.core.project.annotation.JaxrsMethodDescribe;
+import com.x.base.core.project.annotation.JaxrsParameterDescribe;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.http.HttpMediaType;
+import com.x.base.core.project.jaxrs.ResponseFactory;
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+
+@Path("service")
+@JaxrsDescribe("服务活动")
+public class ServiceAction extends StandardJaxrsAction {
+
+ private static Logger logger = LoggerFactory.getLogger(ServiceAction.class);
+
+ @JaxrsMethodDescribe(value = "访问服务", action = ActionTouch.class)
+ @PUT
+ @Path("work/{id}/touch")
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+ @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
+ ActionResult result = new ActionResult<>();
+ EffectivePerson effectivePerson = this.effectivePerson(request);
+ try {
+ result = new ActionTouch().execute(effectivePerson, id, jsonElement);
+ } catch (Exception e) {
+ logger.error(e, effectivePerson, request, null);
+ result.error(e);
+ }
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+ }
+
+}
\ No newline at end of file
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
index 61fa6f4a4b3ac5f18c4bc546d484f74447ef9adc..6024ce9baef134768a29d382a227d60000e0e414 100644
--- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
@@ -4,8 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
-
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
@@ -44,6 +42,8 @@ import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProc
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
+import org.apache.commons.lang3.StringUtils;
+
class ActionProcessing extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionProcessing.class);
@@ -261,7 +261,7 @@ class ActionProcessing extends BaseAction {
/* 记录上一处理人信息 */
if (ListTools.isNotEmpty(newTasks)) {
WrapUpdatePrevTaskIdentity req = new WrapUpdatePrevTaskIdentity();
- req.setTaskList(ListTools.extractProperty(newTasks, Task.id_FIELDNAME, String.class, true, true));
+ req.setTaskList(ListTools.extractProperty(newTasks, JpaObject.id_FIELDNAME, String.class, true, true));
req.getPrevTaskIdentityList().add(task.getIdentity());
ThisApplication.context().applications()
.putQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
@@ -345,7 +345,7 @@ class ActionProcessing extends BaseAction {
private static final long serialVersionUID = 2702712453822143654L;
static WrapCopier copier = WrapCopierFactory.wo(Task.class, WoTask.class,
- ListTools.toList(Task.id_FIELDNAME, Task.activity_FIELDNAME, Task.activityName_FIELDNAME,
+ ListTools.toList(JpaObject.id_FIELDNAME, Task.activity_FIELDNAME, Task.activityName_FIELDNAME,
Task.person_FIELDNAME, Task.identity_FIELDNAME, Task.unit_FIELDNAME),
null);
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCreate.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCreate.java
index 6f197736538dbc421af5a25c80c7a48d14b49460..a66fab2e81a1a431c1984c0af0fcfea906e7b66c 100644
--- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCreate.java
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCreate.java
@@ -6,13 +6,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import com.x.base.core.project.logger.Audit;
-import com.x.base.core.project.logger.Logger;
-import com.x.base.core.project.logger.LoggerFactory;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
@@ -22,12 +15,14 @@ import com.x.base.core.project.x_processplatform_service_processing;
import com.x.base.core.project.annotation.FieldDescribe;
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.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.TokenType;
import com.x.base.core.project.jaxrs.WoId;
+import com.x.base.core.project.logger.Audit;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.organization.Unit;
import com.x.base.core.project.tools.DefaultCharset;
import com.x.base.core.project.tools.ListTools;
@@ -44,6 +39,10 @@ import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Process;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+
class ActionCreate extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionCreate.class);
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionReroute.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionReroute.java
index 58cc319a2e2f66197d5067aff4f36cc6f12bbae1..ea49723a893f61da4aa700a436b2b43591992324 100644
--- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionReroute.java
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionReroute.java
@@ -31,6 +31,11 @@ import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.Process;
import com.x.processplatform.core.express.ProcessingAttributes;
+/**
+ * @deprecated
+ *
+ * 废弃,不再使用,改用V2Reroute
+ */
class ActionReroute extends BaseAction {
ActionResult execute(EffectivePerson effectivePerson, String id, String activityId, ActivityType activityType,
diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/schedule/CleanKeyLock.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/schedule/CleanKeyLock.java
index d10bc0efe8090ce51c4d76c3df570b8911ad89ec..c4c4b8970f1544dbc81e93581d70b02e767b6734 100644
--- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/schedule/CleanKeyLock.java
+++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/schedule/CleanKeyLock.java
@@ -6,6 +6,7 @@ import java.util.List;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.schedule.AbstractJob;
@@ -26,7 +27,7 @@ public class CleanKeyLock extends AbstractJob {
Integer count = 0;
do {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
- targets = emc.listLessThan(KeyLock.class, KeyLock.createTime_FIELDNAME,
+ targets = emc.listLessThan(KeyLock.class, JpaObject.createTime_FIELDNAME,
DateUtils.addMinutes(new Date(), -2));
if (!targets.isEmpty()) {
emc.beginTransaction(KeyLock.class);
diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
index 48cc7bb3895218caab8a0d5399819623afa5b345..0718e94e8721a2f3fc4519e51b4fc7eebd76f3af 100644
--- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
+++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
@@ -80,6 +80,9 @@ public class Record extends SliceJpaObject {
/* 超时自动流转 */
public final static String TYPE_PASSEXPIRED = "passExpired";
+ /* 外部调用流转 */
+ public final static String TYPE_SERVICE = "service";
+
/* 定制意见 */
public final static String TYPE_CUSTOM = "custom";
diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
index 5bdb0ad4f01c6834d5212428d365433d99f3446a..ffc86c4d46e7dee7bc3b17e64fd46eb6b427c2e9 100644
--- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
+++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
@@ -138,7 +138,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
: WORKCREATETYPE_SURFACE;
}
-
/* 修改过的Set Get 方法 */
public static final String job_FIELDNAME = "job";
@@ -334,11 +333,11 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
@CheckPersist(allowEmpty = false)
private WorkStatus workStatus;
-// public static final String errorRetry_FIELDNAME = "errorRetry";
-// @FieldDescribe("重试次数.")
-// @Column(name = ColumnNamePrefix + errorRetry_FIELDNAME)
-// @CheckPersist(allowEmpty = false)
-// private Integer errorRetry;
+ // public static final String errorRetry_FIELDNAME = "errorRetry";
+ // @FieldDescribe("重试次数.")
+ // @Column(name = ColumnNamePrefix + errorRetry_FIELDNAME)
+ // @CheckPersist(allowEmpty = false)
+ // private Integer errorRetry;
public static final String beforeExecuted_FIELDNAME = "beforeExecuted";
@FieldDescribe("是否已经通过执行前")
@@ -396,13 +395,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
@CheckPersist(allowEmpty = true)
private String splitValue;
- public static final String serviceValue_FIELDNAME = "serviceValue";
- @FieldDescribe("Service活动环节回写的值ID")
- @Column(length = JpaObject.length_id, name = ColumnNamePrefix + serviceValue_FIELDNAME)
- @Index(name = TABLE + IndexNameMiddle + serviceValue_FIELDNAME)
- @CheckPersist(allowEmpty = true)
- private String serviceValue;
-
public static final String form_FIELDNAME = "form";
@FieldDescribe("使用表单")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + form_FIELDNAME)
@@ -436,17 +428,18 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
@CheckPersist(allowEmpty = true)
private String destinationActivity;
-// public static final String forceRoute_FIELDNAME = "forceRoute";
-// @FieldDescribe("强制路由,用于调度等需要跳过执行环节直接进行的.")
-// @Column(name = ColumnNamePrefix + forceRoute_FIELDNAME)
-// @CheckPersist(allowEmpty = true)
-// private Boolean forceRoute;
-//
-// public static final String forceRouteArriveCurrentActivity_FIELDNAME = "forceRouteArriveCurrentActivity";
-// @FieldDescribe("是否是强制路由进入当前节点.")
-// @Column(name = ColumnNamePrefix + forceRouteArriveCurrentActivity_FIELDNAME)
-// @CheckPersist(allowEmpty = true)
-// private Boolean forceRouteArriveCurrentActivity;
+ // public static final String forceRoute_FIELDNAME = "forceRoute";
+ // @FieldDescribe("强制路由,用于调度等需要跳过执行环节直接进行的.")
+ // @Column(name = ColumnNamePrefix + forceRoute_FIELDNAME)
+ // @CheckPersist(allowEmpty = true)
+ // private Boolean forceRoute;
+ //
+ // public static final String forceRouteArriveCurrentActivity_FIELDNAME =
+ // "forceRouteArriveCurrentActivity";
+ // @FieldDescribe("是否是强制路由进入当前节点.")
+ // @Column(name = ColumnNamePrefix + forceRouteArriveCurrentActivity_FIELDNAME)
+ // @CheckPersist(allowEmpty = true)
+ // private Boolean forceRouteArriveCurrentActivity;
public static final String expireTime_FIELDNAME = "expireTime";
@FieldDescribe("任务截止时间.")
@@ -841,13 +834,13 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this.form = form;
}
-// public Integer getErrorRetry() {
-// return errorRetry;
-// }
-//
-// public void setErrorRetry(Integer errorRetry) {
-// this.errorRetry = errorRetry;
-// }
+ // public Integer getErrorRetry() {
+ // return errorRetry;
+ // }
+ //
+ // public void setErrorRetry(Integer errorRetry) {
+ // this.errorRetry = errorRetry;
+ // }
public String getDestinationRoute() {
return destinationRoute;
@@ -933,14 +926,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this.applicationAlias = applicationAlias;
}
- public String getServiceValue() {
- return serviceValue;
- }
-
- public void setServiceValue(String serviceValue) {
- this.serviceValue = serviceValue;
- }
-
public Date getExpireTime() {
return expireTime;
}
diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java
index d1e72e025d46d98541d85812709522e98bc77525..e1772bfcb82b6bf359b6ccfb444588a13149fa3c 100644
--- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java
+++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java
@@ -12,6 +12,8 @@ public class WorkProperties extends JsonProperties {
private LinkedHashMap manualEmpowerMap = new LinkedHashMap<>();
+ private LinkedHashMap serviceValue = new LinkedHashMap<>();
+
public List getManualForceTaskIdentityList() {
if (this.manualForceTaskIdentityList == null) {
this.manualForceTaskIdentityList = new ArrayList();
@@ -34,6 +36,21 @@ public class WorkProperties extends JsonProperties {
this.manualEmpowerMap = manualEmpowerMap;
}
+ public LinkedHashMap getServiceValue() {
+ if (this.serviceValue == null) {
+ this.serviceValue = new LinkedHashMap();
+ }
+ return this.serviceValue;
+ }
+
+ public void setServiceValue(LinkedHashMap serviceValue) {
+ this.serviceValue = serviceValue;
+ }
+
+
+
+
+
// private String destinationRoute;
//
// private String destinationRouteName;
diff --git a/o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java b/o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java
index 7de5ef134981fed0a34ed685dd3734f324231d5f..36dd9c2f84eadb36e81f974b1eff6eb40fb5e018 100644
--- a/o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java
+++ b/o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java
@@ -16,7 +16,7 @@ public class ProcessingAttributes extends GsonPropertyObject {
public static final String TYPE_RESET = "reset";
public static final String TYPE_RETRACT = "retract";
public static final String TYPE_ROLLBACK = "rollback";
- //public static final String TYPE_BEGIN = "begin";
+ public static final String TYPE_SERVICE = "service";
private Integer loop = 1;
@FieldDescribe("强制从arrive开始")
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ActionApplication.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ActionApplication.java
index 3e7eaf0e7499d696d7a0b3352ff6ebb5ccf651c4..dbb8430b232b1e688547dfcf973424c42c53d6fd 100644
--- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ActionApplication.java
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ActionApplication.java
@@ -14,6 +14,7 @@ import com.x.processplatform.service.processing.jaxrs.read.ReadAction;
import com.x.processplatform.service.processing.jaxrs.readcompleted.ReadCompletedAction;
import com.x.processplatform.service.processing.jaxrs.record.RecordAction;
import com.x.processplatform.service.processing.jaxrs.review.ReviewAction;
+import com.x.processplatform.service.processing.jaxrs.service.ServiceAction;
import com.x.processplatform.service.processing.jaxrs.task.TaskAction;
import com.x.processplatform.service.processing.jaxrs.taskcompleted.TaskCompletedAction;
import com.x.processplatform.service.processing.jaxrs.test.TestAction;
@@ -38,6 +39,7 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(DocumentVersionAction.class);
classes.add(TestAction.class);
classes.add(RecordAction.class);
+ classes.add(ServiceAction.class);
return classes;
}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ServiceJaxrsFilter.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ServiceJaxrsFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..4808690b68ceeade9b962c7349fb2e675efcb814
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/ServiceJaxrsFilter.java
@@ -0,0 +1,10 @@
+package com.x.processplatform.service.processing.jaxrs;
+
+import javax.servlet.annotation.WebFilter;
+
+import com.x.base.core.project.jaxrs.CipherManagerJaxrsFilter;
+
+@WebFilter(urlPatterns = "/jaxrs/service/*", asyncSupported = true)
+public class ServiceJaxrsFilter extends CipherManagerJaxrsFilter {
+
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ActionTouch.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ActionTouch.java
new file mode 100644
index 0000000000000000000000000000000000000000..f7488cc6bb07a6484a4df39762c5393580e06707
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ActionTouch.java
@@ -0,0 +1,79 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import java.lang.reflect.Type;
+import java.util.LinkedHashMap;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+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.exception.ExceptionEntityNotExist;
+import com.x.base.core.project.executor.ProcessPlatformExecutorFactory;
+import com.x.base.core.project.gson.XGsonBuilder;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WrapBoolean;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
+import com.x.processplatform.core.entity.content.Work;
+import com.x.processplatform.core.entity.element.ActivityType;
+
+class ActionTouch extends BaseAction{
+
+ private static Logger logger = LoggerFactory.getLogger(ActionTouch.class);
+
+ ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
+ String job = null;
+ try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+ Work work = emc.fetch(id, Work.class, ListTools.toList(Work.job_FIELDNAME));
+ if (null == work) {
+ throw new ExceptionEntityNotExist(id, Work.class);
+ }
+ job = work.getJob();
+ }
+ return ProcessPlatformExecutorFactory.get(job).submit(new CallableAction(id, jsonElement)).get();
+ }
+
+ public class CallableAction implements Callable> {
+
+ private String id;
+
+ private JsonElement jsonElement;
+
+ public CallableAction(String id, JsonElement jsonElement) {
+ this.id = id;
+ this.jsonElement = jsonElement;
+ }
+
+ public ActionResult call() throws Exception {
+ ActionResult result = new ActionResult<>();
+ try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+ Work work = emc.find(id, Work.class);
+ if (null == work) {
+ throw new ExceptionEntityNotExist(id, Work.class);
+ }
+ if (!Objects.equals(ActivityType.service, work.getActivityType())) {
+ throw new ExceptionActivityNotService(id);
+ }
+ emc.beginTransaction(Work.class);
+ Type type = new TypeToken>() {
+ }.getType();
+ work.getProperties().setServiceValue(XGsonBuilder.instance().fromJson(jsonElement, type));
+ emc.check(work, CheckPersistType.all);
+ emc.commit();
+ Wo wo = new Wo();
+ wo.setValue(true);
+ result.setData(wo);
+ return result;
+ }
+ }
+ }
+
+ public static class Wo extends WrapBoolean {
+ }
+
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/BaseAction.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/BaseAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..d0784f5099d895168af2f1da380178f2880d026c
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/BaseAction.java
@@ -0,0 +1,7 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+
+abstract class BaseAction extends StandardJaxrsAction {
+
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionActivityNotService.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionActivityNotService.java
new file mode 100644
index 0000000000000000000000000000000000000000..4c420fb259c797b2262583b759e1c9a74176b45b
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionActivityNotService.java
@@ -0,0 +1,13 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionActivityNotService extends PromptException {
+
+ private static final long serialVersionUID = -7038279889683420366L;
+
+ ExceptionActivityNotService(String id) {
+ super("工作:{}, 未处于服务活动环节.", id);
+ }
+
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionService.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionService.java
new file mode 100644
index 0000000000000000000000000000000000000000..fe23fba381697ae343b509dd977e39b3af61dc2f
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionService.java
@@ -0,0 +1,12 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionService extends PromptException {
+
+ private static final long serialVersionUID = 1040883405179987063L;
+
+ ExceptionService(String workId) {
+ super("服务执行失败,工作:{}.", workId);
+ }
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java
new file mode 100644
index 0000000000000000000000000000000000000000..2c36d5a0dff99350ce35bafda16c5c016120d237
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ExceptionWorkLogWithActivityTokenNotExist.java
@@ -0,0 +1,12 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionWorkLogWithActivityTokenNotExist extends PromptException {
+
+ private static final long serialVersionUID = -9089355008820123519L;
+
+ ExceptionWorkLogWithActivityTokenNotExist(String str) {
+ super("无法根据活动令牌获取工作日志:{}.", str);
+ }
+}
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ServiceAction.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ServiceAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..217bfcdd75e81099ff1ff64cfdef2e4fd4a2ff2b
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/service/ServiceAction.java
@@ -0,0 +1,50 @@
+package com.x.processplatform.service.processing.jaxrs.service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.container.Suspended;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import com.google.gson.JsonElement;
+import com.x.base.core.project.annotation.JaxrsDescribe;
+import com.x.base.core.project.annotation.JaxrsMethodDescribe;
+import com.x.base.core.project.annotation.JaxrsParameterDescribe;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.http.HttpMediaType;
+import com.x.base.core.project.jaxrs.ResponseFactory;
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+
+@Path("service")
+@JaxrsDescribe("服务活动")
+public class ServiceAction extends StandardJaxrsAction {
+
+ private static Logger logger = LoggerFactory.getLogger(ServiceAction.class);
+
+ @JaxrsMethodDescribe(value = "访问服务", action = ActionTouch.class)
+ @PUT
+ @Path("work/{id}/touch")
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+ @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
+ ActionResult result = new ActionResult<>();
+ EffectivePerson effectivePerson = this.effectivePerson(request);
+ try {
+ result = new ActionTouch().execute(effectivePerson, id, jsonElement);
+ } catch (Exception e) {
+ logger.error(e, effectivePerson, request, null);
+ result.error(e);
+ }
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+ }
+
+}
\ No newline at end of file
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionProcessingNonblocking.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionProcessingNonblocking.java
new file mode 100644
index 0000000000000000000000000000000000000000..24d1140e3f66ac821d7e327d9e9aeff1b6666d1e
--- /dev/null
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionProcessingNonblocking.java
@@ -0,0 +1,49 @@
+package com.x.processplatform.service.processing.jaxrs.work;
+
+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.project.exception.ExceptionEntityNotExist;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WoId;
+import com.x.processplatform.core.entity.content.Work;
+import com.x.processplatform.core.express.ProcessingAttributes;
+import com.x.processplatform.service.processing.Processing;
+
+class ActionProcessingNonblocking extends BaseAction {
+
+ ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
+
+ Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+
+ try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+
+ wi.setDebugger(effectivePerson.getDebugger());
+
+ Work work = emc.find(id, Work.class);
+
+ if (null == work) {
+ throw new ExceptionEntityNotExist(id, Work.class);
+ }
+
+ }
+
+ Processing processing = new Processing(wi);
+ processing.processing(id);
+ ActionResult result = new ActionResult<>();
+ Wo wo = new Wo();
+ wo.setId(id);
+ result.setData(wo);
+ return result;
+
+ }
+
+ public static class Wi extends ProcessingAttributes {
+
+ }
+
+ public static class Wo extends WoId {
+ }
+
+}
\ No newline at end of file
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Reroute.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Reroute.java
index 68f91905a62950fe76f0a0227102eb9b8a6d1bff..6f2a3605dbd709921657d1109963be9efdd11284 100644
--- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Reroute.java
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Reroute.java
@@ -4,11 +4,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
-import org.apache.commons.lang3.StringUtils;
-
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.JpaObject;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
@@ -26,7 +25,8 @@ import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.express.service.processing.jaxrs.work.V2RerouteWi;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.MessageFactory;
-import com.x.processplatform.service.processing.jaxrs.work.V2Retract.Wo;
+
+import org.apache.commons.lang3.StringUtils;
class V2Reroute extends BaseAction {
@@ -120,7 +120,7 @@ class V2Reroute extends BaseAction {
private void removeOtherWork(Business business, Work work) throws Exception {
List os = business.entityManagerContainer().listEqualAndNotEqual(Work.class, Work.job_FIELDNAME,
- work.getJob(), Work.id_FIELDNAME, work.getId());
+ work.getJob(), JpaObject.id_FIELDNAME, work.getId());
os.stream().forEach(o -> {
try {
business.entityManagerContainer().remove(o, CheckRemoveType.all);
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/WorkAction.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/WorkAction.java
index 3889dc3f58bc5af9a7935ff062a50d3b40f1af45..a249915728f519e73b7b8c9eeacc4bf411495d82 100644
--- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/WorkAction.java
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/WorkAction.java
@@ -87,6 +87,25 @@ public class WorkAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
+
+ @JaxrsMethodDescribe(value = "流转一个流程实例,以非阻塞队列方式运行.", action = ActionProcessingNonblocking.class)
+ @PUT
+ @Path("{id}/processing/nonblocking")
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public void processingNonblocking(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+ @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
+ ActionResult result = new ActionResult<>();
+ EffectivePerson effectivePerson = this.effectivePerson(request);
+ try {
+ result = new ActionProcessingNonblocking().execute(effectivePerson, id, jsonElement);
+ } catch (Exception e) {
+ logger.error(e, effectivePerson, request, jsonElement);
+ result.error(e);
+ }
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+ }
+
@JaxrsMethodDescribe(value = "删除单个工作.", action = ActionDelete.class)
@DELETE
@Path("{id}")
diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/service/ServiceProcessor.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/service/ServiceProcessor.java
index 221df010e3fef5f553ed590fe3da9754d30ed132..c2e779ff7d63449ae9c4646f1ed156fb35cb4a3b 100644
--- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/service/ServiceProcessor.java
+++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/service/ServiceProcessor.java
@@ -1,13 +1,12 @@
package com.x.processplatform.service.processing.processor.service;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import javax.script.CompiledScript;
import javax.script.ScriptContext;
-import org.apache.commons.lang3.StringUtils;
-
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@@ -15,10 +14,11 @@ import com.x.base.core.project.script.ScriptFactory;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.element.Route;
import com.x.processplatform.core.entity.element.Service;
-import com.x.processplatform.core.entity.temporary.ServiceValue;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.processor.AeiObjects;
+import org.apache.commons.lang3.StringUtils;
+
public class ServiceProcessor extends AbstractServiceProcessor {
private static Logger logger = LoggerFactory.getLogger(ServiceProcessor.class);
@@ -30,47 +30,40 @@ public class ServiceProcessor extends AbstractServiceProcessor {
@Override
protected Work arriving(AeiObjects aeiObjects, Service service) throws Exception {
/** 清空上一次调用值 */
- aeiObjects.getWork().setServiceValue("");
+ aeiObjects.getWork().getProperties().setServiceValue(new LinkedHashMap());
return aeiObjects.getWork();
}
@Override
protected void arrivingCommitted(AeiObjects aeiObjects, Service service) throws Exception {
+ // Do nothing
}
@Override
protected List executing(AeiObjects aeiObjects, Service service) throws Exception {
List results = new ArrayList<>();
- if (StringUtils.isNotEmpty(aeiObjects.getWork().getServiceValue())) {
- boolean passThrough = false;
- if (StringUtils.isNotEmpty(service.getScript()) || StringUtils.isNotEmpty(service.getScriptText())) {
- ServiceValue serviceValue = this.entityManagerContainer().find(aeiObjects.getWork().getServiceValue(),
- ServiceValue.class);
- if (null != serviceValue) {
- ScriptContext scriptContext = aeiObjects.scriptContext();
- scriptContext.getBindings(ScriptContext.ENGINE_SCOPE).put(ScriptFactory.BINDING_NAME_SERVICEVALUE,
- serviceValue);
- CompiledScript cs = aeiObjects.business().element().getCompiledScript(
- aeiObjects.getWork().getApplication(), aeiObjects.getActivity(), Business.EVENT_SERVICE);
- passThrough = ScriptFactory.asBoolean(cs.eval(scriptContext));
-// ScriptHelper scriptHelper = ScriptHelperFactory.create(aeiObjects,
-// new BindingPair("serviceValue", serviceValue));
-// passThrough = scriptHelper.evalAsBoolean(aeiObjects.getWork().getApplication(),
-// service.getScript(), service.getScriptText());
- }
- } else {
- passThrough = true;
- }
- if (passThrough) {
- results.add(aeiObjects.getWork());
- }
+ boolean passThrough = false;
+ if (StringUtils.isNotEmpty(service.getScript()) || StringUtils.isNotEmpty(service.getScriptText())) {
+ ScriptContext scriptContext = aeiObjects.scriptContext();
+ scriptContext.getBindings(ScriptContext.ENGINE_SCOPE).put(ScriptFactory.BINDING_NAME_SERVICEVALUE,
+ gson.toJson(aeiObjects.getWork().getProperties().getServiceValue()));
+ CompiledScript cs = aeiObjects.business().element().getCompiledScript(aeiObjects.getWork().getApplication(),
+ aeiObjects.getActivity(), Business.EVENT_SERVICE);
+ passThrough = ScriptFactory.asBoolean(cs.eval(scriptContext));
+ } else {
+ passThrough = true;
+ }
+ if (passThrough) {
+ results.add(aeiObjects.getWork());
}
+
return results;
}
@Override
protected void executingCommitted(AeiObjects aeiObjects, Service service) throws Exception {
+ // Do nothing
}
@Override
@@ -82,5 +75,6 @@ public class ServiceProcessor extends AbstractServiceProcessor {
@Override
protected void inquiringCommitted(AeiObjects aeiObjects, Service service) throws Exception {
+ // Do nothing
}
}