Commit bba9d0f4 authored by 张欣's avatar 张欣

对接企查查接口

parent fecf773c
......@@ -4,6 +4,7 @@ package com.mth.requestsecret.controller;
import com.mth.requestsecret.util.QccHttpUtil;
import com.mth.requestsecret.util.QccUtil;
import org.apache.http.client.methods.HttpHead;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
......@@ -32,7 +33,7 @@ public class QccController {
* @return
*/
@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";
HttpHead reqHeader = new HttpHead();
String[] autherHeader = QccUtil.RandomAuthentHeader(appkey,seckey);
......@@ -40,8 +41,9 @@ public class QccController {
reqHeader.setHeader("Timespan", autherHeader[1]);
String reqUri = interfaceUrl.concat("?key=").concat(appkey).concat("&keyword=").concat(keyword);
String resultJson = QccHttpUtil.httpGet(reqUri, reqHeader.getAllHeaders());
JSONObject jObject = new JSONObject(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 {
* @return
*/
@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";
HttpHead reqHeader = new HttpHead();
String[] autherHeader = QccUtil.RandomAuthentHeader(appkey,seckey);
......@@ -59,8 +61,9 @@ public class QccController {
reqHeader.setHeader("Timespan", autherHeader[1]);
String reqUri = interfaceUrl.concat("?key=").concat(appkey).concat("&searchKey=").concat(keyword);
String resultJson = QccHttpUtil.httpGet(reqUri, reqHeader.getAllHeaders());
JSONObject jObject = new JSONObject(resultJson);
log.info("企查查企业股东信息查询接口返回结果为:"+resultJson);
ResponseEntity<String> result = new ResponseEntity<String>(resultJson, HttpStatus.OK);
ResponseEntity<JSONObject> result = new ResponseEntity<JSONObject>(jObject, HttpStatus.OK);
return result;
}
......@@ -72,7 +75,7 @@ public class QccController {
* @return
*/
@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";
HttpHead reqHeader = new HttpHead();
String[] autherHeader = QccUtil.RandomAuthentHeader(appkey,seckey);
......@@ -80,8 +83,9 @@ public class QccController {
reqHeader.setHeader("Timespan", autherHeader[1]);
String reqUri = interfaceUrl.concat("?key=").concat(appkey).concat("&searchKey=").concat(searchKey).concat("&personName=").concat(personName);
String resultJson = QccHttpUtil.httpGet(reqUri, reqHeader.getAllHeaders());
JSONObject jObject = new JSONObject(resultJson);
log.info("个人历史担任法人企业查询接口返回结果为:"+resultJson);
return new ResponseEntity<String>(resultJson, HttpStatus.OK);
return new ResponseEntity<JSONObject>(jObject, HttpStatus.OK);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment