|  |  | @ -2,24 +2,38 @@ package com.glxp.sale.admin.idc.controller; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.BufferedReader; |  |  |  | import java.io.BufferedReader; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.IOException; |  |  |  | import java.io.IOException; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.io.InputStream; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.InputStreamReader; |  |  |  | import java.io.InputStreamReader; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.net.URISyntaxException; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.nio.file.Files; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.nio.file.Paths; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Enumeration; |  |  |  | import java.util.Enumeration; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.HashMap; |  |  |  | import java.util.HashMap; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Map; |  |  |  | import java.util.Map; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.Objects; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.servlet.http.HttpServletRequest; |  |  |  | import javax.servlet.http.HttpServletRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.servlet.http.HttpServletResponse; |  |  |  | import javax.servlet.http.HttpServletResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpEntity; |  |  |  | import cn.hutool.core.io.IoUtil; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpHeaders; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpMethod; |  |  |  | import com.glxp.sale.admin.idc.service.DownloadRestTemplate; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.ResponseEntity; |  |  |  | import com.glxp.sale.admin.service.param.SystemParamConfigService; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.apache.tomcat.util.http.fileupload.IOUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.beans.factory.annotation.Qualifier; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.http.*; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.http.client.ClientHttpRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.util.LinkedMultiValueMap; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.util.MultiValueMap; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.RequestBody; |  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; |  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.RequestParam; |  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.ResponseBody; |  |  |  | import org.springframework.web.bind.annotation.ResponseBody; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.RestController; |  |  |  | import org.springframework.web.bind.annotation.RestController; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.web.client.RequestCallback; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.client.RestTemplate; |  |  |  | import org.springframework.web.client.RestTemplate; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.multipart.MultipartFile; |  |  |  | import org.springframework.web.multipart.MultipartFile; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -29,9 +43,6 @@ import com.glxp.sale.admin.idc.dao.DbDao; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.sale.admin.idc.service.IdcService; |  |  |  | import com.glxp.sale.admin.idc.service.IdcService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.sale.common.res.BaseResponse; |  |  |  | import com.glxp.sale.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.io.IoUtil; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import lombok.extern.slf4j.Slf4j; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  * 中继服务接口 |  |  |  |  * 中继服务接口 | 
			
		
	
	
		
		
			
				
					|  |  | @ -86,6 +97,16 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public Object mapi(HttpServletRequest request, HttpServletResponse httpServletResponse) { |  |  |  |     public Object mapi(HttpServletRequest request, HttpServletResponse httpServletResponse) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         String uri = parseUri(request.getRequestURL().toString()); |  |  |  |         String uri = parseUri(request.getRequestURL().toString()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             uri = uri.replace("mapi/", ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_host"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (StrUtil.isNotEmpty(upperServerHost)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             uri = upperServerHost + "/" + uri; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (uri.contains("getImage")) { |  |  |  |         if (uri.contains("getImage")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return redirectIamge(request, httpServletResponse, uri); |  |  |  |             return redirectIamge(request, httpServletResponse, uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
	
		
		
			
				
					|  |  | @ -137,8 +158,6 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     private byte[] redirectIamge(HttpServletRequest request, HttpServletResponse httpServletResponse, String uri) { |  |  |  |     private byte[] redirectIamge(HttpServletRequest request, HttpServletResponse httpServletResponse, String uri) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         uri = uri.replace("mapi/", ""); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         uri = "http://116.204.106.103:9150/UDI_SPMS_SERVER/" + uri; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  | //        HttpEntity<String> httpEntity = buildHeader(request);
 |  |  |  | //        HttpEntity<String> httpEntity = buildHeader(request);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         log.info(request.getMethod()); |  |  |  |         log.info(request.getMethod()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -185,14 +204,15 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     SystemParamConfigService systemParamConfigService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     private JSONObject redirect(HttpServletRequest request, String uri) { |  |  |  |     private JSONObject redirect(HttpServletRequest request, String uri) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         RestTemplate restTemplate = new RestTemplate(); |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpEntity<String> httpEntity = buildHeader(request); |  |  |  |         HttpEntity<String> httpEntity = buildHeader(request); | 
			
		
	
		
		
			
				
					
					|  |  |  |         log.info(uri); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         uri = uri.replace("mapi/", ""); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         uri = "http://116.204.106.103:9150/UDI_SPMS_SERVER/" + uri; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         log.info(uri); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         ResponseEntity<JSONObject> responseBody = null; |  |  |  |         ResponseEntity<JSONObject> responseBody = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (request.getMethod().equals("POST")) |  |  |  |         if (request.getMethod().equals("POST")) | 
			
		
	
		
		
			
				
					
					|  |  |  |             responseBody = restTemplate.postForEntity(uri, httpEntity, JSONObject.class); |  |  |  |             responseBody = restTemplate.postForEntity(uri, httpEntity, JSONObject.class); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |