Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
legobackend
/
lego-manage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
69deb321
authored
2025-08-06 12:38:35 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
2f067e16
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
lego-system/src/main/java/com/lego/system/service/impl/SysOssServiceImpl.java
lego-system/src/main/java/com/lego/system/service/impl/SysOssServiceImpl.java
View file @
69deb32
...
...
@@ -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
());
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment