Merge pull request 'clay' (#12) from clay into master

Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/12
This commit is contained in:
clay
2024-03-09 05:59:29 +00:00
6 changed files with 57 additions and 47 deletions

View File

@@ -0,0 +1,38 @@
package cn.fateverse.admin.entity;
import cn.fateverse.admin.vo.IpBackVo;
import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import lombok.Data;
/**
* @author Clay
* @date 2023-10-22
*/
@Data
@EnableAutoField
public class IpBack extends BaseEntity {
/**
* 主键id
*/
private Long id;
/**
* ip地址
*/
private String ipAddr;
/**
* ip类型 ipv4 ipv6
*/
private String type;
public IpBackVo toIPBackVo(){
return IpBackVo.builder()
.id(id)
.ipAddr(ipAddr)
.type(type)
.createTime(getCreateTime())
.remark(getRemark())
.build();
}
}

View File

@@ -87,19 +87,23 @@ public class MappingSwitchVo {
private String operName; private String operName;
public static MappingSwitchVo toMappingSwitchVo(MappingSwitchInfo mappingSwitchInfo) { public static MappingSwitchVo toMappingSwitchVo(MappingSwitchInfo mappingSwitchInfo) {
return MappingSwitchVo.builder() MappingSwitchVo mappingSwitchVo = MappingSwitchVo.builder()
.key(mappingSwitchInfo.getKey()) .key(mappingSwitchInfo.getKey())
.applicationName(mappingSwitchInfo.getApplicationName()) .applicationName(mappingSwitchInfo.getApplicationName())
.className(mappingSwitchInfo.getClassName()) .className(mappingSwitchInfo.getClassName())
.description(mappingSwitchInfo.getDescription()) .description(mappingSwitchInfo.getDescription())
.methodName(mappingSwitchInfo.getMethodName()) .methodName(mappingSwitchInfo.getMethodName())
.uris(mappingSwitchInfo.getUris()) .uris(mappingSwitchInfo.getUris())
.type(mappingSwitchInfo.getType().toString())
.httpMethods(mappingSwitchInfo.getHttpMethods()) .httpMethods(mappingSwitchInfo.getHttpMethods())
.state(mappingSwitchInfo.getState()) .state(mappingSwitchInfo.getState())
.operName(mappingSwitchInfo.getOperName()) .operName(mappingSwitchInfo.getOperName())
.operTime(mappingSwitchInfo.getOperTime()) .operTime(mappingSwitchInfo.getOperTime())
.build(); .build();
MappingSwitchInfo.MappingSwitchType switchType = mappingSwitchInfo.getType();
if (switchType != null) {
mappingSwitchVo.setType(switchType.name());
}
return mappingSwitchVo;
} }

View File

@@ -307,7 +307,6 @@ public class UserServiceImpl implements UserService {
batchUserPost(dto, Boolean.TRUE); batchUserPost(dto, Boolean.TRUE);
dto.setPassword(null); dto.setPassword(null);
UserBase user = dto.toUser(); UserBase user = dto.toUser();
return userMapper.update(user); return userMapper.update(user);
} }

View File

@@ -85,18 +85,18 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
public String login(LoginBody login) { public String login(LoginBody login) {
log.info("用户:{},于:{}登录系统", login.getUsername(), DateUtil.format(new Date(), DateConstants.YYYY_MM_DD_HH_MM_SS)); log.info("用户:{},于:{}登录系统", login.getUsername(), DateUtil.format(new Date(), DateConstants.YYYY_MM_DD_HH_MM_SS));
// String uuid = CacheConstants.CAPTCHA_CODE_KEY + login.getUuid(); String uuid = CacheConstants.CAPTCHA_CODE_KEY + login.getUuid();
// String code = String.valueOf(redisTemplate.opsForValue().get(uuid)); String code = String.valueOf(redisTemplate.opsForValue().get(uuid));
// if (null == code) { if (null == code) {
// publishEvent(login.getUsername(), "验证码已过期!", Boolean.FALSE, null); publishEvent(login.getUsername(), "验证码已过期!", Boolean.FALSE, null);
// throw new CustomException("验证码已过期!"); throw new CustomException("验证码已过期!");
// } }
// if (!code.equals(login.getCode())) { if (!code.equals(login.getCode())) {
// publishEvent(login.getUsername(), "验证码错误!", Boolean.FALSE, null); publishEvent(login.getUsername(), "验证码错误!", Boolean.FALSE, null);
// throw new CustomException("验证码错误!"); throw new CustomException("验证码错误!");
// } }
// redisTemplate.delete(uuid); redisTemplate.delete(uuid);
//用户验证 //用户验证
Authentication authentication = null; Authentication authentication = null;
try { try {
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername

View File

@@ -47,7 +47,7 @@ public class LogAspect {
@Around("@within(log) || @annotation(log)") @Around("@within(log) || @annotation(log)")
public Object before(ProceedingJoinPoint point, Log log) throws Throwable { public Object around(ProceedingJoinPoint point, Log log) throws Throwable {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
try { try {
Object proceed = point.proceed(point.getArgs()); Object proceed = point.proceed(point.getArgs());

View File

@@ -1,31 +0,0 @@
package cn.fateverse.notice.config;
import cn.fateverse.notice.entity.UserInfo;
import org.redisson.spring.data.connection.RedissonConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* @author Clay
* @date 2023-10-15
*/
//@Configuration
public class RedisTemplateConfig {
@Bean("noticeRedisTemplate")
public RedisTemplate<String, UserInfo> noticeRedisTemplate(RedissonConnectionFactory redissonConnectionFactory) {
RedisTemplate<String, UserInfo> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(redissonConnectionFactory);
//设置key序列化方式string
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
}