Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dangerousenterprise-device-report
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
耿迪迪
dangerousenterprise-device-report
Commits
e74c8b79
Commit
e74c8b79
authored
Jul 07, 2022
by
lizhichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去空格
parent
586be965
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
UDPServerHandler.java
...dangerousdevicereport/netty/handler/UDPServerHandler.java
+7
-4
No files found.
src/main/java/com/zehong/dangerousdevicereport/netty/handler/UDPServerHandler.java
View file @
e74c8b79
...
...
@@ -56,6 +56,7 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
throw
new
Exception
(
"接收数据异常,请联系管理员查看设备上传数据!"
);
}
logger
.
info
(
"udp接收上传数据:"
+
bufStr
);
bufStr
=
bufStr
.
trim
();
//上传数据入库并处理报警信息
List
<
TDeviceReportData
>
dataList
=
saveReportDataAndDealAlarmInfo
(
bufStr
);
//报警信息处理
...
...
@@ -72,6 +73,7 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
* @param bufStr 上报数据
*/
private
List
<
TDeviceReportData
>
saveReportDataAndDealAlarmInfo
(
String
bufStr
)
{
List
<
TDeviceReportData
>
datas
=
new
ArrayList
<>();
//单组数据上报
if
(!
bufStr
.
contains
(
"@"
)){
...
...
@@ -168,10 +170,11 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
private
TDeviceReportData
assembleSaveInfo
(
String
reportData
){
String
[]
data
=
reportData
.
split
(
"/"
);
TDeviceReportData
tDeviceReportData
=
new
TDeviceReportData
();
tDeviceReportData
.
setDeviceNum
(
data
[
0
]);
tDeviceReportData
.
setDeviceStatus
(
data
[
1
]);
tDeviceReportData
.
setDeviceStatusDescribe
(
deviceStatus
(
data
[
1
]));
tDeviceReportData
.
setDevicePotency
(
data
[
2
]);
tDeviceReportData
.
setDeviceNum
(
data
[
0
].
trim
());
tDeviceReportData
.
setDeviceStatus
(
data
[
1
].
trim
());
tDeviceReportData
.
setDeviceStatusDescribe
(
deviceStatus
(
data
[
1
].
trim
()));
tDeviceReportData
.
setDevicePotency
(
data
[
2
].
trim
().
indexOf
(
"."
)==
0
?
"0"
+
data
[
2
].
trim
():
data
[
2
].
trim
());
return
tDeviceReportData
;
}
...
...
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