From e2c28bc98587c6edd6a38f06b972ff51d998028f Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期三, 27 十一月 2024 08:52:05 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java index 2619ddc..5180006 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java @@ -14,10 +14,7 @@ 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; @@ -104,8 +101,9 @@ .queryParam("token", token) .build() .toUriString(); - // 鐢变簬鑾峰彇student鎺ュ彛鍜变滑璁剧疆浜哹asicauth锛屾墍浠ラ渶瑕佸湪璇锋眰鏃堕厤缃� HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8")); + HttpEntity<?> httpEntity = new HttpEntity<>(headers); ResponseEntity<SsoVo> response = null; try { @@ -113,9 +111,13 @@ 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"); } -- Gitblit v1.8.0