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 fe373d0c
authored
Mar 15, 2022
by
王欣伟
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
离线规则修改完成
1 parent
08186e96
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
56 deletions
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/main/resources/mapper/VehicleMapper.xml
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
fe373d0
...
@@ -66,6 +66,7 @@ import org.springframework.util.StopWatch;
...
@@ -66,6 +66,7 @@ import org.springframework.util.StopWatch;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -1059,23 +1060,58 @@ public class VehicleService {
...
@@ -1059,23 +1060,58 @@ public class VehicleService {
}
}
// 设置设备状态
// 设置设备状态
buildDeviceStatusCommon
(
vehicleInfoList
);
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoList.removeIf(vehicleInfoPageDTO -> {
// Integer deviceState = vehicleInfoPageDTO.getDeviceState();
// if (deviceState != null) {
// return search.getDeviceState().intValue() != deviceState.intValue();
// }
// // deviceState 为null 的时候为删掉
// return true;
// });
// }
return
new
PageInfo
<>(
vehicleInfoList
);
}
/**
* 给设备添加设备状态
* @param vehicleInfoList
*/
private
void
buildDeviceStatusCommon
(
List
<
VehicleInfoPageDTO
>
vehicleInfoList
)
{
if
(
CollectionUtil
.
isEmpty
(
vehicleInfoList
))
{
return
;
}
List
<
String
>
sns
=
vehicleInfoList
.
stream
().
map
(
VehicleInfoPageDTO:
:
getSn
).
collect
(
Collectors
.
toList
());
List
<
String
>
sns
=
vehicleInfoList
.
stream
().
map
(
VehicleInfoPageDTO:
:
getSn
).
collect
(
Collectors
.
toList
());
DeviceSearchDTO
deviceSearchDTO
=
new
DeviceSearchDTO
();
DeviceSearchDTO
deviceSearchDTO
=
new
DeviceSearchDTO
();
deviceSearchDTO
.
setSns
(
sns
);
deviceSearchDTO
.
setSns
(
sns
);
deviceSearchDTO
.
setOfflineTime
(
0L
);
deviceSearchDTO
.
setOfflineTime
(
0L
);
log
.
info
(
"批量调用设备状态查询接口==="
+
JSON
.
toJSONString
(
deviceSearchDTO
));
log
.
info
(
"批量调用设备状态查询接口==="
+
sns
.
size
(
));
R
<
List
<
DeviceStatusModel
>>
listDeviceStatusR
=
deviceFeignService
.
listDeviceStatusBySns
(
deviceSearchDTO
);
R
<
List
<
DeviceStatusModel
>>
listDeviceStatusR
=
deviceFeignService
.
listDeviceStatusBySns
(
deviceSearchDTO
);
log
.
info
(
"批量调用设备状态返回结果==="
+
JSON
.
toJSONString
(
listDeviceStatusR
));
log
.
info
(
"批量调用设备状态返回结果==="
+
((
listDeviceStatusR
!=
null
)?
listDeviceStatusR
.
getCode
():
"error"
));
if
(
listDeviceStatusR
!=
null
)
{
if
(
listDeviceStatusR
==
null
)
{
return
;
}
// 状态(0 行驶中 1 静止 2离线 3 在线)
// 状态(0 行驶中 1 静止 2离线 3 在线)
List
<
DeviceStatusModel
>
deviceStatusModelList
=
listDeviceStatusR
.
getDataList
(
new
TypeToken
<
List
<
DeviceStatusModel
>>()
{
List
<
DeviceStatusModel
>
deviceStatusModelList
=
listDeviceStatusR
.
getDataList
(
new
TypeToken
<
List
<
DeviceStatusModel
>>()
{
}.
getType
());
}.
getType
());
if
(
CollectionUtils
.
isNotEmpty
(
deviceStatusModelList
))
{
if
(
CollectionUtil
.
isEmpty
(
deviceStatusModelList
))
{
for
(
DeviceStatusModel
deviceStatusModel
:
deviceStatusModelList
)
{
return
;
Integer
deviceStatus
=
deviceStatusModel
.
getStatus
();
}
if
(
deviceStatus
!=
null
)
{
Map
<
String
,
DeviceStatusModel
>
deviceStatusModelMap
=
deviceStatusModelList
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceStatusModel:
:
getSn
,
Function
.
identity
(),(
v1
,
v2
)->
v1
));
for
(
VehicleInfoPageDTO
vehicleInfoPageDTO
:
vehicleInfoList
)
{
for
(
VehicleInfoPageDTO
vehicleInfoPageDTO
:
vehicleInfoList
)
{
DeviceStatusModel
deviceStatusModel
=
deviceStatusModelMap
.
get
(
vehicleInfoPageDTO
.
getSn
());
Integer
deviceStatus
=
deviceStatusModel
.
getStatus
();
if
(
deviceStatus
==
null
)
{
continue
;
}
if
(
vehicleInfoPageDTO
.
getSn
().
equals
(
deviceStatusModel
.
getSn
()))
{
if
(
vehicleInfoPageDTO
.
getSn
().
equals
(
deviceStatusModel
.
getSn
()))
{
vehicleInfoPageDTO
.
setDeviceState
(
deviceStatus
);
vehicleInfoPageDTO
.
setDeviceState
(
deviceStatus
);
switch
(
deviceStatus
)
{
switch
(
deviceStatus
)
{
...
@@ -1097,24 +1133,6 @@ public class VehicleService {
...
@@ -1097,24 +1133,6 @@ public class VehicleService {
}
}
}
}
}
}
}
}
}
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoList.removeIf(vehicleInfoPageDTO -> {
// Integer deviceState = vehicleInfoPageDTO.getDeviceState();
// if (deviceState != null) {
// return search.getDeviceState().intValue() != deviceState.intValue();
// }
// // deviceState 为null 的时候为删掉
// return true;
// });
// }
return
new
PageInfo
<>(
vehicleInfoList
);
}
/**
/**
* 判断是否支持高阶调频
* 判断是否支持高阶调频
...
@@ -1215,22 +1233,55 @@ public class VehicleService {
...
@@ -1215,22 +1233,55 @@ public class VehicleService {
}
}
// 设置设备状态
// 设置设备状态
buildDeviceStatusExpert
(
vehicleInfoReportExportList
);
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoReportExportList.removeIf(vehicleInfoReportExport -> {
// Integer deviceState = vehicleInfoReportExport.getDeviceState();
// if (deviceState != null) {
// return search.getDeviceState().intValue() != deviceState.intValue();
// }
// // deviceState 为null 的时候为删掉
// return true;
// });
// }
organizationApiService
.
drawReportOrganization
(
vehicleInfoReportExportList
);
return
vehicleInfoReportExportList
;
}
/**
* 给导出数据增加设备状态
* @param vehicleInfoReportExportList
*/
private
void
buildDeviceStatusExpert
(
List
<
VehicleInfoReportExport
>
vehicleInfoReportExportList
)
{
if
(
CollectionUtil
.
isEmpty
(
vehicleInfoReportExportList
))
{
return
;
}
List
<
String
>
sns
=
vehicleInfoReportExportList
.
stream
().
map
(
VehicleInfoReportExport:
:
getSn
).
collect
(
Collectors
.
toList
());
List
<
String
>
sns
=
vehicleInfoReportExportList
.
stream
().
map
(
VehicleInfoReportExport:
:
getSn
).
collect
(
Collectors
.
toList
());
DeviceSearchDTO
deviceSearchDTO
=
new
DeviceSearchDTO
();
DeviceSearchDTO
deviceSearchDTO
=
new
DeviceSearchDTO
();
deviceSearchDTO
.
setSns
(
sns
);
deviceSearchDTO
.
setSns
(
sns
);
deviceSearchDTO
.
setOfflineTime
(
0L
);
deviceSearchDTO
.
setOfflineTime
(
0L
);
R
<
List
<
DeviceStatusModel
>>
listDeviceStatusR
=
deviceFeignService
.
listDeviceStatusBySns
(
deviceSearchDTO
);
R
<
List
<
DeviceStatusModel
>>
listDeviceStatusR
=
deviceFeignService
.
listDeviceStatusBySns
(
deviceSearchDTO
);
if
(
listDeviceStatusR
!=
null
)
{
if
(
listDeviceStatusR
==
null
)
{
return
;
}
// 状态(0 行驶中 1 静止 2离线 3 在线)
// 状态(0 行驶中 1 静止 2离线 3 在线)
List
<
DeviceStatusModel
>
deviceStatusModelList
=
listDeviceStatusR
.
getDataList
(
new
TypeToken
<
List
<
DeviceStatusModel
>>()
{
List
<
DeviceStatusModel
>
deviceStatusModelList
=
listDeviceStatusR
.
getDataList
(
new
TypeToken
<
List
<
DeviceStatusModel
>>()
{
}.
getType
());
}.
getType
());
if
(
CollectionUtils
.
isNotEmpty
(
deviceStatusModelList
))
{
if
(
CollectionUtil
.
isEmpty
(
deviceStatusModelList
))
{
for
(
DeviceStatusModel
deviceStatusModel
:
deviceStatusModelList
)
{
return
;
Integer
deviceStatus
=
deviceStatusModel
.
getStatus
();
}
if
(
deviceStatus
!=
null
)
{
Map
<
String
,
DeviceStatusModel
>
deviceStatusModelMap
=
deviceStatusModelList
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceStatusModel:
:
getSn
,
Function
.
identity
(),(
v1
,
v2
)->
v1
));
for
(
VehicleInfoReportExport
vehicleInfoReportExport
:
vehicleInfoReportExportList
)
{
for
(
VehicleInfoReportExport
vehicleInfoReportExport
:
vehicleInfoReportExportList
)
{
if
(
vehicleInfoReportExport
.
getSn
().
equals
(
deviceStatusModel
.
getSn
()))
{
DeviceStatusModel
deviceStatusModel
=
deviceStatusModelMap
.
get
(
vehicleInfoReportExport
.
getSn
());
Integer
deviceStatus
=
deviceStatusModel
.
getStatus
();
if
(
deviceStatus
==
null
)
{
continue
;
}
vehicleInfoReportExport
.
setDeviceState
(
deviceStatus
);
vehicleInfoReportExport
.
setDeviceState
(
deviceStatus
);
switch
(
deviceStatus
)
{
switch
(
deviceStatus
)
{
case
0
:
case
0
:
...
@@ -1250,25 +1301,6 @@ public class VehicleService {
...
@@ -1250,25 +1301,6 @@ public class VehicleService {
}
}
}
}
}
}
}
}
}
}
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoReportExportList.removeIf(vehicleInfoReportExport -> {
// Integer deviceState = vehicleInfoReportExport.getDeviceState();
// if (deviceState != null) {
// return search.getDeviceState().intValue() != deviceState.intValue();
// }
// // deviceState 为null 的时候为删掉
// return true;
// });
// }
organizationApiService
.
drawReportOrganization
(
vehicleInfoReportExportList
);
return
vehicleInfoReportExportList
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addVehicleInfo
(
VehicleInfoVo
vehicleInfoVo
)
{
public
void
addVehicleInfo
(
VehicleInfoVo
vehicleInfoVo
)
{
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
fe373d0
...
@@ -740,9 +740,11 @@
...
@@ -740,9 +740,11 @@
and tvd.bind_status = 1
and tvd.bind_status = 1
and tvd.del_flag = 0
and tvd.del_flag = 0
<if
test=
"offlineStartTime != null and offlineStartTime != ''"
>
<if
test=
"offlineStartTime != null and offlineStartTime != ''"
>
and ((tdl.last_gps_time
<
#{offlineStartTime} and tdl.last_bs_time
<
#{offlineStartTime}
and ((tdl.last_gps_time
<
#{offlineStartTime} and tdl.last_bs_time
<
#{offlineStartTime})
and td.source = 1)
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_bs_time
<
#{offlineStartTime} and td.source = 0))
or (tdl.last_gps_time is null and tdl.last_bs_time
<
#{offlineStartTime})
or (tdl.last_gps_time
<
#{offlineStartTime} and tdl.last_bs_time is null)
)
</if>
</if>
<if
test=
"activeStartTime != null and activeStartTime != ''"
>
<if
test=
"activeStartTime != null and activeStartTime != ''"
>
and tvd.created_date
>
= #{activeStartTime}
and tvd.created_date
>
= #{activeStartTime}
...
@@ -878,8 +880,11 @@
...
@@ -878,8 +880,11 @@
left join t_device td on td.sn = tvd.sn
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.sn
left join t_device_location tdl on tdl.sn = td.sn
WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1
WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1
and timestampdiff(SECOND, tdl.last_gps_time, now())
>
#{offlineTime}
and ((timestampdiff(SECOND, tdl.last_gps_time, now())
>
#{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now())
>
#{offlineTime})
and timestampdiff(SECOND, tdl.last_bs_time, now())
>
#{offlineTime}
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now())
>
#{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now())
>
#{offlineTime} and tdl.last_bs_time is null)
)
<if
test=
"offlineSnStr != null and offlineSnStr != ''"
>
<if
test=
"offlineSnStr != null and offlineSnStr != ''"
>
and tvd.sn not in (${offlineSnStr})
and tvd.sn not in (${offlineSnStr})
</if>
</if>
...
@@ -924,7 +929,11 @@
...
@@ -924,7 +929,11 @@
and tvd.created_date > '2013-01-01 00:00:00.0'
and tvd.created_date > '2013-01-01 00:00:00.0'
<!--离线时间-->
<!--离线时间-->
<if
test=
"lostBegin != null"
>
<if
test=
"lostBegin != null"
>
and tdl.last_gps_time
<
#{lostBegin} and tdl.last_bs_time
<
#{lostBegin}
and ((tdl.last_gps_time
<
#{lostBegin} and tdl.last_bs_time
<
#{lostBegin})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and tdl.last_bs_time
<
#{lostBegin})
or (tdl.last_gps_time
<
#{lostBegin} and tdl.last_bs_time is null)
)
</if>
</if>
</select>
</select>
...
...
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