代码提交
This commit is contained in:
@@ -15,7 +15,9 @@ public enum MessageEnum {
|
|||||||
FORGET_PWD(3, "SMS_176195072"),
|
FORGET_PWD(3, "SMS_176195072"),
|
||||||
UPDATE_PHONE(4, "SMS_175583840"),
|
UPDATE_PHONE(4, "SMS_175583840"),
|
||||||
JUDGE_OLD_PHONE(5, "SMS_176195072"),
|
JUDGE_OLD_PHONE(5, "SMS_176195072"),
|
||||||
EVENT_MESSAGE_NOTICE(6,"SMS_212270827");
|
EVENT_MESSAGE_NOTICE(6,"SMS_212270827"),
|
||||||
|
DEFAULT_PASSWORD(7,"SMS_212270827"),
|
||||||
|
;
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ public class AppUserController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
@ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
||||||
@ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
@ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||||
})
|
})
|
||||||
public HttpResult<AppUserResultVO> register(@Param("phone") String phone, @Param("code") String code, @Param("devCode") String devCode) {
|
public HttpResult<String> register(@Param("phone") String phone, @Param("code") String code, @Param("devCode") String devCode) {
|
||||||
String methodDescribe = getMethodDescribe("register");
|
String methodDescribe = getMethodDescribe("register");
|
||||||
LogUtil.njcnDebug(log, "{},手机号:{},验证码:{},设备码:{}", methodDescribe, phone,code,devCode);
|
LogUtil.njcnDebug(log, "{},手机号:{},验证码:{},设备码:{}", methodDescribe, phone,code,devCode);
|
||||||
AppUserResultVO appUserResultVo = appUserService.register(phone,code,devCode);
|
appUserService.register(phone,code,devCode);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appUserResultVo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "", methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface IAppUserService {
|
|||||||
* @param code 验证码
|
* @param code 验证码
|
||||||
* @param devCode 设备码
|
* @param devCode 设备码
|
||||||
*/
|
*/
|
||||||
AppUserResultVO register(String phone, String code, String devCode);
|
void register(String phone, String code, String devCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户设置密码
|
* 用户设置密码
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public AppUserResultVO register(String phone, String code, String devCode) {
|
public void register(String phone, String code, String devCode) {
|
||||||
AppUserResultVO appUserResultVo = new AppUserResultVO();
|
AppUserResultVO appUserResultVo = new AppUserResultVO();
|
||||||
if (!PubUtils.match(PatternRegex.PHONE_REGEX, phone)){
|
if (!PubUtils.match(PatternRegex.PHONE_REGEX, phone)){
|
||||||
throw new BusinessException(UserResponseEnum.REGISTER_PHONE_WRONG);
|
throw new BusinessException(UserResponseEnum.REGISTER_PHONE_WRONG);
|
||||||
@@ -198,14 +198,16 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
appInfoSet.setSystemInfo(1);
|
appInfoSet.setSystemInfo(1);
|
||||||
appInfoSet.setHarmonicInfo(1);
|
appInfoSet.setHarmonicInfo(1);
|
||||||
appInfoSetService.save(appInfoSet);
|
appInfoSetService.save(appInfoSet);
|
||||||
//配置返回数据
|
//自动登录 && 发送密码短信
|
||||||
appUserResultVo.setUserId(newUser.getId());
|
String password = redisUtil.getStringByKey(userSet.getId());
|
||||||
appUserResultVo.setRoleName(AppRoleEnum.TOURIST.getMessage());
|
|
||||||
appUserResultVo.setPhone(newUser.getPhone());
|
|
||||||
appUserResultVo.setRoleCode(AppRoleEnum.TOURIST.getCode());
|
|
||||||
appUserResultVo.setUserName(StringUtils.isEmpty(newUser.getName()) ? null : newUser.getName());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return appUserResultVo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +297,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
user.setSmsNotice(0);
|
user.setSmsNotice(0);
|
||||||
user.setEmailNotice(0);
|
user.setEmailNotice(0);
|
||||||
user.setLimitIpStart("0.0.0.0");
|
user.setLimitIpStart("0.0.0.0");
|
||||||
user.setLimitIpStart("255.255.255.255");
|
user.setLimitIpEnd("255.255.255.255");
|
||||||
user.setLimitTime("0-24");
|
user.setLimitTime("0-24");
|
||||||
this.save(user);
|
this.save(user);
|
||||||
return user;
|
return user;
|
||||||
|
|||||||
@@ -251,7 +251,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BeanUtil.copyProperties(user, userVO);
|
BeanUtil.copyProperties(user, userVO);
|
||||||
if (!Objects.isNull(user.getDeptId())){
|
|
||||||
Dept dept = deptService.getDeptById(user.getDeptId());
|
Dept dept = deptService.getDeptById(user.getDeptId());
|
||||||
//非自定义部门
|
//非自定义部门
|
||||||
if (Objects.equals(dept.getType(),0)){
|
if (Objects.equals(dept.getType(),0)){
|
||||||
@@ -262,10 +261,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
userVO.setAreaName(deptService.getNameByDeptId(user.getDeptId()));
|
userVO.setAreaName(deptService.getNameByDeptId(user.getDeptId()));
|
||||||
}
|
}
|
||||||
userVO.setDeptName(deptService.getNameByDeptId(user.getDeptId()));
|
userVO.setDeptName(deptService.getNameByDeptId(user.getDeptId()));
|
||||||
userVO.setDeptLevel(dept.getPids().split(StrUtil.COMMA).length);
|
|
||||||
}
|
|
||||||
userVO.setRoleList(roleService.getIdByUserId(id));
|
userVO.setRoleList(roleService.getIdByUserId(id));
|
||||||
userVO.setRole(roleService.getNameByUserId(id));
|
userVO.setRole(roleService.getNameByUserId(id));
|
||||||
|
userVO.setDeptLevel(dept.getPids().split(StrUtil.COMMA).length);
|
||||||
return userVO;
|
return userVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.user.service.impl;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -14,17 +15,14 @@ import com.njcn.user.enums.UserResponseEnum;
|
|||||||
import com.njcn.user.mapper.UserMapper;
|
import com.njcn.user.mapper.UserMapper;
|
||||||
import com.njcn.user.mapper.UserSetMapper;
|
import com.njcn.user.mapper.UserSetMapper;
|
||||||
import com.njcn.user.pojo.constant.UserDefaultPassword;
|
import com.njcn.user.pojo.constant.UserDefaultPassword;
|
||||||
import com.njcn.user.pojo.constant.UserState;
|
|
||||||
import com.njcn.user.pojo.param.UserParam;
|
import com.njcn.user.pojo.param.UserParam;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.user.pojo.po.UserSet;
|
import com.njcn.user.pojo.po.UserSet;
|
||||||
import com.njcn.user.service.IUserSetService;
|
import com.njcn.user.service.IUserSetService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -53,10 +51,8 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> impl
|
|||||||
String secretKey = PubUtils.randomCode(16);
|
String secretKey = PubUtils.randomCode(16);
|
||||||
userSet.setSecretKey(secretKey);
|
userSet.setSecretKey(secretKey);
|
||||||
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
||||||
String password = PubUtils.getCode(8);
|
|
||||||
System.out.println("password==:" + password);
|
|
||||||
//SM4加密初始默认密码
|
//SM4加密初始默认密码
|
||||||
String strSm4 = sm4.encryptData_ECB(password);
|
String strSm4 = sm4.encryptData_ECB(UserDefaultPassword.DEFAULT_PASSWORD);
|
||||||
userSet.setStandBy(strSm4);
|
userSet.setStandBy(strSm4);
|
||||||
this.save(userSet);
|
this.save(userSet);
|
||||||
return userSet;
|
return userSet;
|
||||||
|
|||||||
Reference in New Issue
Block a user