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
64833a39
authored
2025-08-10 20:07:48 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
8f4ba851
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
27 deletions
lego-admin/src/main/java/com/lego/web/controller/core/CourseController.java
lego-admin/src/main/resources/application.yml
lego-oss/src/main/java/com/lego/oss/core/OssClient.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 @
64833a3
...
...
@@ -151,7 +151,7 @@ public class CourseController extends BaseController {
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
log
.
info
(
"======fileBytes.length===="
+
fileBytes
.
length
);
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -168,7 +168,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -253,7 +253,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -270,7 +270,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -359,7 +359,7 @@ public class CourseController extends BaseController {
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
log
.
info
(
"======fileBytes.length===="
+
fileBytes
.
length
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
log
.
info
(
"json==============="
+
uploadResult
.
getUrl
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
...
...
@@ -377,7 +377,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -462,7 +462,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -479,7 +479,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -564,7 +564,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -581,7 +581,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -666,7 +666,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -683,7 +683,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -770,7 +770,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plai
n"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/jso
n"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
@@ -788,7 +788,7 @@ public class CourseController extends BaseController {
byteArrayOutputStream
.
flush
();
fileBytes
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
fileBytes
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
text/plain
"
);
uploadResult
=
storage
.
uploadSuffix
(
encryptBytes
,
suffix
,
"
application/octet-stream
"
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
());
}
...
...
lego-admin/src/main/resources/application.yml
View file @
64833a3
...
...
@@ -136,7 +136,6 @@ security:
# actuator 监控配置
-
/actuator
-
/actuator/**
-
/core/course/encrypt
# MyBatisPlus配置
# https://baomidou.com/config/
...
...
lego-oss/src/main/java/com/lego/oss/core/OssClient.java
View file @
64833a3
...
...
@@ -163,9 +163,7 @@ public class OssClient {
}
public
InputStream
getObjectContent
(
String
path
)
{
path
=
path
.
replace
(
"http://bp.douyaedu.com/legao/"
,
""
);
log
.
info
(
"============path==========="
+
path
);
log
.
info
(
"============properties.getBucketName()==========="
+
properties
.
getBucketName
());
path
=
path
.
replace
(
getUrl
()
+
"/"
,
""
);
S3Object
object
=
client
.
getObject
(
properties
.
getBucketName
(),
path
);
return
object
.
getObjectContent
();
}
...
...
lego-system/src/main/java/com/lego/system/service/impl/SysOssServiceImpl.java
View file @
64833a3
...
...
@@ -210,16 +210,13 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
OssClient
storage
=
OssFactory
.
instance
();
UploadResult
uploadResult
;
try
{
// if(".pdf".equals(suffix) || ".mp4".equals(suffix) || ".json".equals(suffix) || ".ldr".equals(suffix)) {
// byte[] encryptBytes = EncryptUtils.encryptByAes(file.getBytes());
// uploadResult = storage.uploadSuffix(encryptBytes, suffix, file.getContentType());
// }
// else{
// uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType());
// }
log
.
info
(
"==========originalfileName========="
+
originalfileName
);
log
.
info
(
"==========getContentType========="
+
file
.
getContentType
());
if
(
".pdf"
.
equals
(
suffix
)
||
".mp4"
.
equals
(
suffix
)
||
".json"
.
equals
(
suffix
)
||
".ldr"
.
equals
(
suffix
))
{
byte
[]
encryptBytes
=
EncryptUtils
.
encryptByAes
(
file
.
getBytes
());
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