Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-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
赵啸非
device-platform
Commits
df233250
Commit
df233250
authored
May 23, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备站点名称
parent
683d7e9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
.../java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
+9
-5
No files found.
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
View file @
df233250
...
@@ -15,6 +15,7 @@ import com.mortals.xhx.common.code.DeviceSourceEnum;
...
@@ -15,6 +15,7 @@ import com.mortals.xhx.common.code.DeviceSourceEnum;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.common.utils.SendTask
;
import
com.mortals.xhx.common.utils.SendTask
;
import
com.mortals.xhx.common.utils.SendTaskThreadPool
;
import
com.mortals.xhx.common.utils.SendTaskThreadPool
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceLogEntity
;
import
com.mortals.xhx.module.device.model.DeviceLogEntity
;
import
com.mortals.xhx.module.device.model.DeviceLogQuery
;
import
com.mortals.xhx.module.device.model.DeviceLogQuery
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
...
@@ -26,6 +27,7 @@ import org.springframework.util.ObjectUtils;
...
@@ -26,6 +27,7 @@ import org.springframework.util.ObjectUtils;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 设备状态任务
* 设备状态任务
...
@@ -62,10 +64,10 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -62,10 +64,10 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
try
{
try
{
//获取所有设备,针对每个设备查询最近指定秒的日志,如果没有则更新下线
//获取所有设备,针对每个设备查询最近指定秒的日志,如果没有则更新下线
deviceService
.
getCacheList
().
stream
()
List
<
DeviceEntity
>
collect
=
deviceService
.
getCacheList
().
stream
()
.
filter
(
f
->
f
.
getDeviceSource
()
==
DeviceSourceEnum
.
大厅
.
getValue
())
.
filter
(
f
->
f
.
getDeviceSource
()
==
DeviceSourceEnum
.
大厅
.
getValue
())
.
filter
(
f
->
f
.
getDeviceOnlineStatus
()
==
DeviceOnlineStatusEnum
.
在线
.
getValue
())
.
filter
(
f
->
f
.
getDeviceOnlineStatus
()
==
DeviceOnlineStatusEnum
.
在线
.
getValue
())
.
peek
(
device
->
{
.
map
(
device
->
{
DeviceLogQuery
query
=
new
DeviceLogQuery
();
DeviceLogQuery
query
=
new
DeviceLogQuery
();
query
.
setCreateTimeStart
(
DateUtils
.
getStrDateTime
(
new
Date
(
System
.
currentTimeMillis
()
-
timeout
)));
query
.
setCreateTimeStart
(
DateUtils
.
getStrDateTime
(
new
Date
(
System
.
currentTimeMillis
()
-
timeout
)));
...
@@ -74,12 +76,14 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -74,12 +76,14 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
//更新设备下线
//更新设备下线
device
.
setOfflineTime
(
new
Date
());
device
.
setOfflineTime
(
new
Date
());
device
.
setDeviceOnlineStatus
(
DeviceOnlineStatusEnum
.
离线
.
getValue
());
device
.
setDeviceOnlineStatus
(
DeviceOnlineStatusEnum
.
离线
.
getValue
());
deviceService
.
update
(
device
);
//
deviceService.update(device);
WebSocketUtil
.
broadcast
(
SendToAllRequest
.
TYPE
,
new
SendToAllRequest
().
setContent
(
JSON
.
toJSONString
(
device
)));
WebSocketUtil
.
broadcast
(
SendToAllRequest
.
TYPE
,
new
SendToAllRequest
().
setContent
(
JSON
.
toJSONString
(
device
)));
return
device
;
}
}
}).
count
();
return
null
;
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
deviceService
.
update
(
collect
,
null
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"更新设备状态任务异常,结束执行"
,
e
);
log
.
error
(
"更新设备状态任务异常,结束执行"
,
e
);
}
}
...
...
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