caixiaofeng 7 місяців тому
батько
коміт
16b2b74026

+ 1 - 1
flow-common/flow-common-flowable-starter/src/main/java/com/flow/flowable/cmd/AddTaskExecutionCmd.java

@@ -29,7 +29,7 @@ public class AddTaskExecutionCmd implements Command<Void> {
 
     @Override
     public Void execute(CommandContext commandContext) {
-        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
+        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
         ManagementService managementService = processEngineConfiguration.getManagementService();
         MultiInstanceLoopCharacteristics loopCharacteristics = managementService.executeCommand(new GetLoopCharacteristicsCmd(this.processInstanceId, this.activityId));
         if (Objects.nonNull(loopCharacteristics)) {

+ 7 - 12
flow-common/flow-common-flowable-starter/src/main/java/com/flow/flowable/cmd/DeleteTaskExecutionCmd.java

@@ -50,19 +50,14 @@ public class DeleteTaskExecutionCmd implements Command<Void> {
             }
             Execution miExecution = managementService.executeCommand(new GetMultiInstanceRootExecutionCmd(this.task.getProcessInstanceId(), this.task.getTaskDefinitionKey()));
             if (loopCharacteristics.isSequential()) {
-                Integer loopCounter = runtimeService.getVariableLocal(this.task.getExecutionId(), "loopCounter", Integer.class);
-                if (assigneeList.subList(loopCounter, assigneeList.size() - 1).contains(this.assignee)) {
-                    // 减签已开始人员
-                    Task deleteTask = taskService.createTaskQuery()
-                            .processInstanceId(this.task.getProcessInstanceId())
-                            .taskDefinitionKey(this.task.getTaskDefinitionKey())
-                            .taskAssignee(this.assignee)
-                            .singleResult();
-                    runtimeService.deleteMultiInstanceExecution(deleteTask.getExecutionId(), true);
-                    ActivityInstanceEntity activityInstanceEntity = activityInstanceEntityManager.findActivityInstanceByTaskId(deleteTask.getId());
-                    managementService.executeCommand(new DeleteActivityEntityCmd(activityInstanceEntity.getId()));
+                Task deleteTask = taskService.createTaskQuery()
+                        .processInstanceId(this.task.getProcessInstanceId())
+                        .taskDefinitionKey(this.task.getTaskDefinitionKey())
+                        .taskAssignee(this.assignee)
+                        .singleResult();
+                if (Objects.nonNull(deleteTask)) {
+                    throw new FlowableException("任务已开始减签失败");
                 } else {
-                    // 减签未开始人员
                     Integer nrOfInstances = runtimeService.getVariableLocal(miExecution.getId(), "nrOfInstances", Integer.class);
                     runtimeService.setVariableLocal(miExecution.getId(), "nrOfInstances", nrOfInstances - 1);
                 }