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 11853111
authored
Mar 18, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化假性离线查询
1 parent
02f2467f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
12 deletions
src/main/java/cn/com/glsx/admin/common/enums/TypeConverseEunm.java
src/main/java/cn/com/glsx/admin/modules/model/imports/WhiteListSnImportListener.java
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
src/main/resources/mapper/FakeOfflineVinMapper.xml
src/test/java/cn/com/glsx/admin/modules/remote/RemoteFeignDeviceServiceTest.java
src/main/java/cn/com/glsx/admin/common/enums/TypeConverseEunm.java
View file @
1185311
...
@@ -90,9 +90,9 @@ public class TypeConverseEunm {
...
@@ -90,9 +90,9 @@ public class TypeConverseEunm {
}
}
public
static
String
getStrBySourceType
(
Integer
sourceType
)
{
public
static
String
getStrBySourceType
(
Integer
sourceType
)
{
for
(
Source
Enum
sourceEnum
:
Source
Enum
.
values
())
{
for
(
Source
StatusEnum
sourceStatusEnum
:
SourceStatus
Enum
.
values
())
{
if
(
sourceEnum
.
getSourceType
().
equals
(
sourceType
))
{
if
(
source
Status
Enum
.
getSourceType
().
equals
(
sourceType
))
{
return
sourceEnum
.
getSourceTypeStr
();
return
source
Status
Enum
.
getSourceTypeStr
();
}
}
}
}
return
null
;
return
null
;
...
...
src/main/java/cn/com/glsx/admin/modules/model/imports/WhiteListSnImportListener.java
View file @
1185311
...
@@ -241,7 +241,7 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
...
@@ -241,7 +241,7 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
checkDevice
(
stringBuilder
,
vi
.
getSn
(),
allSnList
);
checkDevice
(
stringBuilder
,
vi
.
getSn
(),
allSnList
);
// 校验车辆数据权限受限
// 校验车辆数据权限受限
checkVinPermission
(
stringBuilder
,
vi
.
getVin
(),
vehicleListByPermission
);
checkVinPermission
(
stringBuilder
,
vi
.
getVin
(),
v
inList
,
v
ehicleListByPermission
);
if
(
StringUtils
.
isNotEmpty
(
vi
.
getVin
())
&&
StringUtils
.
isNotEmpty
(
vi
.
getSn
()))
{
if
(
StringUtils
.
isNotEmpty
(
vi
.
getVin
())
&&
StringUtils
.
isNotEmpty
(
vi
.
getSn
()))
{
// 校验车辆和设备的绑定关系
// 校验车辆和设备的绑定关系
...
@@ -275,14 +275,18 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
...
@@ -275,14 +275,18 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
*
*
* @param stringBuilder
* @param stringBuilder
* @param vin
* @param vin
* @param vinList
* @param vehicleListByPermission
* @param vehicleListByPermission
*/
*/
private
void
checkVinPermission
(
StringBuilder
stringBuilder
,
String
vin
,
List
<
String
>
vehicleListByPermission
)
{
private
void
checkVinPermission
(
StringBuilder
stringBuilder
,
String
vin
,
List
<
String
>
vinList
,
List
<
String
>
vehicleListByPermission
)
{
if
(
CollectionUtil
.
isNotEmpty
(
vinList
)
&&
vinList
.
contains
(
vin
))
{
if
(
CollectionUtil
.
isEmpty
(
vehicleListByPermission
)
||
!
vehicleListByPermission
.
contains
(
vin
))
{
if
(
CollectionUtil
.
isEmpty
(
vehicleListByPermission
)
||
!
vehicleListByPermission
.
contains
(
vin
))
{
stringBuilder
.
append
(
"数据权限受限"
);
stringBuilder
.
append
(
"数据权限受限"
);
}
}
}
}
}
/**
/**
* 校验车架号和设备号的绑定关系
* 校验车架号和设备号的绑定关系
*
*
...
...
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
View file @
1185311
...
@@ -118,12 +118,12 @@ public class FakeOfflineService extends AbstractCommonService {
...
@@ -118,12 +118,12 @@ public class FakeOfflineService extends AbstractCommonService {
DeviceStatusModel
deviceStatusModel
=
deviceStatusMap
.
get
(
sn
);
DeviceStatusModel
deviceStatusModel
=
deviceStatusMap
.
get
(
sn
);
if
(
deviceStatusModel
!=
null
)
{
if
(
deviceStatusModel
!=
null
)
{
Integer
status
=
deviceStatusModel
.
getStatus
();
Integer
status
=
deviceStatusModel
.
getStatus
();
if
(
status
!=
null
&&
ConstantsDevice
.
DEVICE_STATUS_OFFLINE
=
=
status
)
{
if
(
status
!=
null
&&
ConstantsDevice
.
DEVICE_STATUS_OFFLINE
!
=
status
)
{
builder
.
append
(
sn
).
append
(
"("
).
append
(
TypeConverseEunm
.
SourceStatusEnum
.
getStrBySourceType
(
deviceStatusModel
.
getSource
())).
append
(
") "
);
builder
.
append
(
sn
).
append
(
"("
).
append
(
TypeConverseEunm
.
SourceStatusEnum
.
getStrBySourceType
(
deviceStatusModel
.
getSource
())).
append
(
") "
);
}
}
}
}
}
}
builder
.
append
(
"】设备
离
线"
);
builder
.
append
(
"】设备
在
线"
);
fakeOfficeExport
.
setReason
(
builder
.
toString
());
fakeOfficeExport
.
setReason
(
builder
.
toString
());
//对于触碰围栏假性离线的设备 封装家庭地址和工作地址
//对于触碰围栏假性离线的设备 封装家庭地址和工作地址
buildPredictAddr
(
fakeOfficeExport
,
vin
);
buildPredictAddr
(
fakeOfficeExport
,
vin
);
...
...
src/main/resources/mapper/FakeOfflineVinMapper.xml
View file @
1185311
...
@@ -56,15 +56,10 @@
...
@@ -56,15 +56,10 @@
group_concat(tvd.sn) sns
group_concat(tvd.sn) sns
from t_vehicle tv
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.sn
left join t_workorder tw on tw.id = tv.workorder_id
left join t_workorder tw on tw.id = tv.workorder_id
where tv.del_flag = 0
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.bind_status = 1
and tvd.del_flag = 0
and tvd.del_flag = 0
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and
timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1)
or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0))
<if
test=
"vinStrs != null and vinStrs != '' "
>
<if
test=
"vinStrs != null and vinStrs != '' "
>
and tv.vin in (${vinStrs})
and tv.vin in (${vinStrs})
</if>
</if>
...
...
src/test/java/cn/com/glsx/admin/modules/remote/RemoteFeignDeviceServiceTest.java
0 → 100644
View file @
1185311
package
cn
.
com
.
glsx
.
admin
.
modules
.
remote
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.devicemonitor.api.dto.response.DeviceStatusModel
;
import
cn.hutool.json.JSONUtil
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Map
;
@Slf4j
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
class
RemoteFeignDeviceServiceTest
{
@Autowired
private
RemoteFeignDeviceService
remoteFeignDeviceService
;
@Test
public
void
listDeviceStatusBySns
()
{
Map
<
String
,
DeviceStatusModel
>
stringDeviceStatusModelMap
=
remoteFeignDeviceService
.
listDeviceStatusBySns
(
Lists
.
newArrayList
(
"1511026328"
));
System
.
out
.
println
(
"stringDeviceStatusModelMap = "
+
JSONUtil
.
toJsonStr
(
stringDeviceStatusModelMap
));
}
}
\ No newline at end of file
\ No newline at end of file
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