From 467fe3b3ec6aa9d449b094bdd9df4611323d88d1 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 24 四月 2026 21:43:50 +0800
Subject: [PATCH] 代码生成
---
server/services/src/main/java/com/doumee/config/jwt/WebMvcConfig.java | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/server/services/src/main/java/com/doumee/config/jwt/WebMvcConfig.java b/server/services/src/main/java/com/doumee/config/jwt/WebMvcConfig.java
index 3c85107..8fb56d8 100644
--- a/server/services/src/main/java/com/doumee/config/jwt/WebMvcConfig.java
+++ b/server/services/src/main/java/com/doumee/config/jwt/WebMvcConfig.java
@@ -74,19 +74,19 @@
}
}else if (beanType.isAnnotationPresent(LoginShopRequired.class)) {
//鑾峰彇token
- String token = request.getHeader(JwtTokenUtil.HEADER_KEY); // 浠� http 璇锋眰澶翠腑鍙栧嚭 token
+ String token = request.getHeader(JwtTokenUtil.SHOP_HEADER_KEY); // 浠� http 璇锋眰澶翠腑鍙栧嚭 token
if (StringUtils.isNotBlank(token)) {
- checkShopLogin(request,response);
+ checkShopLogin(token,request,response);
} else {
- throw new BusinessException(ResponseStatus.BE_OVERDUE.getCode(),"鏈櫥褰�");
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE.getCode(),"鏈櫥褰�");
}
}else if (handlerMethod.hasMethodAnnotation(LoginShopRequired.class)){
//鑾峰彇token
- String token = request.getHeader(JwtTokenUtil.HEADER_KEY); // 浠� http 璇锋眰澶翠腑鍙栧嚭 token
+ String token = request.getHeader(JwtTokenUtil.SHOP_HEADER_KEY); // 浠� http 璇锋眰澶翠腑鍙栧嚭 token
if (StringUtils.isNotBlank(token)) {
- checkShopLogin(request,response);
+ checkShopLogin(token,request,response);
} else {
- throw new BusinessException(ResponseStatus.BE_OVERDUE.getCode(),"鏈櫥褰�");
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE.getCode(),"鏈櫥褰�");
}
}else if (beanType.isAnnotationPresent(LoginDriverRequired.class)) {
//鑾峰彇token
@@ -144,23 +144,22 @@
}
- public Boolean checkShopLogin(HttpServletRequest request, HttpServletResponse response){
- String token = request.getHeader(JwtTokenUtil.HEADER_KEY);
+ public Boolean checkShopLogin(String token,HttpServletRequest request, HttpServletResponse response){
try {
if(!token.startsWith(Constants.TWO+"")){
- throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME);
+ throw new BusinessException(ResponseStatus.SHOP_TOKEN_EXCEED_TIME);
}
String tokenRedis = (String) redisTemplate.opsForValue().get(Constants.REDIS_TOKEN_KEY+token);
if(StringUtils.isBlank(tokenRedis)){
- throw new BusinessException(ResponseStatus.BE_OVERDUE);
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE);
}
ShopInfo shop = JSONObject.parseObject(tokenRedis, ShopInfo.class);
if(Objects.isNull(shop)){
- throw new BusinessException(ResponseStatus.BE_OVERDUE);
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE);
}
String openid = shop.getOpenid();
Integer shopId = getTokenId(token);
- Integer isDeleted = dao.queryForObject(" select COALESCE(ISDELETED,0) from shop_info where id = ?", Integer.class, shopId);
+ Integer isDeleted = dao.queryForObject(" select COALESCE(DELETED,0) from shop_info where id = ?", Integer.class, shopId);
if(isDeleted== Constants.ONE){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍟嗘埛宸插垹闄�,璇疯仈绯荤鐞嗗憳");
}
@@ -168,19 +167,19 @@
if(isForbidden == Constants.ONE){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍟嗘埛宸茬鐢�,璇疯仈绯荤鐞嗗憳");
}
- String dbOpenid = dao.queryForObject(" select ifnull(openid,'') from shop where id = ?", String.class, shopId);
+ String dbOpenid = dao.queryForObject(" select ifnull(openid,'') from shop_info where id = ?", String.class, shopId);
if(StringUtils.isBlank(dbOpenid)||!openid.equals(dbOpenid)){
- throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME);
+ throw new BusinessException(ResponseStatus.SHOP_TOKEN_EXCEED_TIME);
}
- Integer count = dao.queryForObject("select count(1) from shop where id = ?", Integer.class, shopId);
+ Integer count = dao.queryForObject("select count(1) from shop_info where id = ?", Integer.class, shopId);
if (count != null && count > 0) {
request.setAttribute(JwtTokenUtil.SHOP_ID, shop.getId());
return true;
}else{
- throw new BusinessException(ResponseStatus.BE_OVERDUE.getCode(),"鐢ㄦ埛淇℃伅鍑洪敊");
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE.getCode(),"鐢ㄦ埛淇℃伅鍑洪敊");
}
} catch (IllegalArgumentException | JwtException e) {
- throw new BusinessException(ResponseStatus.BE_OVERDUE);
+ throw new BusinessException(ResponseStatus.SHOP_BE_OVERDUE);
}
}
--
Gitblit v1.9.3