Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-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-new-platform
Commits
763253c6
Commit
763253c6
authored
Dec 18, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新下发消息为线程池发送
parent
e6b31455
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+1
-2
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
.../java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
+6
-5
No files found.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
763253c6
...
@@ -243,12 +243,11 @@ public class DeviceApiController {
...
@@ -243,12 +243,11 @@ public class DeviceApiController {
deviceEntity
.
setOnlineTime
(
new
Date
());
deviceEntity
.
setOnlineTime
(
new
Date
());
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
deviceEntity
.
setDeviceVersion
(
req
.
getDeviceVersion
()
==
null
?
""
:
req
.
getDeviceVersion
());
deviceEntity
.
setDeviceVersion
(
req
.
getDeviceVersion
()
==
null
?
""
:
req
.
getDeviceVersion
());
//todo 延迟队列更新 此时进入redis 队列
DeviceEntity
entity
=
new
DeviceEntity
();
DeviceEntity
entity
=
new
DeviceEntity
();
entity
.
setId
(
deviceEntity
.
getId
());
entity
.
setId
(
deviceEntity
.
getId
());
entity
.
setOnlineTime
(
new
Date
());
entity
.
setOnlineTime
(
new
Date
());
entity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
entity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
//cacheService.lpush(RedisKey.KEY_DEVICE_ONLINE_QUEUE, entity);
deviceService
.
getDeviceDao
().
update
(
deviceEntity
);
deviceService
.
getDeviceDao
().
update
(
deviceEntity
);
rsp
.
setData
(
deviceResp
);
rsp
.
setData
(
deviceResp
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
View file @
763253c6
...
@@ -13,7 +13,6 @@ import com.mortals.xhx.common.code.DeviceStatusEnum;
...
@@ -13,7 +13,6 @@ import com.mortals.xhx.common.code.DeviceStatusEnum;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
...
@@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -49,7 +47,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -49,7 +47,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
@Override
@Override
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
log
.
info
(
"设备状态修正任务"
);
log
.
info
(
"设备状态修正任务"
);
List
<
DeviceEntity
>
waitDeviceInfos
=
new
ArrayList
<>();
/*
List<DeviceEntity> waitDeviceInfos = new ArrayList<>();
while (true) {
while (true) {
DeviceEntity deviceEntity = cacheService.blpop(RedisKey.KEY_DEVICE_ONLINE_QUEUE,10, DeviceEntity.class);
DeviceEntity deviceEntity = cacheService.blpop(RedisKey.KEY_DEVICE_ONLINE_QUEUE,10, DeviceEntity.class);
if (ObjectUtils.isEmpty(deviceEntity)) {
if (ObjectUtils.isEmpty(deviceEntity)) {
...
@@ -70,9 +68,12 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -70,9 +68,12 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
cacheService.lpush(RedisKey.KEY_DEVICE_UPDATE_QUEUE,waitDeviceInfo);
cacheService.lpush(RedisKey.KEY_DEVICE_UPDATE_QUEUE,waitDeviceInfo);
}
}
// deviceService.update(waitDeviceInfos);
// deviceService.update(waitDeviceInfos);
}
}
*/
//获取所有在线设备
//获取所有在线设备
List
<
DeviceEntity
>
deviceList
=
deviceService
.
find
(
new
DeviceQuery
().
deviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
()));
List
<
DeviceEntity
>
deviceList
=
deviceService
.
getCacheList
().
stream
().
filter
(
f
->
DeviceStatusEnum
.
在线
.
getValue
()==
f
.
getDeviceStatus
()).
collect
(
Collectors
.
toList
());
// List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue()));
//更新离线
//更新离线
List
<
DeviceEntity
>
deviceOfflineList
=
deviceList
.
parallelStream
().
map
(
item
->
{
List
<
DeviceEntity
>
deviceOfflineList
=
deviceList
.
parallelStream
().
map
(
item
->
{
if
(
ObjectUtils
.
isEmpty
(
item
.
getDeviceCode
()))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
item
.
getDeviceCode
()))
return
null
;
...
...
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