Browse Source

增加附件下载插件测试3

turborao 6 days ago
parent
commit
6c75cab226

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

@@ -66,10 +66,13 @@ public class AttachmentDownloadListPlugin extends AbstractListPlugin implements
             for (Map map : list) {
                 //String url = map.get("url").toString();//获取到url
                 String realUrl  = map.get("relativeUrl").toString();
+                logger.info("SEC relativeUrl:" + realUrl);
                 FileService fileService = FileServiceFactory.getAttachmentFileService();
                 String path = FileServiceExtFactory.getAttachFileServiceExt().getRealPath(realUrl);
+                logger.info("SEC path:" + path);
                 InputStream inputStream = fileService.getInputStream(realUrl);
                 String downloadUrl =  FileSECUtils.getFileUrlByEncodeSEC(path,inputStream);
+                logger.info("SEC downloadUrl:" + downloadUrl);
                 this.getView().download(downloadUrl);
             }
         }

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

@@ -411,7 +411,7 @@ public class FileSECUtils {
     public static String getFileUrlByEncodeSEC(String path,InputStream inputStream) {
         File tempFile = null;
         try {
-            logger.info("--------------SEC附件密 processFileWithSEC1 ----------------");
+            logger.info("--------------SEC附件密 processFileWithSEC1 ----------------");
             String filename = getFileNameWithoutExtension(path);
             String filetype = getFileType(filename);
             /**
@@ -451,15 +451,15 @@ public class FileSECUtils {
             long fileSize = tempFile.length();
 
             // 4. 调用解密方法
-            InputStream decryptedInputStream = decodeFileForSEC(fileSize, new FileInputStream(tempFile));
+            InputStream decryptedInputStream = encodeFileForSEC(fileSize, new FileInputStream(tempFile));
             if (decryptedInputStream == null) {
-                logger.info("--------------SEC附件密,文件解密失败----------------");
+                logger.info("--------------SEC附件密,文件解密失败----------------");
                 return "";
             }
 
             // 5. 删除临时文件
             if (!tempFile.delete()) {
-                logger.info("--------------SEC附件密,无法删除临时文件----------------");
+                logger.info("--------------SEC附件密,无法删除临时文件----------------");
             }
 
             String url = getDownloadUrl(filename, decryptedInputStream);
@@ -469,7 +469,7 @@ public class FileSECUtils {
 
         } catch (IOException e) {
             e.printStackTrace();
-            logger.info("--------------SEC附件密 处理过程中发生错误1: " + e.getMessage());
+            logger.info("--------------SEC附件密 处理过程中发生错误1: " + e.getMessage());
             return null;
         } finally {
             try {
@@ -478,7 +478,7 @@ public class FileSECUtils {
                 }
             } catch (IOException e) {
                 e.printStackTrace();
-                logger.info("--------------SEC附件密 处理过程中发生错误2: " + e.getMessage());
+                logger.info("--------------SEC附件密 处理过程中发生错误2: " + e.getMessage());
             }
         }
     }