From 1268957b82edca954a75ba93afc94ace8d04ed83 Mon Sep 17 00:00:00 2001 From: ASUS <1621302159@qq.com> Date: Tue, 12 Dec 2023 21:25:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A2=84=E7=BA=A6(=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 1 + .../list/service/impl/ParkingServiceImpl.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 1f9c892..b8595a9 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -9,6 +9,7 @@ + diff --git a/bwie-models/bwie-list/src/main/java/com/bwie/list/service/impl/ParkingServiceImpl.java b/bwie-models/bwie-list/src/main/java/com/bwie/list/service/impl/ParkingServiceImpl.java index 628e8bc..2cc490a 100644 --- a/bwie-models/bwie-list/src/main/java/com/bwie/list/service/impl/ParkingServiceImpl.java +++ b/bwie-models/bwie-list/src/main/java/com/bwie/list/service/impl/ParkingServiceImpl.java @@ -1,7 +1,11 @@ package com.bwie.list.service.impl; +import com.alibaba.fastjson.JSON; +import com.bwie.common.constants.TokenConstants; +import com.bwie.common.pojo.User; import com.bwie.common.pojo.vo.VOLogMake; import com.bwie.common.result.Result; +import com.bwie.common.utils.JwtUtils; import com.bwie.list.mapper.ParkingMapper; import com.bwie.list.service.ParkingService; import org.springframework.beans.factory.annotation.Autowired; @@ -23,13 +27,13 @@ public class ParkingServiceImpl implements ParkingService { public Result makeAppointment(VOLogMake voLogMake) { //1.获取用户信息 -// String token = request.getHeader("token"); -// String userKey = JwtUtils.getUserKey(token); -// String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey); -// User user = JSON.parseObject(s, User.class); -// if (user != null) { -// voLogMake.setUserId(user.getUserId()); -// } + String token = request.getHeader("token"); + String userKey = JwtUtils.getUserKey(token); + String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey); + User user = JSON.parseObject(s, User.class); + if (user != null) { + voLogMake.setUserId(user.getUserId()); + } //2.添加预约信息 System.out.println("开始添加"); Integer i = parkingMapper.makeAppointment(voLogMake);