更新预约(新增获取用户信息)

syl
ASUS 2023-12-12 21:25:55 +08:00
parent 4b558ab882
commit 1268957b82
2 changed files with 12 additions and 7 deletions

View File

@ -9,6 +9,7 @@
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/bwie-list/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/bwie-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/resources" charset="UTF-8" />

View File

@ -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);