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
8f4ba851
authored
2025-08-10 19:54:05 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
05d3b9f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
lego-admin/src/main/java/com/lego/web/controller/core/CourseController.java
lego-system/src/main/java/com/lego/system/service/impl/SysOssServiceImpl.java
lego-admin/src/main/java/com/lego/web/controller/core/CourseController.java
View file @
8f4ba85
...
...
@@ -308,6 +308,7 @@ public class CourseController extends BaseController {
}
else
{
String
originalfileName
=
sysOss
.
getOriginalName
();
String
suffix
=
StringUtils
.
substring
(
originalfileName
,
originalfileName
.
lastIndexOf
(
"."
),
originalfileName
.
length
());
log
.
info
(
"==========suffix=========="
+
suffix
);
UploadResult
uploadResult
=
null
;
if
(
".pdf"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
...
...
@@ -347,6 +348,7 @@ public class CourseController extends BaseController {
byte
[]
fileBytes
=
null
;
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
log
.
info
(
"======inputStream===="
+
inputStream
.
available
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -356,6 +358,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
log
.
info
(
"======fileBytes.length===="
+
fileBytes
.
length
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
log
.
info
(
"json==============="
+
uploadResult
.
getUrl
());
}
catch
(
Exception
e
)
{
...
...
lego-system/src/main/java/com/lego/system/service/impl/SysOssServiceImpl.java
View file @
8f4ba85
...
...
@@ -217,6 +217,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
// else{
// uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType());
// }
log
.
info
(
"==========originalfileName========="
+
originalfileName
);
log
.
info
(
"==========getContentType========="
+
file
.
getContentType
());
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