Commit d726ca92 authored by gaoguangjing's avatar gaoguangjing

代码优化

parent 330c5613
...@@ -161,9 +161,10 @@ public class UserController implements IBaseController { ...@@ -161,9 +161,10 @@ public class UserController implements IBaseController {
@RequestParam(required = false) Long btRegisterChannelId, @RequestParam(required = false) Long btRegisterChannelId,
@RequestParam(required = false) String dimension, @RequestParam(required = false) String dimension,
@RequestParam(name = "click_id", required = false) String clickId, @RequestParam(name = "click_id", required = false) String clickId,
@RequestParam(required = false, defaultValue = "defualt") String tenantId,
HttpServletRequest request) { HttpServletRequest request) {
log.info("login/fastV1 -> channelId:{},ZappChennel:{},createdFrom:{},key:{},btRegisterChannelId:{},dimension:{},clickId:{}", channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId); log.info("login/fastV1 -> channelId:{},ZappChennel:{},createdFrom:{},key:{},btRegisterChannelId:{},dimension:{},clickId:{}", channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId);
return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId, request); return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId, tenantId, request);
} }
/** /**
...@@ -180,6 +181,7 @@ public class UserController implements IBaseController { ...@@ -180,6 +181,7 @@ public class UserController implements IBaseController {
@RequestParam(required = false) Long btRegisterChannelId, @RequestParam(required = false) Long btRegisterChannelId,
@RequestParam(required = false) String dimension, @RequestParam(required = false) String dimension,
@RequestParam(name = "click_id", required = false) String clickId, @RequestParam(name = "click_id", required = false) String clickId,
@RequestParam(required = false, defaultValue = "defualt") String tenantId,
HttpServletRequest request) { HttpServletRequest request) {
Map<String, JsonResult> validMap = getHeaderParam(request); Map<String, JsonResult> validMap = getHeaderParam(request);
log.info("login/fast -> channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{},clickId:{}", channelId, appChannel, createdFrom, btRegisterChannelId, key, dimension, clickId); log.info("login/fast -> channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{},clickId:{}", channelId, appChannel, createdFrom, btRegisterChannelId, key, dimension, clickId);
...@@ -200,7 +202,7 @@ public class UserController implements IBaseController { ...@@ -200,7 +202,7 @@ public class UserController implements IBaseController {
String verificationCode = successResult.getMsg(); String verificationCode = successResult.getMsg();
// 执行短信验证码检查 // 执行短信验证码检查
verifyPhoneAndCodeForOnce(phoneNo, verificationCode); verifyPhoneAndCodeForOnce(phoneNo, verificationCode);
return userService.loginFast(channelId, appChannel, createdFrom, btRegisterChannelId, dimension, clickId, request, merchant, phoneNo); return userService.loginFast(channelId, appChannel, createdFrom, btRegisterChannelId, dimension, clickId, request, merchant, phoneNo, tenantId);
} }
/** /**
......
...@@ -19,6 +19,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService; ...@@ -19,6 +19,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService; import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.util.IpUtil; import cn.quantgroup.xyqb.util.IpUtil;
import cn.quantgroup.xyqb.util.TenantUtil;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
import com.sensorsdata.analytics.javasdk.ISensorsAnalytics; import com.sensorsdata.analytics.javasdk.ISensorsAnalytics;
import com.sensorsdata.analytics.javasdk.bean.EventRecord; import com.sensorsdata.analytics.javasdk.bean.EventRecord;
...@@ -165,6 +166,7 @@ public class AppController implements IBaseController { ...@@ -165,6 +166,7 @@ public class AppController implements IBaseController {
if (merchant == null) { if (merchant == null) {
return JsonResult.buildErrorStateResult("无效的商户", null); return JsonResult.buildErrorStateResult("无效的商户", null);
} }
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), null); LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), null);
AuthBean bean = sessionService.createSession(user, loginProperties); AuthBean bean = sessionService.createSession(user, loginProperties);
log.info("第三方用户登录成功 [AppController] login --> loginFrom:{}, phoneNo:{},appChannel:{}", registerFrom, phoneNo, appChannel); log.info("第三方用户登录成功 [AppController] login --> loginFrom:{}, phoneNo:{},appChannel:{}", registerFrom, phoneNo, appChannel);
...@@ -315,7 +317,7 @@ public class AppController implements IBaseController { ...@@ -315,7 +317,7 @@ public class AppController implements IBaseController {
return JsonResult.buildErrorStateResult("登录失败", null); return JsonResult.buildErrorStateResult("登录失败", null);
} }
//校验租户ID tenantId //校验租户ID tenantId
if (!tenantId.equals("1")) { if (!TenantUtil.TENANT_DEFAULT.equals(tenantId)) {
oauthLoginInfoService.addLoginInfo(user, tenantId); oauthLoginInfoService.addLoginInfo(user, tenantId);
} }
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, null, "", tenantId); LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, null, "", tenantId);
......
...@@ -11,6 +11,7 @@ import cn.quantgroup.xyqb.service.middleoffice.applet.IAppletService; ...@@ -11,6 +11,7 @@ import cn.quantgroup.xyqb.service.middleoffice.applet.IAppletService;
import cn.quantgroup.xyqb.service.register.IUserRegisterService; import cn.quantgroup.xyqb.service.register.IUserRegisterService;
import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService; import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.util.TenantUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -102,7 +103,7 @@ public class AppletServiceImpl implements IAppletService { ...@@ -102,7 +103,7 @@ public class AppletServiceImpl implements IAppletService {
throw new AppletException("未找到此用户","0401"); throw new AppletException("未找到此用户","0401");
} }
//校验租户ID tenantId //校验租户ID tenantId
if (!"defualt".equals(tenantId)) { if (!TenantUtil.TENANT_DEFAULT.equals(tenantId)) {
iOauthLoginInfoService.addLoginInfo(user, tenantId); iOauthLoginInfoService.addLoginInfo(user, tenantId);
} }
LoginVo loginVo = loginModule.loginByUserId(user.getRegisteredFrom(), LoginVo loginVo = loginModule.loginByUserId(user.getRegisteredFrom(),
......
...@@ -10,6 +10,7 @@ import cn.quantgroup.xyqb.model.session.SessionValue; ...@@ -10,6 +10,7 @@ import cn.quantgroup.xyqb.model.session.SessionValue;
import cn.quantgroup.xyqb.service.session.ISessionService; import cn.quantgroup.xyqb.service.session.ISessionService;
import cn.quantgroup.xyqb.service.session.aspect.UserBtRegisterFill; import cn.quantgroup.xyqb.service.session.aspect.UserBtRegisterFill;
import cn.quantgroup.xyqb.util.MqUtils; import cn.quantgroup.xyqb.util.MqUtils;
import cn.quantgroup.xyqb.util.TenantUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -103,7 +104,7 @@ public class SessionServiceImpl implements ISessionService { ...@@ -103,7 +104,7 @@ public class SessionServiceImpl implements ISessionService {
* @return redisKey. 用来标识这个渠道的用户 Session 是否存在 * @return redisKey. 用来标识这个渠道的用户 Session 是否存在
*/ */
private String generateLoginPropertiesKey(Long userId, LoginProperties properties) { private String generateLoginPropertiesKey(Long userId, LoginProperties properties) {
if (properties.getTenantId() == null || "defualt".equals(properties.getTenantId())) { if (properties.getTenantId() == null || TenantUtil.TENANT_DEFAULT.equals(properties.getTenantId())) {
return Constants.Session.USER_SESSION_ID_CACHE + ":" + userId + ":" + properties.getMerchantName() + ":" + properties.getCreatedFrom(); return Constants.Session.USER_SESSION_ID_CACHE + ":" + userId + ":" + properties.getMerchantName() + ":" + properties.getCreatedFrom();
}else { }else {
return Constants.Session.USER_SESSION_ID_CACHE + ":" + userId + ":" + properties.getMerchantName() + ":" + properties.getCreatedFrom() + ":" + properties.getTenantId(); return Constants.Session.USER_SESSION_ID_CACHE + ":" + userId + ":" + properties.getMerchantName() + ":" + properties.getCreatedFrom() + ":" + properties.getTenantId();
......
package cn.quantgroup.xyqb.util;
public class TenantUtil {
public static final String TENANT_DEFAULT = "defualt";
}
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