Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YX_IDENT_beijing_auxiliary_YD
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
zhangyusheng
YX_IDENT_beijing_auxiliary_YD
Commits
38b46dd6
Commit
38b46dd6
authored
Aug 30, 2021
by
Liuxb@yingxingroup.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改xml上传解析的返回值
parent
fcc703ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
ReadXmlApi.java
src/main/java/com/yxproject/start/api/ReadXmlApi.java
+25
-12
No files found.
src/main/java/com/yxproject/start/api/ReadXmlApi.java
View file @
38b46dd6
...
@@ -54,10 +54,12 @@ public class ReadXmlApi {
...
@@ -54,10 +54,12 @@ public class ReadXmlApi {
@Consumes
(
MediaType
.
MULTIPART_FORM_DATA
)
@Consumes
(
MediaType
.
MULTIPART_FORM_DATA
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
getXMLToCheck
(
@Context
HttpServletResponse
resp
,
@Context
HttpServletRequest
requ
)
{
public
Map
<
String
,
Object
>
getXMLToCheck
(
@Context
HttpServletResponse
resp
,
HttpServletRequest
requ
)
{
YXJSONResponse
yxresp
=
new
YXJSONResponse
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
String
>
errList
=
new
ArrayList
<>();
String
remoteAddr
=
requ
.
getRemoteAddr
();
String
remoteAddr
=
requ
.
getRemoteAddr
();
MDC
.
put
(
"ip"
,
remoteAddr
);
MDC
.
put
(
"ip"
,
remoteAddr
);
YXJSONResponse
yxresp
=
new
YXJSONResponse
();
resp
.
setCharacterEncoding
(
"UTF-8"
);
resp
.
setCharacterEncoding
(
"UTF-8"
);
String
filename
=
""
;
String
filename
=
""
;
DiskFileItemFactory
factory
=
new
DiskFileItemFactory
();
DiskFileItemFactory
factory
=
new
DiskFileItemFactory
();
...
@@ -97,27 +99,31 @@ public class ReadXmlApi {
...
@@ -97,27 +99,31 @@ public class ReadXmlApi {
idcardsFactory
(
idCardFactory
.
extractIDCard
(
str
,
date
));
idcardsFactory
(
idCardFactory
.
extractIDCard
(
str
,
date
));
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"UnsupportedEncodingException 上传文件时发现文件编码错误"
,
e
);
logger
.
error
(
"UnsupportedEncodingException 上传文件时发现文件编码错误"
,
e
);
yxresp
.
outPutError
(
"UnsupportedEncodingException"
,
"上传文件时发现文件编码错误:"
+
e
.
getMessage
());
yxresp
.
outPutError
(
"UnsupportedEncodingException"
,
"上传文件时发现文件编码错误:"
+
e
.
getMessage
());
errList
.
add
(
"上传文件名:"
+
filename
+
",上传文件时发现文件编码错误"
);
continue
;
continue
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"IOException 上传文件时发生IO错误"
,
e
);
logger
.
error
(
"IOException 上传文件时发生IO错误"
,
e
);
yxresp
.
outPutError
(
"IOException"
,
"上传文件时发生IO错误:"
+
e
.
getMessage
());
yxresp
.
outPutError
(
"IOException"
,
"上传文件时发生IO错误:"
+
e
.
getMessage
());
errList
.
add
(
"上传文件名:"
+
filename
+
",上传文件时发生IO错误"
);
continue
;
continue
;
}
catch
(
DocumentException
e
)
{
}
catch
(
DocumentException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"DocumentException 上传文件时发生
IO错误
"
,
e
);
logger
.
error
(
"DocumentException 上传文件时发生
错误,非法XML文件
"
,
e
);
yxresp
.
outPutError
(
"DocumentException"
,
"上传文件时发生IO错误:"
+
e
.
getMessage
());
yxresp
.
outPutError
(
"DocumentException"
,
"上传文件时发生IO错误:"
+
e
.
getMessage
());
errList
.
add
(
"上传文件名:"
+
filename
+
",上传文件时发生错误,非法XML文件"
);
continue
;
continue
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"Exception 上传文件时发生错误
,非法XML文件
"
,
e
);
logger
.
error
(
"Exception 上传文件时发生错误"
,
e
);
yxresp
.
outPutError
(
"Exception"
,
"上传文件时发生错误,非法XML文件:"
+
filename
);
yxresp
.
outPutError
(
"Exception"
,
"上传文件时发生错误,非法XML文件:"
+
filename
);
errList
.
add
(
"上传文件名:"
+
filename
+
",上传文件时发生错误"
);
continue
;
continue
;
}
}
}
}
...
@@ -125,13 +131,20 @@ public class ReadXmlApi {
...
@@ -125,13 +131,20 @@ public class ReadXmlApi {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"上传文件名"
+
filename
);
logger
.
error
(
"FileUploadException 文件上传发生异常"
,
e
);
logger
.
error
(
"FileUploadException 文件上传发生异常"
,
e
);
yxresp
.
outPutError
(
"FileUploadException"
,
"文件上传发生异常:"
+
e
.
getMessage
());
yxresp
.
outPutError
(
"FileUploadException"
,
"文件上传发生异常:"
+
e
.
getMessage
());
}
finally
{
errList
.
add
(
"上传文件名:"
+
filename
+
",上传文件时发生错误"
);
return
true
;
}
}
if
(
errList
.
size
()
==
0
){
map
.
put
(
"msg"
,
"文件上传成功!"
);
map
.
put
(
"code"
,
"200"
);
}
else
{
map
.
put
(
"msg"
,
"文件上传失败!"
);
map
.
put
(
"code"
,
"500"
);
map
.
put
(
"errMsg"
,
errList
);
}
return
map
;
}
}
private
Boolean
idcardsFactory
(
Map
<
String
,
Object
>
map1
)
{
private
Boolean
idcardsFactory
(
Map
<
String
,
Object
>
map1
)
{
...
...
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