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
97f006b9
Commit
97f006b9
authored
Nov 20, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加资源自动刷新获取
parent
eb177719
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
13 deletions
+51
-13
base-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
...ls/xhx/base/system/user/service/impl/UserServiceImpl.java
+7
-4
base-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DemoStartedService.java
...als/xhx/daemon/applicationservice/DemoStartedService.java
+6
-3
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteService.java
...java/com/mortals/xhx/module/site/service/SiteService.java
+2
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
...mortals/xhx/module/site/service/impl/SiteServiceImpl.java
+36
-6
No files found.
base-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
View file @
97f006b9
...
@@ -75,6 +75,8 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -75,6 +75,8 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
@Autowired
private
RoleUserService
roleUserService
;
private
RoleUserService
roleUserService
;
@Autowired
private
SiteService
siteService
;
@Lazy
@Lazy
@Autowired
@Autowired
...
@@ -322,7 +324,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -322,7 +324,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
List
<
UserEntity
>
existUsers
=
list
.
parallelStream
().
map
(
item
->
this
.
getExtCache
(
item
.
getLoginName
())).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
existUsers
=
list
.
parallelStream
().
map
(
item
->
this
.
getExtCache
(
item
.
getLoginName
())).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
Map
<
String
,
UserEntity
>
existUserMap
=
existUsers
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getLoginName
(),
y
->
y
,
(
o
,
n
)
->
n
));
Map
<
String
,
UserEntity
>
existUserMap
=
existUsers
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getLoginName
(),
y
->
y
,
(
o
,
n
)
->
n
));
//分组查找存在的与不存在的用户
//分组查找存在的与不存在的用户
Map
<
Boolean
,
List
<
UserPdu
>>
collect
=
list
.
parallelStream
().
collect
(
Collectors
.
partitioningBy
(
x
->
existUserMap
.
containsKey
(
x
.
getLoginName
())));
Map
<
Boolean
,
List
<
UserPdu
>>
collect
=
list
.
parallelStream
().
collect
(
Collectors
.
partitioningBy
(
x
->
existUserMap
.
containsKey
(
x
.
getLoginName
())));
...
@@ -346,7 +347,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -346,7 +347,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
UserEntity
userEntity
=
new
UserEntity
();
UserEntity
userEntity
=
new
UserEntity
();
BeanUtils
.
copyProperties
(
user
,
userEntity
,
new
String
[]{
"loginPwd"
,
"loginName"
,
"userType"
,
"status"
,
"lastLoginTime"
,
"lastLoginAddress"
});
BeanUtils
.
copyProperties
(
user
,
userEntity
,
new
String
[]{
"loginPwd"
,
"loginName"
,
"userType"
,
"status"
,
"lastLoginTime"
,
"lastLoginAddress"
});
userEntity
.
setId
(
existUserMap
.
get
(
user
.
getLoginName
()).
getId
());
userEntity
.
setId
(
existUserMap
.
get
(
user
.
getLoginName
()).
getId
());
this
.
updateWidthDao
(
userEntity
);
//
this.updateWidthDao(userEntity);
if
(!
ObjectUtils
.
isEmpty
(
userEntity
.
getSiteIds
()))
{
if
(!
ObjectUtils
.
isEmpty
(
userEntity
.
getSiteIds
()))
{
userEntitySave
.
add
(
userEntity
);
userEntitySave
.
add
(
userEntity
);
}
}
...
@@ -364,7 +365,9 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -364,7 +365,9 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
}
});
});
//单独更新全站点
siteService
.
updateAllSiteTree
(
null
);
/* //单独更新全站点
UserEntity userEntity = new UserEntity();
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.initAttrValue();
userEntity.setId(0L);
userEntity.setId(0L);
...
@@ -380,7 +383,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -380,7 +383,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
contextTemp.setUser(userEntity);
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
ThreadPool.getInstance().execute(syncTreeSiteThread);
*/
}
}
...
...
base-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DemoStartedService.java
View file @
97f006b9
...
@@ -40,6 +40,8 @@ public class DemoStartedService implements IApplicationStartedService {
...
@@ -40,6 +40,8 @@ public class DemoStartedService implements IApplicationStartedService {
private
UserService
userService
;
private
UserService
userService
;
@Autowired
@Autowired
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
@Autowired
private
SiteService
siteService
;
@Override
@Override
public
void
start
()
{
public
void
start
()
{
...
@@ -48,7 +50,9 @@ public class DemoStartedService implements IApplicationStartedService {
...
@@ -48,7 +50,9 @@ public class DemoStartedService implements IApplicationStartedService {
//删除redis 中的 站点树
//删除redis 中的 站点树
cacheService
.
del
(
USER_SITE_TREE
);
cacheService
.
del
(
USER_SITE_TREE
);
UserEntity
userEntity
=
new
UserEntity
();
siteService
.
updateAllSiteTree
(
null
);
/* UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.initAttrValue();
userEntity.setId(0L);
userEntity.setId(0L);
Context contextTemp = new Context();
Context contextTemp = new Context();
...
@@ -62,8 +66,7 @@ public class DemoStartedService implements IApplicationStartedService {
...
@@ -62,8 +66,7 @@ public class DemoStartedService implements IApplicationStartedService {
contextTemp = new Context();
contextTemp = new Context();
contextTemp.setUser(userEntity);
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool
.
getInstance
().
execute
(
syncTreeSiteThread
);
ThreadPool.getInstance().execute(syncTreeSiteThread);*/
}
}
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteService.java
View file @
97f006b9
...
@@ -67,4 +67,6 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
...
@@ -67,4 +67,6 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
Rest
<
String
>
syncMatterBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
Rest
<
String
>
syncMatterBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
void
deleteBysiteIdAndSource
(
Long
siteId
,
Integer
source
,
Context
context
);
void
deleteBysiteIdAndSource
(
Long
siteId
,
Integer
source
,
Context
context
);
void
updateAllSiteTree
(
Context
context
);
}
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
View file @
97f006b9
...
@@ -16,6 +16,8 @@ import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
...
@@ -16,6 +16,8 @@ import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.AreaLevelDxTypeEnum
;
import
com.mortals.xhx.common.code.AreaLevelDxTypeEnum
;
import
com.mortals.xhx.common.code.AreaLevelEnum
;
import
com.mortals.xhx.common.code.AreaLevelEnum
;
...
@@ -25,6 +27,7 @@ import com.mortals.xhx.common.pdu.RespData;
...
@@ -25,6 +27,7 @@ import com.mortals.xhx.common.pdu.RespData;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.utils.MatterHtmlParseUtil
;
import
com.mortals.xhx.common.utils.MatterHtmlParseUtil
;
import
com.mortals.xhx.common.utils.SyncTreeSiteThread
;
import
com.mortals.xhx.feign.device.IDeviceFeign
;
import
com.mortals.xhx.feign.device.IDeviceFeign
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
com.mortals.xhx.module.area.model.AreaEntity
;
import
com.mortals.xhx.module.area.model.AreaEntity
;
...
@@ -191,14 +194,19 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -191,14 +194,19 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
super
.
saveAfter
(
entity
,
context
);
super
.
saveAfter
(
entity
,
context
);
//刷新站点树
//刷新站点树
//ThreadPool.getInstance().execute(new SyncTreeSiteThread(this,context));
//ThreadPool.getInstance().execute(new SyncTreeSiteThread(this,context));
Rest
<
String
>
rest
=
userFeign
.
synchSiteAuth
();
/*
Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setPage(1);
userPdu.setSize(-1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
userService.updateUserList(list.getData().getData());
}
}*/
this
.
updateAllSiteTree
(
context
);
//新加的站点 只需要更新全树
//更新同步部门相关
//更新同步部门相关
deptService
.
syncDeptBySiteId
(
entity
,
context
);
deptService
.
syncDeptBySiteId
(
entity
,
context
);
...
@@ -239,7 +247,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -239,7 +247,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
}
}
}
//查詢指定的站點ids
//查詢指定的站點ids
// log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
// log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
siteList
=
this
.
find
(
siteQuery
);
siteList
=
this
.
find
(
siteQuery
);
}
}
//如果是管理员 默认全部站点
//如果是管理员 默认全部站点
...
@@ -340,16 +348,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -340,16 +348,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
@Override
protected
void
updateAfter
(
SiteEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
SiteEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateAfter
(
entity
,
context
);
super
.
updateAfter
(
entity
,
context
);
//刷新站点树
//刷新站点树
Rest
<
String
>
rest
=
userFeign
.
synchSiteAuth
();
/*
Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setPage(1);
userPdu.setSize(-1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
userService.updateUserList(list.getData().getData());
}
}
*/
if
(
refresh
)
{
if
(
refresh
)
{
//通知设备更新站点信息
//通知设备更新站点信息
DevicePdu
devicePdu
=
new
DevicePdu
();
DevicePdu
devicePdu
=
new
DevicePdu
();
...
@@ -815,6 +823,28 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -815,6 +823,28 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
this
.
dao
.
delete
(
condition
);
this
.
dao
.
delete
(
condition
);
}
}
/**
* @param context
*/
@Override
public
void
updateAllSiteTree
(
Context
context
)
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
initAttrValue
();
userEntity
.
setId
(
0L
);
Context
contextTemp
=
new
Context
();
contextTemp
.
setUser
(
userEntity
);
SyncTreeSiteThread
syncTreeSiteThread
=
new
SyncTreeSiteThread
(
contextTemp
);
ThreadPool
.
getInstance
().
execute
(
syncTreeSiteThread
);
userEntity
=
new
UserEntity
();
userEntity
.
initAttrValue
();
userEntity
.
setId
(
1L
);
contextTemp
=
new
Context
();
contextTemp
.
setUser
(
userEntity
);
syncTreeSiteThread
=
new
SyncTreeSiteThread
(
contextTemp
);
ThreadPool
.
getInstance
().
execute
(
syncTreeSiteThread
);
}
public
List
<
MatterEntity
>
subList
(
List
<
MatterEntity
>
firstList
,
List
<
MatterEntity
>
secondList
)
{
public
List
<
MatterEntity
>
subList
(
List
<
MatterEntity
>
firstList
,
List
<
MatterEntity
>
secondList
)
{
Set
<
String
>
secondSet
=
secondList
.
parallelStream
().
map
(
e
->
e
.
getMatterNo
()).
collect
(
Collectors
.
toSet
());
Set
<
String
>
secondSet
=
secondList
.
parallelStream
().
map
(
e
->
e
.
getMatterNo
()).
collect
(
Collectors
.
toSet
());
...
...
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