wanghaiwu 2 недель назад
Родитель
Сommit
500b34fa37

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

@@ -278,7 +278,7 @@ public class FileSECUtils {
     }
 
     public static InputStream processFileWithSEC(String path, InputStream inputStream) {
-//        InputStream tmpInputStream = inputStream;
+        InputStream tmpInputStream = inputStream;
 
 
 ////        File tempFile = null;
@@ -321,14 +321,16 @@ public class FileSECUtils {
             int isEncrypted = checkFileIsEncryptionRest(inputStream);
             if (isEncrypted == -1) {
                 logger.info("--------------SEC附件检查,文件加密状态检查失败----------------");
-                return inputStream;
+                return tmpInputStream;
             } else if (isEncrypted == 0) {
                 logger.info("--------------SEC附件检查,是明文无需解密----------------");
-                return inputStream;
+                return tmpInputStream;
             }
             int fileSize = 0;
 
-            byte[] bytes = StreamUtils.copyToByteArray(inputStream);
+            InputStream tmpInputStream1 = inputStream;
+
+            byte[] bytes = StreamUtils.copyToByteArray(tmpInputStream);
             fileSize = inputStream.read(bytes);
 
             logger.info("--------------SEC附件解密,文件大小:" + fileSize + "----------------");
@@ -337,10 +339,10 @@ public class FileSECUtils {
 //            int fileSize = tempFile.length();
 
             // 4. 调用解密方法
-            InputStream decryptedInputStream = decodeFileForSEC(fileSize, inputStream);
+            InputStream decryptedInputStream = decodeFileForSEC(fileSize, tmpInputStream);
             if (decryptedInputStream == null) {
                 logger.info("--------------SEC附件解密,文件解密失败----------------");
-                return inputStream;
+                return tmpInputStream1;
             }