企查查接口对接

/ 2026-01-05

@Slf4j
@Data
@Component
public class QccUtil {


  1. private static QccUtil instance;
  2. @Value("${qcc.app-key}")
  3. private String APP_KEY;
  4. @Value("${qcc.secret-key}")
  5. private String SECRET_KEY;
  6. @Value("${qcc.base-url}")
  7. private String BASE_URL;
  8. @Value("${qcc.GetBasicDetailsByName}")
  9. private String ECIV4_GET_BASIC_DETAILS_BY_NAME;
  10. @Value("${qcc.GetComList}")
  11. private String COM_LIST;
  12. @PostConstruct
  13. public void init() {
  14. instance = this;
  15. }
  16. /**
  17. * 查询企业基本信息 410 接口 暂不使用
  18. * @param searchKey 企业名称关键字
  19. * @return 接口响应结果
  20. */
  21. public static QccResponse getComList(String searchKey) {
  22. String reqInterNme = instance.BASE_URL + instance.COM_LIST;
  23. String paramStr = "searchKey=" + searchKey;
  24. try {
  25. String[] autherHeader = RandomAuthentHeader();
  26. final String reqUri = reqInterNme.concat("?key=").concat(instance.APP_KEY).concat("&").concat(paramStr);
  27. HttpResponse response = HttpRequest.get(reqUri)
  28. .header("Token", autherHeader[0])
  29. .header("Timespan", autherHeader[1])
  30. .execute();
  31. return JSON.parseObject(response.body(), QccResponse.class);
  32. } catch (Exception e) {
  33. log.error("errors happened in getBasicDetailsByName,{}.",e.getMessage());
  34. return new QccResponse();
  35. }
  36. }
  37. public static QccResponse getComList(String searchKey, String path) {
  38. String reqInterNme = instance.BASE_URL + path;
  39. String paramStr = "searchKey=" + searchKey;
  40. try {
  41. String[] autherHeader = RandomAuthentHeader();
  42. final String reqUri = reqInterNme.concat("?key=").concat(instance.APP_KEY).concat("&").concat(paramStr);
  43. HttpResponse response = HttpRequest.get(reqUri)
  44. .header("Token", autherHeader[0])
  45. .header("Timespan", autherHeader[1])
  46. .execute();
  47. return JSON.parseObject(response.body(), QccResponse.class);
  48. } catch (Exception e) {
  49. log.error("errors happened in getBasicDetailsByName,{}.",e.getMessage());
  50. return new QccResponse();
  51. }
  52. }
  53. public static QccResponse getDetail(String id, String path) {
  54. String reqInterNme = instance.BASE_URL + path;
  55. String paramStr = "id=" + id;
  56. try {
  57. String[] autherHeader = RandomAuthentHeader();
  58. final String reqUri = reqInterNme.concat("?key=").concat(instance.APP_KEY).concat("&").concat(paramStr);
  59. HttpResponse response = HttpRequest.get(reqUri)
  60. .header("Token", autherHeader[0])
  61. .header("Timespan", autherHeader[1])
  62. .execute();
  63. return JSON.parseObject(response.body(), QccResponse.class);
  64. } catch (Exception e) {
  65. log.error("errors happened in getBasicDetailsByName,{}.",e.getMessage());
  66. return new QccResponse();
  67. }
  68. }
  69. // 获取Auth Code
  70. private static String[] RandomAuthentHeader() {
  71. String timeSpan = String.valueOf(System.currentTimeMillis() / 1000);
  72. String[] authentHeaders = new String[] {
  73. DigestUtils.md5Hex(instance.APP_KEY.concat(timeSpan).concat(instance.SECRET_KEY)).toUpperCase(),
  74. timeSpan
  75. };
  76. return authentHeaders;
  77. }

}


转载请注明作者和出处,并添加本页链接。
原文链接: //pongpongkai.top/180

皖ICP备2025092356号-1 | 沪公网安备31011202021249号