Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhmes-agecal
Commits
fdcf679d
Commit
fdcf679d
authored
Aug 31, 2026
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 老化过程中 获取卡号,获取IOT状态调整中
parent
118abb05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
20 deletions
+29
-20
AllCommandHandler.java
...c/main/java/com/zehong/system/task/AllCommandHandler.java
+29
-20
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/task/AllCommandHandler.java
View file @
fdcf679d
...
@@ -229,7 +229,7 @@ public class AllCommandHandler {
...
@@ -229,7 +229,7 @@ public class AllCommandHandler {
return
;
return
;
}
}
// 1. 查询数据
// 1. 查询数据
// 已经过滤掉 空 motherboardCode
List
<
PalletDeviceBinding
>
bindings
=
palletDeviceBindingService
.
listByStoreyCode
(
storeyCode
);
List
<
PalletDeviceBinding
>
bindings
=
palletDeviceBindingService
.
listByStoreyCode
(
storeyCode
);
if
(
bindings
.
isEmpty
())
{
if
(
bindings
.
isEmpty
())
{
return
;
return
;
...
@@ -242,16 +242,7 @@ public class AllCommandHandler {
...
@@ -242,16 +242,7 @@ public class AllCommandHandler {
.
collect
(
Collectors
.
groupingBy
(
PalletDeviceBinding:
:
getMotherboardCode
));
.
collect
(
Collectors
.
groupingBy
(
PalletDeviceBinding:
:
getMotherboardCode
));
// 处理 nbCode 为空的(直接设状态为 2,加入待更新列表)
// 处理 nbCode 为空的(直接设状态为 2,加入待更新列表)
List
<
PalletDeviceBinding
>
needUpdateList
=
new
ArrayList
<>();
List
<
PalletDeviceBinding
>
needUpdateList
=
bindings
.
stream
().
filter
(
b
->
StringUtils
.
isBlank
(
b
.
getNbCode
())).
collect
(
Collectors
.
toList
());
for
(
PalletDeviceBinding
binding
:
bindings
)
{
if
(
StringUtils
.
isBlank
(
binding
.
getNbCode
()))
{
binding
.
setIotStatus
(
2
);
needUpdateList
.
add
(
binding
);
}
// 顺便处理网络状态异常(但不要覆盖后续 IOT 查询结果,网络异常只是前置标记)
// 注意:如果网络状态 !=1,但 IOT 查询成功,应该以 IOT 为准,这里先不 set,留给后面判断
}
if
(
groupByMotherboard
.
isEmpty
())
{
if
(
groupByMotherboard
.
isEmpty
())
{
// 如果没有需要调接口的,直接批量更新后返回
// 如果没有需要调接口的,直接批量更新后返回
if
(!
needUpdateList
.
isEmpty
())
{
if
(!
needUpdateList
.
isEmpty
())
{
...
@@ -276,14 +267,13 @@ public class AllCommandHandler {
...
@@ -276,14 +267,13 @@ public class AllCommandHandler {
for
(
Map
.
Entry
<
String
,
List
<
PalletDeviceBinding
>>
entry
:
groupByMotherboard
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
PalletDeviceBinding
>>
entry
:
groupByMotherboard
.
entrySet
())
{
String
motherboardCode
=
entry
.
getKey
();
String
motherboardCode
=
entry
.
getKey
();
List
<
PalletDeviceBinding
>
sameBoardDevices
=
entry
.
getValue
();
List
<
PalletDeviceBinding
>
sameBoardDevices
=
entry
.
getValue
();
// 取任意一个设备的 nbCode(因为同一主板下的 nbCode 理论上一致,但为了严谨取第一个非空的)
String
nbCode
=
sameBoardDevices
.
stream
()
PalletDeviceBinding
palletDeviceBinding
=
sameBoardDevices
.
get
(
0
);
.
map
(
PalletDeviceBinding:
:
getNbCode
)
if
(
palletDeviceBinding
==
null
)
{
.
filter
(
StringUtils:
:
isNotBlank
)
continue
;
.
findFirst
()
}
.
orElse
(
null
);
String
nbCode
=
palletDeviceBinding
.
getNbCode
();
if
(
StringUtils
.
isBlank
(
nbCode
))
{
if
(
nbCode
==
null
)
{
continue
;
continue
;
}
}
...
@@ -304,11 +294,30 @@ public class AllCommandHandler {
...
@@ -304,11 +294,30 @@ public class AllCommandHandler {
Integer
statusToSet
;
Integer
statusToSet
;
if
(
StringUtils
.
isNotBlank
(
result
))
{
if
(
StringUtils
.
isNotBlank
(
result
))
{
Map
<
String
,
String
>
dataMap
=
iotDataAndTokenUtil
.
processIotData
(
result
);
Map
<
String
,
String
>
dataMap
=
iotDataAndTokenUtil
.
processIotData
(
result
);
// 上报时间必须在 老化时间范围内
if
(
dataMap
!=
null
&&
!
dataMap
.
isEmpty
())
{
if
(
dataMap
!=
null
&&
!
dataMap
.
isEmpty
())
{
statusToSet
=
1
;
// IOT数据正常
String
reportTimeStr
=
dataMap
.
get
(
"reportTime"
);
Date
bindingTime
=
palletDeviceBinding
.
getBindingTime
();
if
(
StringUtils
.
isNotBlank
(
reportTimeStr
)
&&
bindingTime
!=
null
)
{
try
{
Date
reportTime
=
DateUtils
.
parseDate
(
reportTimeStr
);
if
(
reportTime
.
after
(
bindingTime
))
{
statusToSet
=
1
;
}
else
{
statusToSet
=
0
;
}
}
catch
(
Exception
e
)
{
statusToSet
=
0
;
}
}
else
{
statusToSet
=
0
;
}
}
else
{
}
else
{
statusToSet
=
0
;
// IOT数据为空
statusToSet
=
0
;
// IOT数据为空
}
}
}
else
{
}
else
{
statusToSet
=
0
;
// 请求失败
statusToSet
=
0
;
// 请求失败
}
}
...
...
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