Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
竹天卫
tianjin-cement
Commits
65f4c993
Commit
65f4c993
authored
Apr 25, 2021
by
shulidong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
474cddf8
71395dd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
EntityEnclosureController.java
...cement/business/controller/EntityEnclosureController.java
+42
-0
FastDFSUtils.java
...ava/cn/wise/sc/cement/business/util/dfs/FastDFSUtils.java
+1
-1
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EntityEnclosureController.java
View file @
65f4c993
...
@@ -79,6 +79,47 @@ public class EntityEnclosureController {
...
@@ -79,6 +79,47 @@ public class EntityEnclosureController {
@ApiOperation
(
value
=
"单个文件上传"
)
@ApiOperation
(
value
=
"单个文件上传"
)
@PostMapping
(
"/fileUpLoad"
)
@PostMapping
(
"/fileUpLoad"
)
public
BaseResponse
fileUpLoad
(
MultipartFile
file
)
{
public
BaseResponse
fileUpLoad
(
MultipartFile
file
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
filePath
=
null
;
String
fileName
=
null
;
String
extName
=
null
;
try
{
boolean
ref
=
checkFileSize
(
file
.
getSize
(),
30
,
"M"
);
if
(!
ref
){
return
BaseResponse
.
errorMsg
(
"文件不能大于30M"
);
}
LoginUser
loginUser
=
userService
.
getLoginUser
();
if
(
loginUser
!=
null
)
{
filePath
=
FastDFSUtils
.
uploadPic
(
file
.
getBytes
(),
file
.
getOriginalFilename
(),
file
.
getSize
());
fileName
=
file
.
getOriginalFilename
().
substring
(
0
,
file
.
getOriginalFilename
().
lastIndexOf
(
"."
));
extName
=
file
.
getOriginalFilename
().
substring
(
file
.
getOriginalFilename
().
lastIndexOf
(
"."
));
}
else
{
return
BaseResponse
.
noLogin
(
"登录信息失效"
);
}
/* if (extName.contains(FileExt.EXCL.getName()) || extName.contains(FileExt.EXCLX.getName())) {
String pdfPath = FastDFSUtils.conventAndUploadExcel(file.getInputStream(), fileName);
map.put("pdfPath", pdfPath);
} else if (extName.contains(FileExt.DOC.getName()) || extName.contains(FileExt.DOCX.getName())) {
String pdfPath = FastDFSUtils.conventAndUploadWord(file.getInputStream(), fileName);
map.put("pdfPath", pdfPath);
} else {
map.put("pdfPath", filePath);
}*/
String
picUrl
=
filePath
;
map
.
put
(
"fileUrl"
,
picUrl
);
map
.
put
(
"fileName"
,
fileName
);
map
.
put
(
"extName"
,
extName
);
return
BaseResponse
.
okData
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
toString
());
}
return
BaseResponse
.
errorMsg
(
"失败"
);
}
@ApiOperation
(
value
=
"检测报告上传"
)
@PostMapping
(
"/reportUpLoad"
)
public
BaseResponse
reportUpLoad
(
MultipartFile
file
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
filePath
=
null
;
String
filePath
=
null
;
String
fileName
=
null
;
String
fileName
=
null
;
...
@@ -117,6 +158,7 @@ public class EntityEnclosureController {
...
@@ -117,6 +158,7 @@ public class EntityEnclosureController {
return
BaseResponse
.
errorMsg
(
"失败"
);
return
BaseResponse
.
errorMsg
(
"失败"
);
}
}
@ApiOperation
(
value
=
"单个图片上传"
)
@ApiOperation
(
value
=
"单个图片上传"
)
@PostMapping
(
"/imgUpLoad"
)
@PostMapping
(
"/imgUpLoad"
)
public
BaseResponse
imgUpLoad
(
MultipartFile
file
)
{
public
BaseResponse
imgUpLoad
(
MultipartFile
file
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/dfs/FastDFSUtils.java
View file @
65f4c993
...
@@ -204,7 +204,7 @@ public class FastDFSUtils {
...
@@ -204,7 +204,7 @@ public class FastDFSUtils {
public
static
String
conventAndUploadExcel
(
InputStream
inputStream
,
String
filename
)
{
public
static
String
conventAndUploadExcel
(
InputStream
inputStream
,
String
filename
)
{
// 验证License
// 验证License
getLicense
();
//
getLicense();
File
outputFile
=
new
File
(
filename
+
".pdf"
);
File
outputFile
=
new
File
(
filename
+
".pdf"
);
String
filePath
=
""
;
String
filePath
=
""
;
try
{
try
{
...
...
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