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
bba9d0f4
Commit
bba9d0f4
authored
Aug 27, 2020
by
张欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接企查查接口
parent
fecf773c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
QccController.java
.../java/com/mth/requestsecret/controller/QccController.java
+10
-6
No files found.
src/main/java/com/mth/requestsecret/controller/QccController.java
View file @
bba9d0f4
...
@@ -4,6 +4,7 @@ package com.mth.requestsecret.controller;
...
@@ -4,6 +4,7 @@ package com.mth.requestsecret.controller;
import
com.mth.requestsecret.util.QccHttpUtil
;
import
com.mth.requestsecret.util.QccHttpUtil
;
import
com.mth.requestsecret.util.QccUtil
;
import
com.mth.requestsecret.util.QccUtil
;
import
org.apache.http.client.methods.HttpHead
;
import
org.apache.http.client.methods.HttpHead
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -32,7 +33,7 @@ public class QccController {
...
@@ -32,7 +33,7 @@ public class QccController {
* @return
* @return
*/
*/
@GetMapping
(
"/qiyeSearch"
)
@GetMapping
(
"/qiyeSearch"
)
public
ResponseEntity
<
String
>
qiyeSearch
(
@RequestParam
String
keyword
)
throws
Exception
{
public
ResponseEntity
<
JSONObject
>
qiyeSearch
(
@RequestParam
String
keyword
)
throws
Exception
{
String
interfaceUrl
=
"http://api.qichacha.com/ECIV4/Search"
;
String
interfaceUrl
=
"http://api.qichacha.com/ECIV4/Search"
;
HttpHead
reqHeader
=
new
HttpHead
();
HttpHead
reqHeader
=
new
HttpHead
();
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
...
@@ -40,8 +41,9 @@ public class QccController {
...
@@ -40,8 +41,9 @@ public class QccController {
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&keyword="
).
concat
(
keyword
);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&keyword="
).
concat
(
keyword
);
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
JSONObject
jObject
=
new
JSONObject
(
resultJson
);
log
.
info
(
"企查查企业查询接口返回结果为:"
+
resultJson
);
log
.
info
(
"企查查企业查询接口返回结果为:"
+
resultJson
);
return
new
ResponseEntity
<
String
>(
resultJson
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
JSONObject
>(
jObject
,
HttpStatus
.
OK
);
}
}
...
@@ -51,7 +53,7 @@ public class QccController {
...
@@ -51,7 +53,7 @@ public class QccController {
* @return
* @return
*/
*/
@GetMapping
(
"/qiyePartnerInfoQuery"
)
@GetMapping
(
"/qiyePartnerInfoQuery"
)
public
ResponseEntity
<
String
>
qiyePartnerInfoQuery
(
@RequestParam
String
keyword
)
throws
Exception
{
public
ResponseEntity
<
JSONObject
>
qiyePartnerInfoQuery
(
@RequestParam
String
keyword
)
throws
Exception
{
String
interfaceUrl
=
"http://api.qichacha.com/ECIPartner/GetList"
;
String
interfaceUrl
=
"http://api.qichacha.com/ECIPartner/GetList"
;
HttpHead
reqHeader
=
new
HttpHead
();
HttpHead
reqHeader
=
new
HttpHead
();
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
...
@@ -59,8 +61,9 @@ public class QccController {
...
@@ -59,8 +61,9 @@ public class QccController {
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&searchKey="
).
concat
(
keyword
);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&searchKey="
).
concat
(
keyword
);
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
JSONObject
jObject
=
new
JSONObject
(
resultJson
);
log
.
info
(
"企查查企业股东信息查询接口返回结果为:"
+
resultJson
);
log
.
info
(
"企查查企业股东信息查询接口返回结果为:"
+
resultJson
);
ResponseEntity
<
String
>
result
=
new
ResponseEntity
<
String
>(
resultJson
,
HttpStatus
.
OK
);
ResponseEntity
<
JSONObject
>
result
=
new
ResponseEntity
<
JSONObject
>(
jObject
,
HttpStatus
.
OK
);
return
result
;
return
result
;
}
}
...
@@ -72,7 +75,7 @@ public class QccController {
...
@@ -72,7 +75,7 @@ public class QccController {
* @return
* @return
*/
*/
@GetMapping
(
"/personHisOperCompany"
)
@GetMapping
(
"/personHisOperCompany"
)
public
ResponseEntity
<
String
>
personHisOperCompany
(
@RequestParam
String
searchKey
,
@RequestParam
String
personName
)
throws
Exception
{
public
ResponseEntity
<
JSONObject
>
personHisOperCompany
(
@RequestParam
String
searchKey
,
@RequestParam
String
personName
)
throws
Exception
{
String
interfaceUrl
=
"http://api.qichacha.com/PersonHisOperCompany/GetList"
;
String
interfaceUrl
=
"http://api.qichacha.com/PersonHisOperCompany/GetList"
;
HttpHead
reqHeader
=
new
HttpHead
();
HttpHead
reqHeader
=
new
HttpHead
();
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
String
[]
autherHeader
=
QccUtil
.
RandomAuthentHeader
(
appkey
,
seckey
);
...
@@ -80,8 +83,9 @@ public class QccController {
...
@@ -80,8 +83,9 @@ public class QccController {
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
reqHeader
.
setHeader
(
"Timespan"
,
autherHeader
[
1
]);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&searchKey="
).
concat
(
searchKey
).
concat
(
"&personName="
).
concat
(
personName
);
String
reqUri
=
interfaceUrl
.
concat
(
"?key="
).
concat
(
appkey
).
concat
(
"&searchKey="
).
concat
(
searchKey
).
concat
(
"&personName="
).
concat
(
personName
);
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
String
resultJson
=
QccHttpUtil
.
httpGet
(
reqUri
,
reqHeader
.
getAllHeaders
());
JSONObject
jObject
=
new
JSONObject
(
resultJson
);
log
.
info
(
"个人历史担任法人企业查询接口返回结果为:"
+
resultJson
);
log
.
info
(
"个人历史担任法人企业查询接口返回结果为:"
+
resultJson
);
return
new
ResponseEntity
<
String
>(
resultJson
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
JSONObject
>(
jObject
,
HttpStatus
.
OK
);
}
}
...
...
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