redis更改,登录部分修改
This commit is contained in:
parent
1b1c69cfa4
commit
66f5c82c9d
|
|
@ -13,4 +13,5 @@ public class RedisKeyExpirationListener implements MessageListener {
|
|||
System.out.println("过期的Key为: " + expiredKey);
|
||||
// 在这里添加处理键过期事件的逻辑
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -44,6 +44,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
<version>1.5.2.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- jwt -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import cn.ysk.cashier.utils.SpringContextHolder;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.ApplicationPidFileWriter;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
package cn.ysk.cashier.config;
|
||||
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author bearBoy80
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer {
|
||||
@Override
|
||||
public void customize(Connector connector) {
|
||||
connector.setProperty("relaxedQueryChars", "[]{}");
|
||||
}
|
||||
}
|
||||
|
|
@ -91,6 +91,7 @@ public class AuthorizationController {
|
|||
if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
//生成token
|
||||
UsernamePasswordAuthenticationToken authenticationToken =
|
||||
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
|
||||
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
||||
|
|
@ -101,10 +102,11 @@ public class AuthorizationController {
|
|||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
String token = tokenProvider.createToken(authentication);
|
||||
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
|
||||
// 保存在线信息
|
||||
onlineUserService.save(jwtUserDto, token, request);
|
||||
// 返回 token 与 用户信息
|
||||
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
|
||||
//校验商户商户激活是否到期(未激活)
|
||||
|
||||
|
||||
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
|
||||
put("token", properties.getTokenStartWith() + token);
|
||||
put("user", jwtUserDto);
|
||||
|
|
@ -113,6 +115,9 @@ public class AuthorizationController {
|
|||
}
|
||||
|
||||
}};
|
||||
// 保存在线信息
|
||||
onlineUserService.save(jwtUserDto, token, request);
|
||||
|
||||
if (loginProperties.isSingleLogin()) {
|
||||
//踢掉之前已经登录的token
|
||||
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||
tbMerchantAccount.setShopId(String.valueOf(save.getId()));
|
||||
tbMerchantAccount.setName(save.getShopName());
|
||||
merchantRegisterRepository.save(tbMerchantRegister);
|
||||
//向redis中存入key
|
||||
// redisUtils.set
|
||||
}
|
||||
|
||||
return tbShopInfoMapper.toDto(new TbShopInfo());
|
||||
|
|
|
|||
|
|
@ -110,14 +110,10 @@ public class UserServiceImpl implements UserService {
|
|||
User user = userRepository.findById(resources.getId()).orElseGet(User::new);
|
||||
ValidationUtil.isNull(user.getId(), "User", "id", resources.getId());
|
||||
User user1 = userRepository.findByUsername(resources.getUsername());
|
||||
User user2 = userRepository.findByEmail(resources.getEmail());
|
||||
User user3 = userRepository.findByPhone(resources.getPhone());
|
||||
if (user1 != null && !user.getId().equals(user1.getId())) {
|
||||
throw new EntityExistException(User.class, "username", resources.getUsername());
|
||||
}
|
||||
if (user2 != null && !user.getId().equals(user2.getId())) {
|
||||
throw new EntityExistException(User.class, "email", resources.getEmail());
|
||||
}
|
||||
if (user3 != null && !user.getId().equals(user3.getId())) {
|
||||
throw new EntityExistException(User.class, "phone", resources.getPhone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ spring:
|
|||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
rabbitmq:
|
||||
host: 121.40.128.145
|
||||
port: 5672
|
||||
username: admin
|
||||
password: Czg666888
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@ spring:
|
|||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
rabbitmq:
|
||||
host: 127.0.0.1
|
||||
port: 5672
|
||||
username: admin
|
||||
password: Czg666888
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ spring:
|
|||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
# pid:
|
||||
|
||||
# pid:
|
||||
# file: /自行指定位置/eladmin.pid
|
||||
|
||||
#配置 Jpa
|
||||
|
|
|
|||
Loading…
Reference in New Issue