From 657698fd2fb32794932474648dbaee9e284e38c8 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 12 十月 2026 18:31:20 +0800
Subject: [PATCH] feat(bpm): 添加全局免审批功能支持

---
 yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmOvertimeApplicationServiceImpl.java |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmOvertimeApplicationServiceImpl.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmOvertimeApplicationServiceImpl.java
index aa9449d..21eb335 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmOvertimeApplicationServiceImpl.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmOvertimeApplicationServiceImpl.java
@@ -2,6 +2,8 @@
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
@@ -115,6 +117,14 @@
     @Transactional(rollbackFor = Exception.class)
     public void submit(Long id, String processDefinitionKey, Long loginUserId) {
         HrmOvertimeApplicationDO application = requireOwnedDraft(id, loginUserId);
+        // 鍏ㄥ眬鍏嶅鎵癸細涓氬姟鏍¢獙閫氳繃鍚庣洿鎺ユ墽琛屽鎵归�氳繃閫昏緫锛屾棤闇�娴佺▼妯″瀷銆�
+        if (bpmProcessInstanceApi.isGlobalAutoApprove()) {
+            mapper.updateById(HrmOvertimeApplicationDO.builder().id(id).processInstanceId("")
+                    .status(HrmAuditStatusEnum.PROCESS.getStatus()).build());
+            updateAuditStatus(id, HrmAuditStatusEnum.APPROVE.getStatus());
+            return;
+        }
+
         validateProcessDefinitions();
         ProcessDefinition definition = bpmProcessDefinitionService.getActiveProcessDefinition(processDefinitionKey);
         if (definition == null || !BPM_PROCESS_DEFINITION_KEY.equals(definition.getKey())) {
@@ -255,9 +265,17 @@
         resp.setEmployeeName(employee.getName()); resp.setEmployeeNo(employee.getEmployeeNo());
         resp.setDeptId(employee.getDeptId());
         DeptRespDTO dept = employee.getDeptId() == null ? null : deptApi.getDept(employee.getDeptId());
-        PostRespDTO post = employee.getPostId() == null ? null
-                : postApi.getPostMap(Collections.singleton(employee.getPostId())).get(employee.getPostId());
         resp.setDeptName(dept == null ? null : dept.getName());
-        resp.setPostName(post == null ? null : post.getName());
+        // 宀椾綅澶氶�夛細瑙f瀽 postIds JSON锛屾嫾鎺ュ矖浣嶅悕绉�
+        if (StrUtil.isNotBlank(employee.getPostIds())) {
+            List<Long> postIds = JSONUtil.toList(employee.getPostIds(), Long.class);
+            if (CollUtil.isNotEmpty(postIds)) {
+                Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds);
+                resp.setPostName(postIds.stream()
+                        .filter(postMap::containsKey)
+                        .map(id -> postMap.get(id).getName())
+                        .collect(Collectors.joining(",")));
+            }
+        }
     }
 }

--
Gitblit v1.9.3