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
9651b5f6
Commit
9651b5f6
authored
Mar 01, 2019
by
suichenguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解析XML包
parent
6ad6ff58
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
95 deletions
+4
-95
ImportXmlApi.java
src/main/java/com/yxproject/start/api/ImportXmlApi.java
+0
-4
YingxinApi.java
src/main/java/com/yxproject/start/api/YingxinApi.java
+0
-91
Analysis.java
src/main/java/com/yxproject/start/mapper/Analysis.java
+4
-0
No files found.
src/main/java/com/yxproject/start/api/ImportXmlApi.java
View file @
9651b5f6
...
@@ -6,24 +6,20 @@ import com.yxproject.start.service.ImportXmlService;
...
@@ -6,24 +6,20 @@ import com.yxproject.start.service.ImportXmlService;
import
com.yxproject.start.utils.IDCardFactory
;
import
com.yxproject.start.utils.IDCardFactory
;
import
com.yxproject.start.utils.YXJSONResponse
;
import
com.yxproject.start.utils.YXJSONResponse
;
import
com.yxproject.start.utils.YXStringUtils
;
import
com.yxproject.start.utils.YXStringUtils
;
import
org.apache.catalina.Manager
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileUploadException
;
import
org.apache.commons.fileupload.FileUploadException
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.fileupload.servlet.ServletFileUpload
;
import
org.apache.commons.fileupload.servlet.ServletFileUpload
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentException
;
import
org.dom4j.Element
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.Context
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
src/main/java/com/yxproject/start/api/YingxinApi.java
deleted
100644 → 0
View file @
6ad6ff58
package
com
.
yxproject
.
start
.
api
;
import
com.yxproject.start.entity.PreproPersonEntity
;
import
com.yxproject.start.service.ImportXmlService
;
import
org.dom4j.Document
;
import
org.dom4j.Element
;
import
org.dom4j.io.SAXReader
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Created by Administrator on 2019/2/15.
*/
@RestController
@RequestMapping
(
"yingxin"
)
public
class
YingxinApi
{
@Autowired
private
ImportXmlService
importXmlService
;
/*导入XML文件*/
@RequestMapping
(
"importXmlData"
)
public
List
<
PreproPersonEntity
>
importXmlData
(){
List
<
PreproPersonEntity
>
list
=
new
ArrayList
<>();
try
{
File
file
=
new
File
(
"D:\\dengzhou.xml"
);
// 该文件目录下文件全部放入数组
File
[]
files
=
file
.
listFiles
();
if
(
files
!=
null
){
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++){
String
fileName
=
files
[
i
].
getName
();
if
(
fileName
.
endsWith
(
"xml"
)){
SAXReader
reader
=
new
SAXReader
();
//读取文件到document中
Document
doc
=
reader
.
read
(
file
);
//获取xml文件的根节点
Element
rootElement
=
doc
.
getRootElement
();
Element
data
=
rootElement
.
element
(
"DATA"
);
//定义一个Element用于遍历
Element
fooElement
;
//遍历所有名叫“RECORD”的节点
for
(
Iterator
j
=
data
.
elementIterator
(
"RECORD"
);
j
.
hasNext
();)
{
fooElement
=
(
Element
)
j
.
next
();
PreproPersonEntity
preproPersonEntity
=
new
PreproPersonEntity
();
preproPersonEntity
.
setJmsfzslh
(
fooElement
.
elementText
(
"jmsfzslh"
));
preproPersonEntity
.
setGmsfhm
(
fooElement
.
elementText
(
"gmsfhm"
));
preproPersonEntity
.
setXm
(
fooElement
.
elementText
(
"xm"
));
preproPersonEntity
.
setXbdm
(
fooElement
.
elementText
(
"xbdm"
));
preproPersonEntity
.
setMzdm
(
fooElement
.
elementText
(
"mzdm"
));
preproPersonEntity
.
setCsrq
(
fooElement
.
elementText
(
"csrq"
));
preproPersonEntity
.
setSsxqdm
(
fooElement
.
elementText
(
"ssxqdm"
));
preproPersonEntity
.
setDzmc
(
fooElement
.
elementText
(
"dzmc"
));
preproPersonEntity
.
setSdxp
(
fooElement
.
elementText
(
"sdxp"
));
preproPersonEntity
.
setZwyZwtxsj
(
fooElement
.
elementText
(
"zwyZwtxsj"
));
preproPersonEntity
.
setZwyZwtzsj
(
fooElement
.
elementText
(
"zwyZwtzsj"
));
preproPersonEntity
.
setZweZwtxsj
(
fooElement
.
elementText
(
"zweZwtxsj"
));
preproPersonEntity
.
setZweZwtzsj
(
fooElement
.
elementText
(
"zweZwtzsj"
));
preproPersonEntity
.
setQfjgGajgmc
(
fooElement
.
elementText
(
"qfjgGajgmc"
));
preproPersonEntity
.
setYxqqsrq
(
fooElement
.
elementText
(
"yxqqsrq"
));
preproPersonEntity
.
setYxqjzrq
(
fooElement
.
elementText
(
"yxqjzrq"
));
preproPersonEntity
.
setJmsfzslyydm
(
fooElement
.
elementText
(
"jmsfzslyydm"
));
preproPersonEntity
.
setJmsfzzzlxdm
(
fooElement
.
elementText
(
"jmsfzzzlxdm"
));
preproPersonEntity
.
setJmsfzlzfsdm
(
fooElement
.
elementText
(
"jmsfzlzfsdm"
));
preproPersonEntity
.
setSjrXm
(
fooElement
.
elementText
(
"sjrXm"
));
preproPersonEntity
.
setSjrLxdh
(
fooElement
.
elementText
(
"sjrLxdh"
));
preproPersonEntity
.
setSjrYzbm
(
fooElement
.
elementText
(
"sjrYzbm"
));
preproPersonEntity
.
setSjrTxdz
(
fooElement
.
elementText
(
"sjrTxdz"
));
preproPersonEntity
.
setSid
(
fooElement
.
elementText
(
"sid"
));
list
.
add
(
preproPersonEntity
);
}
ImportXmlService
.
importPersonXml
(
list
);
}
else
{
continue
;
}
}
}
}
catch
(
Exception
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
return
list
;
}
}
src/main/java/com/yxproject/start/mapper/Analysis.java
0 → 100644
View file @
9651b5f6
package
com
.
yxproject
.
start
.
mapper
;
public
interface
Analysis
{
}
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