Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
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 7b7662e1
authored
Jun 14, 2024
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【ID1016906】 bug修复:离线报警排除假性离线
1 parent
c6564672
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
11 deletions
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
View file @
7b7662e
...
@@ -574,7 +574,10 @@ public class RiskAssessmentService {
...
@@ -574,7 +574,10 @@ public class RiskAssessmentService {
}
}
// 查询离线警情
// 查询离线警情
getOffLinePoint
(
snList
,
alarmInfoList
,
snDeviceNameMap
);
AlarmTimeLinePointVo
offlinePointVo
=
getOffLinePoint
(
snList
,
snDeviceNameMap
);
if
(
Objects
.
nonNull
(
offlinePointVo
)
&&
!
falseOffline
(
vehicle
.
getVin
()))
{
alarmInfoList
.
add
(
offlinePointVo
);
}
// 查询警情研判:多种警情
// 查询警情研判:多种警情
List
<
AlarmWarnAnalyse
>
alarmWarnAnalyseList
=
alarmWarnAnalyseMapper
.
selectLatestAlarmOfEachType
(
vehicleId
);
List
<
AlarmWarnAnalyse
>
alarmWarnAnalyseList
=
alarmWarnAnalyseMapper
.
selectLatestAlarmOfEachType
(
vehicleId
);
...
@@ -621,6 +624,41 @@ public class RiskAssessmentService {
...
@@ -621,6 +624,41 @@ public class RiskAssessmentService {
}
}
/**
/**
* 通过车架号判断车辆是否是假性离线
* 假性离线有三种情况
*
* @param vin 车架号
* @return true是假性离线 false不是假性离线
*/
private
boolean
falseOffline
(
String
vin
)
{
boolean
result
=
false
;
List
<
String
>
vinList
=
Lists
.
newArrayList
(
vin
);
// 一 获取设备都离线 最后定位点在家庭围栏或者工作地围栏 获取车架通过权限控制 当存在设备都离线的车辆时才进行计算
List
<
String
>
fakeOfflineVinList
=
fakeOfflineVinMapper
.
getFakeOfflineVinByFence
(
vinList
);
if
(
CollectionUtils
.
isNotEmpty
(
fakeOfflineVinList
))
{
result
=
Boolean
.
TRUE
;
}
// 二 十日内状态反复变化 假性离线
List
<
FakeOfflineChangeFrequently
>
changeFrequentlyList
=
fakeOfflineChangeFrequentlyMapper
.
listByVin
(
vinList
);
if
(
CollectionUtils
.
isNotEmpty
(
changeFrequentlyList
))
{
result
=
Boolean
.
TRUE
;
}
// 三 获取本部门以及下级部门的白名单
Set
<
Long
>
deptIds
=
organizationApiService
.
getAllSubOrgIds
();
log
.
info
(
"isFakeOffline userId:"
+
ShieldContextHolder
.
getUserId
()
+
";deptIds:"
+
JSONUtil
.
toJsonStr
(
deptIds
));
// 从白名单列表获取白名单设备号及其车架号
List
<
String
>
writeListVinList
=
whitelistSnMapper
.
getWriteListVinListAndDeptIds
(
deptIds
,
vinList
);
// 白名单不为空 并且白名单包括车架号
if
(
CollectionUtils
.
isNotEmpty
(
writeListVinList
))
{
result
=
Boolean
.
TRUE
;
}
return
result
;
}
/**
* 获取最后检测时间节点
* 获取最后检测时间节点
*
*
* @param alarmInfoList
* @param alarmInfoList
...
@@ -685,18 +723,16 @@ public class RiskAssessmentService {
...
@@ -685,18 +723,16 @@ public class RiskAssessmentService {
/**
/**
* 获取离线警情
* 获取离线警情
*
*
* @param snList
* @param snList 车辆设备号集合
* @param alarmInfoList
*/
*/
private
void
getOffLinePoint
(
List
<
String
>
snList
,
List
<
AlarmTimeLinePointVo
>
alarmInfo
List
,
Map
<
String
,
String
>
snDeviceNameMap
)
{
private
AlarmTimeLinePointVo
getOffLinePoint
(
List
<
String
>
sn
List
,
Map
<
String
,
String
>
snDeviceNameMap
)
{
List
<
DeviceLocation
>
deviceLocationList
=
deviceLocationMapper
.
findLocationListBySnList
(
snList
);
List
<
DeviceLocation
>
deviceLocationList
=
deviceLocationMapper
.
findLocationListBySnList
(
snList
);
if
(
CollectionUtils
.
isEmpty
(
deviceLocationList
))
{
if
(
CollectionUtils
.
isEmpty
(
deviceLocationList
))
{
AlarmTimeLinePointVo
pointVo
=
new
AlarmTimeLinePointVo
();
AlarmTimeLinePointVo
pointVo
=
new
AlarmTimeLinePointVo
();
pointVo
.
setAlarmLevel
(
3
);
pointVo
.
setAlarmLevel
(
3
);
pointVo
.
setAlarmType
(
"离线报警"
);
pointVo
.
setAlarmType
(
"离线报警"
);
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
snList
.
get
(
0
)));
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
snList
.
get
(
0
)));
alarmInfoList
.
add
(
pointVo
);
return
pointVo
;
return
;
}
}
// 是否离线判断 前三天时间范围内存在上报记录则不算离线
// 是否离线判断 前三天时间范围内存在上报记录则不算离线
...
@@ -704,12 +740,12 @@ public class RiskAssessmentService {
...
@@ -704,12 +740,12 @@ public class RiskAssessmentService {
Date
date
=
DateUtils
.
addDays
(
new
Date
(),
-
3
);
Date
date
=
DateUtils
.
addDays
(
new
Date
(),
-
3
);
Date
lastGpsTime
=
location
.
getLastGpsTime
();
Date
lastGpsTime
=
location
.
getLastGpsTime
();
if
(
Objects
.
nonNull
(
lastGpsTime
)
&&
lastGpsTime
.
compareTo
(
date
)
>
0
)
{
if
(
Objects
.
nonNull
(
lastGpsTime
)
&&
lastGpsTime
.
compareTo
(
date
)
>
0
)
{
return
;
return
null
;
}
}
Date
lastBsTime
=
location
.
getLastBsTime
();
Date
lastBsTime
=
location
.
getLastBsTime
();
if
(
Objects
.
nonNull
(
lastBsTime
)
&&
lastBsTime
.
compareTo
(
date
)
>
0
)
{
if
(
Objects
.
nonNull
(
lastBsTime
)
&&
lastBsTime
.
compareTo
(
date
)
>
0
)
{
return
;
return
null
;
}
}
}
}
...
@@ -739,8 +775,7 @@ public class RiskAssessmentService {
...
@@ -739,8 +775,7 @@ public class RiskAssessmentService {
pointVo
.
setAlarmType
(
"离线报警"
);
pointVo
.
setAlarmType
(
"离线报警"
);
String
sn
=
deviceLocationList
.
get
(
0
).
getSn
();
String
sn
=
deviceLocationList
.
get
(
0
).
getSn
();
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
sn
));
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
sn
));
alarmInfoList
.
add
(
pointVo
);
return
pointVo
;
return
;
}
}
// 取最近上报时间点
// 取最近上报时间点
...
@@ -763,7 +798,7 @@ public class RiskAssessmentService {
...
@@ -763,7 +798,7 @@ public class RiskAssessmentService {
pointVo
.
setAlarmTime
(
DateUtil
.
formatDate
(
latestTime
));
pointVo
.
setAlarmTime
(
DateUtil
.
formatDate
(
latestTime
));
pointVo
.
setAlarmType
(
"离线报警"
);
pointVo
.
setAlarmType
(
"离线报警"
);
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
alarmSn
));
pointVo
.
setDevice
(
snDeviceNameMap
.
get
(
alarmSn
));
alarmInfoList
.
add
(
pointVo
)
;
return
pointVo
;
}
}
private
static
List
<
FinalPositioningExport
>
customSort
(
List
<
FinalPositioningExport
>
finalPositioningList
)
{
private
static
List
<
FinalPositioningExport
>
customSort
(
List
<
FinalPositioningExport
>
finalPositioningList
)
{
...
...
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