| | |
| | | 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;
|
| | |
|
| | |
| | | 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);
|
| | |
| | | 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)) {
|
| | |
| | | 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) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | 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;
|
| | | }
|
| | |
| | | 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);
|
| | |
|