|
@@ -45,11 +45,11 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void userAgentUpdate(User user, String channel) {
|
|
public void userAgentUpdate(User user, String channel) {
|
|
- //渠道为空
|
|
|
|
|
|
+ log.error("用户登录接收到的渠道参数 userId : {}, channel : {}", user.getId(), channel);
|
|
|
|
+ //渠道参数为空
|
|
if (Strings.isBlank(channel)) {
|
|
if (Strings.isBlank(channel)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- log.error("接收到的渠道参数 user : {}, channel : {}", JsonUtil.toString(user), channel);
|
|
|
|
//判断用户是否超过30天未登录
|
|
//判断用户是否超过30天未登录
|
|
List<UserLoginLog> userLoginLogList = userLoginLogService.list(new LambdaQueryWrapper<UserLoginLog>()
|
|
List<UserLoginLog> userLoginLogList = userLoginLogService.list(new LambdaQueryWrapper<UserLoginLog>()
|
|
.eq(UserLoginLog::getUserId, user.getId())
|
|
.eq(UserLoginLog::getUserId, user.getId())
|
|
@@ -67,18 +67,14 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
//30天未登录, 更新渠道
|
|
//30天未登录, 更新渠道
|
|
Map<String, String> urlParamMap = this.channelTransform(channel);
|
|
Map<String, String> urlParamMap = this.channelTransform(channel);
|
|
//查询渠道
|
|
//查询渠道
|
|
- String state = urlParamMap.get("agentKey");
|
|
|
|
- if (Strings.isBlank(state)) {
|
|
|
|
- state = urlParamMap.get("state");
|
|
|
|
- }
|
|
|
|
- Agent agent = super.getOne(new LambdaQueryWrapper<Agent>()
|
|
|
|
- .eq(Agent::getAgentKey, state));
|
|
|
|
|
|
+ Agent agent = this.getAgentByKey(urlParamMap);
|
|
if (agent == null) {
|
|
if (agent == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
//更新用户信息
|
|
//更新用户信息
|
|
userService.update(new LambdaUpdateWrapper<User>()
|
|
userService.update(new LambdaUpdateWrapper<User>()
|
|
.set(User::getAgentId, agent.getId())
|
|
.set(User::getAgentId, agent.getId())
|
|
|
|
+ .set(User::getChannel, channel)
|
|
.set(User::getUpdateTime, LocalDateTime.now())
|
|
.set(User::getUpdateTime, LocalDateTime.now())
|
|
.eq(User::getId, user.getId()));
|
|
.eq(User::getId, user.getId()));
|
|
//回传用户信息
|
|
//回传用户信息
|
|
@@ -87,6 +83,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Tuple2<Long, Map<String, String>> getUserAgentId(String channel, Long shareUserId) {
|
|
public Tuple2<Long, Map<String, String>> getUserAgentId(String channel, Long shareUserId) {
|
|
|
|
+ log.error("用户注册接收到的渠道参数 channel : {}", channel);
|
|
if (Strings.isBlank(channel) && shareUserId != null) {
|
|
if (Strings.isBlank(channel) && shareUserId != null) {
|
|
User user = userService.getById(shareUserId);
|
|
User user = userService.getById(shareUserId);
|
|
return Tuples.of(user.getAgentId(), Collections.emptyMap());
|
|
return Tuples.of(user.getAgentId(), Collections.emptyMap());
|
|
@@ -94,22 +91,29 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
if (Strings.isBlank(channel)) {
|
|
if (Strings.isBlank(channel)) {
|
|
return Tuples.of(0L, Collections.emptyMap());
|
|
return Tuples.of(0L, Collections.emptyMap());
|
|
}
|
|
}
|
|
- log.error("接收到的渠道参数 channel : {}", channel);
|
|
|
|
//数据解析
|
|
//数据解析
|
|
Map<String, String> urlParamMap = this.channelTransform(channel);
|
|
Map<String, String> urlParamMap = this.channelTransform(channel);
|
|
//查询渠道
|
|
//查询渠道
|
|
- String state = urlParamMap.get("agentKey");
|
|
|
|
- if (Strings.isBlank(state)) {
|
|
|
|
- state = urlParamMap.get("state");
|
|
|
|
- }
|
|
|
|
- Agent agent = super.getOne(new LambdaQueryWrapper<Agent>()
|
|
|
|
- .eq(Agent::getAgentKey, state));
|
|
|
|
|
|
+ Agent agent = this.getAgentByKey(urlParamMap);
|
|
if (agent == null) {
|
|
if (agent == null) {
|
|
return Tuples.of(0L, Collections.emptyMap());
|
|
return Tuples.of(0L, Collections.emptyMap());
|
|
}
|
|
}
|
|
return Tuples.of(agent.getId(), urlParamMap);
|
|
return Tuples.of(agent.getId(), urlParamMap);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private Agent getAgentByKey(Map<String, String> urlParamMap) {
|
|
|
|
+ //参数不存在
|
|
|
|
+ if (CollectionUtils.isEmpty(urlParamMap)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ //判断渠道标识
|
|
|
|
+ String state = urlParamMap.get("agentKey");
|
|
|
|
+ if (Strings.isBlank(state)) {
|
|
|
|
+ state = urlParamMap.get("state");
|
|
|
|
+ }
|
|
|
|
+ return super.getOne(new LambdaQueryWrapper<Agent>().eq(Agent::getAgentKey, state));
|
|
|
|
+ }
|
|
|
|
+
|
|
private Map<String, String> channelTransform(String channel) {
|
|
private Map<String, String> channelTransform(String channel) {
|
|
//判断是否是json, 是就直接转成map
|
|
//判断是否是json, 是就直接转成map
|
|
if (this.isJsonStr(channel)) {
|
|
if (this.isJsonStr(channel)) {
|