|
@@ -347,6 +347,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
|
|
|
/**
|
|
|
* 登录加密
|
|
|
+ *
|
|
|
* @param vo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -374,9 +375,13 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
}
|
|
|
//用用户名查询人员信息
|
|
|
LambdaQueryWrapper<Personnel> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(Personnel::getPersonnelUserName, username);
|
|
|
+ queryWrapper.eq(Personnel::getPersonnelPhone, username)
|
|
|
+ .or()
|
|
|
+ .eq(Personnel::getPersonnelEmail, username)
|
|
|
+ .or()
|
|
|
+ .eq(Personnel::getPersonnelUserName, username);
|
|
|
//获取一条
|
|
|
- Personnel personnel = this.getOne(queryWrapper);
|
|
|
+ Personnel personnel = this.getOne(queryWrapper, false);
|
|
|
final Integer personId = personnel.getId();
|
|
|
//如果查不到 报错 用户名不存在
|
|
|
if (ObjectUtils.isEmpty(personnel)) {
|
|
@@ -463,6 +468,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
|
|
|
/**
|
|
|
* 功能模块化代码加密
|
|
|
+ *
|
|
|
* @param vo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -471,7 +477,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
String sign = vo.getSign();
|
|
|
String appKey = vo.getAppKey();
|
|
|
String version = vo.getVersion();
|
|
|
- if (Boolean.TRUE.equals(StringUtils.isEmpty(version))){
|
|
|
+ if (Boolean.TRUE.equals(StringUtils.isEmpty(version))) {
|
|
|
version = "1.0.0.0";
|
|
|
}
|
|
|
long currentTimeMillis = vo.getCurrentTimeMillis() / 1000;
|
|
@@ -506,7 +512,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
permissions.add(i.getFunctionPath());
|
|
|
});
|
|
|
}
|
|
|
- List<EncryptionFunctionVO> list = this.loadFunctionVOS(permissions, 2, symmetryKey,version);
|
|
|
+ List<EncryptionFunctionVO> list = this.loadFunctionVOS(permissions, 2, symmetryKey, version);
|
|
|
functionVOS.addAll(list);
|
|
|
|
|
|
List<String> permissions1 = new ArrayList<>();
|
|
@@ -517,7 +523,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
permissions1.add(i.getFunctionPath());
|
|
|
});
|
|
|
permissions1.removeAll(permissions);
|
|
|
- List<EncryptionFunctionVO> list1 = this.loadFunctionVOS(permissions1, 1, symmetryKey,version);
|
|
|
+ List<EncryptionFunctionVO> list1 = this.loadFunctionVOS(permissions1, 1, symmetryKey, version);
|
|
|
functionVOS.addAll(list1);
|
|
|
finalVO.setFunctionVOS(functionVOS);
|
|
|
String key = RSAUtils.encryptByPublicKey(symmetryKey, publicKey);
|
|
@@ -549,6 +555,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
}
|
|
|
|
|
|
//---------------------------------------二期开发--------------------------
|
|
|
+
|
|
|
/**
|
|
|
* 发送验证码
|
|
|
*
|
|
@@ -568,7 +575,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
String random = RandomUtil.getSixRandom();
|
|
|
//手机号和验证码放进缓存 设置过期时间60s
|
|
|
redisUtil.set(LoginCacheKeyUtil.getLoginCaptcha(vo.getPhoneNum()), random);
|
|
|
- redisUtil.expire(LoginCacheKeyUtil.getLoginCaptcha(vo.getPhoneNum()), 60L,TimeUnit.SECONDS);
|
|
|
+ redisUtil.expire(LoginCacheKeyUtil.getLoginCaptcha(vo.getPhoneNum()), 60L, TimeUnit.SECONDS);
|
|
|
//发送短信
|
|
|
smsService.sendMessage(vo.getPhoneNum(), random);
|
|
|
res = "发送验证码成功";
|
|
@@ -622,7 +629,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(dto.getPhoneNum())) {
|
|
|
queryWrapper.eq(Personnel::getPersonnelPhone, dto.getPhoneNum());
|
|
|
}
|
|
|
- Personnel person = personnelMapper.selectOne(queryWrapper);
|
|
|
+ Personnel person = this.getOne(queryWrapper, false);
|
|
|
if (org.apache.commons.lang3.ObjectUtils.isEmpty(person)) {
|
|
|
throw new XiaoShiException(ExceptionEnum.THE_PERSONNEL_IS_NOT_EXIST);
|
|
|
}
|