Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
e64f7125
Commit
e64f7125
authored
Jun 19, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] return upload result
parent
7093cc1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
FileUploadAdapter.java
.../pwc/taxtech/atms/vat/service/impl/FileUploadAdapter.java
+7
-6
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FileUploadAdapter.java
View file @
e64f7125
...
...
@@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import
pwc.taxtech.atms.constant.enums.EnumModule
;
import
java.io.File
;
import
java.net.URI
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.UUID
;
...
...
@@ -48,10 +49,10 @@ public class FileUploadAdapter {
public
ResponseEntity
upload
(
MultipartHttpServletRequest
request
,
EnumModule
trailBalance
,
UUID
userIdForUpload
)
{
if
(
request
.
getFileMap
().
size
()
<=
0
)
return
ResponseEntity
.
badRequest
().
body
(
"NoFile"
);
FileParamBean
paramBean
=
getQueryStringParameters
(
request
);
if
(!
paramBean
.
result
)
return
ResponseEntity
.
badRequest
().
body
(
"ParametersInvalid"
);
if
(
paramBean
.
totalSize
>
Long
.
valueOf
(
maxFileSize
))
return
ResponseEntity
.
badRequest
().
body
(
"InvalidFileSize"
);
if
(
paramBean
.
totalSize
>
Long
.
valueOf
(
maxFileSize
))
return
ResponseEntity
.
badRequest
().
body
(
"InvalidFileSize"
);
String
baseFolder
=
prepareFolder
();
if
(!
Utils
.
isEmpty
(
baseFolder
))
return
ResponseEntity
.
badRequest
().
body
(
"PrepareFolderError"
);
...
...
@@ -68,23 +69,23 @@ public class FileUploadAdapter {
if
(
completeFile
.
exists
())
completeFile
.
delete
();
}
if
(
paramBean
.
isLastChunk
)
{
if
(
paramBean
.
isLastChunk
)
{
LOGGER
.
debug
(
"Last chunk arrived"
);
File
completeFile
=
new
File
(
completePath
);
File
tempFile
=
new
File
(
tempPath
);
tempFile
.
renameTo
(
completeFile
);
LOGGER
.
info
(
"{} upload to temp folder sucess"
,
paramBean
.
fileName
);
LOGGER
.
info
(
"{} upload to temp folder sucess"
,
paramBean
.
fileName
);
}
}
else
{
}
else
{
File
tempFile
=
new
File
(
tempPath
);
File
completeFile
=
new
File
(
completePath
);
if
(
tempFile
.
exists
())
tempFile
.
delete
();
if
(
completeFile
.
exists
())
completeFile
.
delete
();
}
return
ResponseEntity
.
created
(
URI
.
create
(
""
)).
body
(
paramBean
.
tempFileName
);
return
null
;
}
private
FileParamBean
getQueryStringParameters
(
MultipartHttpServletRequest
request
)
{
...
...
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