| | |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | public ResponseEntity<String> doApi(String body, Map<String, String> headers, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | 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()); |
| | | headers.remove("user-id"); |
| | | headers.remove("user_id"); |
| | | headers.put("user-id", result.getUserId()); |
| | | headers.put("user_id", result.getUserId()); |
| | | if (!StringUtil.isEmpty(result.getUserName())) { |
| | | header.add("user-name", URLEncoder.encode(result.getUserName(), "UTF-8")); |
| | | headers.put("user-name", URLEncoder.encode(result.getUserName(), "UTF-8")); |
| | | } |
| | | } |
| | | header.add("store-id", result.getStoreId()); |
| | | |
| | | if (!headers.containsKey("user_id")) { |
| | | headers.put("user_id", "-1"); |
| | | } |
| | | if (!headers.containsKey("user-id")) { |
| | | headers.put("user-id", "-1"); |
| | | } |
| | | headers.put("store-id", result.getStoreId()); |
| | | ResponseEntity<String> responseEntity = apiServiceSMOImpl.service(body, headers); |
| | | return responseEntity; |
| | | } |