Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
c95fe372
Commit
c95fe372
authored
Jun 22, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化用户同步更新所属站点代码
parent
b85541d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
...mortals/xhx/module/user/service/impl/UserServiceImpl.java
+31
-4
No files found.
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
View file @
c95fe372
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -270,8 +271,34 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
public
void
synchSitesAuth
()
throws
AppException
{
//todo 批量更新 用户太多 该接口查询非常缓慢 用户根据所属区域分组查询后更新
UserEntity
query
=
new
UserEntity
();
List
<
UserEntity
>
all
=
this
.
find
(
query
);
all
.
forEach
(
item
->
{
List
<
UserEntity
>
allUsers
=
this
.
find
(
query
);
//区域分组编码
allUsers
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getAreaCodes
())).
entrySet
().
forEach
(
item
->
{
String
areaCodes
=
item
.
getKey
();
if
(!
ObjectUtils
.
isEmpty
(
areaCodes
))
{
List
<
String
>
areaCodeList
=
Arrays
.
asList
(
areaCodes
.
split
(
","
));
String
resp
=
areaService
.
getFlatSitesByAreaCodes
(
new
AreaQuery
().
areaCodeList
(
areaCodeList
),
null
);
JSONObject
apiResp
=
JSON
.
parseObject
(
resp
);
if
(
apiResp
.
getInteger
(
"code"
)
==
YesNoEnum
.
YES
.
getValue
())
{
String
siteIds
=
apiResp
.
getString
(
"data"
);
//更新用户站点
List
<
UserEntity
>
userEntityList
=
item
.
getValue
();
if
(!
ObjectUtils
.
isEmpty
(
userEntityList
))
{
userEntityList
.
stream
().
forEach
(
userEntity
->
{
userEntity
.
setSiteIds
(
siteIds
);
updateRedisUserSession
(
userEntity
);
});
this
.
dao
.
updateBatch
(
userEntityList
);
}
}
else
{
log
.
info
(
"获取用户站点列表树数据失败:"
+
apiResp
.
getString
(
"msg"
));
}
}
});
/* all.forEach(item -> {
if (StringUtils.isNotEmpty(item.getAreaCodes())) {
List<String> areaCodeList = Arrays.asList(item.getAreaCodes().split(","));
String resp = areaService.getFlatSitesByAreaCodes(new AreaQuery().areaCodeList(areaCodeList), null);
...
...
@@ -287,7 +314,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
updateRedisUserSession(userEntity);
}
});
});
*/
}
@Override
...
...
@@ -353,7 +380,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
entity
.
setCreateTime
(
new
Date
());
entity
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
entity
.
getLoginPwd
()));
int
insert
=
this
.
getDao
().
insert
(
entity
);
if
(
insert
>
0
)
{
if
(
insert
>
0
)
{
successNum
++;
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserId
(
entity
.
getId
());
...
...
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