1098226878
2021-09-06 8d0d2ac5db499a72cc029c6c5ced1d4f82c2c4d1
service-front/src/main/java/com/java110/front/smo/api/impl/ApiSMOImpl.java
@@ -12,11 +12,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
@@ -78,10 +74,18 @@
        HttpHeaders header = new HttpHeaders();
        IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA);
        for (String key : headers.keySet()
        ) {
            header.add(key, headers.get(key));
        }
        ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
        if (!StringUtil.isEmpty(result.getUserId())) {
            header.remove("user-id");
            header.add("user-id", result.getUserId());
            header.add("user-name", URLEncoder.encode(result.getUserName(), "UTF-8"));
            if (!StringUtil.isEmpty(result.getUserName())) {
                header.add("user-name", URLEncoder.encode(result.getUserName(), "UTF-8"));
            }
        }
        header.add("store-id", result.getStoreId());
@@ -102,11 +106,6 @@
            throw new IllegalArgumentException("不支持的请求方式" + headers.get(CommonConstant.HTTP_METHOD));
        }
        for (String key : headers.keySet()
        ) {
            header.add(key, headers.get(key));
        }
        HttpEntity<String> httpEntity = new HttpEntity<String>(body, header);
        logger.debug("请求后端url" + url);