From 618688161567a5e92263874076c50d3d5eff48fc Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 17 六月 2024 11:12:52 +0800
Subject: [PATCH] update 优化 特殊service传值方式

---
 ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/cmd/AttachmentCmd.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/cmd/AttachmentCmd.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/cmd/AttachmentCmd.java
index dd9849a..20a0a5f 100644
--- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/cmd/AttachmentCmd.java
+++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/cmd/AttachmentCmd.java
@@ -3,7 +3,6 @@
 import cn.hutool.core.collection.CollUtil;
 import org.dromara.common.core.domain.dto.OssDTO;
 import org.dromara.common.core.service.OssService;
-import org.dromara.common.core.utils.SpringUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.flowable.common.engine.impl.interceptor.Command;
@@ -28,17 +27,20 @@
 
     private final String processInstanceId;
 
-    public AttachmentCmd(String fileId, String taskId, String processInstanceId) {
+    private final OssService ossService;
+
+    public AttachmentCmd(String fileId, String taskId, String processInstanceId, OssService ossService) {
         this.fileId = fileId;
         this.taskId = taskId;
         this.processInstanceId = processInstanceId;
+        this.ossService = ossService;
     }
 
     @Override
     public Boolean execute(CommandContext commandContext) {
         try {
             if (StringUtils.isNotBlank(fileId)) {
-                List<OssDTO> ossList = SpringUtils.getBean(OssService.class).selectByIds(fileId);
+                List<OssDTO> ossList = ossService.selectByIds(fileId);
                 if (CollUtil.isNotEmpty(ossList)) {
                     for (OssDTO oss : ossList) {
                         AttachmentEntityManager attachmentEntityManager = CommandContextUtil.getAttachmentEntityManager();

--
Gitblit v1.9.3