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
78a2a99a
Commit
78a2a99a
authored
Dec 18, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新下发消息为线程池发送
parent
6fd98cee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
10 deletions
+16
-10
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+4
-4
device-manager/src/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
...c/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
+10
-0
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceComsumersRegisterService.java
...on/applicationservice/DeviceComsumersRegisterService.java
+2
-2
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
.../java/com/mortals/httpclient/device/DeviceController.http
+0
-4
No files found.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
78a2a99a
...
@@ -667,13 +667,13 @@ public class DeviceApiController {
...
@@ -667,13 +667,13 @@ public class DeviceApiController {
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
try
{
try
{
list
.
stream
()
/*
list.stream()
.sorted(Comparator.comparing(DeviceMsgReq::getTimestamp))
.sorted(Comparator.comparing(DeviceMsgReq::getTimestamp))
.forEach(item -> {
.forEach(item -> {
cacheService.lpush(KEY_DEVICE_DOWN_MSG_QUEUE, item);
cacheService.lpush(KEY_DEVICE_DOWN_MSG_QUEUE, item);
});
});
*/
/*
DownMsgTask downMsgTask = new DownMsgTask(list, platformService, productService, deviceService, deviceLogService, messageProducer);
DownMsgTask
downMsgTask
=
new
DownMsgTask
(
list
,
platformService
,
productService
,
deviceService
,
deviceLogService
,
messageProducer
);
sendTaskThreadPool.execute(downMsgTask);
*/
sendTaskThreadPool
.
execute
(
downMsgTask
);
}
catch
(
AppException
e
)
{
}
catch
(
AppException
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
log
.
error
(
"接收数据失败"
,
e
);
rsp
.
setCode
(
e
.
getCode
());
rsp
.
setCode
(
e
.
getCode
());
...
...
device-manager/src/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
View file @
78a2a99a
...
@@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
...
@@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -49,6 +50,7 @@ public class DownMsgTask implements Runnable {
...
@@ -49,6 +50,7 @@ public class DownMsgTask implements Runnable {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
ArrayList
<
DeviceLogEntity
>
deviceLogList
=
new
ArrayList
<>();
List
<
DeviceMsgReq
>
collect
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceMsgReq:
:
getTimestamp
)).
collect
(
Collectors
.
toList
());
List
<
DeviceMsgReq
>
collect
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceMsgReq:
:
getTimestamp
)).
collect
(
Collectors
.
toList
());
List
<
List
<
DeviceMsgReq
>>
partition
=
ListUtil
.
partition
(
collect
,
10
);
List
<
List
<
DeviceMsgReq
>>
partition
=
ListUtil
.
partition
(
collect
,
10
);
for
(
List
<
DeviceMsgReq
>
deviceMsgReqs
:
partition
)
{
for
(
List
<
DeviceMsgReq
>
deviceMsgReqs
:
partition
)
{
...
@@ -83,6 +85,7 @@ public class DownMsgTask implements Runnable {
...
@@ -83,6 +85,7 @@ public class DownMsgTask implements Runnable {
deviceLogEntity
.
setLogType
(
LogTypeEnum
.
下发服务
.
getValue
());
deviceLogEntity
.
setLogType
(
LogTypeEnum
.
下发服务
.
getValue
());
deviceLogEntity
.
setCreateUserId
(
1L
);
deviceLogEntity
.
setCreateUserId
(
1L
);
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogEntity
.
setCreateTime
(
new
Date
());
// deviceLogList.add(deviceLogEntity);
deviceLogService
.
save
(
deviceLogEntity
,
null
);
deviceLogService
.
save
(
deviceLogEntity
,
null
);
}
else
{
}
else
{
log
.
info
(
"未找到设备,deviceCode:{}"
,
item
.
getDeviceCode
());
log
.
info
(
"未找到设备,deviceCode:{}"
,
item
.
getDeviceCode
());
...
@@ -92,6 +95,13 @@ public class DownMsgTask implements Runnable {
...
@@ -92,6 +95,13 @@ public class DownMsgTask implements Runnable {
TimeUnit
.
SECONDS
.
sleep
(
1
);
TimeUnit
.
SECONDS
.
sleep
(
1
);
}
}
/* if (!ObjectUtils.isEmpty(deviceLogList)) {
List<List<DeviceLogEntity>> partitionlogs = ListUtil.partition(deviceLogList, 100);
for (List<DeviceLogEntity> deviceLogEntities : partitionlogs) {
deviceLogService.save(deviceLogEntities);
}
}*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常:"
,
e
);
log
.
error
(
"异常:"
,
e
);
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceComsumersRegisterService.java
View file @
78a2a99a
...
@@ -84,8 +84,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic
...
@@ -84,8 +84,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic
}
}
log
.
info
(
"第三方发送线程启动"
);
log
.
info
(
"第三方发送线程启动"
);
sendThirdPartyThread
.
start
();
sendThirdPartyThread
.
start
();
log
.
info
(
"消息下发发送线程启动"
);
//
log.info("消息下发发送线程启动");
deviceDownMsgThread
.
start
();
//
deviceDownMsgThread.start();
log
.
info
(
"服务端消息队列初始化服务开始.."
);
log
.
info
(
"服务端消息队列初始化服务开始.."
);
deviceService
.
find
(
new
DeviceEntity
())
deviceService
.
find
(
new
DeviceEntity
())
...
...
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
View file @
78a2a99a
...
@@ -119,10 +119,6 @@ Content-Type: application/json
...
@@ -119,10 +119,6 @@ Content-Type: application/json
"deviceCode": "12-31-70-9C-BF-A3"
"deviceCode": "12-31-70-9C-BF-A3"
}
}
> {%
client.global.set("content", JSON.parse(response.body).data.content);
%}
###获取产品与
###获取产品与
GET {{baseUrl}}/api/deviceInit
GET {{baseUrl}}/api/deviceInit
Accept: application/json
Accept: application/json
...
...
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