no message
Showing
1 changed file
with
11 additions
and
1 deletions
| ... | @@ -3,6 +3,7 @@ package com.lego.system.service.impl; | ... | @@ -3,6 +3,7 @@ package com.lego.system.service.impl; |
| 3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import cn.hutool.core.convert.Convert; | 4 | import cn.hutool.core.convert.Convert; |
| 5 | import cn.hutool.core.io.IoUtil; | 5 | import cn.hutool.core.io.IoUtil; |
| 6 | import cn.hutool.core.util.CharsetUtil; | ||
| 6 | import cn.hutool.core.util.ObjectUtil; | 7 | import cn.hutool.core.util.ObjectUtil; |
| 7 | import cn.hutool.core.util.StrUtil; | 8 | import cn.hutool.core.util.StrUtil; |
| 8 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| ... | @@ -16,6 +17,7 @@ import com.lego.common.core.service.ConfigService; | ... | @@ -16,6 +17,7 @@ import com.lego.common.core.service.ConfigService; |
| 16 | import com.lego.common.core.service.OssService; | 17 | import com.lego.common.core.service.OssService; |
| 17 | import com.lego.common.exception.ServiceException; | 18 | import com.lego.common.exception.ServiceException; |
| 18 | import com.lego.common.utils.BeanCopyUtils; | 19 | import com.lego.common.utils.BeanCopyUtils; |
| 20 | import com.lego.common.utils.EncryptUtils; | ||
| 19 | import com.lego.common.utils.StringUtils; | 21 | import com.lego.common.utils.StringUtils; |
| 20 | import com.lego.common.utils.file.FileUtils; | 22 | import com.lego.common.utils.file.FileUtils; |
| 21 | import com.lego.common.utils.spring.SpringUtils; | 23 | import com.lego.common.utils.spring.SpringUtils; |
| ... | @@ -40,6 +42,7 @@ import javax.servlet.http.HttpServletResponse; | ... | @@ -40,6 +42,7 @@ import javax.servlet.http.HttpServletResponse; |
| 40 | import java.io.File; | 42 | import java.io.File; |
| 41 | import java.io.IOException; | 43 | import java.io.IOException; |
| 42 | import java.io.InputStream; | 44 | import java.io.InputStream; |
| 45 | import java.nio.charset.StandardCharsets; | ||
| 43 | import java.util.*; | 46 | import java.util.*; |
| 44 | import java.util.stream.Collectors; | 47 | import java.util.stream.Collectors; |
| 45 | 48 | ||
| ... | @@ -207,7 +210,14 @@ public class SysOssServiceImpl implements ISysOssService, OssService { | ... | @@ -207,7 +210,14 @@ public class SysOssServiceImpl implements ISysOssService, OssService { |
| 207 | OssClient storage = OssFactory.instance(); | 210 | OssClient storage = OssFactory.instance(); |
| 208 | UploadResult uploadResult; | 211 | UploadResult uploadResult; |
| 209 | try { | 212 | try { |
| 210 | uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); | 213 | if(".pdf".equals(suffix) || ".mp4".equals(suffix) || ".json".equals(suffix) || ".ldr".equals(suffix)) { |
| 214 | String temp = EncryptUtils.encryptByAes(StrUtil.str(file.getBytes(), StandardCharsets.UTF_8)); | ||
| 215 | byte[] encryptBytes = StrUtil.bytes(temp, CharsetUtil.CHARSET_UTF_8); | ||
| 216 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, file.getContentType()); | ||
| 217 | } | ||
| 218 | else{ | ||
| 219 | uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType()); | ||
| 220 | } | ||
| 211 | } catch (IOException e) { | 221 | } catch (IOException e) { |
| 212 | throw new ServiceException(e.getMessage()); | 222 | throw new ServiceException(e.getMessage()); |
| 213 | } | 223 | } | ... | ... |
-
Please register or sign in to post a comment