Commit a9ed2de4 authored by zuoadmin's avatar zuoadmin

Merge branch 'dev' into 'master'

Dev

See merge request !28
parents 3d77fe24 512a15ea
...@@ -6,17 +6,14 @@ import cn.hutool.core.convert.ConvertException; ...@@ -6,17 +6,14 @@ import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.TypeReference; import cn.hutool.core.lang.TypeReference;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.weface.common.utils.SnowIdUtil; import com.weface.common.utils.SnowIdUtil;
import com.weface.entity.MenuTagsEntity; import com.weface.entity.MenuTagsEntity;
import com.weface.entity.UserMenusEntity; import com.weface.entity.UserMenusEntity;
import com.weface.entity.UserTagEntity; import com.weface.entity.UserTagEntity;
import com.weface.service.UserMenusService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
...@@ -30,8 +27,8 @@ public class MenuService { ...@@ -30,8 +27,8 @@ public class MenuService {
@Autowired @Autowired
private GeTuiService geTuiService; private GeTuiService geTuiService;
@Autowired /*@Autowired
private UserMenusService userMenusService; private UserMenusService userMenusService;*/
/** /**
* 从map中解析标签并收集关系表数据 * 从map中解析标签并收集关系表数据
...@@ -59,10 +56,10 @@ public class MenuService { ...@@ -59,10 +56,10 @@ public class MenuService {
if (first.isPresent()) { if (first.isPresent()) {
//拿到id //拿到id
String uid = first.get().getUid(); String uid = first.get().getUid();
List<UserMenusEntity> entityList = userMenusService.list(new LambdaQueryWrapper<UserMenusEntity>().eq(UserMenusEntity::getUserId, uid).eq(UserMenusEntity::getIsValid, 1)); /*List<UserMenusEntity> entityList = userMenusService.list(new LambdaQueryWrapper<UserMenusEntity>().eq(UserMenusEntity::getUserId, uid).eq(UserMenusEntity::getIsValid, 1));
if (!CollectionUtils.isEmpty(entityList)) { if (!CollectionUtils.isEmpty(entityList)) {
continue; continue;
} }*/
//遍历标签id //遍历标签id
Date date = new Date(); Date date = new Date();
for (Long aLong : list) { for (Long aLong : list) {
......
...@@ -37,7 +37,7 @@ public interface UserTagDao extends BaseMapper<UserTagEntity> { ...@@ -37,7 +37,7 @@ public interface UserTagDao extends BaseMapper<UserTagEntity> {
* *
* @return 用户信息 * @return 用户信息
*/ */
List<UserTagEntity> findUserByIdAfter(Integer id, Integer limit); List<UserTagEntity> findUserByIdAfter(@Param("limit") Integer limit);
/** /**
* 查询库中无标签用户 * 查询库中无标签用户
......
...@@ -39,7 +39,7 @@ public class UserTagServiceImpl extends ServiceImpl<UserTagDao, UserTagEntity> i ...@@ -39,7 +39,7 @@ public class UserTagServiceImpl extends ServiceImpl<UserTagDao, UserTagEntity> i
@Override @Override
public List<UserTagEntity> findUserByIdAfter(Integer id, Integer limit) { public List<UserTagEntity> findUserByIdAfter(Integer id, Integer limit) {
return this.baseMapper.findUserByIdAfter(id, limit); return this.baseMapper.findUserByIdAfter(limit);
} }
@Override @Override
......
...@@ -236,17 +236,18 @@ public class UserTagsTask { ...@@ -236,17 +236,18 @@ public class UserTagsTask {
int max = Integer.parseInt(pushSize); int max = Integer.parseInt(pushSize);
//存储用户标签信息 //存储用户标签信息
List<UserMenusEntity> userMenusList = new ArrayList<>(); List<UserMenusEntity> userMenusList;
//获取标签列表 //获取标签列表
List<MenuTagsEntity> tags = menuTagsService.list(); List<MenuTagsEntity> tags = menuTagsService.list();
//获取小于起始值,且更新时间为当前时间用户信息 //获取小于起始值,且更新时间为当前时间用户信息
//List<UserTagEntity> beforeUser = userTagService.findUserByTodayAndIdBefore(id); //List<UserTagEntity> beforeUser = userTagService.findUserByTodayAndIdBefore(id);
//如果每次更新数据为空则全部设置为新增 //如果每次更新数据为空则全部设置为新增
//if (CollUtil.isEmpty(beforeUser)) { //if (CollUtil.isEmpty(beforeUser)) {
List<UserMenusEntity> afterTag = getAfterTag(id, max, tags); //List<UserMenusEntity> afterTag = getAfterTag(id, max, tags);
if (afterTag != null) { userMenusList = getAfterTag(id, max, tags);
userMenusList.addAll(afterTag); //if (afterTag != null) {
} // userMenusList.addAll(afterTag);
//}
/*} else { /*} else {
//过滤用户gid //过滤用户gid
List<String> beforeGid = beforeUser.stream().map(UserTagEntity::getGid).distinct().collect(Collectors.toList()); List<String> beforeGid = beforeUser.stream().map(UserTagEntity::getGid).distinct().collect(Collectors.toList());
...@@ -291,9 +292,9 @@ public class UserTagsTask { ...@@ -291,9 +292,9 @@ public class UserTagsTask {
//如果当天新增数不为空 //如果当天新增数不为空
if (CollUtil.isNotEmpty(afterUser)) { if (CollUtil.isNotEmpty(afterUser)) {
//获取用户最后一条信息 //获取用户最后一条信息
UserTagEntity afterUserInfo = afterUser.get(afterUser.size() - 1); //UserTagEntity afterUserInfo = afterUser.get(afterUser.size() - 1);
//并覆盖起始值 //并覆盖起始值
RedisUtil.StringOps.set("user_tag_id", String.valueOf(afterUserInfo.getId())); //RedisUtil.StringOps.set("user_tag_id", String.valueOf(afterUserInfo.getId()));
//过滤用户gid //过滤用户gid
List<String> afterGid = afterUser.stream().map(UserTagEntity::getGid).distinct().collect(Collectors.toList()); List<String> afterGid = afterUser.stream().map(UserTagEntity::getGid).distinct().collect(Collectors.toList());
//调用个像接口获取新增用户标签 //调用个像接口获取新增用户标签
......
...@@ -51,12 +51,15 @@ ...@@ -51,12 +51,15 @@
<!-- 查询id之后的用户信息--> <!-- 查询id之后的用户信息-->
<select id="findUserByIdAfter" resultMap="userTagMap"> <select id="findUserByIdAfter" resultMap="userTagMap">
SELECT SELECT
us.* us.id,
us.uid,
us.gid
FROM FROM
( SELECT id, uid, gid FROM t_user_tag WHERE gid IS NOT NULL AND id > #{id} ) us t_user_tag us
LEFT JOIN ( SELECT * FROM tb_user_menus WHERE is_valid = 1 ) um ON us.uid = um.user_id WHERE
WHERE us.gid IS NOT NULL
um.id IS NULL LIMIT #{limit} AND us.uid NOT IN ( SELECT DISTINCT user_id FROM tb_user_menus)
LIMIT #{limit}
</select> </select>
<!-- 查询无标签用户--> <!-- 查询无标签用户-->
......
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