doum
3 天以前 d352184d3364e379da38e56d6aa53c1f53f517ca
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/model/http/ApiClient.java
@@ -1,5 +1,6 @@
package com.doumee.core.jiandaoyun.model.http;
import com.alibaba.fastjson.JSONObject;
import com.doumee.core.jiandaoyun.util.LimitUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
@@ -119,11 +120,12 @@
     */
    public Map<String, Object> sendPostRequest(HttpRequestParam param) throws Exception {
        if (param == null || StringUtils.isBlank(param.getPath())) {
            throw new RuntimeException("缺失参数!");
            throw new Exception("缺失参数!");
        }
        HttpClient client = getSSLHttpClient();
        Header[] headers = getHttpHeaders(this.getApiKey());
        String url = this.host + param.getPath();
        log.error("===简道云接口url:"+url);
        HttpRequestBase request = new HttpPost(url);
        // 请求参数
@@ -148,9 +150,11 @@
            result = (Map<String, Object>) mapper.readValue(response.getEntity().getContent(), Object.class);
        }
        if (statusCode >= 400) {
            throw new RuntimeException("请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
            log.error("===简道云接口:请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
            throw new Exception("请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
        } else {
            // 处理返回结果
            log.error("===简道云接口:请求成功result:" + JSONObject.toJSONString(result));
            return result;
        }
    }