kimi
2020-05-23 82fbbf24939e150ee3cef90dc0dd843c9897a7e6
src/main/java/com/highdatas/mdm/util/RuleClient.java
@@ -14,6 +14,7 @@
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
@@ -39,10 +40,11 @@
    public HashMap<String,Boolean> execuImmeForCollect(String tableName,String userId) {
        //TODO
        String url = this.url + prefix + "execuImmeForCollect";
        HashMap<String, String> params = new HashMap<>();
        HashMap<String, Object> params = new HashMap<>();
        params.put("tableName",tableName);
        params.put("createUserId",tableName);
        String s = HttpRestClient(url, HttpMethod.POST, params, null, null);
        params.put("createUserId",userId);
        String urlParamsByMap = HttpUtils.getUrlParamsByMap(params);
        String s = HttpUtils.HttpRestClient(url, HttpMethod.POST, null, urlParamsByMap, null);
        JSONObject result = (JSONObject) JSON.parse(s);
        String sucess = result.getString(Constant.Success);
        JSONObject dataObject = result.getJSONObject(Constant.Data);
@@ -78,7 +80,7 @@
        params.put("tableName",tableName);
        params.put("pageNum",pageNo.toString());
        params.put("pageSize",pageSize.toString());
        String s = HttpRestClient(url, HttpMethod.POST, params, null, null);
        String s = HttpUtils.HttpRestClient(url, HttpMethod.POST, params, null, null);
        JSONObject result = (JSONObject) JSON.parse(s);
        String sucess = result.getString(Constant.Success);
        if (StringUtils.isEmpty(sucess) || !Boolean.valueOf(sucess)) {
@@ -94,7 +96,7 @@
        params.put("tableName",tableName);
        params.put("isTemp",isTemp);
        String s = HttpRestClient(url, HttpMethod.POST, params,null, MediaType.APPLICATION_JSON);
        String s = HttpUtils.HttpRestClient(url, HttpMethod.POST, params,null, MediaType.APPLICATION_JSON);
        JSONObject result = (JSONObject) JSON.parse(s);
        boolean sucess = result.getBoolean(Constant.Success);
        if (!sucess) {
@@ -120,7 +122,7 @@
    }
    public String HttpRestClient(String url, HttpMethod method, HashMap<String, String> formParams, String getParams,  MediaType mediaType) {
    public String HttpRestClient(String url, HttpMethod method, MultiValueMap<String, String> formParams, String getParams,  MediaType mediaType) {
        if (!StringUtils.isEmpty(getParams)) {
            url = url + Constant.QUESTION + getParams;
        }
@@ -136,7 +138,7 @@
            headers.setContentType(mediaType);
        }
        HttpEntity<HashMap<String, String>> requestEntity = new HttpEntity<HashMap<String, String>>(formParams, headers);
        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(formParams, headers);
        //  执行HTTP请求
        ResponseEntity<String> response = client.exchange(url, method, requestEntity, String.class);