|  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.core.annotation.Order; | 
 |  |  | import org.springframework.http.HttpEntity; | 
 |  |  | import org.springframework.http.HttpHeaders; | 
 |  |  | import org.springframework.http.HttpMethod; | 
 |  |  | import org.springframework.http.ResponseEntity; | 
 |  |  | import org.springframework.http.*; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  | import org.springframework.web.client.RestTemplate; | 
 |  |  | import org.springframework.web.util.UriComponentsBuilder; | 
 |  |  | 
 |  |  |                     .build() | 
 |  |  |                     .toUriString(); | 
 |  |  |             HttpHeaders headers = new HttpHeaders(); | 
 |  |  |             headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8")); | 
 |  |  |  | 
 |  |  |             HttpEntity<?> httpEntity = new HttpEntity<>(headers); | 
 |  |  |             ResponseEntity<SsoVo> response = null; | 
 |  |  |             try { | 
 |  |  | 
 |  |  |                 response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, SsoVo.class); | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |                 return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常"); | 
 |  |  |             } | 
 |  |  |             assert response != null; | 
 |  |  |             return response.getBody(); | 
 |  |  |             if(response == null){ | 
 |  |  |                 return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常"); | 
 |  |  |             }else{ | 
 |  |  |                 return response.getBody(); | 
 |  |  |             } | 
 |  |  |         }else { | 
 |  |  |             return BaseResponseUtils.buildError("后端系统出错,未得到SsoCheckUrl"); | 
 |  |  |         } |