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 417a79e4
authored
Jun 15, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
二押警情:不处理离开时间
1 parent
94cd1f8c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
22 deletions
src/main/java/cn/com/glsx/kafka/service/SecondDataService.java
src/main/java/cn/com/glsx/kafka/service/SecondDataService.java
View file @
417a79e
...
@@ -40,7 +40,7 @@ public class SecondDataService {
...
@@ -40,7 +40,7 @@ public class SecondDataService {
public
void
processTrackEvent
(
KafkaSecondData
.
SecondEvent
trackEvent
)
{
public
void
processTrackEvent
(
KafkaSecondData
.
SecondEvent
trackEvent
)
{
try
{
try
{
long
startTime
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
//查询vdId
//查询vdId
VehicleDeviceDto
vehicleDevice
=
vehicleDeviceService
.
getVehicleDevice
(
trackEvent
.
getSn
());
VehicleDeviceDto
vehicleDevice
=
vehicleDeviceService
.
getVehicleDevice
(
trackEvent
.
getSn
());
Long
vdId
=
Optional
.
ofNullable
(
vehicleDevice
).
map
(
VehicleDeviceDto:
:
getId
).
orElse
(
0L
);
Long
vdId
=
Optional
.
ofNullable
(
vehicleDevice
).
map
(
VehicleDeviceDto:
:
getId
).
orElse
(
0L
);
...
@@ -48,8 +48,8 @@ public class SecondDataService {
...
@@ -48,8 +48,8 @@ public class SecondDataService {
//判断重复
//判断重复
AlarmSecondDataDTO
alarmSecondDataOld
=
getAlarmSecondDataBySnAndAlarmTime
(
trackEvent
.
getSn
(),
trackEvent
.
getSecondAlarmTime
(),
vdId
);
AlarmSecondDataDTO
alarmSecondDataOld
=
getAlarmSecondDataBySnAndAlarmTime
(
trackEvent
.
getSn
(),
trackEvent
.
getSecondAlarmTime
(),
vdId
);
long
endTime
=
System
.
currentTimeMillis
();
long
t2
=
System
.
currentTimeMillis
();
log
.
info
(
"secondData 判断重复:{}"
,
endTime
-
startTime
);
log
.
info
(
"secondData 判断重复:{}"
,
t2
-
t1
);
if
(
Objects
.
nonNull
(
alarmSecondDataOld
))
{
if
(
Objects
.
nonNull
(
alarmSecondDataOld
))
{
log
.
info
(
"secondDataAlarm exist params:{}"
,
JSONObject
.
toJSONString
(
alarmSecondDataOld
));
log
.
info
(
"secondDataAlarm exist params:{}"
,
JSONObject
.
toJSONString
(
alarmSecondDataOld
));
return
;
return
;
...
@@ -61,28 +61,17 @@ public class SecondDataService {
...
@@ -61,28 +61,17 @@ public class SecondDataService {
log
.
info
(
"sn:{}, createBy:{}"
,
trackEvent
.
getSn
(),
createBy
);
log
.
info
(
"sn:{}, createBy:{}"
,
trackEvent
.
getSn
(),
createBy
);
AlarmSecondDataDTO
lastSecondData
=
getLastSecondDataBySn
(
trackEvent
.
getSn
(),
vdId
);
AlarmSecondDataDTO
lastSecondData
=
getLastSecondDataBySn
(
trackEvent
.
getSn
(),
vdId
);
if
(
Objects
.
isNull
(
lastSecondData
))
{
if
(
Objects
.
nonNull
(
lastSecondData
))
{
long
startTime01
=
System
.
currentTimeMillis
();
//恢复上一条报警
insertData
(
trackEvent
,
vdId
,
createBy
);
long
endTime01
=
System
.
currentTimeMillis
();
log
.
info
(
"sn:{},secondData insertData(trackEvent)01耗时:{}"
,
trackEvent
.
getSn
(),
startTime01
-
endTime01
);
return
;
}
//恢复报警
long
startTime02
=
System
.
currentTimeMillis
();
updateSecondData
(
trackEvent
,
lastSecondData
.
getId
());
updateSecondData
(
trackEvent
,
lastSecondData
.
getId
());
long
endTime02
=
System
.
currentTimeMillis
();
long
t3
=
System
.
currentTimeMillis
();
log
.
info
(
"sn:{},secondData updateByExampleSelective耗时:{}"
,
trackEvent
.
getSn
(),
startTime02
-
endTime02
);
log
.
info
(
"sn:{},updateSecondData 耗时:{}"
,
trackEvent
.
getSn
(),
t3
-
t2
);
}
//如果该设备最后一条报警离开二押区域时间不为空 或者推送报警数据离开二押区域时间为空 新增一条报警
//最新报警
Date
leaveTime
=
lastSecondData
.
getLeaveTime
();
if
(
Objects
.
nonNull
(
leaveTime
)
||
StringUtils
.
isBlank
(
trackEvent
.
getSecondLeaveTime
()))
{
long
startTime03
=
System
.
currentTimeMillis
();
insertData
(
trackEvent
,
vdId
,
createBy
);
insertData
(
trackEvent
,
vdId
,
createBy
);
long
endTime03
=
System
.
currentTimeMillis
();
long
t3
=
System
.
currentTimeMillis
();
log
.
info
(
"secondData insertData(trackEvent)01耗时:{}"
,
startTime03
-
endTime03
);
log
.
info
(
"insertData 耗时:{}"
,
t3
-
t2
);
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
}
...
...
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