|  |  |  | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.LoginDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemLoginLog; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemPermission; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemRole; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemUser; | 
|---|
|  |  |  | import com.doumee.dao.system.model.*; | 
|---|
|  |  |  | import com.doumee.service.common.CaptchaService; | 
|---|
|  |  |  | import com.doumee.service.system.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserService systemUserService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Lazy | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDataPermissionService systemDataPermissionService; | 
|---|
|  |  |  | @Lazy | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemRoleService systemRoleService; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String pwd = Utils.Secure.encryptPassword(new String(dto.getPassword()), user.getSalt()); | 
|---|
|  |  |  | // 比较密码 | 
|---|
|  |  |  | if( StringUtils.equals(pwd, user.getPassword())){ | 
|---|
|  |  |  | if( !StringUtils.equals(pwd, user.getPassword())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取登录用户信息 | 
|---|
|  |  |  | List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); | 
|---|
|  |  |  | List<SystemPermission> permissions = systemPermissionService.findByUserId(user.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SystemRole rt = new SystemRole(); | 
|---|
|  |  |  | rt.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | //数据部门权限集合 | 
|---|
|  |  |  | user.setCompanyIdList(systemDataPermissionService.selectHighRole(new SystemDataPermission(),rt,user)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LoginUserInfo userInfo = LoginUserInfo.from(user, roles, permissions,null); | 
|---|
|  |  |  | return  userInfo; | 
|---|
|  |  |  | } | 
|---|