From 8ff3b2c30a4f9bb80ee59650264d28eb24e2e600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LI-CCONG=5C=E6=9D=8E=E8=81=AA=E8=81=AA?= <1441652193@qq.com> Date: Wed, 6 Mar 2024 14:24:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=A3=E6=88=B7=E4=B8=8B=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunxi/domain/vo/recycleorder/RecycleOrderCreateVO.java | 2 +- .../main/java/cc/yunxi/interceptor/LoginInterceptor.java | 6 +++++- .../java/cc/yunxi/service/impl/RecycleOrderServiceImpl.java | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nxhs-service/src/main/java/cc/yunxi/domain/vo/recycleorder/RecycleOrderCreateVO.java b/nxhs-service/src/main/java/cc/yunxi/domain/vo/recycleorder/RecycleOrderCreateVO.java index e437ad7..6cde15c 100644 --- a/nxhs-service/src/main/java/cc/yunxi/domain/vo/recycleorder/RecycleOrderCreateVO.java +++ b/nxhs-service/src/main/java/cc/yunxi/domain/vo/recycleorder/RecycleOrderCreateVO.java @@ -41,7 +41,7 @@ public class RecycleOrderCreateVO { @ApiModelProperty(value = "当前位置", required = true) @NotNull(message = "位置定位信息未授权") @Valid - private LocationDTO locationDTO; + private LocationDTO location; @ApiModelProperty(value = "预约上门时间起", required = true, example = "2024-03-01 15:58:49") @NotNull(message = "预约上门时间起不能为空") diff --git a/nxhs-service/src/main/java/cc/yunxi/interceptor/LoginInterceptor.java b/nxhs-service/src/main/java/cc/yunxi/interceptor/LoginInterceptor.java index 376cd58..4e65a17 100644 --- a/nxhs-service/src/main/java/cc/yunxi/interceptor/LoginInterceptor.java +++ b/nxhs-service/src/main/java/cc/yunxi/interceptor/LoginInterceptor.java @@ -29,10 +29,14 @@ public class LoginInterceptor implements HandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // 1.获取请求头中的 token String token = request.getHeader("authorization"); + log.info("request token = {}", token); + if (ObjectUtil.isEmpty(token)) { + throw new UnauthorizedException("请登录后访问!"); + } // 2.缓存中读取token信息 boolean existsKey = redisTool.existsKey(CommonService.TOKEN_KEY + token); if (!existsKey) { - throw new UnauthorizedException("token已过期"); + throw new UnauthorizedException("登录过期,请重新登录!"); } // 这里userInfo可以来自缓存 todo // 3.校验token diff --git a/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleOrderServiceImpl.java b/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleOrderServiceImpl.java index da92e3e..d4a69ed 100644 --- a/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleOrderServiceImpl.java +++ b/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleOrderServiceImpl.java @@ -94,8 +94,8 @@ public class RecycleOrderServiceImpl extends ServiceImpl { - target.setLatitude(source.getLocationDTO().getLatitude()); - target.setLongitude(source.getLocationDTO().getLongitude()); + target.setLatitude(source.getLocation().getLatitude()); + target.setLongitude(source.getLocation().getLongitude()); }); String idNumber = CommonUtil.getIdNumber(BusinessCodeEnum.ORDER.getCode()); recycleOrder.setClientId(client.getId());