Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
push-message
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liucheng
push-message
Commits
3d77fe24
Commit
3d77fe24
authored
Jul 12, 2022
by
zuoadmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
1,用户标签不再更新,仅增加 See merge request
!27
parents
4bcc1405
dc20e5da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
MenuService.java
src/main/java/com/weface/component/MenuService.java
+9
-0
UserMenusServiceImpl.java
...ain/java/com/weface/serviceimpl/UserMenusServiceImpl.java
+2
-2
UserTagsTask.java
src/main/java/com/weface/task/UserTagsTask.java
+8
-8
UserTagDao.xml
src/main/resources/mapper/UserTagDao.xml
+7
-4
No files found.
src/main/java/com/weface/component/MenuService.java
View file @
3d77fe24
...
...
@@ -6,14 +6,17 @@ import cn.hutool.core.convert.ConvertException;
import
cn.hutool.core.lang.TypeReference
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.weface.common.utils.SnowIdUtil
;
import
com.weface.entity.MenuTagsEntity
;
import
com.weface.entity.UserMenusEntity
;
import
com.weface.entity.UserTagEntity
;
import
com.weface.service.UserMenusService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
...
...
@@ -27,6 +30,8 @@ public class MenuService {
@Autowired
private
GeTuiService
geTuiService
;
@Autowired
private
UserMenusService
userMenusService
;
/**
* 从map中解析标签并收集关系表数据
...
...
@@ -54,6 +59,10 @@ public class MenuService {
if
(
first
.
isPresent
())
{
//拿到id
String
uid
=
first
.
get
().
getUid
();
List
<
UserMenusEntity
>
entityList
=
userMenusService
.
list
(
new
LambdaQueryWrapper
<
UserMenusEntity
>().
eq
(
UserMenusEntity:
:
getUserId
,
uid
).
eq
(
UserMenusEntity:
:
getIsValid
,
1
));
if
(!
CollectionUtils
.
isEmpty
(
entityList
))
{
continue
;
}
//遍历标签id
Date
date
=
new
Date
();
for
(
Long
aLong
:
list
)
{
...
...
src/main/java/com/weface/serviceimpl/UserMenusServiceImpl.java
View file @
3d77fe24
...
...
@@ -36,13 +36,13 @@ public class UserMenusServiceImpl extends ServiceImpl<UserMenusDao, UserMenusEnt
public
void
batchInsert
(
List
<
UserMenusEntity
>
userMenusList
)
{
try
{
if
(
CollUtil
.
isNotEmpty
(
userMenusList
))
{
List
<
String
>
deleteUid
=
getDeleteUid
(
userMenusList
);
/*
List<String> deleteUid = getDeleteUid(userMenusList);
List<List<String>> lists = CommonUtil.fixedGrouping(deleteUid, 10000);
for (List<String> list : lists) {
//批量插入前全删
List<Long> ids = this.baseMapper.findIdByUserId(list);
this.removeByIds(ids);
}
}
*/
int
sum
=
0
;
List
<
List
<
UserMenusEntity
>>
tagLists
=
CommonUtil
.
fixedGrouping
(
userMenusList
,
10000
);
for
(
List
<
UserMenusEntity
>
tagList
:
tagLists
)
{
...
...
src/main/java/com/weface/task/UserTagsTask.java
View file @
3d77fe24
...
...
@@ -240,14 +240,14 @@ public class UserTagsTask {
//获取标签列表
List
<
MenuTagsEntity
>
tags
=
menuTagsService
.
list
();
//获取小于起始值,且更新时间为当前时间用户信息
List
<
UserTagEntity
>
beforeUser
=
userTagService
.
findUserByTodayAndIdBefore
(
id
);
//
List<UserTagEntity> beforeUser = userTagService.findUserByTodayAndIdBefore(id);
//如果每次更新数据为空则全部设置为新增
if
(
CollUtil
.
isEmpty
(
beforeUser
))
{
List
<
UserMenusEntity
>
afterTag
=
getAfterTag
(
id
,
max
,
tags
);
if
(
afterTag
!=
null
)
{
userMenusList
.
addAll
(
afterTag
);
}
}
else
{
//
if (CollUtil.isEmpty(beforeUser)) {
List
<
UserMenusEntity
>
afterTag
=
getAfterTag
(
id
,
max
,
tags
);
if
(
afterTag
!=
null
)
{
userMenusList
.
addAll
(
afterTag
);
}
/*
} else {
//过滤用户gid
List<String> beforeGid = beforeUser.stream().map(UserTagEntity::getGid).distinct().collect(Collectors.toList());
//获取更新总数量
...
...
@@ -266,7 +266,7 @@ public class UserTagsTask {
if (CollUtil.isNotEmpty(beforeTag)) {
userMenusList.addAll(beforeTag);
}
}
}
*/
//批量插入用户标签信息
userMenusService
.
batchInsert
(
userMenusList
);
log
.
info
(
"执行结束,当前最新id{}"
,
RedisUtil
.
StringOps
.
get
(
"user_tag_id"
));
...
...
src/main/resources/mapper/UserTagDao.xml
View file @
3d77fe24
...
...
@@ -50,10 +50,13 @@
<!-- 查询id之后的用户信息-->
<select
id=
"findUserByIdAfter"
resultMap=
"userTagMap"
>
SELECT id, uid, gid
FROM t_user_tag
WHERE gid IS NOT NULL
AND id > #{id} LIMIT #{limit}
SELECT
us.*
FROM
( SELECT id, uid, gid FROM t_user_tag WHERE gid IS NOT NULL AND id > #{id} ) us
LEFT JOIN ( SELECT * FROM tb_user_menus WHERE is_valid = 1 ) um ON us.uid = um.user_id
WHERE
um.id IS NULL LIMIT #{limit}
</select>
<!-- 查询无标签用户-->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment