用户模块依赖优化、代码精简
This commit is contained in:
parent
148896c5a6
commit
676720c65b
@ -34,6 +34,11 @@
|
|||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
@ -80,20 +85,6 @@
|
|||||||
<version>${nacos.version}</version>
|
<version>${nacos.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Sa-Token 权限认证,在线文档:https://sa-token.cc -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.dev33</groupId>
|
|
||||||
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
|
||||||
<version>${satoken.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Sa-Token 整合 Redis (使用 jackson 序列化方式) -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.dev33</groupId>
|
|
||||||
<artifactId>sa-token-redis-jackson</artifactId>
|
|
||||||
<version>${satoken.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 提供Redis连接池 -->
|
<!-- 提供Redis连接池 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@ -123,12 +114,6 @@
|
|||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<version>${jackson.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 数据宝实名认证加密 -->
|
<!-- 数据宝实名认证加密 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cdp.product</groupId>
|
<groupId>com.cdp.product</groupId>
|
||||||
@ -169,6 +154,27 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet</groupId>
|
||||||
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.cdzy.user.config;
|
package com.cdzy.user.config;
|
||||||
|
|
||||||
import cn.dev33.satoken.exception.NotLoginException;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonSyntaxException;
|
import com.alibaba.nacos.shaded.com.google.gson.JsonSyntaxException;
|
||||||
import com.cdzy.common.model.response.JsonResult;
|
import com.cdzy.common.model.response.JsonResult;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -29,12 +28,6 @@ import java.sql.SQLSyntaxErrorException;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
@ExceptionHandler(NotLoginException.class)
|
|
||||||
public JsonResult<?> bindExceptionHandler(NotLoginException e) {
|
|
||||||
log.error(e.toString());
|
|
||||||
return JsonResult.failed(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(BindException.class)
|
@ExceptionHandler(BindException.class)
|
||||||
public JsonResult<?> bindExceptionHandler(BindException e) {
|
public JsonResult<?> bindExceptionHandler(BindException e) {
|
||||||
log.error(e.toString());
|
log.error(e.toString());
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
package com.cdzy.user.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author yanglei
|
|
||||||
* @since 2025-10-15 09:36
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
|
||||||
//registry.addInterceptor(new TenantInterceptor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package com.cdzy.user.controller;
|
package com.cdzy.user.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
|
||||||
import com.cdzy.common.model.response.JsonResult;
|
import com.cdzy.common.model.response.JsonResult;
|
||||||
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
||||||
import com.cdzy.user.model.dto.UserValidateDto;
|
import com.cdzy.user.model.dto.UserValidateDto;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.cdzy.user.service.impl;
|
package com.cdzy.user.service.impl;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
|
||||||
import com.cdzy.user.enums.UserStatus;
|
import com.cdzy.user.enums.UserStatus;
|
||||||
import com.cdzy.user.mapper.EbikeUserMapper;
|
import com.cdzy.user.mapper.EbikeUserMapper;
|
||||||
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
import com.cdzy.user.model.dto.EbikeUserPageDto;
|
||||||
@ -87,8 +86,6 @@ public class EbikeUserServiceImpl extends ServiceImpl<EbikeUserMapper, EbikeUser
|
|||||||
this.mapper.insert(ebikeUser);
|
this.mapper.insert(ebikeUser);
|
||||||
isNewUser = true;
|
isNewUser = true;
|
||||||
}
|
}
|
||||||
// 用户登录
|
|
||||||
StpUtil.login(ebikeUser.getUserId());
|
|
||||||
// 返回数据
|
// 返回数据
|
||||||
Map<String, Object> data = new HashMap<>();
|
Map<String, Object> data = new HashMap<>();
|
||||||
data.put("userId", ebikeUser.getUserId());
|
data.put("userId", ebikeUser.getUserId());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user