|  |  | @ -2,8 +2,7 @@ package com.glxp.api.admin.util; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.alibaba.fastjson.JSONObject; |  |  |  | import com.alibaba.fastjson.JSONObject; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.admin.entity.basic.BasicThirdSysEntity; |  |  |  | import com.glxp.api.admin.entity.basic.BasicThirdSysEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.slf4j.Logger; |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import org.slf4j.LoggerFactory; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpEntity; |  |  |  | import org.springframework.http.HttpEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpHeaders; |  |  |  | import org.springframework.http.HttpHeaders; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.util.LinkedMultiValueMap; |  |  |  | import org.springframework.util.LinkedMultiValueMap; | 
			
		
	
	
		
		
			
				
					|  |  | @ -17,13 +16,13 @@ import java.net.URLEncoder; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Iterator; |  |  |  | import java.util.Iterator; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Map; |  |  |  | import java.util.Map; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @Slf4j | 
			
		
	
		
		
			
				
					
					|  |  |  | public class HttpClient { |  |  |  | public class HttpClient { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private static final Logger logger = LoggerFactory.getLogger(HttpClient.class); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static String post(String url, Object object) { |  |  |  |     public static String post(String url, Object object) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String json = JSONObject.toJSON(object).toString(); |  |  |  |         String json = JSONObject.toJSON(object).toString(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(url + "\n" + json); |  |  |  |         log.info(url + "\n" + json); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>(); |  |  |  |         MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         postParameters.add("params", json); |  |  |  |         postParameters.add("params", json); | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpHeaders headers = new HttpHeaders(); |  |  |  |         HttpHeaders headers = new HttpHeaders(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -37,27 +36,27 @@ public class HttpClient { | 
			
		
	
		
		
			
				
					
					|  |  |  |         String json = JSONObject.toJSON(object).toString(); |  |  |  |         String json = JSONObject.toJSON(object).toString(); | 
			
		
	
		
		
			
				
					
					|  |  |  | //        MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
 |  |  |  | //        MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //        postParameters.add("params", json);
 |  |  |  | //        postParameters.add("params", json);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(url + "\n" + json); |  |  |  |         log.info(url + "\n" + json); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         HttpHeaders headers = new HttpHeaders(); |  |  |  |         HttpHeaders headers = new HttpHeaders(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         headers.add("Content-Type", "application/json"); |  |  |  |         headers.add("Content-Type", "application/json"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         headers.add("system", "1"); |  |  |  |         headers.add("system", "1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         headers.add("apicode", "1b723931cca84aee8ced6b607fc7dabb"); |  |  |  |         headers.add("apicode", "1b723931cca84aee8ced6b607fc7dabb"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); |  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String response = restTemplate.postForObject(url, httpEntity, String.class); |  |  |  |         String response = restTemplate.postForObject(url, httpEntity, String.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |         System.out.println(response); |  |  |  |         log.info(response); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return response; |  |  |  |         return response; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static String uCloudPost(String url, Object object) { |  |  |  |     public static String uCloudPost(String url, Object object) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String json = JSONObject.toJSON(object).toString(); |  |  |  |         String json = JSONObject.toJSON(object).toString(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(url + "\n" + json); |  |  |  |         log.info(url + "\n" + json); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         HttpHeaders headers = new HttpHeaders(); |  |  |  |         HttpHeaders headers = new HttpHeaders(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         headers.add("Content-Type", "application/json"); |  |  |  |         headers.add("Content-Type", "application/json"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); |  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(httpEntity.toString()); |  |  |  |         log.info(httpEntity.toString()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         String response = restTemplate.postForObject(url, httpEntity, String.class); |  |  |  |         String response = restTemplate.postForObject(url, httpEntity, String.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |         System.out.println(response); |  |  |  |         log.info(response); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return response; |  |  |  |         return response; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -72,7 +71,7 @@ public class HttpClient { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static String uCloudPost(String url, Object object, BasicThirdSysEntity basicThirdSysEntity) { |  |  |  |     public static String uCloudPost(String url, Object object, BasicThirdSysEntity basicThirdSysEntity) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String json = JSONObject.toJSON(object).toString(); |  |  |  |         String json = JSONObject.toJSON(object).toString(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(url + "\n" + json); |  |  |  |         log.info(url + "\n" + json); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         HttpHeaders headers = new HttpHeaders(); |  |  |  |         HttpHeaders headers = new HttpHeaders(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         headers.add("Content-Type", "application/json"); |  |  |  |         headers.add("Content-Type", "application/json"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (null != basicThirdSysEntity) { |  |  |  |         if (null != basicThirdSysEntity) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -80,17 +79,15 @@ public class HttpClient { | 
			
		
	
		
		
			
				
					
					|  |  |  |             headers.add("secret_key", basicThirdSysEntity.getSecretkey()); |  |  |  |             headers.add("secret_key", basicThirdSysEntity.getSecretkey()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); |  |  |  |         HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(httpEntity.toString()); |  |  |  |         log.info(httpEntity.toString()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         String response = restTemplate.postForObject(url, httpEntity, String.class); |  |  |  |         return restTemplate.postForObject(url, httpEntity, String.class); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         return response; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static String mipsGet(String url) { |  |  |  |     public static String mipsGet(String url) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String accessTokenRequestUrl = url;//"http://127.0.0.1:9997/mips/druginfo/list";
 |  |  |  |         String accessTokenRequestUrl = url;//"http://127.0.0.1:9997/mips/druginfo/list";
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         String response = restTemplate.getForObject(accessTokenRequestUrl, String.class); |  |  |  |         return restTemplate.getForObject(accessTokenRequestUrl, String.class); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         return response; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static String mipsGet(String url, Map params) { |  |  |  |     public static String mipsGet(String url, Map params) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -131,9 +128,8 @@ public class HttpClient { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (MalformedURLException e) { |  |  |  |         } catch (MalformedURLException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             e.printStackTrace(); |  |  |  |             e.printStackTrace(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info(accessTokenRequestUrl); |  |  |  |         log.info(accessTokenRequestUrl); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         String response = restTemplate.getForObject(accessTokenRequestUrl, String.class); |  |  |  |         return restTemplate.getForObject(accessTokenRequestUrl, String.class); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         return response; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |