From 82fbbf24939e150ee3cef90dc0dd843c9897a7e6 Mon Sep 17 00:00:00 2001 From: kimi <kimi42345@gmail.com> Date: 星期六, 23 五月 2020 12:27:13 +0800 Subject: [PATCH] 添加 log前 去除bak文件前的备份 --- src/main/java/com/highdatas/mdm/util/RuleClient.java | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/highdatas/mdm/util/RuleClient.java b/src/main/java/com/highdatas/mdm/util/RuleClient.java index 513ac4e..16e61e5 100644 --- a/src/main/java/com/highdatas/mdm/util/RuleClient.java +++ b/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); -- Gitblit v1.8.0