| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.RemoteUserService; |
| | | import com.ruoyi.system.api.domain.SeBei; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.ManagementClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Autowired |
| | | private ManagementClient managementClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 登录 |
| | | */ |
| | | public LoginUser login(String username, String password) |
| | | public LoginUser login(String username, String password,String seBei) |
| | | { |
| | | // 用户名或密码为空 错误 |
| | | if (StringUtils.isAnyBlank(username, password)) |
| | |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员"); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | } |
| | | if (user.getUserType().equals("02")){ |
| | | throw new ServiceException("登录失败,登录账号权限不足"); |
| | | } |
| | | if (user.getUserType().equals("03")){ |
| | | SeBei se=new SeBei(); |
| | | se.setUserId(user.getUserId()); |
| | | se.setSebei(seBei); |
| | | Integer getequipmente = managementClient.getequipmente(se).getData(); |
| | | if (getequipmente==1){ |
| | | throw new ServiceException("登录失败,登录账号与当前设备不匹配"); |
| | | } |
| | | } |
| | | passwordService.validate(user, password); |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功"); |
| | | return userInfo; |