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
56e31553
Commit
56e31553
authored
Dec 16, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分组更新设备
parent
5b103540
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
device-manager/src/main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
...main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
+5
-1
device-manager/src/main/java/com/mortals/xhx/thread/SendThirdPartyThread.java
...ain/java/com/mortals/xhx/thread/SendThirdPartyThread.java
+28
-9
No files found.
device-manager/src/main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
View file @
56e31553
package
com.mortals.xhx.thread
;
package
com.mortals.xhx.thread
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
...
@@ -112,7 +113,10 @@ public class DeviceDownMsgThread extends AbstractThread {
...
@@ -112,7 +113,10 @@ public class DeviceDownMsgThread extends AbstractThread {
}
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
deviceLogList
))
{
if
(!
ObjectUtils
.
isEmpty
(
deviceLogList
))
{
deviceLogService
.
save
(
deviceLogList
);
List
<
List
<
DeviceLogEntity
>>
partition
=
ListUtil
.
partition
(
deviceLogList
,
100
);
for
(
List
<
DeviceLogEntity
>
deviceLogEntities
:
partition
)
{
deviceLogService
.
save
(
deviceLogEntities
);
}
}
}
}
}
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/thread/SendThirdPartyThread.java
View file @
56e31553
...
@@ -17,6 +17,9 @@ import org.springframework.core.annotation.Order;
...
@@ -17,6 +17,9 @@ import org.springframework.core.annotation.Order;
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.List
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_PHP_IN_HTTP_URL
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_PHP_IN_HTTP_URL
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
RedisKey
.
KEY_DEVICE_THIRDPARTY_QUEUE
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
RedisKey
.
KEY_DEVICE_THIRDPARTY_QUEUE
;
...
@@ -47,17 +50,33 @@ public class SendThirdPartyThread extends AbstractThread {
...
@@ -47,17 +50,33 @@ public class SendThirdPartyThread extends AbstractThread {
@Override
@Override
protected
void
process
()
{
protected
void
process
()
{
// log.info("SendThirdPartyThread process");
// log.info("SendThirdPartyThread process");
DeviceReq
deviceReq
=
cacheService
.
blpop
(
KEY_DEVICE_THIRDPARTY_QUEUE
,
10
,
DeviceReq
.
class
);
List
<
DeviceReq
>
deviceMsgReqs
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
deviceReq
))
{
while
(
true
)
{
//设备上下线信息 不更新通知
DeviceReq
deviceReq
=
cacheService
.
lpop
(
KEY_DEVICE_THIRDPARTY_QUEUE
,
DeviceReq
.
class
);
if
(
DeviceMethodEnum
.
ONLINE
.
getValue
()
==
deviceReq
.
getDeviceStatus
()
||
DeviceMethodEnum
.
ONLINE
.
getValue
()
==
deviceReq
.
getDeviceStatus
())
{
if
(
ObjectUtils
.
isEmpty
(
deviceReq
))
{
return
;
// log.info("deviceMsgReq:{}", deviceMsgReq == null);
break
;
}
deviceMsgReqs
.
add
(
deviceReq
);
}
if
(!
ObjectUtils
.
isEmpty
(
deviceMsgReqs
))
{
// DeviceReq deviceReq = cacheService.lpop(KEY_DEVICE_THIRDPARTY_QUEUE, DeviceReq.class);
if
(!
ObjectUtils
.
isEmpty
(
deviceMsgReqs
))
{
for
(
DeviceReq
deviceMsgReq
:
deviceMsgReqs
)
{
//设备上下线信息 不更新通知
if
(
DeviceMethodEnum
.
ONLINE
.
getValue
()
==
deviceMsgReq
.
getDeviceStatus
()
||
DeviceMethodEnum
.
ONLINE
.
getValue
()
==
deviceMsgReq
.
getDeviceStatus
())
{
return
;
}
//deviceReq.getReceiveMethod()
String
phpInUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_IN_HTTP_URL
,
"http://127.0.0.1:11078/zwfw_api"
);
ApiResp
<
String
>
resp
=
messageService
.
sendThirdParty
(
UrlBuilder
.
of
(
phpInUrl
).
addPath
(
thirdPartyPath
).
build
(),
deviceMsgReq
);
log
.
info
(
"sendThirty req==>deviceCode:{} TYPE:{} \n resp ==>{}"
,
deviceMsgReq
.
getDeviceCode
(),
DeviceMethodEnum
.
getByValue
(
deviceMsgReq
.
getDeviceStatus
()).
getDesc
(),
JSON
.
toJSONString
(
resp
));
}
}
}
//deviceReq.getReceiveMethod()
String
phpInUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_IN_HTTP_URL
,
"http://127.0.0.1:11078/zwfw_api"
);
ApiResp
<
String
>
resp
=
messageService
.
sendThirdParty
(
UrlBuilder
.
of
(
phpInUrl
).
addPath
(
thirdPartyPath
).
build
(),
deviceReq
);
log
.
info
(
"sendThirty req==>{} \n resp ==>{}"
,
JSON
.
toJSONString
(
deviceReq
),
JSON
.
toJSONString
(
resp
));
}
}
}
}
...
...
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