Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jiwei-api
Project
Project
Details
Activity
Releases
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
马天浩
jiwei-api
Commits
6070193d
Commit
6070193d
authored
May 18, 2021
by
matianhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[鸿程接口] <feat> 鸿程接口请求方式修改
parent
1519a701
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
31 deletions
+62
-31
HongChengController.java
...com/mth/requestsecret/controller/HongChengController.java
+31
-29
RestTemplateService.java
...va/com/mth/requestsecret/service/RestTemplateService.java
+31
-2
No files found.
src/main/java/com/mth/requestsecret/controller/HongChengController.java
View file @
6070193d
...
...
@@ -7,6 +7,8 @@ import com.mth.requestsecret.vo.hongcheng.HongChengUser;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -34,7 +36,7 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/realEstateOwnership"
)
public
ResponseEntity
realEstateOwnership
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
realEstateOwnership
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
// api签名
String
apiMethod
=
"30160300772/20210308111381091663091696"
;
// api参数
...
...
@@ -76,18 +78,18 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/edgeBasicLivingAllowance"
)
public
ResponseEntity
edgeBasicLivingAllowance
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
edgeBasicLivingAllowance
(
HongChengUser
user
)
{
// api签名
String
apiMethod
=
"30501500813/20210511146922115787328422"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 姓名
paramMap
.
put
(
"mhz"
,
user
.
getName
());
paramMap
.
add
(
"mhz"
,
user
.
getName
());
// 身份证号
paramMap
.
put
(
"mhzsfz"
,
user
.
getZjh
());
paramMap
.
add
(
"mhzsfz"
,
user
.
getZjh
());
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"低保边缘在册家庭信息查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"低保边缘在册家庭信息查询"
);
}
/**
...
...
@@ -97,18 +99,18 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/basicLivingAllowance"
)
public
ResponseEntity
basicLivingAllowance
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
basicLivingAllowance
(
HongChengUser
user
)
{
// api签名
String
apiMethod
=
"30501500811/20210511106906969438949677"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 姓名
paramMap
.
put
(
"mhz"
,
user
.
getName
());
paramMap
.
add
(
"mhz"
,
user
.
getName
());
// 身份证号
paramMap
.
put
(
"mhzsfz"
,
user
.
getZjh
());
paramMap
.
add
(
"mhzsfz"
,
user
.
getZjh
());
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"低保在册家庭信息查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"低保在册家庭信息查询"
);
}
/**
...
...
@@ -118,18 +120,18 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/extremelyPoor"
)
public
ResponseEntity
extremelyPoor
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
extremelyPoor
(
HongChengUser
user
)
{
// api签名
String
apiMethod
=
"30501500814/20210511166929001099754693"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 姓名
paramMap
.
put
(
"mhz"
,
user
.
getName
());
paramMap
.
add
(
"mhz"
,
user
.
getName
());
// 身份证号
paramMap
.
put
(
"mhzsfz"
,
user
.
getZjh
());
paramMap
.
add
(
"mhzsfz"
,
user
.
getZjh
());
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"特困在册家庭信息查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"特困在册家庭信息查询"
);
}
/**
...
...
@@ -139,16 +141,16 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/entryAndExit"
)
public
ResponseEntity
entryAndExit
(
HongChengUser
user
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
entryAndExit
(
HongChengUser
user
)
{
// api签名
String
apiMethod
=
"30681300812/20210511146921555575237961"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 身份证号
paramMap
.
put
(
"sfzh"
,
user
.
getZjh
());
paramMap
.
add
(
"sfzh"
,
user
.
getZjh
());
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"浙江出入境口岸查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"浙江出入境口岸查询"
);
}
/**
...
...
@@ -159,18 +161,18 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/motorVehicleIllegalRecord"
)
public
ResponseEntity
motorVehicleIllegalRecord
(
String
hpzl
,
String
hphm
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
motorVehicleIllegalRecord
(
String
hpzl
,
String
hphm
)
{
// api签名
String
apiMethod
=
"30210900816/20210511176931335940936366"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 号牌种类
paramMap
.
put
(
"hpzl"
,
hpzl
);
paramMap
.
add
(
"hpzl"
,
hpzl
);
// 号牌号码
paramMap
.
put
(
"hphm"
,
hphm
);
paramMap
.
add
(
"hphm"
,
hphm
);
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"浙江省机动车违法记录查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"浙江省机动车违法记录查询"
);
}
/**
...
...
@@ -180,16 +182,16 @@ public class HongChengController {
* @return
*/
@PostMapping
(
"/deathMessage"
)
public
ResponseEntity
deathMessage
(
String
swrq
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
deathMessage
(
String
swrq
)
{
// api签名
String
apiMethod
=
"30682000808/20210506106476298582165626"
;
// api参数
M
ap
<
String
,
Object
>
paramMap
=
new
Hash
Map
<>();
M
ultiValueMap
<
String
,
Object
>
paramMap
=
new
LinkedMultiValue
Map
<>();
// 死亡日期(格式:20201221)
paramMap
.
put
(
"SWRQ"
,
swrq
);
paramMap
.
add
(
"SWRQ"
,
swrq
);
return
restTemplateService
.
hongChengSendRequest
(
paramMap
,
apiMethod
,
"浙江省死亡信息查询"
);
return
restTemplateService
.
hongChengSendRequest
2
(
paramMap
,
apiMethod
,
"浙江省死亡信息查询"
);
}
}
src/main/java/com/mth/requestsecret/service/RestTemplateService.java
View file @
6070193d
...
...
@@ -232,7 +232,7 @@ public class RestTemplateService {
// 释放该线程的锁
redisUtil
.
releaseLock
(
SJJ_DISTRIBUTED_LOCK
,
randomValue
);
}
}
else
{
}
else
{
log
.
info
(
"未获取到锁 - 等待1000毫秒"
);
try
{
TimeUnit
.
MILLISECONDS
.
sleep
(
1000
);
...
...
@@ -385,11 +385,12 @@ public class RestTemplateService {
/**
* 鸿程 浙江杭州规划和自然资源局不动产权属查询
*
* @param paramMap
* @param apiMethod
* @param apiDesc
*/
public
ResponseEntity
hongChengSendRequest
(
Map
<
String
,
Object
>
paramMap
,
String
apiMethod
,
String
apiDesc
)
throws
UnsupportedEncodingException
{
public
ResponseEntity
<
String
>
hongChengSendRequest
(
Map
<
String
,
Object
>
paramMap
,
String
apiMethod
,
String
apiDesc
)
throws
UnsupportedEncodingException
{
String
url
=
hongchengAddress
+
apiMethod
;
...
...
@@ -422,4 +423,32 @@ public class RestTemplateService {
return
responseEntity
;
}
/**
* 鸿程 发送请求
*
* @param paramMap
* @param apiMethod
* @param apiDesc
*/
public
ResponseEntity
<
String
>
hongChengSendRequest2
(
MultiValueMap
<
String
,
Object
>
paramMap
,
String
apiMethod
,
String
apiDesc
)
{
String
url
=
hongchengAddress
+
apiMethod
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
paramMap
.
add
(
"appSecret"
,
hongchengAppSecret
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
httpEntity
=
new
HttpEntity
<>(
paramMap
,
headers
);
log
.
info
(
"api描述:{}"
,
apiDesc
);
log
.
info
(
"api url:{}"
,
url
);
log
.
info
(
"原参数:{}"
,
paramMap
);
// 发送请求
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
httpEntity
,
String
.
class
);
log
.
info
(
"api response:{}"
,
responseEntity
);
return
responseEntity
;
}
}
\ No newline at end of file
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