fix(user): 修复用户注册逻辑并更新Redis键格式
- 修改设备模板和监测点位置的Redis键格式,统一添加冒号后缀 - 移除未使用的ResponseEntity导入 - 简化用户注册流程,移除重复的手机号验证逻辑 - 在网关配置中添加新的白名单接口路径
This commit is contained in:
@@ -13,7 +13,7 @@ public interface AppRedisKey {
|
|||||||
/**
|
/**
|
||||||
* 设备模板前缀
|
* 设备模板前缀
|
||||||
*/
|
*/
|
||||||
String MODEL = "MODEL";
|
String MODEL = "MODEL:";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public interface AppRedisKey {
|
|||||||
/**
|
/**
|
||||||
* 监测点位置数据
|
* 监测点位置数据
|
||||||
*/
|
*/
|
||||||
String LINE_POSITION = "LINEPOSITION";
|
String LINE_POSITION = "LINEPOSITION:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rocketMQ消费key
|
* rocketMQ消费key
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ whitelist:
|
|||||||
- /harmonic-boot/comAccess/getComAccessData
|
- /harmonic-boot/comAccess/getComAccessData
|
||||||
- /harmonic-boot/harmonic/getHistoryResult
|
- /harmonic-boot/harmonic/getHistoryResult
|
||||||
- /event-boot/transient/getTransientAnalyseWave
|
- /event-boot/transient/getTransientAnalyseWave
|
||||||
|
- /cs-system-boot/appVersion/getLastData
|
||||||
# - /**
|
# - /**
|
||||||
#开始
|
#开始
|
||||||
# - /advance-boot/**
|
# - /advance-boot/**
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -106,37 +105,30 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
throw new BusinessException(UserResponseEnum.DEV_CODE_WRONG);
|
throw new BusinessException(UserResponseEnum.DEV_CODE_WRONG);
|
||||||
}
|
}
|
||||||
judgeCode(phone, code);
|
judgeCode(phone, code);
|
||||||
String password = null;
|
//新增用户配置表
|
||||||
//先根据手机号查询是否已被注册
|
UserSet userSet = userSetService.addAppUserSet();
|
||||||
User user = this.lambdaQuery().eq(User::getPhone,phone).ne(User::getState,0).one();
|
//新增用户表
|
||||||
if (!Objects.isNull(user)){
|
User newUser = cloneUserBoToUser(phone,devCode,userSet);
|
||||||
throw new BusinessException(UserResponseEnum.REGISTER_PHONE_REPEAT);
|
//新增用户角色关系表
|
||||||
} else {
|
Role role = roleService.getRoleByCode(AppRoleEnum.TOURIST.getCode());
|
||||||
//新增用户配置表
|
userRoleService.addUserRole(newUser.getId(), Collections.singletonList(role.getId()));
|
||||||
UserSet userSet = userSetService.addAppUserSet();
|
//消息默认配置
|
||||||
//新增用户表
|
AppInfoSet appInfoSet = new AppInfoSet();
|
||||||
User newUser = cloneUserBoToUser(phone,devCode,userSet);
|
appInfoSet.setUserId(newUser.getId());
|
||||||
//新增用户角色关系表
|
appInfoSet.setHarmonicInfo(1);
|
||||||
Role role = roleService.getRoleByCode(AppRoleEnum.TOURIST.getCode());
|
appInfoSet.setEventInfo(1);
|
||||||
userRoleService.addUserRole(newUser.getId(), Collections.singletonList(role.getId()));
|
appInfoSet.setRunInfo(1);
|
||||||
//消息默认配置
|
appInfoSet.setAlarmInfo(1);
|
||||||
AppInfoSet appInfoSet = new AppInfoSet();
|
appInfoSet.setIticFunction(0);
|
||||||
appInfoSet.setUserId(newUser.getId());
|
appInfoSet.setF47Function(0);
|
||||||
appInfoSet.setHarmonicInfo(1);
|
appInfoSetService.save(appInfoSet);
|
||||||
appInfoSet.setEventInfo(1);
|
//发送用户初始密码
|
||||||
appInfoSet.setRunInfo(1);
|
String password = redisUtil.getStringByKey(newUser.getId());
|
||||||
appInfoSet.setAlarmInfo(1);
|
String content = SmsUtil.getLianTongMessageTemplate("3", password);
|
||||||
appInfoSet.setIticFunction(0);
|
smsSendService.sendSmsWithRetry(phone,content,"verify_code");
|
||||||
appInfoSet.setF47Function(0);
|
redisUtil.delete(newUser.getId());
|
||||||
appInfoSetService.save(appInfoSet);
|
//删除验证码
|
||||||
//发送用户初始密码
|
deleteCode(phone);
|
||||||
password = redisUtil.getStringByKey(newUser.getId());
|
|
||||||
String content = SmsUtil.getLianTongMessageTemplate("3", password);
|
|
||||||
smsSendService.sendSmsWithRetry(phone,content,"verify_code");
|
|
||||||
redisUtil.delete(newUser.getId());
|
|
||||||
//删除验证码
|
|
||||||
deleteCode(phone);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user