Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
haoban3.0
haoban-manage3.0
Commits
3d351154
Commit
3d351154
authored
Jan 21, 2022
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!157
parents
03853f9d
a437b217
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
pom.xml
haoban-manage3-web/pom.xml
+6
-0
UploadController.java
...om/gic/haoban/manage/web/controller/UploadController.java
+21
-13
No files found.
haoban-manage3-web/pom.xml
View file @
3d351154
...
...
@@ -91,6 +91,12 @@
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.9
</version>
<exclusions>
<exclusion>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/UploadController.java
View file @
3d351154
...
...
@@ -8,6 +8,8 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.qcloud.BucketNameEnum
;
import
com.gic.qcloud.FileUploadUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -22,7 +24,7 @@ import java.util.Set;
@RestController
public
class
UploadController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
UploadController
.
class
);
private
static
Set
<
String
>
FILE_TYPE
=
new
HashSet
<>(
);
static
{
for
(
BucketNameEnum
value:
BucketNameEnum
.
values
()){
...
...
@@ -56,20 +58,26 @@ public class UploadController extends WebBaseController{
String
key
=
"haoban/"
+
dayFilePath
+
"/"
+
name
;
fileType
=
FILE_TYPE
.
contains
(
fileType
)?
fileType:
BucketNameEnum
.
OTHER_90000
.
getName
();
String
url
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
templateFile
,
key
,
fileType
);
try
{
String
url
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
templateFile
,
key
,
fileType
);
if
(
templateFile
!=
null
)
{
templateFile
.
delete
();
}
if
(
templateFile
!=
null
)
{
templateFile
.
delete
();
}
JSONObject
res
=
new
JSONObject
(
);
res
.
put
(
"name"
,
name
);
res
.
put
(
"mediaName"
,
mediaName
);
res
.
put
(
"ext"
,
suffix
);
res
.
put
(
"size"
,
len
);
res
.
put
(
"key"
,
key
);
res
.
put
(
"url"
,
"https://"
+
url
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
res
);
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"name"
,
name
);
res
.
put
(
"mediaName"
,
mediaName
);
res
.
put
(
"ext"
,
suffix
);
res
.
put
(
"size"
,
len
);
res
.
put
(
"key"
,
key
);
res
.
put
(
"url"
,
"https://"
+
url
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
res
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"异常:{}"
,
e
);
return
resultResponse
(
HaoBanErrCode
.
ERR_0
);
}
}
}
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