jiangping
2023-08-17 6365ab0a976afdd247742c9b3dca15deb3a7a7a1
server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
@@ -35,9 +35,7 @@
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * 自定义Realm,处理认证和权限
@@ -131,12 +129,6 @@
            if(com == null){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该账户异常!");
            }
//            if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){
//                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过禁用!");
//            }
            if(com.getOepnValidDate() != null && com.getOepnValidDate().before(new Date())){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过使用有效期!");
            }
            //如果是企业用户
            QueryCompanyUserExtDTO c =new QueryCompanyUserExtDTO();
            c.setUserId(user.getId());
@@ -144,11 +136,11 @@
            c.setCompanyId(authenticationToken.getCompanyId());
            cu = companyUserExtService.selectOne(c);
            if(cu == null){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户不存在!");
                return  null;
            }
//            if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){
//                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户已禁用!");
//            }
            if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户已禁用!");
            }
            rootDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getRootDepartId());
            comDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getComDepartId());
            depart = departmentExtService.getModelById(c.getCompanyId(),cu.getDepartmentId());