o2null 5 лет назад
Родитель
Сommit
f73d0e86f0
20 измененных файлов с 623 добавлено и 98 удалено
  1. 43 27
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java
  2. 24 11
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/BaseAction.java
  3. 12 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ExceptionAlreadyPause.java
  4. 12 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ExceptionAlreadyResume.java
  5. 13 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ExceptionNotAllowPause.java
  6. 36 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/TaskAction.java
  7. 65 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Pause.java
  8. 57 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Resume.java
  9. 14 0
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Task.java
  10. 39 6
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/TaskProperties.java
  11. 4 24
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
  12. 19 5
      o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Manual.java
  13. 9 0
      o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2PauseWo.java
  14. 9 0
      o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2ResumeWo.java
  15. 36 1
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/TaskAction.java
  16. 68 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Pause.java
  17. 99 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Resume.java
  18. 27 0
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/test/ActionTest.java
  19. 4 2
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/test/TestAction.java
  20. 33 22
      o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/schedule/Expire.java

+ 43 - 27
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java

@@ -3,7 +3,9 @@ package com.x.processplatform.assemble.surface.jaxrs.control;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import org.apache.commons.lang3.BooleanUtils;
 
@@ -45,7 +47,8 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 
 	private Map<String, Boolean> hasTaskCompletedWithActivityToken = new HashMap<>();
 
