Bladeren bron

附近加密测试5

wangjun 3 weken geleden
bovenliggende
commit
fe7c469fb7

+ 9 - 3
code/base/nckd-jimin-base-helper/src/main/java/nckd/base/helper/CusFileServiceExt.java

@@ -1,10 +1,12 @@
 package nckd.base.helper;
 
+import kd.bos.fileservice.FileServiceFactory;
 import kd.bos.fileservice.extension.FileServiceExt;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
 import kd.bos.service.attachment.FilePathService;
 
+import java.io.File;
 import java.io.InputStream;
 
 public class CusFileServiceExt extends FilePathService implements FileServiceExt {
@@ -15,14 +17,18 @@ public class CusFileServiceExt extends FilePathService implements FileServiceExt
     public InputStream encode(String originalPath, InputStream in) {
         logger.info("--------------SEC 附件加密 "+originalPath+"----------------");
 
-        return in;
+        long filesize = FileSECUtils.getFileSizeByPath(originalPath);
+        InputStream inForSEC = FileSECUtils.decodeFileForSEC(filesize,in);
+
+        return inForSEC;
     }
 
     @Override
     public InputStream decode(String originalPath, InputStream in) {
         logger.info("--------------SEC 附件解密 "+originalPath+"----------------");
-
-        return in;
+        long filesize = FileSECUtils.getFileSizeByPath(originalPath);
+        InputStream inForSEC = FileSECUtils.decodeFileForSEC(filesize,in);
+        return inForSEC;
     }