Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
online-edu
online-edu-backend
Commits
30d7a620
Commit
30d7a620
authored
Apr 29, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update OSS上传样例
parent
895745af
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
21 deletions
+79
-21
readme.md
doc/readme.md
+34
-0
pom.xml
pom.xml
+6
-6
AliyunOSSCallbackController.java
...ta/biz/aliyun/controller/AliyunOSSCallbackController.java
+8
-3
AliyunService.java
...ain/java/com/qkdata/biz/aliyun/service/AliyunService.java
+1
-10
AliyunCallbackRespModel.java
...ava/com/qkdata/biz/aliyun/vo/AliyunCallbackRespModel.java
+28
-0
index.html
src/main/resources/static/index.html
+2
-2
No files found.
doc/readme.md
0 → 100644
View file @
30d7a620
阿里云OSS上传回调时返回的数据
图片
{
"bucket": ""qkdata-online-edu"",
"fileName": ""pjMwzsYBwD.png"",
"etag": ""367FA509D3CCB1838ADE75533E779DAC"",
"size": "1079945",
"mimeType": ""image/png"",
"imageHeight": "573",
"imageWidth": "1400",
"imageFormat": ""png""
}
word
{
"bucket": ""qkdata-online-edu"",
"fileName": ""红十字会小程序功能清单.doc"",
"etag": ""82F9C1FFC48EDBAD8ECF99C05A27C113"",
"size": "33280",
"mimeType": ""application/msword"",
"imageHeight": "",
"imageWidth": "",
"imageFormat": "null"
}
pdf
{
"bucket": ""qkdata-online-edu"",
"fileName": ""天地伟业-报价部分7.17.pdf"",
"etag": ""8A4CCB36312BBBCD0DF80F2A59EF4A2A"",
"size": "184992",
"mimeType": ""application/pdf"",
"imageHeight": "",
"imageWidth": "",
"imageFormat": "null"
}
pom.xml
View file @
30d7a620
...
@@ -91,11 +91,11 @@
...
@@ -91,11 +91,11 @@
<groupId>
org.springframework.retry
</groupId>
<groupId>
org.springframework.retry
</groupId>
<artifactId>
spring-retry
</artifactId>
<artifactId>
spring-retry
</artifactId>
</dependency>
</dependency>
<dependency
>
<!-- <dependency>--
>
<groupId>
org.springframework.boot
</groupId
>
<!-- <groupId>org.springframework.boot</groupId>--
>
<artifactId>
spring-boot-devtools
</artifactId
>
<!-- <artifactId>spring-boot-devtools</artifactId>--
>
<optional>
true
</optional
>
<!-- <optional>true</optional>--
>
</dependency
>
<!-- </dependency>--
>
<!--shiro-->
<!--shiro-->
<dependency>
<dependency>
<groupId>
org.apache.shiro
</groupId>
<groupId>
org.apache.shiro
</groupId>
...
@@ -293,7 +293,7 @@
...
@@ -293,7 +293,7 @@
<layout>
ZIP
</layout>
<layout>
ZIP
</layout>
<classifier>
all
</classifier>
<classifier>
all
</classifier>
<!-- 引入devtools后fork为false才能断点,但热部署失败,fork为true时热部署正常,debug失败 -->
<!-- 引入devtools后fork为false才能断点,但热部署失败,fork为true时热部署正常,debug失败 -->
<fork>
false
</fork
>
<!-- <fork>false</fork>--
>
</configuration>
</configuration>
<executions>
<executions>
<execution>
<execution>
...
...
src/main/java/com/qkdata/biz/aliyun/controller/AliyunOSSCallbackController.java
View file @
30d7a620
package
com
.
qkdata
.
biz
.
aliyun
.
controller
;
package
com
.
qkdata
.
biz
.
aliyun
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.qkdata.biz.aliyun.vo.AliyunCallbackRespModel
;
import
com.qkdata.common.annotation.SysLog
;
import
com.qkdata.common.annotation.SysLog
;
import
com.qkdata.common.base.model.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@Slf4j
@Api
(
tags
=
"阿里云OSS callback"
)
@Api
(
tags
=
"阿里云OSS callback"
)
@RestController
@RestController
@RequestMapping
(
"/aliyun"
)
@RequestMapping
(
"/aliyun"
)
...
@@ -14,8 +19,8 @@ public class AliyunOSSCallbackController {
...
@@ -14,8 +19,8 @@ public class AliyunOSSCallbackController {
@SysLog
(
"oss上传回调"
)
@SysLog
(
"oss上传回调"
)
@PostMapping
(
"/oss/callback"
)
@PostMapping
(
"/oss/callback"
)
public
String
callback
(
@RequestBody
String
respData
){
public
Result
<
String
>
callback
(
@RequestBody
AliyunCallbackRespModel
model
){
System
.
out
.
println
(
respData
);
return
"{\"Status\": \"OK\"}"
;
return
Result
.
succeed
(
"ok"
)
;
}
}
}
}
src/main/java/com/qkdata/biz/aliyun/service/AliyunService.java
View file @
30d7a620
...
@@ -59,16 +59,7 @@ public class AliyunService {
...
@@ -59,16 +59,7 @@ public class AliyunService {
JSONObject
jsonCallback
=
new
JSONObject
();
JSONObject
jsonCallback
=
new
JSONObject
();
jsonCallback
.
put
(
"callbackUrl"
,
frontendDomain
+
serverContextPath
+
"/aliyun/oss/callback"
);
jsonCallback
.
put
(
"callbackUrl"
,
frontendDomain
+
serverContextPath
+
"/aliyun/oss/callback"
);
jsonCallback
.
put
(
"callbackBody"
,
"{\n"
+
jsonCallback
.
put
(
"callbackBody"
,
"{\"bucket\":${bucket},\"imageWidth\":${imageInfo.width},\"imageFormat\":${imageInfo.format},\"fileName\":${object},\"size\":${size},\"etag\":${etag},\"mimeType\":${mimeType},\"imageHeight\":${imageInfo.height}}"
);
" \"bucket\": \"${bucket}\",\n"
+
" \"fileName\": \"${object}\",\n"
+
" \"etag\": \"${etag}\",\n"
+
" \"size\": \"${size}\",\n"
+
" \"mimeType\": \"${mimeType}\",\n"
+
" \"imageHeight\": \"${imageInfo.height}\",\n"
+
" \"imageWidth\": \"${imageInfo.width}\",\n"
+
" \"imageFormat\": \"${imageInfo.format}\"\n"
+
"}"
);
jsonCallback
.
put
(
"callbackBodyType"
,
"application/json"
);
jsonCallback
.
put
(
"callbackBodyType"
,
"application/json"
);
String
base64CallbackBody
=
BinaryUtil
.
toBase64String
(
jsonCallback
.
toString
().
getBytes
());
String
base64CallbackBody
=
BinaryUtil
.
toBase64String
(
jsonCallback
.
toString
().
getBytes
());
model
.
setCallback
(
base64CallbackBody
);
model
.
setCallback
(
base64CallbackBody
);
...
...
src/main/java/com/qkdata/biz/aliyun/vo/AliyunCallbackRespModel.java
0 → 100644
View file @
30d7a620
package
com
.
qkdata
.
biz
.
aliyun
.
vo
;
import
lombok.Data
;
/**
* {
* "bucket": ""qkdata-online-edu"",
* "fileName": ""pjMwzsYBwD.png"",
* "etag": ""367FA509D3CCB1838ADE75533E779DAC"",
* "size": "1079945",
* "mimeType": ""image/png"",
* "imageHeight": "573",
* "imageWidth": "1400",
* "imageFormat": ""png""
* }
*/
@Data
public
class
AliyunCallbackRespModel
{
private
String
buket
;
private
String
fileName
;
private
String
etag
;
private
Long
size
;
private
String
mimeType
;
private
Integer
imageHeight
;
private
Integer
imageWidth
;
private
String
imageFormat
;
}
src/main/resources/static/index.html
View file @
30d7a620
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
</ol>
</ol>
<br>
<br>
<form
name=
theform
>
<form
name=
theform
>
<input
type=
"radio"
name=
"myradio"
value=
"local_name"
checked=
true
/
>
上传文件名字保持本地文件名字
<input
type=
"radio"
name=
"myradio"
value=
"local_name"
/>
上传文件名字保持本地文件名字
<input
type=
"radio"
name=
"myradio"
value=
"random_name"
/>
上传文件名字是随机文件名, 后缀保留
<input
type=
"radio"
name=
"myradio"
value=
"random_name"
checked=
true
/
>
上传文件名字是随机文件名, 后缀保留
</form>
</form>
<h4>
您所选择的文件列表:
</h4>
<h4>
您所选择的文件列表:
</h4>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment