Commit df79006a by 赵剑炜

修改待审批单据

parent 12b8f4cd
...@@ -23,4 +23,5 @@ public interface CommonConstants { ...@@ -23,4 +23,5 @@ public interface CommonConstants {
String TASK_STATUS_1="已同意";//已同意 String TASK_STATUS_1="已同意";//已同意
String TASK_STATUS_2="已拒绝";//已拒绝 String TASK_STATUS_2="已拒绝";//已拒绝
String TASK_STATUS_3="已撤销";//已撤销 String TASK_STATUS_3="已撤销";//已撤销
String TASK_STATUS_4="待审批";//待审批
} }
...@@ -534,13 +534,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -534,13 +534,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements(); Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
// 构建任务节点信息的映射
Map<String, FlowElement> flowElementMap = flowElements.stream()
.filter(flowElement -> flowElement instanceof UserTask)
.collect(Collectors.toMap(FlowElement::getId, Function.identity()));
// 遍历所有任务节点和结束节点,如果不在已有任务列表中,则添加到结果中 // 遍历所有任务节点和结束节点,如果不在已有任务列表中,则添加到结果中
for (FlowElement flowElement : flowElements) { for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask && if (flowElement instanceof UserTask &&
!taskDetailVOS.stream().anyMatch(task -> task.getActivityId().equals(flowElement.getId()))) { !taskDetailVOS.stream().anyMatch(task -> task.getActivityId().equals(flowElement.getId()))) {
TaskDetailVO taskDetailVO = new TaskDetailVO(); TaskDetailVO taskDetailVO = new TaskDetailVO();
...@@ -552,6 +548,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -552,6 +548,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskDetailVOS.add(taskDetailVO); taskDetailVOS.add(taskDetailVO);
} }
} }
// 根据 processInstanceId 查询正在执行的任务
Task currentTask = taskService.createTaskQuery()
.processInstanceId(processInstanceId)
.list().get(0);
// 使用 Stream API 进行过滤和修改
taskDetailVOS.stream()
.filter(taskDetail -> taskDetail.getActivityId().equals(currentTask.getTaskDefinitionKey()))
.findFirst()
.ifPresent(matchingTask -> matchingTask.setTaskStatusWrapper("待审核"));
JSONObject jsonForm = JSON.parseObject(formJson.toString()); JSONObject jsonForm = JSON.parseObject(formJson.toString());
JSONArray jsonArray2 = new JSONArray(Collections.singletonList(taskDetailVOS)); JSONArray jsonArray2 = new JSONArray(Collections.singletonList(taskDetailVOS));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论