Bläddra i källkod

增加附件下载插件测试2

turborao 6 dagar sedan
förälder
incheckning
8e4d497b57

+ 8 - 3
code/base/nckd-jimin-base-helper/src/main/java/nckd/base/helper/AttachmentDownloadListPlugin.java

@@ -7,6 +7,7 @@ import kd.bos.entity.operate.result.OperationResult;
 import kd.bos.ext.fi.bei.util.EmptyUtil;
 import kd.bos.fileservice.FileService;
 import kd.bos.fileservice.FileServiceFactory;
+import kd.bos.fileservice.extension.FileServiceExtFactory;
 import kd.bos.form.events.AfterDoOperationEventArgs;
 import kd.bos.list.BillList;
 import kd.bos.list.IListView;
@@ -18,7 +19,9 @@ import kd.bos.metadata.dao.MetadataDao;
 import kd.bos.metadata.form.ControlAp;
 import kd.bos.metadata.form.FormMetadata;
 import kd.bos.metadata.form.control.AttachmentPanelAp;
+import kd.bos.servicehelper.AttachmentDto;
 import kd.bos.servicehelper.AttachmentServiceHelper;
+import kd.bos.servicehelper.attachment.AttachmentFieldServiceHelper;
 import kd.bos.util.StringUtils;
 import kd.sdk.plugin.Plugin;
 
@@ -59,11 +62,13 @@ public class AttachmentDownloadListPlugin extends AbstractListPlugin implements
                 return;
             }
             List<Map<String, Object>> list = AttachmentServiceHelper.getAttachments(billForm, billid, attForm);
+
             for (Map map : list) {
-                String url = map.get("url").toString();//获取到url
+                //String url = map.get("url").toString();//获取到url
+                String realUrl  = map.get("relativeUrl").toString();
                 FileService fileService = FileServiceFactory.getAttachmentFileService();
-                String path = fileService.getFileServiceExt().getRealPath(url);
-                InputStream inputStream = fileService.getInputStream(url);
+                String path = FileServiceExtFactory.getAttachFileServiceExt().getRealPath(realUrl);
+                InputStream inputStream = fileService.getInputStream(realUrl);
                 String downloadUrl =  FileSECUtils.getFileUrlByEncodeSEC(path,inputStream);
                 this.getView().download(downloadUrl);
             }

+ 1 - 1
code/base/nckd-jimin-base-helper/src/main/java/nckd/base/helper/FileSECUtils.java

@@ -413,7 +413,7 @@ public class FileSECUtils {
         try {
             logger.info("--------------SEC附件解密 processFileWithSEC1 ----------------");
             String filename = getFileNameWithoutExtension(path);
-            String filetype = getFileType(path);
+            String filetype = getFileType(filename);
             /**
              * 判断是否是媒体文件,如果是媒体文件,则不进行处理
              */