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