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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
23 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 {
public
void
processTrackEvent
(
KafkaSecondData
.
SecondEvent
trackEvent
)
{
try
{
long
startTime
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
//查询vdId
VehicleDeviceDto
vehicleDevice
=
vehicleDeviceService
.
getVehicleDevice
(
trackEvent
.
getSn
());
Long
vdId
=
Optional
.
ofNullable
(
vehicleDevice
).
map
(
VehicleDeviceDto:
:
getId
).
orElse
(
0L
);
...
...
@@ -48,8 +48,8 @@ public class SecondDataService {
//判断重复
AlarmSecondDataDTO
alarmSecondDataOld
=
getAlarmSecondDataBySnAndAlarmTime
(
trackEvent
.
getSn
(),
trackEvent
.
getSecondAlarmTime
(),
vdId
);
long
endTime
=
System
.
currentTimeMillis
();
log
.
info
(
"secondData 判断重复:{}"
,
endTime
-
startTime
);
long
t2
=
System
.
currentTimeMillis
();
log
.
info
(
"secondData 判断重复:{}"
,
t2
-
t1
);
if
(
Objects
.
nonNull
(
alarmSecondDataOld
))
{
log
.
info
(
"secondDataAlarm exist params:{}"
,
JSONObject
.
toJSONString
(
alarmSecondDataOld
));
return
;
...
...
@@ -61,28 +61,17 @@ public class SecondDataService {
log
.
info
(
"sn:{}, createBy:{}"
,
trackEvent
.
getSn
(),
createBy
);
AlarmSecondDataDTO
lastSecondData
=
getLastSecondDataBySn
(
trackEvent
.
getSn
(),
vdId
);
if
(
Objects
.
isNull
(
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
;
if
(
Objects
.
nonNull
(
lastSecondData
))
{
//恢复上一条报警
updateSecondData
(
trackEvent
,
lastSecondData
.
getId
());
long
t3
=
System
.
currentTimeMillis
();
log
.
info
(
"sn:{},updateSecondData 耗时:{}"
,
trackEvent
.
getSn
(),
t3
-
t2
);
}
//恢复报警
long
startTime02
=
System
.
currentTimeMillis
();
updateSecondData
(
trackEvent
,
lastSecondData
.
getId
());
long
endTime02
=
System
.
currentTimeMillis
();
log
.
info
(
"sn:{},secondData updateByExampleSelective耗时:{}"
,
trackEvent
.
getSn
(),
startTime02
-
endTime02
);
//如果该设备最后一条报警离开二押区域时间不为空 或者推送报警数据离开二押区域时间为空 新增一条报警
Date
leaveTime
=
lastSecondData
.
getLeaveTime
();
if
(
Objects
.
nonNull
(
leaveTime
)
||
StringUtils
.
isBlank
(
trackEvent
.
getSecondLeaveTime
()))
{
long
startTime03
=
System
.
currentTimeMillis
();
insertData
(
trackEvent
,
vdId
,
createBy
);
long
endTime03
=
System
.
currentTimeMillis
();
log
.
info
(
"secondData insertData(trackEvent)01耗时:{}"
,
startTime03
-
endTime03
);
}
//最新报警
insertData
(
trackEvent
,
vdId
,
createBy
);
long
t3
=
System
.
currentTimeMillis
();
log
.
info
(
"insertData 耗时:{}"
,
t3
-
t2
);
}
catch
(
ParseException
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