Browse Source

加签/减签优化

caixiaofeng 7 months ago
parent
commit
0135b35ba8

+ 3 - 2
flow-workflow/flow-workflow-biz/src/main/java/com/flow/service/impl/FlowTaskServiceImpl.java

@@ -317,11 +317,12 @@ public class FlowTaskServiceImpl extends BaseServiceImpl<FlowTaskDao, FlowTask>
     @Override
     public void removeSign(AddSignTaskForm taskForm) {
         TaskInfo taskInfo = this.getTask(taskForm.getTaskId());
+        String collectionName = String.format("%sCollection", taskInfo.getTaskDefinitionKey());
         Execution miExecution = getMultiInstanceRootExecution(taskInfo.getProcessInstanceId(), taskInfo.getTaskDefinitionKey());
         Integer nrOfInstances = runtimeService.getVariableLocal(miExecution.getId(), "nrOfInstances", Integer.class);
         runtimeService.setVariableLocal(miExecution.getId(), "nrOfInstances", nrOfInstances - 1);
         MultiInstanceLoopCharacteristics loopCharacteristics = getLoopCharacteristics(taskInfo.getProcessInstanceId(), taskInfo.getTaskDefinitionKey());
-        List<String> assigneeList = runtimeService.getVariable(taskInfo.getProcessInstanceId(), String.format("%sCollection", taskInfo.getTaskDefinitionKey()), List.class);
+        List<String> assigneeList = runtimeService.getVariable(taskInfo.getProcessInstanceId(), collectionName, List.class);
         if (loopCharacteristics.isSequential()) {
             Integer loopCounter = runtimeService.getVariableLocal(taskInfo.getExecutionId(), "loopCounter", Integer.class);
             if (!assigneeList.subList(loopCounter, assigneeList.size() - 1).contains(taskForm.getAssignee())) {
@@ -348,7 +349,7 @@ public class FlowTaskServiceImpl extends BaseServiceImpl<FlowTaskDao, FlowTask>
             }
         }
         assigneeList.remove(taskForm.getAssignee());
-        runtimeService.setVariable(taskInfo.getProcessInstanceId(), String.format("%sCollection", taskInfo.getTaskDefinitionKey()), assigneeList);
+        runtimeService.setVariable(taskInfo.getProcessInstanceId(), collectionName, assigneeList);
     }
 
     private MultiInstanceLoopCharacteristics getLoopCharacteristics(String processInstanceId, String taskDefinitionKey) {