-	ActionResult<Wo> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception {
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String workOrWorkCompleted)
+			throws InterruptedException, ExecutionException, TimeoutException, ExceptionAccessDenied {
 		ActionResult<Wo> result = new ActionResult<>();
 		CompletableFuture<Wo> getFuture = this.getFuture(effectivePerson, workOrWorkCompleted);
 		CompletableFuture<Boolean> checkControlFuture = this.checkControlFuture(effectivePerson, workOrWorkCompleted);
@@ -94,31 +97,31 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 
 		Activity activity = business.getActivity(work);
 
-		/* 是否可以看到 */
+		// 是否可以看到
 		wo.setAllowVisit(true);
-		/* 是否可以直接流转 */
+		// 是否可以直接流转
 		wo.setAllowProcessing(this.hasTaskWithWork(business, effectivePerson, work.getId()));
-		/* 是否可以处理待阅 */
+		// 是否可以处理待阅
 		wo.setAllowReadProcessing(this.hasReadWithJob(business, effectivePerson, work.getJob()));
-		/* 是否可以保存数据 */
+		// 是否可以保存数据
 		wo.setAllowSave(
 				this.canManageApplicationOrProcess(business, effectivePerson, work.getApplication(), work.getProcess())
 						|| this.hasTaskWithWork(business, effectivePerson, work.getId()));
-		/* 是否可以重置处理人 */
+		// 是否可以重置处理人
 		wo.setAllowReset(PropertyTools.getOrElse(activity, Manual.allowReset_FIELDNAME, Boolean.class, false)
 				&& wo.getAllowSave());
-
-		/* 是否可以调度 */
+		// 是否可以调度
 		wo.setAllowReroute(PropertyTools.getOrElse(activity, Manual.allowReroute_FIELDNAME, Boolean.class, false)
 				&& this.canManageApplicationOrProcess(business, effectivePerson, work.getApplication(),
 						work.getProcess()));
-
-		/* 是否可以删除 */
+		// 是否可以删除
 		wo.setAllowDelete(PropertyTools.getOrElse(activity, Manual.allowDeleteWork_FIELDNAME, Boolean.class, false)
 				&& wo.getAllowSave());
-
-		/* 是否可以增加会签分支 */
-		if (PropertyTools.getOrElse(activity, Manual.allowAddSplit_FIELDNAME, Boolean.class, false)
+		// 是否可以挂起待办,暂停待办计时
+		wo.setAllowPause(PropertyTools.getOrElse(activity, Manual.allowPause_FIELDNAME, Boolean.class, false)
+				&& wo.getAllowPause());
+		// 是否可以增加会签分支
+		if (BooleanUtils.isTrue(PropertyTools.getOrElse(activity, Manual.allowAddSplit_FIELDNAME, Boolean.class, false))
 				&& BooleanUtils.isTrue(work.getSplitting())) {
 			Node node = this.workLogTree(business, work.getJob()).location(work);
 			if (null != node) {
@@ -134,8 +137,9 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 				}
 			}
 		}
-		/* 是否可以召回 */
-		if (PropertyTools.getOrElse(activity, Manual.allowRetract_FIELDNAME, Boolean.class, false)) {
+		// 是否可以召回
+		if (BooleanUtils
+				.isTrue(PropertyTools.getOrElse(activity, Manual.allowRetract_FIELDNAME, Boolean.class, false))) {
 			Node node = this.workLogTree(business, work.getJob()).location(work);
 			if (null != node) {
 				Nodes ups = node.upTo(ActivityType.manual, ActivityType.agent, ActivityType.choice, ActivityType.delay,
@@ -149,14 +153,14 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 				}
 			}
 		}
-		/* 是否可以回滚 */
+		// 是否可以回滚
 		wo.setAllowRollback(PropertyTools.getOrElse(activity, Manual.allowRollback_FIELDNAME, Boolean.class, false)
 				&& this.canManageApplicationOrProcess(business, effectivePerson, work.getApplication(),
 						work.getProcess()));
-		/* 是否可以提醒 */
+		// 是否可以提醒
 		wo.setAllowPress(PropertyTools.getOrElse(activity, Manual.allowPress_FIELDNAME, Boolean.class, false)
 				&& this.hasTaskCompletedWithJob(business, effectivePerson, work.getJob()));
-		/* 是否可以看到 */
+		// 是否可以看到
 		wo.setAllowVisit(true);
 
 		return wo;
@@ -164,15 +168,25 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 	}
 
 	private boolean hasTaskCompletedWithActivityToken(Business business, EffectivePerson effectivePerson,
-			String activityToken) throws Exception {
-		Boolean o = this.hasTaskCompletedWithActivityToken.get(activityToken);
-		if (null == o) {
-			o = business.entityManagerContainer().countEqualAndEqual(TaskCompleted.class,
-					TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(),
-					TaskCompleted.activityToken_FIELDNAME, activityToken) > 0;
-			this.hasTaskCompletedWithActivityToken.put(activityToken, o);
-		}
-		return o;
+			String activityToken) {
+		return this.hasTaskCompletedWithActivityToken.computeIfAbsent(activityToken, k -> {
+			try {
+				return business.entityManagerContainer().countEqualAndEqual(TaskCompleted.class,
+						TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(),
+						TaskCompleted.activityToken_FIELDNAME, activityToken) > 0;
+			} catch (Exception e) {
+				logger.error(e);
+			}
+			return false;
+		});
+//		Boolean o = this.hasTaskCompletedWithActivityToken.get(activityToken);
+//		if (null == o) {
+//			o = business.entityManagerContainer().countEqualAndEqual(TaskCompleted.class,
+//					TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(),
+//					TaskCompleted.activityToken_FIELDNAME, activityToken) > 0;
+//			this.hasTaskCompletedWithActivityToken.put(activityToken, o);
+//		}
+//		return o;
 	}
 
 	private boolean hasTaskWithWork(Business business, EffectivePerson effectivePerson, String work) throws Exception {
@@ -220,6 +234,8 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
 
 	public static class Wo extends AbstractControl {
 
+		private static final long serialVersionUID = -4677744478291468477L;
+
 	}
 
 }

+ 24 - 11
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/BaseAction.java

@@ -17,28 +17,41 @@ abstract class BaseAction extends StandardJaxrsAction {
 	private static Logger logger = LoggerFactory.getLogger(BaseAction.class);
 
 	protected static class AbstractControl extends GsonPropertyObject {
-		/* 是否可以看到 */
+
+		private static final long serialVersionUID = 4099187125935802183L;
+		// 是否可以看到
 		private Boolean allowVisit = false;
-		/* 是否可以直接流转 */
+		// 是否可以直接流转
 		private Boolean allowProcessing = false;
-		/* 是否可以处理待阅 */
+		// 是否可以处理待阅
 		private Boolean allowReadProcessing = false;
-		/* 是否可以保存数据 */
+		// 是否可以保存数据
 		private Boolean allowSave = false;
-		/* 是否可以重置处理人 */
+		// 是否可以重置处理人
 		private Boolean allowReset = false;
-		/* 是否可以调度 */
+
+		public Boolean getAllowPause() {
+			return allowPause;
+		}
+
+		public void setAllowPause(Boolean allowPause) {
+			this.allowPause = allowPause;
+		}
+
+		// 是否可以调度
 		private Boolean allowReroute = false;
-		/* 是否可以删除 */
+		// 是否可以删除
 		private Boolean allowDelete = false;
-		/* 是否可以增加会签分支 */
+		// 是否可以增加会签分支
 		private Boolean allowAddSplit = false;
-		/* 是否可以召回 */
+		// 是否可以召回
 		private Boolean allowRetract = false;
-		/* 是否可以回滚 */
+		// 是否可以回滚
 		private Boolean allowRollback = false;
-		/* 是否可以回滚 */
+		// 是否可以提醒
 		private Boolean allowPress = false;
+		// 是否可以待办挂起(暂停待办计时)
+		private Boolean allowPause = false;
 
 		public Boolean getAllowSave() {
 			return allowSave;

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

@@ -0,0 +1,12 @@
+package com.x.processplatform.assemble.surface.jaxrs.task;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionAlreadyPause extends PromptException {
+
+	private static final long serialVersionUID = 1040883405179987063L;
+
+	ExceptionAlreadyPause(String id) {
+		super("待办已经处于挂起状态{}.", id);
+	}
+}

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

@@ -0,0 +1,12 @@
+package com.x.processplatform.assemble.surface.jaxrs.task;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionAlreadyResume extends PromptException {
+
+	private static final long serialVersionUID = 1040883405179987063L;
+
+	ExceptionAlreadyResume(String id) {
+		super("待办已经处于正常状态:{}.", id);
+	}
+}

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

@@ -0,0 +1,13 @@
+package com.x.processplatform.assemble.surface.jaxrs.task;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionNotAllowPause extends PromptException {
+
+	private static final long serialVersionUID = -5515077418025884395L;
+
+	ExceptionNotAllowPause(String id) {
+		super("不允许进行待办挂起: {}.", id);
+	}
+
+}

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

@@ -1017,4 +1017,40 @@ public class TaskAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
+
+	@JaxrsMethodDescribe(value = "V2_暂停待办处理计时.", action = V2Pause.class)
+	@GET
+	@Path("v2/{id}/pause")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void v2Pause(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<V2Pause.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new V2Pause().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "V2_恢复待办处理计时.", action = V2Resume.class)
+	@GET
+	@Path("v2/{id}/resume")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void v2Resume(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<V2Resume.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new V2Resume().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 }

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

@@ -0,0 +1,65 @@
+package com.x.processplatform.assemble.surface.jaxrs.task;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.Applications;
+import com.x.base.core.project.x_processplatform_service_processing;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+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.WrapBoolean;
+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.ThisApplication;
+import com.x.processplatform.core.entity.content.Task;
+import com.x.processplatform.core.entity.element.Manual;
+import com.x.processplatform.core.express.service.processing.jaxrs.task.V2PauseWo;
+
+class V2Pause extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(V2Pause.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		String job = null;
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Business business = new Business(emc);
+			Task task = emc.find(id, Task.class);
+			if (null == task) {
+				throw new ExceptionEntityNotExist(id, Task.class);
+			}
+			if (!business.readable(effectivePerson, task)) {
+				throw new ExceptionAccessDenied(effectivePerson, task);
+			}
+			if (BooleanUtils.isTrue(task.getPause())) {
+				throw new ExceptionAlreadyPause(task.getId());
+			}
+			Manual manual = business.manual().pick(task.getActivity());
+			if (null == manual) {
+				throw new ExceptionEntityNotExist(task.getActivity(), Manual.class);
+			}
+			if (BooleanUtils.isNotTrue(manual.getAllowPause())) {
+				throw new ExceptionNotAllowPause(task.getId());
+			}
+			job = task.getJob();
+		}
+		V2PauseWo resp = ThisApplication.context().applications().getQuery(effectivePerson.getDebugger(),
+				x_processplatform_service_processing.class, Applications.joinQueryUri("task", "v2", id, "pause"), job)
+				.getData(V2PauseWo.class);
+		Wo wo = new Wo();
+		wo.setValue(resp.getValue());
+		result.setData(wo);
+		return result;
+	}
+
+	public static class Wo extends WrapBoolean {
+
+		private static final long serialVersionUID = 4257481488388740879L;
+
+	}
+
+}

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

@@ -0,0 +1,57 @@
+package com.x.processplatform.assemble.surface.jaxrs.task;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.Applications;
+import com.x.base.core.project.x_processplatform_service_processing;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+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.WrapBoolean;
+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.ThisApplication;
+import com.x.processplatform.core.entity.content.Task;
+import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResumeWo;
+
+class V2Resume extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(V2Resume.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		String job = null;
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Business business = new Business(emc);
+			Task task = emc.find(id, Task.class);
+			if (null == task) {
+				throw new ExceptionEntityNotExist(id, Task.class);
+			}
+			if (!business.readable(effectivePerson, task)) {
+				throw new ExceptionAccessDenied(effectivePerson, task);
+			}
+			if ((!BooleanUtils.isTrue(task.getPause())) || (null == task.getProperties().getPauseStartTime())) {
+				throw new ExceptionAlreadyResume(task.getId());
+			}
+			job = task.getJob();
+		}
+		V2ResumeWo resp = ThisApplication.context().applications().getQuery(effectivePerson.getDebugger(),
+				x_processplatform_service_processing.class, Applications.joinQueryUri("task", "v2", id, "resume"), job)
+				.getData(V2ResumeWo.class);
+		Wo wo = new Wo();
+		wo.setValue(resp.getValue());
+		result.setData(wo);
+		return result;
+	}
+
+	public static class Wo extends WrapBoolean {
+
+		private static final long serialVersionUID = 4257481488388740879L;
+
+	}
+
+}

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

