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
4b627354
Commit
4b627354
authored
May 06, 2022
by
zuoadmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!19
parents
f8548932
80c048fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
27 deletions
+31
-27
PushCallBackServiceImpl.java
.../java/com/weface/serviceimpl/PushCallBackServiceImpl.java
+1
-1
UserMenusServiceImpl.java
...ain/java/com/weface/serviceimpl/UserMenusServiceImpl.java
+22
-25
UserMenusDao.xml
src/main/resources/mapper/UserMenusDao.xml
+8
-1
No files found.
src/main/java/com/weface/serviceimpl/PushCallBackServiceImpl.java
View file @
4b627354
...
@@ -122,7 +122,7 @@ public class PushCallBackServiceImpl extends ServiceImpl<PushCallBackDao, PushCa
...
@@ -122,7 +122,7 @@ public class PushCallBackServiceImpl extends ServiceImpl<PushCallBackDao, PushCa
List
<
PushCallBackEntity
>
list
=
new
ArrayList
<>();
List
<
PushCallBackEntity
>
list
=
new
ArrayList
<>();
while
(
matcher
.
find
())
{
while
(
matcher
.
find
())
{
String
group
=
matcher
.
group
(
1
);
String
group
=
matcher
.
group
(
1
);
log
.
error
(
"回调信息:{}"
,
group
);
log
.
info
(
"回调信息:{}"
,
group
);
PushCallBackEntity
callBackInfo
=
JSONObject
.
parseObject
(
group
,
PushCallBackEntity
.
class
);
PushCallBackEntity
callBackInfo
=
JSONObject
.
parseObject
(
group
,
PushCallBackEntity
.
class
);
String
desc
=
JSONObject
.
parseObject
(
group
).
getString
(
"desc"
);
String
desc
=
JSONObject
.
parseObject
(
group
).
getString
(
"desc"
);
callBackInfo
.
setDescStr
(
desc
);
callBackInfo
.
setDescStr
(
desc
);
...
...
src/main/java/com/weface/serviceimpl/UserMenusServiceImpl.java
View file @
4b627354
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.weface.code.CommonResult
;
import
com.weface.code.CommonResult
;
import
com.weface.common.utils.CommonUtil
;
import
com.weface.common.utils.SnowIdUtil
;
import
com.weface.common.utils.SnowIdUtil
;
import
com.weface.dao.UserMenusDao
;
import
com.weface.dao.UserMenusDao
;
import
com.weface.dto.UserMenuFrom
;
import
com.weface.dto.UserMenuFrom
;
...
@@ -33,28 +34,20 @@ public class UserMenusServiceImpl extends ServiceImpl<UserMenusDao, UserMenusEnt
...
@@ -33,28 +34,20 @@ public class UserMenusServiceImpl extends ServiceImpl<UserMenusDao, UserMenusEnt
*/
*/
@Override
@Override
public
void
batchInsert
(
List
<
UserMenusEntity
>
userMenusList
)
{
public
void
batchInsert
(
List
<
UserMenusEntity
>
userMenusList
)
{
try
{
if
(
CollUtil
.
isNotEmpty
(
userMenusList
))
{
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
(
deleteUid
);
List
<
Long
>
ids
=
this
.
baseMapper
.
findIdByUserId
(
list
);
this
.
removeByIds
(
ids
);
this
.
removeByIds
(
ids
);
//获取集合长度
int
count
=
userMenusList
.
size
();
//每次批量插入个数
int
limit
=
10000
;
int
sum
=
0
;
//计算页数
int
totalPage
=
(
count
%
limit
==
0
)
?
(
count
/
limit
)
:
(
count
/
limit
+
1
);
for
(
int
i
=
0
;
i
<
totalPage
;
i
++)
{
List
<
UserMenusEntity
>
userMenusEntities
=
new
ArrayList
<>(
10000
);
//如果是最后一页,则截取到最后
if
(
i
==
totalPage
-
1
)
{
userMenusEntities
=
userMenusList
.
subList
(
i
*
limit
,
count
);
}
else
{
userMenusEntities
=
userMenusList
.
subList
(
i
*
limit
,
(
i
+
1
)
*
limit
);
}
}
int
sum
=
0
;
List
<
List
<
UserMenusEntity
>>
tagLists
=
CommonUtil
.
fixedGrouping
(
userMenusList
,
10000
);
for
(
List
<
UserMenusEntity
>
tagList
:
tagLists
)
{
//批量插入每次一万条
//批量插入每次一万条
sum
+=
this
.
baseMapper
.
batchInsert
(
userMenusEntities
);
sum
+=
this
.
baseMapper
.
batchInsert
(
tagList
);
}
}
if
(
sum
>
0
)
{
if
(
sum
>
0
)
{
log
.
warn
(
"新增成功记录=={}==条"
,
sum
);
log
.
warn
(
"新增成功记录=={}==条"
,
sum
);
...
@@ -62,6 +55,10 @@ public class UserMenusServiceImpl extends ServiceImpl<UserMenusDao, UserMenusEnt
...
@@ -62,6 +55,10 @@ public class UserMenusServiceImpl extends ServiceImpl<UserMenusDao, UserMenusEnt
log
.
error
(
"新增失败"
);
log
.
error
(
"新增失败"
);
}
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"新增用户标签失败{}"
,
e
.
getMessage
());
}
}
}
@Override
@Override
...
...
src/main/resources/mapper/UserMenusDao.xml
View file @
4b627354
...
@@ -22,10 +22,17 @@
...
@@ -22,10 +22,17 @@
<!-- 根据uid查询标签id-->
<!-- 根据uid查询标签id-->
<select
id=
"findIdByUserId"
resultType=
"long"
>
<select
id=
"findIdByUserId"
resultType=
"long"
>
SELECT id FROM tb_user_menus WHERE is_valid = 1 AND user_id IN
SELECT
um.id
FROM
( SELECT id, tags_id FROM tb_user_menus WHERE is_valid = 1 AND user_id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
open=
"("
close=
")"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
open=
"("
close=
")"
>
#{item}
#{item}
</foreach>
</foreach>
) um
LEFT JOIN tb_menu_tags mt ON um.tags_id = mt.id
WHERE
mt.is_custom = 0
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
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