|  |  | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.model.LoginUserInfo; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.DateUtil; | 
 |  |  | import com.doumee.dao.business.model.Company; | 
 |  |  | import com.doumee.dao.system.model.SystemPermission; | 
 |  |  | import com.doumee.dao.system.model.SystemRole; | 
 |  |  | import com.doumee.dao.system.model.SystemUser; | 
 |  |  | import com.doumee.service.business.CompanyService; | 
 |  |  | import com.doumee.service.system.SystemDataPermissionService; | 
 |  |  | import com.doumee.service.system.SystemPermissionService; | 
 |  |  | import com.doumee.service.system.SystemRoleService; | 
 |  |  | 
 |  |  | import org.springframework.context.annotation.Lazy; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SystemPermissionService systemPermissionService; | 
 |  |  |  | 
 |  |  |     @Lazy | 
 |  |  |     @Autowired | 
 |  |  |     private CompanyService companyService; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 权限处理 | 
 |  |  |      * @author Eva.Caesar Liu | 
 |  |  | 
 |  |  |      * @date 2022/03/15 09:54 | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { | 
 |  |  |     protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ | 
 |  |  |         // 获取用户名 | 
 |  |  |         String username = authenticationToken.getPrincipal().toString(); | 
 |  |  |         // 根据用户名查询用户对象 | 
 |  |  | 
 |  |  |         if(!Constants.equalsInteger(user.getStatus(),Constants.ZERO)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,账号信息已被禁用,如有疑问请联系系统管理员!"); | 
 |  |  |         } | 
 |  |  |         if(!user.getType().equals(Constants.UserType.SYSTEM)){ | 
 |  |  |             Company company = companyService.findById(user.getCompanyId()); | 
 |  |  |             if(company.getStatus().equals(Constants.ONE)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业信息已被禁用,如有疑问请联系系统管理员!"); | 
 |  |  |             } | 
 |  |  |             if(DateUtil.compareDate(new Date(),DateUtil.addDaysToDate(company.getOepnValidDate(),1))<=Constants.ZERO){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业信息已过期,如有疑问请联系系统管理员!"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 获取登录用户信息 | 
 |  |  |         List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); |