|
|
@@ -30,6 +30,7 @@ import com.x.processplatform.core.entity.element.util.WorkLogTree.Node;
|
|
|
import com.x.processplatform.core.entity.element.util.WorkLogTree.Nodes;
|
|
|
import com.x.processplatform.core.express.service.processing.jaxrs.work.V2RetractWi;
|
|
|
import com.x.processplatform.service.processing.Business;
|
|
|
+import com.x.processplatform.service.processing.MessageFactory;
|
|
|
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -74,10 +75,12 @@ class V2Retract extends BaseAction {
|
|
|
emc.beginTransaction(Work.class);
|
|
|
emc.beginTransaction(Record.class);
|
|
|
|
|
|
- deleteTasks(business, work.getJob(), activityTokens);
|
|
|
- deleteTaskCompleteds(business, work.getJob(), activityTokens);
|
|
|
- deleteReads(business, work.getJob(), activityTokens);
|
|
|
- deleteReadCompleteds(business, work.getJob(), activityTokens);
|
|
|
+ List<Task> removeTasks = deleteTasks(business, work.getJob(), activityTokens);
|
|
|
+ List<TaskCompleted> removeTaskCompleteds = deleteTaskCompleteds(business, work.getJob(),
|
|
|
+ activityTokens);
|
|
|
+ List<Read> removeReads = deleteReads(business, work.getJob(), activityTokens);
|
|
|
+ List<ReadCompleted> removeReadCompleteds = deleteReadCompleteds(business, work.getJob(),
|
|
|
+ activityTokens);
|
|
|
deleteRecords(business, work.getJob(), activityTokens);
|
|
|
deleteWorkLogs(business, work.getJob(), activityTokens);
|
|
|
|
|
|
@@ -100,13 +103,13 @@ class V2Retract extends BaseAction {
|
|
|
|
|
|
update(work, workLog);
|
|
|
|
|
|
- if (null != taskCompleted) {
|
|
|
- taskCompleted.setProcessingType(TaskCompleted.PROCESSINGTYPE_RETRACT);
|
|
|
- List<String> manualTaskIdentityList = new ArrayList<>();
|
|
|
- manualTaskIdentityList.add(taskCompleted.getIdentity());
|
|
|
- work.setManualTaskIdentityList(manualTaskIdentityList);
|
|
|
- }
|
|
|
-
|
|
|
+ // 必然不为null
|
|
|
+ taskCompleted.setProcessingType(TaskCompleted.PROCESSINGTYPE_RETRACT);
|
|
|
+ List<String> manualTaskIdentityList = new ArrayList<>();
|
|
|
+ manualTaskIdentityList.add(taskCompleted.getIdentity());
|
|
|
+ work.setManualTaskIdentityList(manualTaskIdentityList);
|
|
|
+ // 发送消息
|
|
|
+ sendRemoveMessages(removeTasks, removeTaskCompleteds, removeReads, removeReadCompleteds);
|
|
|
emc.commit();
|
|
|
}
|
|
|
|
|
|
@@ -122,6 +125,22 @@ class V2Retract extends BaseAction {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void sendRemoveMessages(List<Task> removeTasks, List<TaskCompleted> removeTaskCompleteds,
|
|
|
+ List<Read> removeReads, List<ReadCompleted> removeReadCompleteds) throws Exception {
|
|
|
+ for (Task o : removeTasks) {
|
|
|
+ MessageFactory.task_delete(o);
|
|
|
+ }
|
|
|
+ for (TaskCompleted o : removeTaskCompleteds) {
|
|
|
+ MessageFactory.taskCompleted_delete(o);
|
|
|
+ }
|
|
|
+ for (Read o : removeReads) {
|
|
|
+ MessageFactory.read_delete(o);
|
|
|
+ }
|
|
|
+ for (ReadCompleted o : removeReadCompleteds) {
|
|
|
+ MessageFactory.readCompleted_delete(o);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private TaskCompleted getTaskCompleted(Business business, String taskCompletedId) throws Exception {
|
|
|
TaskCompleted taskCompleted = business.entityManagerContainer().find(taskCompletedId, TaskCompleted.class);
|
|
|
if (null == taskCompleted) {
|
|
|
@@ -181,36 +200,42 @@ class V2Retract extends BaseAction {
|
|
|
return ListTools.trim(list, true, true);
|
|
|
}
|
|
|
|
|
|
- private void deleteTasks(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
+ private List<Task> deleteTasks(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
List<Task> os = business.entityManagerContainer().listEqualAndIn(Task.class, Task.job_FIELDNAME, job,
|
|
|
Task.activityToken_FIELDNAME, activityTokens);
|
|
|
for (Task o : os) {
|
|
|
business.entityManagerContainer().remove(o, CheckRemoveType.all);
|
|
|
}
|
|
|
+ return os;
|
|
|
}
|
|
|
|
|
|
- private void deleteTaskCompleteds(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
+ private List<TaskCompleted> deleteTaskCompleteds(Business business, String job, List<String> activityTokens)
|
|
|
+ throws Exception {
|
|
|
List<TaskCompleted> os = business.entityManagerContainer().listEqualAndIn(TaskCompleted.class,
|
|
|
TaskCompleted.job_FIELDNAME, job, TaskCompleted.activityToken_FIELDNAME, activityTokens);
|
|
|
for (TaskCompleted o : os) {
|
|
|
business.entityManagerContainer().remove(o, CheckRemoveType.all);
|
|
|
}
|
|
|
+ return os;
|
|
|
}
|
|
|
|
|
|
- private void deleteReads(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
+ private List<Read> deleteReads(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
List<Read> os = business.entityManagerContainer().listEqualAndIn(Read.class, Read.job_FIELDNAME, job,
|
|
|
Read.activityToken_FIELDNAME, activityTokens);
|
|
|
for (Read o : os) {
|
|
|
business.entityManagerContainer().remove(o, CheckRemoveType.all);
|
|
|
}
|
|
|
+ return os;
|
|
|
}
|
|
|
|
|
|
- private void deleteReadCompleteds(Business business, String job, List<String> activityTokens) throws Exception {
|
|
|
+ private List<ReadCompleted> deleteReadCompleteds(Business business, String job, List<String> activityTokens)
|
|
|
+ throws Exception {
|
|
|
List<ReadCompleted> os = business.entityManagerContainer().listEqualAndIn(ReadCompleted.class,
|
|
|
ReadCompleted.job_FIELDNAME, job, ReadCompleted.activityToken_FIELDNAME, activityTokens);
|
|
|
for (ReadCompleted o : os) {
|
|
|
business.entityManagerContainer().remove(o, CheckRemoveType.all);
|
|
|
}
|
|
|
+ return os;
|
|
|
}
|
|
|
|
|
|
private void deleteRecords(Business business, String job, List<String> activityTokens) throws Exception {
|