|  |  | @ -6,9 +6,12 @@ import java.util.Map; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.servlet.http.HttpServletRequest; |  |  |  | import javax.servlet.http.HttpServletRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.servlet.http.HttpServletResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpEntity; |  |  |  | import org.springframework.http.HttpEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.HttpHeaders; |  |  |  | import org.springframework.http.HttpHeaders; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.http.HttpMethod; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.http.ResponseEntity; |  |  |  | import org.springframework.http.ResponseEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | 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; | 
			
		
	
	
		
		
			
				
					|  |  | @ -28,12 +31,14 @@ import com.glxp.sale.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  * 中继服务接口 |  |  |  |  * 中继服务接口 | 
			
		
	
		
		
			
				
					
					|  |  |  |  */ |  |  |  |  */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @Slf4j | 
			
		
	
		
		
			
				
					
					|  |  |  | @RestController |  |  |  | @RestController | 
			
		
	
		
		
			
				
					
					|  |  |  | public class IdcController { |  |  |  | public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IdcService idcService; |  |  |  |     IdcService idcService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     DbDao dbDao; |  |  |  |     DbDao dbDao; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /*通用上传接口*/ |  |  |  |     /*通用上传接口*/ | 
			
		
	
		
		
			
				
					
					|  |  |  |     //@Log("中继服务数据接收,下级往上级上传")
 |  |  |  |     //@Log("中继服务数据接收,下级往上级上传")
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @RequestMapping(value = "/spssync/common/upload") |  |  |  |     @RequestMapping(value = "/spssync/common/upload") | 
			
		
	
	
		
		
			
				
					|  |  | @ -43,6 +48,7 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //
 |  |  |  |         //
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return idcService.receive("U", request, content, files); |  |  |  |         return idcService.receive("U", request, content, files); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /*通用下发接口*/ |  |  |  |     /*通用下发接口*/ | 
			
		
	
		
		
			
				
					
					|  |  |  |     //@Log("中继服务数据接收,上级往下级下发")
 |  |  |  |     //@Log("中继服务数据接收,上级往下级下发")
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @RequestMapping(value = "/spssync/common/issued") |  |  |  |     @RequestMapping(value = "/spssync/common/issued") | 
			
		
	
	
		
		
			
				
					|  |  | @ -81,20 +87,20 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @RequestMapping("/mapi/**") |  |  |  |     @RequestMapping("/mapi/**") | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public JSONObject mapi(HttpServletRequest request) { |  |  |  |     public Object mapi(HttpServletRequest request) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String uri = parseUri(request.getRequestURL().toString()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return redirect(request);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |  |  |  |         if (uri.contains("image")) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return redirectIamge(request, uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return redirect(request, uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 	@RequestMapping("/zapi/**") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public JSONObject zapi(HttpServletRequest request) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return redirect(request);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private  JSONObject redirect(HttpServletRequest request) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String uri = parseUri(request.getRequestURL().toString()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		RestTemplate restTemplate = new RestTemplate(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     HttpEntity<String> buildHeader(HttpServletRequest request) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(request.getMethod()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, Object> headerParam = new HashMap<>(); |  |  |  |         Map<String, Object> headerParam = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, Object> bodyParam = new HashMap<String, Object>(); |  |  |  |         Map<String, Object> bodyParam = new HashMap<String, Object>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Enumeration pNames = request.getParameterNames(); |  |  |  |         Enumeration pNames = request.getParameterNames(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -111,20 +117,72 @@ public class IdcController { | 
			
		
	
		
		
			
				
					
					|  |  |  |             headerParam.put(name, value); |  |  |  |             headerParam.put(name, value); | 
			
		
	
		
		
			
				
					
					|  |  |  |             headers.add(name, value); |  |  |  |             headers.add(name, value); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	     |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         //headers.add("Content-Type", "application/json;charset=UTF-8");
 |  |  |  |         //headers.add("Content-Type", "application/json;charset=UTF-8");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         HttpEntity<String> http = new HttpEntity<>(JSON.toJSONString(bodyParam), headers); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return http; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	    System.out.print(JSON.toJSONString(headerParam)); |  |  |  |     private Resource redirectIamge(HttpServletRequest request, String uri) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	    System.out.print(JSON.toJSONString(bodyParam)); |  |  |  |         uri = uri.replace("mapi/", ""); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         uri = "http://127.0.0.1:9993/" + uri; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        HttpEntity<String> httpEntity = buildHeader(request);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(request.getMethod()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, Object> headerParam = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, Object> bodyParam = new HashMap<String, Object>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Enumeration pNames = request.getParameterNames(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String parm = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         while (pNames.hasMoreElements()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             String name = (String) pNames.nextElement(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             String value = request.getParameter(name); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             bodyParam.put(name, value); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             parm = parm + name + "=" + value + "&"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         uri = uri + "?" + parm.substring(0, parm.length() - 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         HttpHeaders headers = new HttpHeaders(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Enumeration<String> enumeration = request.getHeaderNames(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         while (enumeration.hasMoreElements()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             String name = enumeration.nextElement(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             String value = request.getHeader(name); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             headerParam.put(name, value); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             headers.add(name, value); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //headers.add("Content-Type", "application/json;charset=UTF-8");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         HttpEntity<String> http = new HttpEntity<>(JSON.toJSONString(bodyParam), headers); |  |  |  |         HttpEntity<String> http = new HttpEntity<>(JSON.toJSONString(bodyParam), headers); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	    ResponseEntity<JSONObject> responseBody = restTemplate.postForEntity("http://127.0.0.1:8090/"+uri, http, JSONObject.class); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        ResponseEntity<Resource> entity = restTemplate.exchange(uri, HttpMethod.GET, httpEntity, Resource.class);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ResponseEntity<Resource> responseEntity = restTemplate.exchange(uri, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 HttpMethod.GET, http, Resource.class, new Object[0]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        ResponseEntity<HttpServletResponse> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, http, HttpServletResponse.class);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return responseEntity.getBody(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private JSONObject redirect(HttpServletRequest request, String uri) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         RestTemplate restTemplate = new RestTemplate(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         HttpEntity<String> httpEntity = buildHeader(request); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         uri = uri.replace("mapi/", ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         uri = "http://127.0.0.1:9993/" + uri; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         log.info(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ResponseEntity<JSONObject> responseBody = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (request.getMethod().equals("POST")) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             responseBody = restTemplate.postForEntity(uri, httpEntity, JSONObject.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         else if (request.getMethod().equals("GET")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             responseBody = restTemplate.exchange(uri, HttpMethod.GET, httpEntity, JSONObject.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else if (request.getMethod().equals("PUT")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             responseBody = restTemplate.exchange(uri, HttpMethod.PUT, httpEntity, JSONObject.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else if (request.getMethod().equals("DELETE")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             responseBody = restTemplate.exchange(uri, HttpMethod.DELETE, httpEntity, JSONObject.class); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         JSONObject result = responseBody.getBody(); |  |  |  |         JSONObject result = responseBody.getBody(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return result; |  |  |  |         return result; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private String parseUri(String url) { |  |  |  |     private String parseUri(String url) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         String uri = url; |  |  |  |         String uri = url; | 
			
		
	
		
		
			
				
					
					|  |  |  |         int a1 = uri.indexOf("://"); |  |  |  |         int a1 = uri.indexOf("://"); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |