| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Object getEntityPipeInfo(EntityTypeInfo entityTypeInfo) { |
| | | HashMap<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | String token = (String) CaffeineHelper.get(CacheConstants.USER_CACHE_KEY + "entity_db_token"); |
| | | log.info("token = " + token); |
| | | // 添加form参数 |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | // e7e2af87096c45e0a14c0a4855cb0b90 |
| | | params.put("token", token); |
| | | params.put("start", Objects.nonNull(entityTypeInfo.getStart()) ? entityTypeInfo.getStart() : 1); |
| | | params.put("containCount", true); |
| | | params.put("count", Objects.nonNull(entityTypeInfo.getCount()) ? entityTypeInfo.getCount() : 20); |
| | | params.put("dbid", Objects.nonNull(entityTypeInfo.getDbid()) ? entityTypeInfo.getDbid() : "85257774fdb64e5f99f6778696cad02a"); |
| | | params.put("layerid", "1e677d48-8dff-4975-b9a0-c16500193629"); |
| | | params.put("like", ""); |
| | | params.put("querytype", "entity"); |
| | | |
| | | CompletableFuture<String> postResponse = CustomWebClient.postAsFuture(queryUrl, params, headers, String.class); |
| | | // 异步处理响应 |
| | | postResponse.thenAccept(response -> { |
| | | log.info("response: {}", response); |
| | | if (response.contains("code")) { |
| | | try { |
| | | JSONObject postResponseJson = JSONObject.parseObject(response); |
| | | int statusCode = postResponseJson.getIntValue("code"); |
| | | log.info("statusCode = " + statusCode); |
| | | String data = postResponseJson.getString("data"); |
| | | log.info("getEntityTypeInfo = " + data); |
| | | } catch (Exception e) { |
| | | log.info("Failed to parse JSON: " + e.getMessage()); |
| | | } |
| | | } else { |
| | | log.info("No 'code' field in the response: " + response); |
| | | } |
| | | }); |
| | | return JSONObject.parseObject(postResponse.join()); |
| | | } |
| | | |
| | | |
| | | } |