Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-kafkaconsumer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a744e35e
authored
May 17, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化kafka获取vdid的逻辑
1 parent
22e06d61
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
src/main/java/cn/com/glsx/kafka/service/GpsAlarmService.java
src/main/java/cn/com/glsx/kafka/service/GpsAlarmService.java
View file @
a744e35
...
@@ -88,6 +88,10 @@ public class GpsAlarmService {
...
@@ -88,6 +88,10 @@ public class GpsAlarmService {
//构建报警类型
//构建报警类型
buildHashAlarm
(
alarm
,
hashAlarm
,
source
);
buildHashAlarm
(
alarm
,
hashAlarm
,
source
);
// 获取 vdId
R
<
VehicleDeviceDto
>
vehicleDeviceBySnR
=
vehicleDeviceClient
.
getVehicleDeviceBySn
(
alarm
.
getSn
());
VehicleDeviceDto
vehicleDeviceDto
=
vehicleDeviceBySnR
.
getData
(
VehicleDeviceDto
.
class
);
// 处理每一个报警的数据
// 处理每一个报警的数据
hashAlarm
.
forEach
((
alarmType
,
alarmVal
)
->
{
hashAlarm
.
forEach
((
alarmType
,
alarmVal
)
->
{
log
.
info
(
"设备号:"
+
sn
+
" alarmType:"
+
alarmType
+
"; alarmVal:"
+
alarmVal
+
";source:"
+
source
);
log
.
info
(
"设备号:"
+
sn
+
" alarmType:"
+
alarmType
+
"; alarmVal:"
+
alarmVal
+
";source:"
+
source
);
...
@@ -95,14 +99,10 @@ public class GpsAlarmService {
...
@@ -95,14 +99,10 @@ public class GpsAlarmService {
return
;
return
;
}
}
// 获取 vdId
R
<
VehicleDeviceDto
>
vehicleDeviceBySnR
=
vehicleDeviceClient
.
getVehicleDeviceBySn
(
alarm
.
getSn
());
VehicleDeviceDto
vehicleDeviceDto
=
vehicleDeviceBySnR
.
getData
(
VehicleDeviceDto
.
class
);
Long
vdId
=
0L
;
Long
vdId
=
0L
;
if
(
Objects
.
nonNull
(
vehicleDeviceDto
))
{
if
(
Objects
.
nonNull
(
vehicleDeviceDto
))
{
vdId
=
vehicleDeviceDto
.
getId
();
vdId
=
vehicleDeviceDto
.
getId
();
}
}
//设置redis key值
//设置redis key值
StringBuffer
key
=
realTimeKey
(
sn
,
alarmType
,
vdId
);
StringBuffer
key
=
realTimeKey
(
sn
,
alarmType
,
vdId
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment