Commit 37546f7c authored by guangjing.gao's avatar guangjing.gao

统一校验处理租户ID

parent f38f77ce
......@@ -453,7 +453,9 @@ public class UserController implements IBaseController {
User user = sessionStruct.getValues().getUser();
if (TenantUtil.checkoutTenantIsDefault(tenantId)) {
user = tenantService.getTenantUser(user, tenantId);
return JsonResult.buildErrorStateResult("查无此人", null);
if (user == null) {
return JsonResult.buildErrorStateResult("查无此人", null);
}
}
String phoneNo = user.getPhoneNo();
result.put("phoneNo", phoneNo);
......
......@@ -316,7 +316,7 @@ public class AppController implements IBaseController {
return JsonResult.buildErrorStateResult("登录失败", null);
}
//校验租户ID tenantId
if (tenantId != null && !TenantUtil.TENANT_DEFAULT.equals(0)) {
if (TenantUtil.checkoutTenantIsDefault(tenantId)) {
oauthLoginInfoService.addLoginInfo(user, tenantId);
}
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, null, "", tenantId);
......
......@@ -11,6 +11,7 @@ import cn.quantgroup.xyqb.service.middleoffice.applet.IAppletService;
import cn.quantgroup.xyqb.service.register.IUserRegisterService;
import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService;
import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.util.TenantUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -104,7 +105,7 @@ public class AppletServiceImpl implements IAppletService {
throw new AppletException("未找到此用户","0401");
}
//校验租户ID tenantId
if (tenantId != null && !tenantId.equals(0)) {
if (TenantUtil.checkoutTenantIsDefault(tenantId)) {
iOauthLoginInfoService.addLoginInfo(user, tenantId);
}
LoginVo loginVo = loginModule.loginByUserId(user.getRegisteredFrom(),
......
......@@ -389,7 +389,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
log.info("神策埋点出现问题", e);
}
//校验租户ID tenantId
if (tenantId != null && !tenantId.equals(0)) {
if (TenantUtil.checkoutTenantIsDefault(tenantId)) {
oauthLoginInfoService.addLoginInfo(user, tenantId);
}
LoginProperties loginProperties = new LoginProperties("", 3, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
......
......@@ -5,6 +5,7 @@ public class TenantUtil {
/* 租户羊小咩 */
public static final Integer TENANT_DEFAULT = 560761;
/* 租户ID校验是否羊小咩 */
public static boolean checkoutTenantIsDefault(Integer tenantId) {
if (tenantId == null || tenantId.equals(0) || TenantUtil.TENANT_DEFAULT.equals(tenantId)) {
return false;
......
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 to comment