Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-app-report
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
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
Administrator
xzxt-app-report
Commits
fd3a3fa3
Commit
fd3a3fa3
authored
Mar 01, 2023
by
lilei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改全国人员常口
parent
d46f2bb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
168 additions
and
13 deletions
+168
-13
src/main/java/org/springblade/founder/utils/QgryHjUtils.java
+117
-0
src/main/java/org/springblade/founder/utils/QgryckUtils.java
+51
-13
No files found.
src/main/java/org/springblade/founder/utils/QgryHjUtils.java
0 → 100644
View file @
fd3a3fa3
package
org
.
springblade
.
founder
.
utils
;
import
org.springblade.core.secure.utils.SecureUtil
;
import
org.springblade.modules.system.entity.XzxtUser
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.nio.charset.Charset
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**户籍服务**/
public
class
QgryHjUtils
{
public
static
String
queryHj
(
String
zjhm
,
boolean
ifLogin
){
try
{
String
postURL
=
"http://jd.zyfwzx.ln:8585/piee/endpoint/invoke"
;
URL
obj
=
new
URL
(
postURL
);
HttpURLConnection
con
=
(
HttpURLConnection
)
obj
.
openConnection
();
con
.
setRequestMethod
(
"POST"
);
con
.
setRequestProperty
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
con
.
setRequestProperty
(
"x-qqfw-senderid"
,
"C00-20000627"
);
//请求方编号
con
.
setRequestProperty
(
"x-qqfw-serviceid"
,
"S10-00000298"
);
//服务方编号
con
.
setRequestProperty
(
"x-qqfw-timeout"
,
"70"
);
//单位秒,超时后返回task_id 后续获取结果0 :立即返回 -1:系统最大值
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyyMMddHHmmssSSS"
);
System
.
out
.
println
(
df
.
format
(
new
Date
()));
con
.
setRequestProperty
(
"x-qqfw-qqsj"
,
df
.
format
(
new
Date
()));
//请求时间,格式:yyyyMMddHHmmssSSS
if
(
ifLogin
){
XzxtUser
user
=
SecureUtil
.
getUserXzxt
();
con
.
setRequestProperty
(
"x-qqfw-qqrxm"
,
URLEncoder
.
encode
(
user
.
getRealname
()));
//仅支持中文、间隔符输入,间隔符为:“•”
con
.
setRequestProperty
(
"x-qqfw-qqrgmsfzh"
,
user
.
getIdentitycard
());
//仅支持中文、间隔符输入,间隔符为:“•”
con
.
setRequestProperty
(
"x-qqfw-qqrjgdm"
,
user
.
getUnitcode
());
//请求人机构代码。描述:最终请求人所属机构代码,符合GA/T 380-2012标准。
con
.
setRequestProperty
(
"x-qqfw-qqrjgmc"
,
URLEncoder
.
encode
(
user
.
getUnitname
()));
//请求人机构名称。描述:最终请求人所属机构名称,符合GA/T 380-2012标准。
}
else
{
con
.
setRequestProperty
(
"x-qqfw-qqrxm"
,
URLEncoder
.
encode
(
"张军"
));
//仅支持中文、间隔符输入,间隔符为:“•”
con
.
setRequestProperty
(
"x-qqfw-qqrgmsfzh"
,
"210104197711241719"
);
//仅支持中文、间隔符输入,间隔符为:“•”
con
.
setRequestProperty
(
"x-qqfw-qqrjgdm"
,
"210000010300"
);
//请求人机构代码。描述:最终请求人所属机构代码,符合GA/T 380-2012标准。
con
.
setRequestProperty
(
"x-qqfw-qqrjgmc"
,
URLEncoder
.
encode
(
"辽宁省公安厅警务指挥部科技信息化总队"
));
//请求人机构名称。描述:最终请求人所属机构名称,符合GA/T 380-2012标准。
}
con
.
setRequestProperty
(
"x-qqfw-qqywxttxdm"
,
"022"
);
//请求业务系统条线代码。描述:最终请求业务系统所属条线代码。
con
.
setRequestProperty
(
"x-qqfw-qqywxtdm"
,
"001"
);
//请求业务系统代码。描述:最终请求业务系统代码(应用资源目录获取,未建设自定义)
con
.
setRequestProperty
(
"x-qqfw-qqywxtmc"
,
URLEncoder
.
encode
(
"警综平台"
));
//请求业务系统名称。描述:最终请求业务系统名称(应用资源目录获取,未建设自定义)
con
.
setRequestProperty
(
"x-qqfw-qqywxtwl"
,
"010"
);
//请求业务系统网络。描述:最终请求业务系统所属网络(010:公安网,020:移动网,030:视频网,040:政务网,050:互联网,999:其他)
con
.
setRequestProperty
(
"x-qqfw-zdsblx"
,
"0"
);
//终端设备类型。描述:终端设备类型(0:非移动端,1:移动端)
con
.
setRequestProperty
(
"x-qqfw-zdsbip"
,
"29.1.29.51"
);
//终端设备IP。描述:校验IP地址的格式是否为:xxx.xxx.xxx.xxx。
con
.
setRequestProperty
(
"x-qqfw-zdsbmac"
,
"B8-AC-6F-33-92-D1"
);
//终端设备mac地址。描述:校验MAC地址的格式是否为:xx-xx-xx-xx-xx-xx。
con
.
setRequestProperty
(
"x-qqfw-zdsbjwd"
,
""
);
//终端设备经纬度。描述:(移动端必填)。
con
.
setRequestProperty
(
"x-qqfw-zdsbszddmc"
,
""
);
//终端设备所在地点名称。描述:(移动端必填)
String
data
=
""
;
if
(
ifLogin
){
XzxtUser
user
=
SecureUtil
.
getUserXzxt
();
data
=
"{\"app_header\":{ },\"app_body\":{\"method\":\"Query\",\"parameters\":"
+
"{\"SenderID\":\"C00-20000627\",\"ServiceID\":\"S10-00000298\""
+
",\"EndUser\":[\""
+
URLEncoder
.
encode
(
user
.
getRealname
())
+
"\",\""
+
user
.
getIdentitycard
()
+
"\",\""
+
user
.
getUnitcode
()+
"\",\"\"],"
//这个LN0002548 随机生成吧 以LN00开头
+
"\"DataObjectCode\":\"\",\"Condition\":\"SFZH="
+
zjhm
+
"\",\"RequiredItems\":[],\"InfoCodeMode\":\"\"}}}"
;
}
else
{
data
=
"{\"app_header\":{ },\"app_body\":{\"method\":\"Query\",\"parameters\":"
+
"{\"SenderID\":\"C00-20000627\",\"ServiceID\":\"S10-00000298\""
+
",\"EndUser\":[\""
+
URLEncoder
.
encode
(
"张军"
)
+
"\",\"210104197711241719\",\"210000010300\",\"\"],"
//这个LN0002548 随机生成吧 以LN00开头
+
"\"DataObjectCode\":\"\",\"Condition\":\"SFZH="
+
zjhm
+
"\",\"RequiredItems\":[],\"InfoCodeMode\":\"\"}}}"
;
}
byte
[]
inputData
=
data
.
getBytes
(
Charset
.
defaultCharset
());
//\"SFZH\",\"XM\",\"CYM\",\"XB\",\"MZ\",\"CSRQ\",\"HYZK\",\"WHCD\",\"JGSSX\",\"FWCS\",\"CSDXZ\",\"BYQK\",\"HJD\",\"HKSZD\",\"ZZXZ\",\"XP\"
//"JGSSX","JGGJ","CYM","CSRQ","HYZK","XM","CSD","BYQK","HKSZD","SFZH","XB","CSDGJ","CSDXZ","WHCD","SG","XP","ZZXZ","ZY","MZ"
con
.
setDoOutput
(
true
);
OutputStream
os
;
os
=
con
.
getOutputStream
();
os
.
write
(
inputData
);
os
.
flush
();
os
.
close
();
int
responseCode
=
con
.
getResponseCode
();
System
.
out
.
println
(
responseCode
);
if
(
responseCode
==
HttpURLConnection
.
HTTP_OK
)
{
//success
Map
map
=
con
.
getHeaderFields
();
for
(
Object
key
:
map
.
keySet
())
{
if
(
key
!=
null
)
{
System
.
out
.
print
(
key
+
":"
);
List
values
=
(
List
)
map
.
get
(
key
);
for
(
Object
aValue
:
values
)
{
System
.
out
.
println
(
"\t"
+
aValue
);
}
}
}
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
con
.
getInputStream
()));
String
inputLine
;
StringBuilder
response
=
new
StringBuilder
();
while
((
inputLine
=
in
.
readLine
())
!=
null
)
{
response
.
append
(
inputLine
);
}
in
.
close
();
System
.
out
.
println
(
response
.
toString
());
return
response
.
toString
();
}
else
{
System
.
out
.
println
(
"POST request not worked"
);
return
""
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
// public static void main(String args[]){
// QgryHjUtils.queryHj("210203194703112293",false);
//
// }
}
src/main/java/org/springblade/founder/utils/QgryckUtils.java
View file @
fd3a3fa3
package
org
.
springblade
.
founder
.
utils
;
package
org
.
springblade
.
founder
.
utils
;
import
com.alibaba.fastjson.JSONArray
;
import
org.apache.commons.lang.StringUtils
;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.Element
;
import
org.dom4j.Element
;
import
org.springblade.founder.entity.QgckryBean
;
import
org.springblade.founder.entity.QgckryBean
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
import
java.util.List
;
...
@@ -35,25 +38,60 @@ public class QgryckUtils {
...
@@ -35,25 +38,60 @@ public class QgryckUtils {
}
}
/**
/**
* 根据
a
jhm查询人员的基本信息
* 根据
z
jhm查询人员的基本信息
* @param zjhm
* @param zjhm
* @return
* @return
*/
*/
public
QgckryBean
getQgckAllxxXml
(
String
zjhm
){
public
QgckryBean
getQgckAllxxXml
(
String
zjhm
){
QgckryBean
ryxx
=
new
QgckryBean
();
//
QgckryBean ryxx=new QgckryBean();
String
esbServiceReturn
=
""
;
//
String esbServiceReturn="";
//String url="http://10.100.17.115:8080/NmgEsbQueryService/QueryLocalPersonForOther?conditions=sfzh='"+zjhm+"'";
//
//String url="http://10.100.17.115:8080/NmgEsbQueryService/QueryLocalPersonForOther?conditions=sfzh='"+zjhm+"'";
String
url
=
getConn
()+
"'"
+
zjhm
+
"'"
;
//
String url=getConn()+"'"+zjhm+"'";
HttpUtil
hu
=
new
HttpUtil
();
//
HttpUtil hu=new HttpUtil();
try
{
//
try {
esbServiceReturn
=
hu
.
doGet
(
url
);
//
esbServiceReturn=hu.doGet(url);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
ryxx
=
getryJbxxxml
(
esbServiceReturn
);
//
ryxx=getryJbxxxml(esbServiceReturn);
return
ryxx
;
return
getRyhj
(
zjhm
,
true
)
;
}
}
public
QgckryBean
getRyhj
(
String
zjhm
,
boolean
ifLogin
){
QgckryBean
ryxx
=
new
QgckryBean
();
String
hj
=
QgryHjUtils
.
queryHj
(
zjhm
,
ifLogin
);
if
(
StringUtils
.
isNotEmpty
(
hj
))
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
hj
);
JSONObject
appBody
=
jsonObject
.
getJSONObject
(
"app_body"
);
JSONArray
jsonArray
=
appBody
.
getJSONArray
(
"QueryReturn"
);
JSONArray
ryJson
=
JSONObject
.
parseArray
(
jsonArray
.
get
(
2
).
toString
());
ryxx
.
setXm
(
objectToStr
(
ryJson
.
get
(
5
)));
ryxx
.
setJgssx
(
objectToStr
(
ryJson
.
get
(
0
)));
ryxx
.
setWhcd
(
objectToStr
(
ryJson
.
get
(
18
)));
ryxx
.
setCym
(
objectToStr
(
ryJson
.
get
(
16
)));
ryxx
.
setXp
(
objectToStr
(
ryJson
.
get
(
17
)));
ryxx
.
setHyzk
(
objectToStr
(
ryJson
.
get
(
13
)));
ryxx
.
setByqk
(
objectToStr
(
ryJson
.
get
(
1
)));
ryxx
.
setSfzh
(
objectToStr
(
ryJson
.
get
(
9
)));
ryxx
.
setMz
(
objectToStr
(
ryJson
.
get
(
10
)));
ryxx
.
setXb
(
objectToStr
(
ryJson
.
get
(
6
)));
ryxx
.
setHkszd
(
objectToStr
(
ryJson
.
get
(
12
)));
ryxx
.
setCsdxz
(
objectToStr
(
ryJson
.
get
(
4
)));
ryxx
.
setCsrq
(
objectToStr
(
ryJson
.
get
(
15
)));
ryxx
.
setZzxz
(
objectToStr
(
ryJson
.
get
(
14
)));
ryxx
.
setSg
(
objectToStr
(
ryJson
.
get
(
7
)));
}
return
ryxx
;
}
private
String
objectToStr
(
Object
object
){
if
(
object
!=
null
){
return
object
.
toString
();
}
return
""
;
}
private
String
getConn
(){
private
String
getConn
(){
String
url
=
"http://26.3.16.58:8080/NmgEsbQueryService/QueryLocalPersonForOther?conditions=sfzh="
;
String
url
=
"http://26.3.16.58:8080/NmgEsbQueryService/QueryLocalPersonForOther?conditions=sfzh="
;
/*Properties properties = new Properties();
/*Properties properties = new Properties();
...
...
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