|
@@ -9,6 +9,13 @@ import kd.bos.service.attachment.FilePathService;
|
|
|
import java.io.File;
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
+/**
|
|
|
+ * 自定义附件服务
|
|
|
+ * 处理附件加密解密
|
|
|
+ *
|
|
|
+ * @author turborao
|
|
|
+ * @date 2025/05/26 14:07
|
|
|
+ */
|
|
|
public class CusFileServiceExt extends FilePathService implements FileServiceExt {
|
|
|
|
|
|
private static final Log logger = LogFactory.getLog(CusFileServiceExt.class);
|
|
@@ -32,22 +39,28 @@ public class CusFileServiceExt extends FilePathService implements FileServiceExt
|
|
|
return in;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 附件解密
|
|
|
+ * 先解决附件解密,后面再解决附件加密问题
|
|
|
+ * @param originalPath
|
|
|
+ * @param in
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public InputStream decode(String originalPath, InputStream in) {
|
|
|
logger.info("--------------SEC 附件解密 "+originalPath+"----------------");
|
|
|
|
|
|
-// InputStream inForSEC = null;
|
|
|
-// int isEncryption = FileSECUtils.checkFileIsEncryptionRest(in);
|
|
|
-// if(isEncryption == 1) {
|
|
|
-// long filesize = FileSECUtils.getFileSizeByPath(originalPath);
|
|
|
-// inForSEC = FileSECUtils.decodeFileForSEC(filesize, in);
|
|
|
-// if (inForSEC != null) {
|
|
|
-// return inForSEC;
|
|
|
-// }
|
|
|
-// }
|
|
|
+ InputStream inForSEC = null;
|
|
|
+ int isEncryption = FileSECUtils.checkFileIsEncryptionRest(in);
|
|
|
+ if(isEncryption == 1) {
|
|
|
+ long filesize = FileSECUtils.getFileSizeByPath(originalPath);
|
|
|
+ inForSEC = FileSECUtils.decodeFileForSEC(filesize, in);
|
|
|
+ if (inForSEC != null) {
|
|
|
+ return inForSEC;
|
|
|
+ }
|
|
|
+ }
|
|
|
return in;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|