@@ -497,6 +497,12 @@ public class Task extends SliceJpaObject implements ProjectionInterface {
 	@Index(name = TABLE + IndexNameMiddle + series_FIELDNAME)
 	private String series;
 
+	public static final String pause_FIELDNAME = "pause";
+	@FieldDescribe("待办是否处于挂起暂停计时状态.")
+	@Column(name = ColumnNamePrefix + pause_FIELDNAME)
+	@CheckPersist(allowEmpty = true)
+	private Boolean pause;
+
 	public static final String workCreateType_FIELDNAME = "workCreateType";
 	@FieldDescribe("工作创建类型,surface,assign")
 	@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + workCreateType_FIELDNAME)
@@ -1306,4 +1312,12 @@ public class Task extends SliceJpaObject implements ProjectionInterface {
 		this.routeNameList = routeNameList;
 	}
 
+	public Boolean getPause() {
+		return pause;
+	}
+
+	public void setPause(Boolean pause) {
+		this.pause = pause;
+	}
+
 }

+ 39 - 6
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/TaskProperties.java

@@ -12,24 +12,33 @@ public class TaskProperties extends JsonProperties {
 
 	private static final long serialVersionUID = 5628694071505848771L;
 
-	@FieldDescribe("上一人工环节处理人")
+	@FieldDescribe("上一人工环节处理人.")
 	private String prevTaskIdentity;
 
-	@FieldDescribe("上一人工环节处理人列表")
+	@FieldDescribe("上一人工环节处理人列表.")
 	private List<String> prevTaskIdentityList;
 
-	@FieldDescribe("标题")
+	@FieldDescribe("标题.")
 	private String title;
 
-	@FieldDescribe("意见")
+	@FieldDescribe("意见.")
 	private String opinion;
 
-	@FieldDescribe("上一人工环节待办对象列表")
+	@FieldDescribe("上一人工环节待办对象列表.")
 	private List<PrevTask> prevTaskList;
 
-	@FieldDescribe("上一人工环节最近待办对象")
+	@FieldDescribe("上一人工环节最近待办对象.")
 	private PrevTask prevTask;
 
+	@FieldDescribe("待办计时暂停工作时间时长(分钟).")
+	private Date pauseStartTime;
+
+	@FieldDescribe("待办计时暂停工作时间时长(分钟).")
+	private Integer pauseWorkTimeMinutes;
+
+	@FieldDescribe("待办计时暂停自然时间时长(分钟).")
+	private Integer pauseMinutes;
+
 	public List<String> getPrevTaskIdentityList() {
 		if (null == prevTaskIdentityList) {
 			this.prevTaskIdentityList = new ArrayList<>();
@@ -152,4 +161,28 @@ public class TaskProperties extends JsonProperties {
 		this.prevTask = prevTask;
 	}
 
+	public Integer getPauseWorkTimeMinutes() {
+		return pauseWorkTimeMinutes;
+	}
+
+	public void setPauseWorkTimeMinutes(Integer pauseWorkTimeMinutes) {
+		this.pauseWorkTimeMinutes = pauseWorkTimeMinutes;
+	}
+
+	public Integer getPauseMinutes() {
+		return pauseMinutes;
+	}
+
+	public void setPauseMinutes(Integer pauseMinutes) {
+		this.pauseMinutes = pauseMinutes;
+	}
+
+	public Date getPauseStartTime() {
+		return pauseStartTime;
+	}
+
+	public void setPauseStartTime(Date pauseStartTime) {
+		this.pauseStartTime = pauseStartTime;
+	}
+
 }

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

@@ -152,10 +152,10 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
 	}
 
 	public List<String> getSplitValueList() {
-		//这里调用必须重新指向一次,如果使用
-		//Work copy = XGsonBuilder.convert(work, Work.class);
-		//copy.copyTo(this, JpaObject.id_FIELDNAME);
-		//这样的方法调用,那么在运行完成以后copy.splitValueList不再指向this.getProperties().getSplitValueList()
+		// 这里调用必须重新指向一次,如果使用
+		// Work copy = XGsonBuilder.convert(work, Work.class);
+		// copy.copyTo(this, JpaObject.id_FIELDNAME);
+		// 这样的方法调用,那么在运行完成以后copy.splitValueList不再指向this.getProperties().getSplitValueList()
 		this.splitValueList = this.getProperties().getSplitValueList();
 		return this.splitValueList;
 	}
@@ -354,12 +354,6 @@ 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 beforeExecuted_FIELDNAME = "beforeExecuted";
 	@FieldDescribe("是否已经通过执行前")
 	@Column(name = ColumnNamePrefix + beforeExecuted_FIELDNAME)
@@ -377,7 +371,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
 	@ElementIndex(name = TABLE + IndexNameMiddle + manualTaskIdentityList_FIELDNAME + ElementIndexNameSuffix)
 	@CheckPersist(allowEmpty = true)
 	private List<String> manualTaskIdentityList;
-	// private List<String> manualTaskIdentityList = new ArrayList<>();
 
 	public static final String manualTaskIdentityText_FIELDNAME = "manualTaskIdentityText";
 	@FieldDescribe("当前处理人身份合并文本,用','分割,超长截断,此字段仅用于显示当前工作的处理人,不索引.")
@@ -449,19 +442,6 @@ 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 expireTime_FIELDNAME = "expireTime";
 	@FieldDescribe("任务截止时间.")
 	@Temporal(TemporalType.TIMESTAMP)

+ 19 - 5
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Manual.java

@@ -85,12 +85,12 @@ public class Manual extends Activity {
 		this.properties = properties;
 	}
 
-	@FieldDescribe("分组")
+	@FieldDescribe("分组.")
 	@CheckPersist(allowEmpty = true)
 	@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + group_FIELDNAME)
 	private String group;
 
