Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
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
李丛阳
education
Commits
353ee7b3
Commit
353ee7b3
authored
Jun 22, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 同步功能 添加日志(zx-1.0)
parent
4bb6bf86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
UserManageTask.java
src/main/java/org/rcisoft/core/task/UserManageTask.java
+2
-1
SysUserServiceImpl.java
...org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
+12
-1
No files found.
src/main/java/org/rcisoft/core/task/UserManageTask.java
View file @
353ee7b3
...
...
@@ -24,10 +24,11 @@ public class UserManageTask {
@Autowired
private
SysRoleRepository
sysRoleRepository
;
@Scheduled
(
cron
=
"${eduJob.userManageJob:0 0
/2
* * ?}"
)
@Scheduled
(
cron
=
"${eduJob.userManageJob:0 0
/5 *
* * ?}"
)
public
void
work
()
{
//获取 智学开通所有企业id
List
<
String
>
corpIds
=
sysRoleRepository
.
getCorpIds
();
log
.
info
(
"------UserManageTask----定时任务调用获取当前企业ids-"
+
corpIds
);
//循环调用 同步接口
corpIds
.
forEach
(
c
->
sysUserService
.
synchronizedALL
(
c
));
}
...
...
src/main/java/org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
View file @
353ee7b3
...
...
@@ -415,6 +415,10 @@ public class SysUserServiceImpl implements SysUserService {
}
else
{
sysUser
.
setCreateDate
(
new
Date
());
sysUser
.
setUpdateDate
(
new
Date
());
if
(
null
==
sysUser
.
getCreateBy
())
sysUser
.
setCreateBy
(
""
);
if
(
null
==
sysUser
.
getUpdateBy
())
sysUser
.
setUpdateBy
(
""
);
sysUserMapper
.
insertSelective
(
sysUser
);
line
++;
}
...
...
@@ -487,8 +491,10 @@ public class SysUserServiceImpl implements SysUserService {
//获取当前企业 主管理员角色id
String
mRId
=
sysRoleRepository
.
getRoleId
(
corpId
,
"0"
);
log
.
info
(
"---------synchronizedManages-----主管理员角色Id-"
+
mRId
);
//获取智信接口 所有主管理员
List
<
CorpGetManager
>
userMainList
=
cotactApiRequestClient
.
corpGetManager
(
corpId
,
"1"
);
log
.
info
(
"---------synchronizedManages-----主管理员list-"
+
userMainList
);
if
(
userMainList
!=
null
&&
userMainList
.
size
()
>
0
){
userMainList
=
this
.
accountIdToBusinessId
(
userMainList
,
corpId
);
List
<
UserRoleDTO
>
userRoleDTOList
=
setUserRole
(
userMainList
,
mRId
);
...
...
@@ -496,12 +502,14 @@ public class SysUserServiceImpl implements SysUserService {
sysRoleRepository
.
deleteUserRole
(
mRId
);
//再插入s_r_user_role
sysRoleRepository
.
addUserRole
(
userRoleDTOList
);
log
.
info
(
"---------synchronizedManages-----插入成功---当前主管理员-"
+
userRoleDTOList
);
}
//获取当前企业 子管理员角色id
String
sRId
=
sysRoleRepository
.
getRoleId
(
corpId
,
"1"
);
log
.
info
(
"---------synchronizedManages-----子管理员角色Id-"
+
sRId
);
List
<
CorpGetManager
>
userSubMainList
=
cotactApiRequestClient
.
corpGetManager
(
corpId
,
"2"
);
log
.
info
(
"---------synchronizedManages-----子管理员list-"
+
userSubMainList
);
if
(
userSubMainList
!=
null
&&
userSubMainList
.
size
()
>
0
){
userSubMainList
=
this
.
accountIdToBusinessId
(
userSubMainList
,
corpId
);
List
<
UserRoleDTO
>
userSubRoleDTOList
=
setUserRole
(
userSubMainList
,
sRId
);
...
...
@@ -509,6 +517,7 @@ public class SysUserServiceImpl implements SysUserService {
sysRoleRepository
.
deleteUserRole
(
sRId
);
//插入s_r_user_role表
sysRoleRepository
.
addUserRole
(
userSubRoleDTOList
);
log
.
info
(
"---------synchronizedManages-----插入成功---当前子管理员-"
+
userSubRoleDTOList
);
}
}
...
...
@@ -610,9 +619,11 @@ public class SysUserServiceImpl implements SysUserService {
*/
@Override
public
int
synchronizedALL
(
String
corpId
){
log
.
info
(
"----------synchronizedALL----开始调用同步管理员接口-------当前企业--"
+
corpId
);
synchronizedManages
(
corpId
);
int
line
=
0
;
try
{
log
.
info
(
"----------synchronizedALL----开始调用同步用户接口-------当前企业--"
+
corpId
);
line
=
synchronizedUsers
(
corpId
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
...
...
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