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
51ce8d57
authored
2025-08-10 15:38:54 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
fb625d54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
77 deletions
lego-admin/src/main/java/com/lego/web/controller/core/CourseController.java
lego-admin/src/main/java/com/lego/web/controller/core/CourseController.java
View file @
51ce8d5
...
...
@@ -117,14 +117,16 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -133,14 +135,16 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -149,14 +153,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -165,11 +170,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -215,14 +220,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -231,14 +237,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -247,14 +254,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -263,11 +271,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -313,14 +321,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -329,14 +338,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -345,14 +355,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -361,11 +372,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -411,14 +422,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -427,14 +439,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -443,14 +456,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -459,11 +473,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -509,14 +523,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -525,14 +540,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -541,14 +557,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -557,11 +574,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -607,14 +624,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -623,14 +641,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -639,14 +658,15 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -655,11 +675,11 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
@@ -705,14 +725,16 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"application/pdf"
);
}
else
if
(
".mp4"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -721,14 +743,16 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"video/mpeg4"
);
}
else
if
(
".json"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -737,14 +761,16 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
else
if
(
".ldr"
.
equals
(
suffix
))
{
byte
[]
fileBytes
=
null
;
try
(
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
()))
{
try
{
InputStream
inputStream
=
storage
.
getObjectContent
(
sysOss
.
getUrl
());
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
8192
];
// 或者根据实际情况选择合适的缓冲区大小
int
bytesRead
;
...
...
@@ -753,11 +779,12 @@ public class CourseController extends BaseController {
}
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"text/plain"
);
}
if
(
Objects
.
nonNull
(
uploadResult
))
{
// 保存文件信息
...
...
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