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 22b3c846
authored
Mar 30, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化假性离线查询
1 parent
eb03fddb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
9 deletions
src/main/java/cn/com/glsx/admin/modules/remote/RemoteGpsBsService.java
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
src/main/java/cn/com/glsx/admin/modules/remote/RemoteGpsBsService.java
View file @
22b3c84
...
...
@@ -51,7 +51,7 @@ public class RemoteGpsBsService {
Map
<
String
,
GpsBsData
>
gpsBsDataMap
=
Maps
.
newHashMap
();
if
(
CollectionUtils
.
isNotEmpty
(
gpsBsDataList
))
{
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
()));
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
()
,
(
o
,
n
)
->
n
));
}
return
gpsBsDataMap
;
}
...
...
@@ -69,7 +69,7 @@ public class RemoteGpsBsService {
Map
<
String
,
GpsBsData
>
gpsBsDataMap
=
Maps
.
newHashMap
();
if
(
CollectionUtils
.
isNotEmpty
(
gpsBsDataList
))
{
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
()));
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
()
,
(
o
,
n
)
->
n
));
}
return
gpsBsDataMap
;
}
...
...
@@ -108,4 +108,18 @@ public class RemoteGpsBsService {
}
return
gpsBsData
;
}
public
Map
<
String
,
GpsBsData
>
getLastGpsBsBySns
(
List
<
String
>
snList
)
{
Map
<
String
,
Integer
>
snsMap
=
Maps
.
newHashMap
();
snList
.
forEach
(
sn
->
snsMap
.
put
(
sn
,
DeviceTypeRelationEnum
.
GPS
.
getBizDeviceType
()));
R
<
List
<
GpsBsData
>>
listR
=
gpsBsFeignService
.
getLastGpsBsBySns
(
snsMap
);
List
<
GpsBsData
>
gpsBsDataList
=
listR
.
getDataList
(
new
TypeToken
<
List
<
GpsBsData
>>()
{
}.
getType
());
Map
<
String
,
GpsBsData
>
gpsBsDataMap
=
Maps
.
newHashMap
();
if
(
CollectionUtils
.
isNotEmpty
(
gpsBsDataList
))
{
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
(),
(
o
,
n
)
->
n
));
}
return
gpsBsDataMap
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
View file @
22b3c84
...
...
@@ -12,15 +12,15 @@ import cn.com.glsx.admin.modules.model.export.FakeOfficeExport;
import
cn.com.glsx.admin.modules.model.export.WhiteListFailExport
;
import
cn.com.glsx.admin.modules.model.imports.WhiteListSnImport
;
import
cn.com.glsx.admin.modules.model.param.FakeOfficeSearch
;
import
cn.com.glsx.admin.modules.model.param.VehicleLocationBo
;
import
cn.com.glsx.admin.modules.remote.RemoteFeignDeviceService
;
import
cn.com.glsx.admin.modules.remote.RemoteGpsBsService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.fileupload.FileConstants
;
import
cn.com.glsx.admin.modules.utils.fileupload.FileUploadServerData
;
import
cn.com.glsx.admin.modules.utils.fileupload.FileUploadUtil
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
cn.com.glsx.devicemonitor.api.dto.response.DeviceStatusModel
;
import
cn.com.glsx.devicemonitor.api.
enums.DeviceTypeRelationEnum
;
import
cn.com.glsx.devicemonitor.api.
dto.response.GpsBsData
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.github.pagehelper.Page
;
...
...
@@ -62,6 +62,9 @@ public class FakeOfflineService extends AbstractCommonService {
@Autowired
private
OrganizationApiService
organizationApiService
;
@Autowired
private
RemoteGpsBsService
remoteGpsBsService
;
/**
* 查询
*
...
...
@@ -113,6 +116,18 @@ public class FakeOfflineService extends AbstractCommonService {
log
.
info
(
"设备号集合==="
+
JSONUtil
.
toJsonStr
(
sns
));
Map
<
String
,
DeviceStatusModel
>
deviceStatusMap
=
remoteFeignDeviceService
.
listDeviceStatusBySns
(
sns
);
// 仅对查询数据 批量获取定位数据
Map
<
String
,
GpsBsData
>
lastGpsBsBatchMap
=
Maps
.
newHashMap
();
if
(
TypeConverseEunm
.
SearchTypeEnum
.
SEARCH
.
getType
().
equals
(
flag
))
{
List
<
String
>
snList
=
fakeOfficeList
.
stream
().
flatMap
(
fakeOfficeExport
->
{
List
<
String
>
snsList
=
Arrays
.
asList
(
fakeOfficeExport
.
getSns
().
split
(
","
));
return
snsList
.
stream
();
}).
collect
(
Collectors
.
toList
());
lastGpsBsBatchMap
=
remoteGpsBsService
.
getLastGpsBsBySns
(
snList
);
}
for
(
FakeOfficeExport
fakeOfficeExport
:
fakeOfficeList
)
{
String
vin
=
fakeOfficeExport
.
getVin
();
Integer
code
=
reasonMap
.
get
(
vin
);
...
...
@@ -138,19 +153,29 @@ public class FakeOfflineService extends AbstractCommonService {
builder
.
append
(
"】设备在线"
);
fakeOfficeExport
.
setReason
(
builder
.
toString
());
}
// 仅对
导出
数据 设置是否有定位标记位
// 仅对
查询
数据 设置是否有定位标记位
if
(
TypeConverseEunm
.
SearchTypeEnum
.
SEARCH
.
getType
().
equals
(
flag
))
{
buildVehicleFlag
(
fakeOfficeExport
);
buildVehicleFlag
(
fakeOfficeExport
,
lastGpsBsBatchMap
);
}
}
return
fakeOfficeList
;
}
private
void
buildVehicleFlag
(
FakeOfficeExport
fakeOfficeExport
)
{
private
void
buildVehicleFlag
(
FakeOfficeExport
fakeOfficeExport
,
Map
<
String
,
GpsBsData
>
lastGpsBsBatchMap
)
{
String
[]
snArr
=
fakeOfficeExport
.
getSns
().
split
(
","
);
// 根据设备号查询设备定位数据
List
<
VehicleLocationBo
>
vehicleLocationBoList
=
vehicleMonitorService
.
getVehicleLocation
(
fakeOfficeExport
.
getSns
(),
DeviceTypeRelationEnum
.
GPS
.
getDeviceCode
());
List
<
GpsBsData
>
gpsBsDataList
=
Lists
.
newArrayList
();
for
(
String
sn
:
snArr
)
{
GpsBsData
gpsBsData
=
lastGpsBsBatchMap
.
get
(
sn
);
if
(
gpsBsData
!=
null
)
{
if
(
gpsBsData
.
getGpsLocation
()
!=
null
||
gpsBsData
.
getBsLocation
()
!=
null
||
gpsBsData
.
getWifiLocation
()
!=
null
)
{
gpsBsDataList
.
add
(
gpsBsData
);
}
}
}
// 1 有定位数据 2 没有定位数据
if
(
CollectionUtil
.
isEmpty
(
vehicleLocationBo
List
))
{
if
(
CollectionUtil
.
isEmpty
(
gpsBsData
List
))
{
fakeOfficeExport
.
setLocationFlag
(
2
);
}
else
{
fakeOfficeExport
.
setLocationFlag
(
1
);
...
...
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