|
@@ -8,6 +8,7 @@ import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.example.xiaoshiweixinback.business.common.ResponseEnum;
|
|
|
import com.example.xiaoshiweixinback.business.common.log.LogHelper;
|
|
|
import com.example.xiaoshiweixinback.business.exception.BusinessException;
|
|
|
import com.example.xiaoshiweixinback.business.exception.ExceptionEnum;
|
|
@@ -426,28 +427,27 @@ public class LoginService {
|
|
|
queryWrapper.eq(Person::getPhoneNum, account).or().eq(Person::getUserName, account)
|
|
|
.or().eq(Person::getEmail, account);
|
|
|
Person person = personService.getOne(queryWrapper, false);
|
|
|
- if(person==null){
|
|
|
- throw new BusinessException("606","账号错误");
|
|
|
+ if (person == null) {
|
|
|
+ throw new BusinessException("606", "账号错误");
|
|
|
}
|
|
|
- if(person.getUserPassword()==null){
|
|
|
- throw new BusinessException("606","非账号登录用户");
|
|
|
+ if (person.getUserPassword() == null) {
|
|
|
+ throw new BusinessException("606", "非账号登录用户");
|
|
|
}
|
|
|
if (!person.getUserPassword().equals(password)) {
|
|
|
- throw new BusinessException("606","密码错误");
|
|
|
+ throw new BusinessException("606", "密码错误");
|
|
|
}
|
|
|
|
|
|
//将用户信息数据存入Redis
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
BeanUtil.copy(person, personnelVO);
|
|
|
- String token="";
|
|
|
+ String token = "";
|
|
|
try {
|
|
|
token = jwtTokenUtil.createToken();
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException("606", "生成token错误");
|
|
|
}
|
|
|
- catch (Exception e){
|
|
|
- throw new BusinessException("606","生成token错误");
|
|
|
- }
|
|
|
- BeanUtil.copy(person,loginVO);
|
|
|
+ BeanUtil.copy(person, loginVO);
|
|
|
loginVO.setToken(token);
|
|
|
cacheUtil.setLoginUser(personnelVO, token);
|
|
|
return loginVO;
|