-	@FieldDescribe("意见分组")
+	@FieldDescribe("意见分组.")
 	@CheckPersist(allowEmpty = true)
 	@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + opinionGroup_FIELDNAME)
 	private String opinionGroup;
@@ -478,13 +478,13 @@ public class Manual extends Activity {
 	private List<String> taskDataPathList;
 
 	public static final String allowReset_FIELDNAME = "allowReset";
-	@FieldDescribe("允许重置待办")
+	@FieldDescribe("允许重置处理人")
 	@CheckPersist(allowEmpty = true)
 	@Column(name = ColumnNamePrefix + allowReset_FIELDNAME)
 	private Boolean allowReset;
 
 	public static final String allowRetract_FIELDNAME = "allowRetract";
-	@FieldDescribe("允许召回")
+	@FieldDescribe("允许工作召回")
 	@CheckPersist(allowEmpty = true)
 	@Column(name = ColumnNamePrefix + allowRetract_FIELDNAME)
 	private Boolean allowRetract;
@@ -519,6 +519,12 @@ public class Manual extends Activity {
 	@Column(name = ColumnNamePrefix + allowPress_FIELDNAME)
 	private Boolean allowPress;
 
+	public static final String allowPause_FIELDNAME = "allowPause";
+	@FieldDescribe("允许暂停待办的计时.")
+	@CheckPersist(allowEmpty = true)
+	@Column(name = ColumnNamePrefix + allowPause_FIELDNAME)
+	private Boolean allowPause;
+
 	public static final String resetRange_FIELDNAME = "resetRange";
 	@FieldDescribe("重置范围.")
 	@CheckPersist(allowEmpty = true)
@@ -526,7 +532,7 @@ public class Manual extends Activity {
 	private String resetRange;
 
 	public static final String resetCount_FIELDNAME = "resetCount";
-	@FieldDescribe("允许最大重置次数")
+	@FieldDescribe("允许最大重置次数.")
 	@CheckPersist(allowEmpty = true)
 	@Column(name = ColumnNamePrefix + resetCount_FIELDNAME)
 	private Integer resetCount;
@@ -1223,4 +1229,12 @@ public class Manual extends Activity {
 	public void setResetRangeScriptText(String resetRangeScriptText) {
 		this.resetRangeScriptText = resetRangeScriptText;
 	}
+
+	public Boolean getAllowPause() {
+		return allowPause;
+	}
+
+	public void setAllowPause(Boolean allowPause) {
+		this.allowPause = allowPause;
+	}
 }

+ 9 - 0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2PauseWo.java

@@ -0,0 +1,9 @@
+package com.x.processplatform.core.express.service.processing.jaxrs.task;
+
+import com.x.base.core.project.jaxrs.WrapBoolean;
+
+public class V2PauseWo extends WrapBoolean {
+
+	private static final long serialVersionUID = -6366340029999624969L;
+
+}

+ 9 - 0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2ResumeWo.java

@@ -0,0 +1,9 @@
+package com.x.processplatform.core.express.service.processing.jaxrs.task;
+
+import com.x.base.core.project.jaxrs.WrapBoolean;
+
+public class V2ResumeWo extends WrapBoolean {
+
+	private static final long serialVersionUID = -6366340029999624969L;
+
+}

+ 36 - 1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/TaskAction.java

@@ -216,7 +216,7 @@ public class TaskAction extends StandardJaxrsAction {
 	@Path("v2/{id}/reset")
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
 	@Consumes(MediaType.APPLICATION_JSON)
-	public void V2Reset(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+	public void v2Reset(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
 			@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
 		ActionResult<V2Reset.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
@@ -247,4 +247,39 @@ public class TaskAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
+	@JaxrsMethodDescribe(value = "V2_暂停待办处理计时.", action = V2Pause.class)
+	@GET
+	@Path("v2/{id}/pause")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void v2Pause(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<V2Pause.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new V2Pause().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "V2_恢复待办处理计时.", action = V2Resume.class)
+	@GET
+	@Path("v2/{id}/resume")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void v2Resume(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<V2Resume.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new V2Resume().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 }

+ 68 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Pause.java

@@ -0,0 +1,68 @@
+package com.x.processplatform.service.processing.jaxrs.task;
+
+import java.util.Date;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+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.executor.ProcessPlatformExecutorFactory;
+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.Task;
+
+class V2Pause extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(V2Pause.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
+
+		final String job;
+
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Task task = emc.fetch(id, Task.class, ListTools.toList(Task.job_FIELDNAME));
+			if (null == task) {
+				throw new ExceptionEntityNotExist(id, Task.class);
+			}
+			job = task.getJob();
+		}
+
+		Callable<ActionResult<Wo>> callable = () -> {
+			ActionResult<Wo> result = new ActionResult<>();
+			Wo wo = new Wo();
+			wo.setValue(false);
+			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+				Task task = emc.find(id, Task.class);
+				if (null == task) {
+					throw new ExceptionEntityNotExist(id, Task.class);
+				}
+				if (BooleanUtils.isNotTrue(task.getPause())) {
+					emc.beginTransaction(Task.class);
+					task.setPause(true);
+					task.getProperties().setPauseStartTime(new Date());
+					emc.commit();
+					wo.setValue(true);
+				}
+			}
+			result.setData(wo);
+			return result;
+		};
+
+		return ProcessPlatformExecutorFactory.get(job).submit(callable).get(300, TimeUnit.SECONDS);
+
+	}
+
+	public static class Wo extends WrapBoolean {
+
+		private static final long serialVersionUID = 2752464360851471911L;
+
+	}
+
+}

+ 99 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Resume.java

@@ -0,0 +1,99 @@
+package com.x.processplatform.service.processing.jaxrs.task;
+
+import java.util.Date;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+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.exception.ExceptionEntityNotExist;
+import com.x.base.core.project.executor.ProcessPlatformExecutorFactory;
+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.Task;
+
+class V2Resume extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(V2Resume.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
+
+		final String job;
+
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Task task = emc.fetch(id, Task.class, ListTools.toList(Task.job_FIELDNAME));
+			if (null == task) {
+				throw new ExceptionEntityNotExist(id, Task.class);
+			}
+			job = task.getJob();
+		}
+
+		return ProcessPlatformExecutorFactory.get(job).submit(new CallableImpl(id)).get(300, TimeUnit.SECONDS);
+
+	}
+
+	private class CallableImpl implements Callable<ActionResult<Wo>> {
+
+		private String id;
+
+		CallableImpl(String id) {
+			this.id = id;
+		}
+
+		@Override
+		public ActionResult<Wo> call() throws Exception {
+			ActionResult<Wo> result = new ActionResult<>();
+			Wo wo = new Wo();
+			wo.setValue(false);
+			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+				Task task = emc.find(id, Task.class);
+				if (null == task) {
+					throw new ExceptionEntityNotExist(id, Task.class);
+				}
+				if (BooleanUtils.isTrue(task.getPause()) && (null != task.getProperties().getPauseStartTime())) {
+					Date now = new Date();
+					int workTimeMinutes = (int) Config.workTime()
+							.betweenMinutes(task.getProperties().getPauseStartTime(), now);
+					int minutes = (int) (now.getTime() - task.getProperties().getPauseStartTime().getTime())
+							/ (1000 * 60);
+					if (null == task.getProperties().getPauseWorkTimeMinutes()) {
+						task.getProperties().setPauseWorkTimeMinutes(workTimeMinutes);
+					} else {
+						task.getProperties().setPauseWorkTimeMinutes(
+								task.getProperties().getPauseWorkTimeMinutes() + workTimeMinutes);
+					}
+					if (null == task.getProperties().getPauseMinutes()) {
+						task.getProperties().setPauseMinutes(minutes);
+					} else {
+						task.getProperties().setPauseMinutes(task.getProperties().getPauseMinutes() + minutes);
+					}
+					// 在原有的过期时间基础上延时workTimeMinutes
+					if (null != task.getExpireTime()) {
+						task.setExpireTime(Config.workTime().forwardMinutes(task.getExpireTime(), workTimeMinutes));
+						task.setExpired(task.getExpireTime().before(now));
+					}
+					emc.beginTransaction(Task.class);
+					task.setPause(false);
+					emc.commit();
+					wo.setValue(true);
+				}
+			}
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WrapBoolean {
+
+		private static final long serialVersionUID = -8246623997534427403L;
+
+	}
+
+}

+ 27 - 0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/test/ActionTest.java

@@ -0,0 +1,27 @@
+package com.x.processplatform.service.processing.jaxrs.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.processplatform.core.entity.content.Task;
+
+class ActionTest extends BaseAction {
+
+	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id) throws Exception {
+		ActionResult<List<Wo>> result = new ActionResult<>();
+		List<Wo> wos = new ArrayList<>();
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+		}
+		result.setData(wos);
+		return result;
+	}
+
+	public static class Wo extends Task {
+
+	}
+
+}

