69deb321 by chentao

no message

1 parent 2f067e16
......@@ -3,6 +3,7 @@ package com.lego.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -16,6 +17,7 @@ import com.lego.common.core.service.ConfigService;
import com.lego.common.core.service.OssService;
import com.lego.common.exception.ServiceException;
import com.lego.common.utils.BeanCopyUtils;
import com.lego.common.utils.EncryptUtils;
import com.lego.common.utils.StringUtils;
import com.lego.common.utils.file.FileUtils;
import com.lego.common.utils.spring.SpringUtils;
......@@ -40,6 +42,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
......@@ -207,7 +210,14 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
OssClient storage = OssFactory.instance();
UploadResult uploadResult;
try {
uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType());
if(".pdf".equals(suffix) || ".mp4".equals(suffix) || ".json".equals(suffix) || ".ldr".equals(suffix)) {
String temp = EncryptUtils.encryptByAes(StrUtil.str(file.getBytes(), StandardCharsets.UTF_8));
byte[] encryptBytes = StrUtil.bytes(temp, CharsetUtil.CHARSET_UTF_8);
uploadResult = storage.uploadSuffix(encryptBytes, suffix, file.getContentType());
}
else{
uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType());
}
} catch (IOException e) {
throw new ServiceException(e.getMessage());
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!