From f83950d292a8933390b3b4b516f90f21a9946c68 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 27 八月 2026 11:41:47 +0800
Subject: [PATCH] fix  修复逻辑缺陷

---
 yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmTransferApplicationServiceImpl.java |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmTransferApplicationServiceImpl.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmTransferApplicationServiceImpl.java
index d63e58a..7505b7b 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmTransferApplicationServiceImpl.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/approval/HrmTransferApplicationServiceImpl.java
@@ -19,6 +19,7 @@
 import cn.iocoder.yudao.module.hrm.enums.HrmTransferTypeEnum;
 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
 import cn.iocoder.yudao.module.system.api.dept.PostApi;
+import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import cn.iocoder.yudao.module.system.api.dept.dto.PostRespDTO;
 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@@ -40,6 +41,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
+
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
 import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*;
@@ -47,7 +50,7 @@
 /**
  * 璋冨矖鐢宠 Service 瀹炵幇绫�
  *
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
  */
 @Service
 @Validated
@@ -68,6 +71,8 @@
     private BpmProcessInstanceApi bpmProcessInstanceApi;
     @Resource
     private BpmCategoryService bpmCategoryService;
+    @Resource
+    private StorageAttachmentApi storageAttachmentApi;
     @Resource
     private BpmProcessDefinitionService bpmProcessDefinitionService;
 
@@ -99,11 +104,13 @@
         application.setUserId(userId);
         application.setStatus(HrmAuditStatusEnum.DRAFT.getStatus());
         transferApplicationMapper.insert(application);
+        storageAttachmentApi.bindAttachments("file", "hrm_transfer_application",
+                application.getId(), createReqVO.getBlobIds());
         return application.getId();
     }
 
     private Long getCurrentUserId() {
-        return 1L;
+        return SecurityFrameworkUtils.getLoginUserId();
     }
 
     private String generateUniqueNo() {
@@ -129,6 +136,7 @@
         }
         HrmTransferApplicationDO updateObj = BeanUtils.toBean(updateReqVO, HrmTransferApplicationDO.class);
         transferApplicationMapper.updateById(updateObj);
+        storageAttachmentApi.updateAttachments("file", "hrm_transfer_application", updateReqVO.getId(), updateReqVO.getBlobIds());
     }
 
     @Override
@@ -137,6 +145,7 @@
         if (!Objects.equals(application.getStatus(), HrmAuditStatusEnum.DRAFT.getStatus())) {
             throw exception(TRANSFER_APPLICATION_UPDATE_FAIL_NOT_DRAFT);
         }
+        storageAttachmentApi.deleteAttachmentsByRecord("hrm_transfer_application", id);
         transferApplicationMapper.deleteById(id);
     }
 
@@ -170,12 +179,13 @@
         fillPostNames(respVO, application);
         respVO.setTransferTypeName(HrmTransferTypeEnum.getNameByStatus(application.getTransferType()));
         respVO.setStatusName(HrmAuditStatusEnum.getNameByStatus(application.getStatus()));
+        respVO.setAttachmentList(storageAttachmentApi.listAttachments("hrm_transfer_application", id));
         return respVO;
     }
 
     private void fillDeptNames(HrmTransferApplicationRespVO respVO, HrmTransferApplicationDO application) {
-        Set<Long> deptIds = Set.of(application.getCurrentDeptId(), application.getTargetDeptId())
-                .stream().filter(Objects::nonNull).collect(Collectors.toSet());
+        Set<Long> deptIds = Stream.of(application.getCurrentDeptId(), application.getTargetDeptId())
+                .filter(Objects::nonNull).collect(Collectors.toSet());
         Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds);
         if (application.getCurrentDeptId() != null && deptMap.containsKey(application.getCurrentDeptId())) {
             respVO.setCurrentDeptName(deptMap.get(application.getCurrentDeptId()).getName());
@@ -186,8 +196,8 @@
     }
 
     private void fillPostNames(HrmTransferApplicationRespVO respVO, HrmTransferApplicationDO application) {
-        Set<Long> postIds = Set.of(application.getCurrentPostId(), application.getTargetPostId())
-                .stream().filter(Objects::nonNull).collect(Collectors.toSet());
+        Set<Long> postIds = Stream.of(application.getCurrentPostId(), application.getTargetPostId())
+                .filter(Objects::nonNull).collect(Collectors.toSet());
         Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds);
         if (application.getCurrentPostId() != null && postMap.containsKey(application.getCurrentPostId())) {
             respVO.setCurrentPostName(postMap.get(application.getCurrentPostId()).getName());

--
Gitblit v1.9.3