| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2,7 +2,9 @@ package com.glxp.sale.admin.controller.sync;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import cn.hutool.core.util.StrUtil;
 | 
					 | 
					 | 
					 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import cn.hutool.http.HttpUtil;
 | 
					 | 
					 | 
					 | 
					import cn.hutool.http.HttpUtil;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import cn.hutool.json.JSONException;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import cn.hutool.json.JSONUtil;
 | 
					 | 
					 | 
					 | 
					import cn.hutool.json.JSONUtil;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONArray;
 | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONArray;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONObject;
 | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONObject;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.sale.admin.constant.BasicProcessStatus;
 | 
					 | 
					 | 
					 | 
					import com.glxp.sale.admin.constant.BasicProcessStatus;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -21,9 +23,7 @@ import com.glxp.sale.common.util.ResultVOUtils;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j;
 | 
					 | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.apache.poi.ss.formula.functions.T;
 | 
					 | 
					 | 
					 | 
					import org.apache.poi.ss.formula.functions.T;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
					 | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.http.HttpEntity;
 | 
					 | 
					 | 
					 | 
					import org.springframework.http.*;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.http.HttpMethod;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.http.ResponseEntity;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.scheduling.annotation.Async;
 | 
					 | 
					 | 
					 | 
					import org.springframework.scheduling.annotation.Async;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.GetMapping;
 | 
					 | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.GetMapping;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.PostMapping;
 | 
					 | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.PostMapping;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -37,8 +37,14 @@ import javax.servlet.http.HttpServletResponse;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import javax.servlet.http.PushBuilder;
 | 
					 | 
					 | 
					 | 
					import javax.servlet.http.PushBuilder;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.io.BufferedReader;
 | 
					 | 
					 | 
					 | 
					import java.io.BufferedReader;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.io.IOException;
 | 
					 | 
					 | 
					 | 
					import java.io.IOException;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.io.UnsupportedEncodingException;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.net.URISyntaxException;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.net.URLDecoder;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.Date;
 | 
					 | 
					 | 
					 | 
					import java.util.Date;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.HashMap;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.List;
 | 
					 | 
					 | 
					 | 
					import java.util.List;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.Map;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/**
 | 
					 | 
					 | 
					 | 
					/**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * 中继服务接口  直连
 | 
					 | 
					 | 
					 | 
					 * 中继服务接口  直连
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -182,13 +188,17 @@ public class SyncController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String isTopService = systemParamConfigService.selectValueByParamKey("is_top_aliService");
 | 
					 | 
					 | 
					 | 
					        String isTopService = systemParamConfigService.selectValueByParamKey("is_top_aliService");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
 | 
					 | 
					 | 
					 | 
					        if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            uri = uri.replace("syncToAliapi/", "");
 | 
					 | 
					 | 
					 | 
					            uri = uri.replace("syncToAliapi/", "");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            uri = uri.replace("syncToAliapi", "");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String upperServerHost = systemParamConfigService.selectValueByParamKey("aliApi_server_ip");
 | 
					 | 
					 | 
					 | 
					        String upperServerHost = systemParamConfigService.selectValueByParamKey("aliApi_server_ip");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (StrUtil.isNotEmpty(upperServerHost)) {
 | 
					 | 
					 | 
					 | 
					        if (StrUtil.isNotEmpty(upperServerHost)) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (StrUtil.isNotEmpty(uri)){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                uri = upperServerHost + "/" + uri;
 | 
					 | 
					 | 
					 | 
					                uri = upperServerHost + "/" + uri;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                uri = upperServerHost;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        uri = changeUri(uri);
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        JSONObject jsonObject = redirect(request, uri);
 | 
					 | 
					 | 
					 | 
					        JSONObject jsonObject = redirectAliApi(request, uri);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return jsonObject;
 | 
					 | 
					 | 
					 | 
					        return jsonObject;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -250,6 +260,51 @@ public class SyncController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return result;
 | 
					 | 
					 | 
					 | 
					        return result;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private JSONObject redirectAliApi(HttpServletRequest request, String uri) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 创建HTTP头,可以从原始请求中复制一些头信息
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        HttpHeaders headers = new HttpHeaders();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 例如,复制Content-Type头(如果需要)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        String contentType = request.getContentType() != null ? request.getContentType().toString() : "application/json";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        headers.setContentType(MediaType.parseMediaType(contentType));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 如果需要,还可以添加其他头信息,如Authorization等
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 创建HttpEntity,包含头和可能的请求体(这里假设是GET请求,所以没有请求体)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        HttpEntity<String> entity = new HttpEntity<>(headers);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        RestTemplate restTemplate = new RestTemplate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        String queryString = request.getQueryString();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, Object> queryMap = null;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        try {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            queryMap = parseQueryString(queryString);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } catch (URISyntaxException e) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            e.printStackTrace();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } catch (UnsupportedEncodingException e) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            e.printStackTrace();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (request.getMethod().equals("POST")) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            String json = HttpUtil.post(uri,queryMap);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return JSONObject.parseObject(json);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } else if (request.getMethod().equals("GET")) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            String json = HttpUtil.get(uri,queryMap);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return JSONObject.parseObject(json);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return new JSONObject();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public static Map<String, Object> parseQueryString(String queryString) throws URISyntaxException, UnsupportedEncodingException {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, Object> queryParams = new HashMap<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        String[] pairs = queryString.split("&");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        for (String pair : pairs) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            int idx = pair.indexOf("=");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            String key = URLDecoder.decode(pair.substring(0, idx), StandardCharsets.UTF_8.toString());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            String value = URLDecoder.decode(pair.substring(idx + 1), StandardCharsets.UTF_8.toString());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            queryParams.put(key, value);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return queryParams;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private JSONObject redirect(HttpServletRequest request, String uri, String idDatas, String type) {
 | 
					 | 
					 | 
					 | 
					    private JSONObject redirect(HttpServletRequest request, String uri, String idDatas, String type) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        RestTemplate restTemplate = new RestTemplate();
 | 
					 | 
					 | 
					 | 
					        RestTemplate restTemplate = new RestTemplate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        HttpEntity<String> httpEntity = uriUtils.buildHeader(request);
 | 
					 | 
					 | 
					 | 
					        HttpEntity<String> httpEntity = uriUtils.buildHeader(request);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |