From d9765e031e100e1d8eea34e086cb9c81766e1a00 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 21 二月 2025 09:52:14 +0800 Subject: [PATCH] 针对王江海制定的协议: 1、优化相关注释; 2、优化代码; 3、协议中报警信息有变化:外门报警改为电池电压报警、增加阀门开关状态、增加阀门堵转报警等。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 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 660982d..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; @@ -105,6 +102,8 @@ .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 { @@ -112,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