From 5921d2fd4d8928901dfd5446a7bde864b979b244 Mon Sep 17 00:00:00 2001 From: yanhuiqing Date: Wed, 24 Dec 2025 20:42:33 +0800 Subject: [PATCH] 工作流 url 审批通过自带框架跳过附件更新的问题修复 --- urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java b/urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java index 3a5a772..b8978e0 100644 --- a/urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java @@ -927,6 +927,25 @@ public class BpmTaskServiceImpl implements BpmTaskService { * @param reqVO 前端参数封装 */ public void returnTask(Long userId, BpmnModel bpmnModel, Task currentTask, FlowElement targetElement, BpmTaskReturnReqVO reqVO) { + + /** + * add by yanhuiqing 审批附件 begin + */ + List urlList = reqVO.getAttattmentUrls(); + if(CollUtil.isNotEmpty(urlList)){ + String targetUrls = CollUtil.isEmpty(urlList)?StrUtil.EMPTY:urlList.stream() + .filter(StrUtil::isNotEmpty) + .distinct() + .collect(Collectors.joining(",")); + String attachmentName = "审批附件-" + BpmCommentTypeEnum.RETURN.getType(); + String attachmentType = "URL"; // 附件类型标记为URL(可自定义) + String description = BpmCommentTypeEnum.RETURN.getName()+"的附件"; + taskService.createAttachment(attachmentType,currentTask.getId(),currentTask.getProcessInstanceId(),attachmentName,description,targetUrls); + } + /** + * add by yanhuiqing 审批附件 end + */ + // 1. 获得所有需要回撤的任务 taskDefinitionKey,用于稍后的 moveActivityIdsToSingleActivityId 回撤 // 1.1 获取所有正常进行的任务节点 Key List taskList = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).list(); @@ -952,24 +971,6 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 2.1.1 添加评论 taskService.addComment(task.getId(), currentTask.getProcessInstanceId(), BpmCommentTypeEnum.RETURN.getType(), BpmCommentTypeEnum.RETURN.formatComment(reqVO.getReason())); - /** - * add by yanhuiqing 审批附件 begin - */ - List urlList = reqVO.getAttattmentUrls(); - if(ObjectUtils.isNotAllEmpty()){ - String targetUrls = CollUtil.isEmpty(urlList)?StrUtil.EMPTY:urlList.stream() - .filter(StrUtil::isNotEmpty) - .distinct() - .collect(Collectors.joining(",")); - String attachmentName = "审批附件-" + BpmCommentTypeEnum.RETURN.getType(); - String attachmentType = "URL"; // 附件类型标记为URL(可自定义) - String description = BpmCommentTypeEnum.RETURN.getName()+"的附件"; - taskService.createAttachment(attachmentType,task.getId(),task.getProcessInstanceId(),attachmentName,description,targetUrls); - } - /** - * add by yanhuiqing 审批附件 end - */ - // 2.1.2 更新 task 状态 + 原因 updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.RETURN.getStatus(), reqVO.getReason()); } else { // 情况二:别人的任务,进行 CANCEL 标记 -- libgit2 0.21.4