+ 4 - 2
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/test/TestAction.java

@@ -1,18 +1,21 @@
 package com.x.processplatform.service.processing.jaxrs.test;
 
+import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 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.x.base.core.project.Application;
 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;
@@ -162,5 +165,4 @@ public class TestAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
-
 }

+ 33 - 22
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/schedule/Expire.java

@@ -13,12 +13,14 @@ import javax.persistence.criteria.Path;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject_;
 import com.x.base.core.project.Applications;
 import com.x.base.core.project.x_processplatform_service_processing;
 import com.x.base.core.project.jaxrs.WoId;
@@ -41,6 +43,7 @@ public class Expire extends AbstractJob {
 			String sequence = null;
 			List<Task> targets = new ArrayList<>();
 			AtomicInteger count = new AtomicInteger();
+			AtomicInteger pause = new AtomicInteger();
 			do {
 				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 					targets = this.list(emc, sequence);
@@ -48,51 +51,59 @@ public class Expire extends AbstractJob {
 				if (!targets.isEmpty()) {
 					sequence = targets.get(targets.size() - 1).getSequence();
 					for (Task task : targets) {
-						try {
-							try {
-								ThisApplication.context().applications()
-										.getQuery(x_processplatform_service_processing.class,
-												Applications.joinQueryUri("task", task.getId(), "expire"),
-												task.getJob())
-										.getData(WoId.class);
-								count.incrementAndGet();
-							} catch (Exception e) {
-								throw new ExceptionExpire(e, task.getId(), task.getTitle(), task.getSequence());
-							}
-						} catch (Exception e) {
-							logger.error(e);
+						// 如果是挂起状态那么就不再进行标志过期
+						if (BooleanUtils.isNotTrue(task.getPause())) {
+							expire(task);
+							count.incrementAndGet();
+						} else {
+							pause.incrementAndGet();
 						}
 					}
 				}
 			} while (!targets.isEmpty());
-			logger.print("标识{}个过期待办, 耗时:{}.", count.intValue(), stamp.consumingMilliseconds());
+			logger.print("标识{}个过期待办, {}个待办处于挂起状态, 耗时:{}.", count.intValue(), pause.intValue(),
+					stamp.consumingMilliseconds());
 		} catch (Exception e) {
 			throw new JobExecutionException(e);
 		}
 	}
 
+	private void expire(Task task) {
+		try {
+			ThisApplication.context().applications()
+					.getQuery(x_processplatform_service_processing.class,
+							Applications.joinQueryUri("task", task.getId(), "expire"), task.getJob())
+					.getData(WoId.class);
+		} catch (Exception e) {
+			ExceptionExpire exceptionExpire = new ExceptionExpire(e, task.getId(), task.getTitle(), task.getSequence());
+			logger.error(exceptionExpire);
+		}
+	}
+
 	private List<Task> list(EntityManagerContainer emc, String sequence) throws Exception {
 		EntityManager em = emc.get(Task.class);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
 		Root<Task> root = cq.from(Task.class);
-		Path<String> id_path = root.get(Task_.id);
-		Path<String> job_path = root.get(Task_.job);
-		Path<String> sequence_path = root.get(Task_.sequence);
+		Path<String> idPath = root.get(Task_.id);
+		Path<String> jobPath = root.get(Task_.job);
+		Path<String> sequencePath = root.get(JpaObject_.sequence);
+		Path<Boolean> pausePath = root.get(Task_.pause);
 		Predicate p = cb.or(cb.isNull(root.get(Task_.expired)), cb.equal(root.get(Task_.expired), false));
 		p = cb.and(p, cb.isNotNull(root.get(Task_.expireTime)));
 		p = cb.and(p, cb.lessThanOrEqualTo(root.get(Task_.expireTime), new Date()));
 		if (StringUtils.isNotEmpty(sequence)) {
-			p = cb.and(p, cb.greaterThan(sequence_path, sequence));
+			p = cb.and(p, cb.greaterThan(sequencePath, sequence));
 		}
-		cq.multiselect(id_path, job_path, sequence_path).where(p).orderBy(cb.asc(sequence_path));
+		cq.multiselect(idPath, jobPath, sequencePath, pausePath).where(p).orderBy(cb.asc(sequencePath));
 		List<Tuple> os = em.createQuery(cq).setMaxResults(200).getResultList();
 		List<Task> list = new ArrayList<>();
 		for (Tuple o : os) {
 			Task task = new Task();
-			task.setId(o.get(id_path));
-			task.setJob(o.get(job_path));
-			task.setSequence(o.get(sequence_path));
+			task.setId(o.get(idPath));
+			task.setJob(o.get(jobPath));
+			task.setSequence(o.get(sequencePath));
+			task.setPause(o.get(pausePath));
 			list.add(task);
 		}
 		return list;