Commit 1d9a15b9 authored by 技术部-任文超's avatar 技术部-任文超

更正登录统计参数值

parent 898a6fb2
...@@ -114,6 +114,29 @@ public class UserController implements IBaseController { ...@@ -114,6 +114,29 @@ public class UserController implements IBaseController {
return login(channelId, appChannel, createdFrom, userId, key, request, openId, dimension); return login(channelId, appChannel, createdFrom, userId, key, request, openId, dimension);
} }
@LogHttpCaller
@PasswordErrorFiniteValidator
@RequestMapping("/login")
public JsonResult login(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false, defaultValue = "") String userId,
@RequestParam(required = false,defaultValue = "xyqb") String key,
HttpServletRequest request, String openId,
@RequestParam(required = false) String dimension) {
LOGGER.info("login -> channelId:{},appChannel:{},createdFrom:{},userId:{},key:{},openId:{},dimension:{}",channelId,appChannel,createdFrom,userId,key,openId,dimension);
Merchant merchant = merchantService.findMerchantByName(key);
if (merchant == null) {
return JsonResult.buildErrorStateResult("未知的连接", null);
}
if (!StringUtils.isEmpty(userId) && userId.length() > 10) {
return loginWithUserId(channelId, appChannel, createdFrom, userId, merchant,dimension);
} else {
return loginWithHttpBasic(channelId, appChannel, createdFrom, merchant, request, openId,dimension);
}
}
/** /**
* 快速登录(手机号 + 短信验证码),H5专用入口 * 快速登录(手机号 + 短信验证码),H5专用入口
* 短信验证码错误达到限定次数时执行图形验证码校验 * 短信验证码错误达到限定次数时执行图形验证码校验
...@@ -139,29 +162,6 @@ public class UserController implements IBaseController { ...@@ -139,29 +162,6 @@ public class UserController implements IBaseController {
return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, request); return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, request);
} }
@LogHttpCaller
@PasswordErrorFiniteValidator
@RequestMapping("/login")
public JsonResult login(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false, defaultValue = "") String userId,
@RequestParam(required = false,defaultValue = "xyqb") String key,
HttpServletRequest request, String openId,
@RequestParam(required = false) String dimension) {
LOGGER.info("login -> channelId:{},appChannel:{},createdFrom:{},userId:{},key:{},openId:{},dimension:{}",channelId,appChannel,createdFrom,userId,key,openId,dimension);
Merchant merchant = merchantService.findMerchantByName(key);
if (merchant == null) {
return JsonResult.buildErrorStateResult("未知的连接", null);
}
if (!StringUtils.isEmpty(userId) && userId.length() > 10) {
return loginWithUserId(channelId, appChannel, createdFrom, userId, merchant,dimension);
} else {
return loginWithHttpBasic(channelId, appChannel, createdFrom, merchant, request, openId,dimension);
}
}
@RequestMapping("/login/fast") @RequestMapping("/login/fast")
public JsonResult loginFast( public JsonResult loginFast(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel, @RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
...@@ -181,29 +181,26 @@ public class UserController implements IBaseController { ...@@ -181,29 +181,26 @@ public class UserController implements IBaseController {
JsonResult successResult = validMap.get("success"); JsonResult successResult = validMap.get("success");
String phoneNo = successResult.getData().toString(); String phoneNo = successResult.getData().toString();
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速登录失败,手机号错误, createdFrom:{},phoneNo:{}", createdFrom, phoneNo); LOGGER.info("用户快速注册失败,手机号错误, createdFrom:{},phoneNo:{}", createdFrom, phoneNo);
throw new UserNotExistException("手机号错误"); throw new UserNotExistException("手机号错误");
} }
String verificationCode = successResult.getMsg(); String verificationCode = successResult.getMsg();
// 执行短信验证码检查 // 执行短信验证码检查
verifyPhoneAndCode(phoneNo, verificationCode); verifyPhoneAndCode(phoneNo, verificationCode);
User user = userService.findByPhoneWithCache(phoneNo); User user = userService.findByPhoneWithCache(phoneNo);
// 缓存未命中时查DB
if (user == null) {
user = userService.findByPhoneInDb(phoneNo);
}
if (user != null && !user.getEnable()) { if (user != null && !user.getEnable()) {
LOGGER.error("用户不存在,或者已经注销,phoneNo:{}",phoneNo); LOGGER.error("用户不存在,或者已经注销,phoneNo:{}",phoneNo);
return JsonResult.buildErrorStateResult("登录失败", null); return JsonResult.buildErrorStateResult("登录失败", null);
} }
UserStatistics statistics = new UserStatistics(user,dimension,3,channelId);
if (user == null) { if (user == null) {
user = userRegisterService.register(phoneNo, channelId, createdFrom, appChannel,btRegisterChannelId,dimension); user = userRegisterService.register(phoneNo, channelId, createdFrom, appChannel,btRegisterChannelId,dimension);
statistics.setAction(2);
if (user == null) { if (user == null) {
throw new UserNotExistException("用户未找到"); throw new UserNotExistException("用户未找到");
} }
} }
//增加登陆统计发送 //增加登陆统计发送
UserStatistics statistics=new UserStatistics(user,dimension,3,channelId);
MqUtils.sendLoanVest(statistics); MqUtils.sendLoanVest(statistics);
return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant)); return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant));
// return createSession(channelId, createdFrom, appChannel, user); // return createSession(channelId, createdFrom, appChannel, user);
...@@ -452,7 +449,7 @@ public class UserController implements IBaseController { ...@@ -452,7 +449,7 @@ public class UserController implements IBaseController {
//用户信息存在,更新session中的最后访问时间,重新写入缓存. //用户信息存在,更新session中的最后访问时间,重新写入缓存.
if (null != user || !user.getEnable()) { if (null != user || !user.getEnable()) {
//增加登陆统计发送 //增加登陆统计发送
UserStatistics statistics=new UserStatistics(user,dimension,1,channelId); UserStatistics statistics=new UserStatistics(user,dimension,4,channelId);
MqUtils.sendLoanVest(statistics); MqUtils.sendLoanVest(statistics);
return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant)); return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant));
} else { } else {
......
...@@ -12,6 +12,12 @@ public class UserStatistics { ...@@ -12,6 +12,12 @@ public class UserStatistics {
private String uuid; private String uuid;
private Long registerFrom; private Long registerFrom;
private String dimension; private String dimension;
/**
* 1-登录
* 2-注册
* 3-快捷登录
* 4-免密登录
*/
private int action;//登录0,注册1,快捷登录2,免密登录3 private int action;//登录0,注册1,快捷登录2,免密登录3
private Long channel; private Long channel;
......
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