提交 fbf04c02 编写于 作者: Z zhourui

修改 reset 接口

上级 0b6c2b7a
......@@ -94,6 +94,46 @@ public class ManualTaskIdentityMatrix extends GsonPropertyObject {
return this.add(identity, after, replace, Arrays.asList(arr));
}
public ManualTaskIdentityMatrix reset(String identity, List<String> addBeforeIdentities,
List<String> extendIdentities, List<String> addAfterIdentities, boolean remove) {
int rowpos = 0;
int colpos = -1;
for (Row row : matrix) {
colpos = row.indexOf(identity);
if (colpos > -1) {
break;
} else {
rowpos++;
}
}
if (colpos > -1) {
resetUpdate(rowpos, colpos, addBeforeIdentities, extendIdentities, addAfterIdentities);
}
return this;
}
private void resetUpdate(int rowpos, int colpos, List<String> addBeforeIdentities, List<String> extendIdentities,
List<String> addAfterIdentities) {
if ((null != addBeforeIdentities) && (!addBeforeIdentities.isEmpty())) {
for (String str : addBeforeIdentities) {
Row row = new Row();
row.add(str);
matrix.add(rowpos++, row);
}
}
if ((null != extendIdentities) && (!extendIdentities.isEmpty())) {
matrix.get(rowpos).addAll(colpos, extendIdentities);
}
if ((null != addAfterIdentities) && (!addAfterIdentities.isEmpty())) {
for (String str : addAfterIdentities) {
Row row = new Row();
row.add(str);
matrix.add(rowpos++, row);
}
compact();
}
}
public void clear() {
this.matrix.clear();
}
......
......@@ -44,9 +44,9 @@ import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.Route;
import com.x.processplatform.core.entity.log.SignalStack;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ActionProcessingWo;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWo;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapAppend;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity.PrevTask;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
......@@ -275,7 +275,7 @@ class ActionProcessing extends BaseAction {
}
private String processingProcessingTask(String processType) throws Exception {
WrapProcessing req = new WrapProcessing();
ProcessingWi req = new ProcessingWi();
req.setProcessingType(processType);
WoId resp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
......@@ -491,7 +491,7 @@ class ActionProcessing extends BaseAction {
return o;
}
public static class Wo extends ActionProcessingWo {
public static class Wo extends ProcessingWo {
private static final long serialVersionUID = -1771383649634969945L;
static WrapCopier<Record, Wo> copier = WrapCopierFactory.wo(Record.class, Wo.class, null,
......
package com.x.processplatform.assemble.surface.jaxrs.task;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionAdd extends LanguagePromptException {
private static final long serialVersionUID = -1678718913437722938L;
ExceptionAdd(String id) {
super("添加待办人失败, task:{}.", id);
}
}
\ No newline at end of file
......@@ -35,8 +35,8 @@ import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2AddWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
......@@ -103,8 +103,8 @@ public class V2Add extends BaseAction {
if (BooleanUtils.isNotTrue(control.getAllowReset())) {
throw new ExceptionAccessDenied(effectivePerson, task);
}
this.existTaskIds = emc.idsEqualAndEqual(Task.class, Task.job_FIELDNAME, task.getJob(),
Task.activityToken_FIELDNAME, task.getActivityToken());
this.existTaskIds = emc.idsEqualAndEqual(Task.class, Task.job_FIELDNAME, task.getJob(), Task.work_FIELDNAME,
task.getWork());
this.identites = business.organization().identity().list(wi.getIdentityList());
// 在新扩充待办人员中去除已经有待办人员
identites.remove(task.getIdentity());
......@@ -125,13 +125,13 @@ public class V2Add extends BaseAction {
req, task.getJob())
.getData(WrapBoolean.class);
if (BooleanUtils.isNotTrue(resp.getValue())) {
throw new ExceptionExtend(task.getId());
throw new ExceptionAdd(task.getId());
}
}
private String processingTask(Task task) throws Exception {
WrapProcessing req = new WrapProcessing();
req.setProcessingType(TaskCompleted.PROCESSINGTYPE_EXTEND);
ProcessingWi req = new ProcessingWi();
req.setProcessingType(TaskCompleted.PROCESSINGTYPE_ADD);
WoId resp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
Applications.joinQueryUri("task", task.getId(), "processing"), req, task.getJob())
......@@ -145,7 +145,7 @@ public class V2Add extends BaseAction {
private void processingWork(Task task) throws Exception {
ProcessingAttributes req = new ProcessingAttributes();
req.setType(ProcessingAttributes.TYPE_TASKEXTEND);
req.setType(ProcessingAttributes.TYPE_TASKADD);
req.setSeries(this.series);
WoId resp = ThisApplication.context().applications()
.putQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
......@@ -168,8 +168,8 @@ public class V2Add extends BaseAction {
concreteRecord.setWorkCompleted(workCompleted.getId());
}
concreteRecord.setPerson(effectivePerson.getDistinguishedName());
concreteRecord.setType(Record.TYPE_TASKEXTEND);
recordAdjust(business, task, concreteRecord);
concreteRecord.setType(Record.TYPE_TASKADD);
createRecordAdjust(business, task, concreteRecord);
}
WoId resp = ThisApplication.context().applications()
.postQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
......@@ -180,15 +180,15 @@ public class V2Add extends BaseAction {
}
}
private void recordAdjust(Business business, Task task, Record concreteRecord) throws Exception {
final List<String> nextTaskIdentities = new ArrayList<>();
private void createRecordAdjust(Business business, Task task, Record concreteRecord) throws Exception {
List<String> ids = business.entityManagerContainer().idsEqualAndEqual(Task.class, Task.job_FIELDNAME,
task.getJob(), Task.activity_FIELDNAME, task.getActivity());
task.getJob(), Task.work_FIELDNAME, task.getWork());
ids = ListUtils.subtract(ids, existTaskIds);
List<Task> list = business.entityManagerContainer().fetch(ids, Task.class,
ListTools.toList(Task.identity_FIELDNAME, Task.job_FIELDNAME, Task.work_FIELDNAME,
Task.activity_FIELDNAME, Task.activityAlias_FIELDNAME, Task.activityName_FIELDNAME,
Task.activityToken_FIELDNAME, Task.activityType_FIELDNAME, Task.identity_FIELDNAME));
final List<String> nextTaskIdentities = new ArrayList<>();
list.stream().collect(Collectors.groupingBy(Task::getActivity, Collectors.toList())).entrySet().stream()
.forEach(o -> {
Task next = o.getValue().get(0);
......@@ -209,7 +209,7 @@ public class V2Add extends BaseAction {
}
private void updateTaskCompleted() throws Exception {
/* 记录下一处理人信息 */
// 记录下一处理人信息
WrapUpdateNextTaskIdentity req = new WrapUpdateNextTaskIdentity();
req.getTaskCompletedList().add(this.taskCompletedId);
req.setNextTaskIdentityList(concreteRecord.getProperties().getNextManualTaskIdentityList());
......@@ -220,7 +220,7 @@ public class V2Add extends BaseAction {
}
private void updateTask() throws Exception {
/* 记录上一处理人信息 */
// 记录上一处理人信息
if (ListTools.isNotEmpty(newTasks)) {
WrapUpdatePrevTaskIdentity req = new WrapUpdatePrevTaskIdentity();
req.setTaskList(newTasks);
......@@ -243,18 +243,19 @@ public class V2Add extends BaseAction {
public static class Wi extends V2AddWi {
private static final long serialVersionUID = -3241215869441470402L;
private static final long serialVersionUID = -6251874269093504136L;
}
public static class WoControl extends WorkControl {
private static final long serialVersionUID = -8781558581462660831L;
private static final long serialVersionUID = -8675239528577375846L;
}
public static class Wo extends WrapBoolean {
private static final long serialVersionUID = 4883624438858385234L;
private static final long serialVersionUID = 8155067200427920853L;
}
......
......@@ -35,8 +35,8 @@ import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ExtendWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
......@@ -129,7 +129,7 @@ public class V2Extend extends BaseAction {
}
private String processingTask(Task task) throws Exception {
WrapProcessing req = new WrapProcessing();
ProcessingWi req = new ProcessingWi();
req.setProcessingType(TaskCompleted.PROCESSINGTYPE_EXTEND);
WoId resp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
......
......@@ -37,8 +37,8 @@ import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResetWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
......@@ -137,7 +137,7 @@ public class V2Reset extends BaseAction {
}
private void processingTask() throws Exception {
WrapProcessing req = new WrapProcessing();
ProcessingWi req = new ProcessingWi();
req.setProcessingType(TaskCompleted.PROCESSINGTYPE_RESET);
WoId resp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
......
......@@ -3,7 +3,7 @@ package com.x.processplatform.core.express.service.processing.jaxrs.task;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
public class WrapProcessing extends GsonPropertyObject {
public class ProcessingWi extends GsonPropertyObject {
private static final long serialVersionUID = -2272062779655632688L;
......@@ -11,12 +11,6 @@ public class WrapProcessing extends GsonPropertyObject {
public static final String PROCESSINGTYPE_RESET = "reset";
// @FieldDescribe("当前处理人")
// private String processingPerson;
//
// @FieldDescribe("当前处理身份")
// private String processingIdentity;
@FieldDescribe("流转类型.")
private String processingType;
......@@ -28,20 +22,4 @@ public class WrapProcessing extends GsonPropertyObject {
this.processingType = processingType;
}
// public String getProcessingPerson() {
// return processingPerson;
// }
//
// public void setProcessingPerson(String processingPerson) {
// this.processingPerson = processingPerson;
// }
//
// public String getProcessingIdentity() {
// return processingIdentity;
// }
//
// public void setProcessingIdentity(String processingIdentity) {
// this.processingIdentity = processingIdentity;
// }
}
......@@ -3,7 +3,7 @@ package com.x.processplatform.core.express.service.processing.jaxrs.task;
import com.x.processplatform.core.entity.content.Record;
import com.x.processplatform.core.entity.log.SignalStack;
public class ActionProcessingWo extends Record {
public class ProcessingWo extends Record {
private static final long serialVersionUID = -8450939016187545724L;
......
......@@ -2,6 +2,8 @@ package com.x.processplatform.core.express.service.processing.jaxrs.task;
import java.util.List;
import org.apache.commons.lang3.BooleanUtils;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.tools.StringTools;
......@@ -10,17 +12,23 @@ public class V2ResetWi extends GsonPropertyObject {
private static final long serialVersionUID = -8631082471633729236L;
@FieldDescribe("路由名称")
private String routeName;
@FieldDescribe("待办")
private String task;
@FieldDescribe("意见")
private String opinion;
@FieldDescribe("在指定待办前添加身份")
private List<String> addBeforeList;
@FieldDescribe("在指定待办扩充的身份")
private List<String> extendList;
@FieldDescribe("在指定待办后添加身份")
private List<String> addAfterList;
@FieldDescribe("重置身份")
private List<String> identityList;
@FieldDescribe("是否删除指定待办身份")
private Boolean remove;
@FieldDescribe("保留自身待办.")
private Boolean keep;
@FieldDescribe("意见")
private String opinion;
@FieldDescribe("操作串号")
private String series;
......@@ -29,27 +37,44 @@ public class V2ResetWi extends GsonPropertyObject {
this.series = StringTools.uniqueToken();
}
public Boolean getKeep() {
if (null == keep) {
keep = false;
}
return keep;
public String getTask() {
return task;
}
public List<String> getIdentityList() {
return identityList;
public void setTask(String task) {
this.task = task;
}
public void setIdentityList(List<String> identityList) {
this.identityList = identityList;
public List<String> getAddBeforeList() {
return addBeforeList;
}
public String getRouteName() {
return routeName;
public void setAddBeforeList(List<String> addBeforeList) {
this.addBeforeList = addBeforeList;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
public List<String> getExtendList() {
return extendList;
}
public void setExtendList(List<String> extendList) {
this.extendList = extendList;
}
public List<String> getAddAfterList() {
return addAfterList;
}
public void setAddAfterList(List<String> addAfterList) {
this.addAfterList = addAfterList;
}
public Boolean getRemove() {
return BooleanUtils.isTrue(remove);
}
public void setRemove(Boolean remove) {
this.remove = remove;
}
public String getOpinion() {
......@@ -60,10 +85,6 @@ public class V2ResetWi extends GsonPropertyObject {
this.opinion = opinion;
}
public void setKeep(Boolean keep) {
this.keep = keep;
}
public String getSeries() {
return series;
}
......
......@@ -33,7 +33,7 @@ import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.Process;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.MessageFactory;
import com.x.processplatform.service.processing.WorkContext;
......@@ -226,7 +226,7 @@ class ActionProcessing extends BaseAction {
private static final long serialVersionUID = 1L;
}
public static class Wi extends WrapProcessing {
public static class Wi extends ProcessingWi {
private static final long serialVersionUID = -6828623155146710691L;
......
......@@ -7,6 +7,7 @@ import java.util.concurrent.TimeUnit;
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.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.executor.ProcessPlatformExecutorFactory;
......@@ -20,6 +21,7 @@ import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2AddWi;
import com.x.processplatform.service.processing.Business;
class V2Add extends BaseAction {
......@@ -33,14 +35,17 @@ class V2Add extends BaseAction {
LOGGER.debug("execute:{}.", effectivePerson::getDistinguishedName);
}
Task task = getTask(wi.getTask());
Task task = null;
if (null == task) {
throw new ExceptionEntityNotExist(wi.getTask(), Task.class);
}
if (null == this.getWork(task.getWork())) {
throw new ExceptionEntityNotExist(task.getWork(), Work.class);
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
task = getTask(business, wi.getTask());
if (null == task) {
throw new ExceptionEntityNotExist(wi.getTask(), Task.class);
}
if (!this.checkWorkExist(business, task.getWork())) {
throw new ExceptionEntityNotExist(task.getWork(), Work.class);
}
}
return ProcessPlatformExecutorFactory.get(task.getJob()).submit(new CallableImpl(task.getWork(),
......@@ -48,17 +53,13 @@ class V2Add extends BaseAction {
}
private Task getTask(String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.fetch(id, Task.class,
ListTools.toList(Task.job_FIELDNAME, Task.identity_FIELDNAME, Task.work_FIELDNAME));
}
private Task getTask(Business business, String id) throws Exception {
return business.entityManagerContainer().fetch(id, Task.class,
ListTools.toList(Task.job_FIELDNAME, Task.identity_FIELDNAME, Task.work_FIELDNAME));
}
private Work getWork(String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.fetch(id, Work.class, ListTools.toList());
}
private boolean checkWorkExist(Business business, String id) throws Exception {
return business.entityManagerContainer().countEqual(Work.class, JpaObject.id_FIELDNAME, id) > 0;
}
private class CallableImpl implements Callable<ActionResult<Wo>> {
......@@ -105,14 +106,14 @@ class V2Add extends BaseAction {
public static class Wi extends V2AddWi {
private static final long serialVersionUID = -3542693358569393097L;
private static final long serialVersionUID = 7870902860170655791L;
}
public static class Wo extends WrapBoolean {
private static final long serialVersionUID = 6457473592503074552L;
private static final long serialVersionUID = -8882214104176786739L;
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import java.util.concurrent.TimeUnit;
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.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.executor.ProcessPlatformExecutorFactory;
......@@ -20,6 +21,7 @@ import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ExtendWi;
import com.x.processplatform.service.processing.Business;
class V2Extend extends BaseAction {
......@@ -32,15 +34,18 @@ class V2Extend extends BaseAction {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("execute:{}.", effectivePerson::getDistinguishedName);
}
Task task = null;
Task task = getTask(wi.getTask());
if (null == task) {
throw new ExceptionEntityNotExist(wi.getTask(), Task.class);
}
if (null == this.getWork(task.getWork())) {
throw new ExceptionEntityNotExist(task.getWork(), Work.class);
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
task = getTask(business, wi.getTask());
if (null == task) {
throw new ExceptionEntityNotExist(wi.getTask(), Task.class);
}
if (!this.checkWorkExist(business, task.getWork())) {
throw new ExceptionEntityNotExist(task.getWork(), Work.class);
}
}
return ProcessPlatformExecutorFactory.get(task.getJob())
......@@ -49,17 +54,13 @@ class V2Extend extends BaseAction {
}
private Task getTask(String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.fetch(id, Task.class,
ListTools.toList(Task.job_FIELDNAME, Task.identity_FIELDNAME, Task.work_FIELDNAME));
}
private Task getTask(Business business, String id) throws Exception {
return business.entityManagerContainer().fetch(id, Task.class,
ListTools.toList(Task.job_FIELDNAME, Task.identity_FIELDNAME, Task.work_FIELDNAME));
}
private Work getWork(String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.fetch(id, Work.class, ListTools.toList());
}
private boolean checkWorkExist(Business business, String id) throws Exception {
return business.entityManagerContainer().countEqual(Work.class, JpaObject.id_FIELDNAME, id) > 0;
}
private class CallableImpl implements Callable<ActionResult<Wo>> {
......@@ -113,4 +114,4 @@ class V2Extend extends BaseAction {
}
}
}
\ No newline at end of file
......@@ -4,9 +4,6 @@ import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -18,11 +15,10 @@ 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.processplatform.ManualTaskIdentityMatrix;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResetWi;
import com.x.processplatform.service.processing.Business;
......@@ -36,17 +32,40 @@ class V2Reset extends BaseAction {
final Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
final String job;
Task task = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Task task = emc.fetch(id, Task.class, ListTools.toList(Task.job_FIELDNAME));
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 = () -> {
return ProcessPlatformExecutorFactory.get(task.getJob()).submit(new CallableImpl(task.getId(),
wi.getAddBeforeList(), wi.getExtendList(), wi.getAddAfterList(), wi.getRemove()))
.get(300, TimeUnit.SECONDS);
}
private class CallableImpl implements Callable<ActionResult<Wo>> {
private String id;
private List<String> addBeforeIdentities;
private List<String> extendIdentities;
private List<String> addAfterIdentities;
private boolean remove;
private CallableImpl(String id, List<String> addBeforeIdentities, List<String> extendIdentities,
List<String> addAfterIdentities, boolean remove) {
this.id = id;
this.addBeforeIdentities = addBeforeIdentities;
this.extendIdentities = extendIdentities;
this.addAfterIdentities = addAfterIdentities;
this.remove = remove;
}
@Override
public ActionResult<Wo> call() throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Task task = emc.find(id, Task.class);
......@@ -58,35 +77,17 @@ class V2Reset extends BaseAction {
throw new ExceptionEntityNotExist(task.getWork(), Work.class);
}
Manual manual = (Manual) business.element().get(work.getActivity(), ActivityType.manual);
if (null == manual) {
throw new ExceptionEntityNotExist(work.getActivity(), Manual.class);
}
/* 检查reset人员 */
List<String> identites = ListTools.trim(business.organization().identity().list(wi.getIdentityList()),
this.addBeforeIdentities = ListTools.trim(business.organization().identity().list(addBeforeIdentities),
true, true);
this.extendIdentities = ListTools.trim(business.organization().identity().list(extendIdentities), true,
true);
this.addAfterIdentities = ListTools.trim(business.organization().identity().list(addAfterIdentities),
true, true);
if (identites.isEmpty()) {
throw new ExceptionResetEmpty();
}
emc.beginTransaction(Work.class);
List<String> os = ListTools.trim(work.getManualTaskIdentityMatrix().flat(), true, true);
os = ListUtils.sum(os, identites);
/* 在新增待办人员中删除当前的处理人 */
if (BooleanUtils.isNotTrue(wi.getKeep())) {
os = ListUtils.subtract(os, ListTools.toList(task.getIdentity()));
}
if (ListTools.isEmpty(os)) {
throw new ExceptionResetEmpty();
}
work.setManualTaskIdentityMatrix(
manual.identitiesToManualTaskIdentityMatrix(ListTools.trim(os, true, true)));
// work.setManualTaskIdentityList(ListTools.trim(os, true, true));
ManualTaskIdentityMatrix matrix = work.getManualTaskIdentityMatrix();
matrix.reset(task.getIdentity(), addBeforeIdentities, extendIdentities, addAfterIdentities, remove);
work.setManualTaskIdentityMatrix(matrix);
emc.check(work, CheckPersistType.all);
emc.commit();
......@@ -96,9 +97,7 @@ class V2Reset extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
result.setData(wo);
return result;
};
return ProcessPlatformExecutorFactory.get(job).submit(callable).get(300, TimeUnit.SECONDS);
}
}
......
......@@ -42,7 +42,7 @@ import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.Route;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing;
import com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi;
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
import com.x.processplatform.service.processing.Business;
......@@ -124,7 +124,7 @@ public class PassExpired extends AbstractJob {
}
private String porcessingTask(Task task) throws Exception {
WrapProcessing req = new WrapProcessing();
ProcessingWi req = new ProcessingWi();
req.setProcessingType(TaskCompleted.PROCESSINGTYPE_PASSEXPIRED);
WoId resp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册