Commit a47d364e by 罗志长

fix: 平台小程序用户登录校验租户禁用/过期状态

parent 59ec29e3
......@@ -3,12 +3,14 @@ package com.makeit.service.wechat.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.common.dto.LoginDTO;
import com.makeit.entity.platform.auth.PlatUser;
import com.makeit.entity.saas.PlatTenant;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.module.admin.vo.plat.PlatUserLoginVO;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.service.wechat.PlatLoginWechatService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.id.IdGen;
......@@ -18,6 +20,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
/**
* Controller
......@@ -29,6 +33,8 @@ import org.springframework.stereotype.Service;
public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
@Autowired
private PlatUserService platUserService;
@Autowired
private PlatTenantService platTenantService;
@Override
@TenantIdIgnore
......@@ -48,6 +54,14 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
if (platUser == null) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_PASSWORD);
}
PlatTenant platTenant = platTenantService.getById(platUser.getTenantId());
if(platTenant == null || StringUtils.equals(platTenant.getStatus(), CommonEnum.NO.getValue())){
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN);
}
LocalDate localDate = LocalDate.now();
if (platTenant.getStartTime().isAfter(localDate) || localDate.isAfter(platTenant.getEndTime())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN);
}
if (CommonEnum.NO.getValue().equals(platUser.getStatus())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_HAS_DISABLED);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment