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 d582abd6
authored
Mar 27, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.50.0 开发1.50.0需求版本 监控页面车辆基本信息添加工单设备组合
1 parent
2a2689e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
85 deletions
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleLocationDTO.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleMonitorService.java
src/main/java/cn/com/glsx/admin/modules/service/WorkOrderService.java
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleLocationDTO.java
View file @
d582abd
...
...
@@ -36,4 +36,13 @@ public class VehicleLocationDTO extends DeviceLocationDTO {
*/
private
String
licensePlate
;
/**
* 设备数量
*/
private
Integer
deviceCnt
;
/**
* 设备组合
*/
private
String
deviceCompose
;
}
src/main/java/cn/com/glsx/admin/modules/service/VehicleMonitorService.java
View file @
d582abd
...
...
@@ -4,11 +4,7 @@ import cn.com.glsx.admin.common.constants.Constants;
import
cn.com.glsx.admin.common.constants.ConstantsVehicle
;
import
cn.com.glsx.admin.common.enums.OrgVehicleTreeIdTag
;
import
cn.com.glsx.admin.modules.converter.VehicleMonitorConvert
;
import
cn.com.glsx.admin.modules.entity.Device
;
import
cn.com.glsx.admin.modules.entity.Vehicle
;
import
cn.com.glsx.admin.modules.entity.VehicleDevice
;
import
cn.com.glsx.admin.modules.entity.VehicleDeviceWorkOrder
;
import
cn.com.glsx.admin.modules.entity.WorkOrder
;
import
cn.com.glsx.admin.modules.entity.*
;
import
cn.com.glsx.admin.modules.mapper.VehicleMapper
;
import
cn.com.glsx.admin.modules.model.OrgVehicleModel
;
import
cn.com.glsx.admin.modules.model.OrgVehicleTree
;
...
...
@@ -30,11 +26,8 @@ import cn.com.glsx.auth.utils.ShieldContextHolder;
import
cn.com.glsx.devicemonitor.api.dto.LngLatDTO
;
import
cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest
;
import
cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest
;
import
cn.com.glsx.devicemonitor.api.dto.response.DeviceLocationDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsLocation
;
import
cn.com.glsx.devicemonitor.api.dto.response.LngLatAddressDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.*
;
import
cn.com.glsx.stdinterface.enums.DeviceComposeEnum
;
import
cn.com.glsx.usercenter.api.dto.tree.OrgTreeModel
;
import
cn.hutool.json.JSONUtil
;
import
com.github.pagehelper.Page
;
...
...
@@ -48,20 +41,14 @@ import com.google.common.collect.Maps;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.commons.lang3.tuple.ImmutablePair
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StopWatch
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -371,11 +358,26 @@ public class VehicleMonitorService {
// 增加监控页面车牌号和店面名称的显示
vehicleBo
.
setLicensePlate
(
vehicle
.
getLicensePlate
());
WorkOrder
workOrder
=
workOrderService
.
getSingleWorkOrderInfoById
(
vehicle
.
getWorkOrderId
());
vehicleBo
.
setShopName
((
workOrder
!=
null
)
?
workOrder
.
getShopName
()
:
""
);
vehicleBo
.
setShopName
(
Objects
.
nonNull
(
workOrder
)
?
workOrder
.
getShopName
()
:
""
);
WorkOrderVehicle
workOrderVehicle
=
workOrderService
.
getWorkOrderVehicleInfoByWorkOrderId
(
vehicle
.
getWorkOrderId
());
vehicleBo
.
setDeviceCnt
(
Objects
.
nonNull
(
workOrderVehicle
)
?
getDeviceCnt
(
workOrderVehicle
.
getDeviceCompose
())
:
0
);
vehicleBo
.
setDeviceCompose
(
Objects
.
nonNull
(
workOrderVehicle
)
?
DeviceComposeEnum
.
getNameByCode
(
workOrderVehicle
.
getDeviceCompose
())
:
""
);
}
return
vehicleBo
;
}
private
Integer
getDeviceCnt
(
String
deviceCompose
)
{
if
(
com
.
glsx
.
plat
.
common
.
utils
.
StringUtils
.
isNullOrEmpty
(
deviceCompose
))
{
return
0
;
}
int
deviceCnt
=
0
;
char
[]
chars
=
deviceCompose
.
toCharArray
();
for
(
char
aChar
:
chars
)
{
deviceCnt
+=
NumberUtils
.
toInt
(
String
.
valueOf
(
aChar
),
0
);
}
return
deviceCnt
;
}
/**
* 停留点列表
*/
...
...
@@ -387,22 +389,12 @@ public class VehicleMonitorService {
VehicleDeviceWorkOrder
commonInfo
=
vehicleDeviceService
.
getVehicleDeviceWorkOrderBySn
(
search
.
getSn
());
//获取地址信息
List
<
LngLatDTO
>
lngLats
=
stayPointRecord
.
stream
()
.
filter
(
e
->
Objects
.
nonNull
(
e
.
getStayGps
()))
.
map
(
e
->
new
LngLatDTO
(
e
.
getStayGps
().
getElng
(),
e
.
getStayGps
().
getElat
()))
.
collect
(
Collectors
.
toList
());
List
<
LngLatDTO
>
lngLats
=
stayPointRecord
.
stream
().
filter
(
e
->
Objects
.
nonNull
(
e
.
getStayGps
())).
map
(
e
->
new
LngLatDTO
(
e
.
getStayGps
().
getElng
(),
e
.
getStayGps
().
getElat
())).
collect
(
Collectors
.
toList
());
LngLatAddressDTO
addressDTO
=
remoteGpsBsService
.
getAddressMap
(
lngLats
);
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
)
.
map
(
LngLatAddressDTO:
:
getAddress
)
.
orElse
(
Maps
.
newHashMap
());
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
).
map
(
LngLatAddressDTO:
:
getAddress
).
orElse
(
Maps
.
newHashMap
());
return
stayPointRecord
.
stream
()
.
map
(
stayPoint
->
VehicleMonitorConvert
.
buildStayPointListVO
(
stayPoint
,
commonInfo
,
search
.
getSn
(),
Optional
.
ofNullable
(
stayPoint
.
getStayGps
())
.
map
(
e
->
e
.
getElat
()
+
e
.
getElng
())
.
map
(
addressMap:
:
get
)
.
orElse
(
Constants
.
EMPTY_CONTENT_EXCEL
)))
.
collect
(
Collectors
.
toList
());
return
stayPointRecord
.
stream
().
map
(
stayPoint
->
VehicleMonitorConvert
.
buildStayPointListVO
(
stayPoint
,
commonInfo
,
search
.
getSn
(),
Optional
.
ofNullable
(
stayPoint
.
getStayGps
()).
map
(
e
->
e
.
getElat
()
+
e
.
getElng
()).
map
(
addressMap:
:
get
).
orElse
(
Constants
.
EMPTY_CONTENT_EXCEL
))).
collect
(
Collectors
.
toList
());
}
/**
...
...
@@ -414,27 +406,16 @@ public class VehicleMonitorService {
List
<
StayPointRecordDTO
>
stayPointRecord
=
getStayPointList
(
search
,
request
);
//获取地址信息
List
<
LngLatDTO
>
lngLats
=
stayPointRecord
.
stream
()
.
filter
(
e
->
Objects
.
nonNull
(
e
.
getStayGps
()))
.
map
(
e
->
new
LngLatDTO
(
e
.
getStayGps
().
getElng
(),
e
.
getStayGps
().
getElat
()))
.
collect
(
Collectors
.
toList
());
List
<
LngLatDTO
>
lngLats
=
stayPointRecord
.
stream
().
filter
(
e
->
Objects
.
nonNull
(
e
.
getStayGps
())).
map
(
e
->
new
LngLatDTO
(
e
.
getStayGps
().
getElng
(),
e
.
getStayGps
().
getElat
())).
collect
(
Collectors
.
toList
());
LngLatAddressDTO
addressDTO
=
remoteGpsBsService
.
getAddressMap
(
lngLats
);
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
)
.
map
(
LngLatAddressDTO:
:
getAddress
)
.
orElse
(
Maps
.
newHashMap
());
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
).
map
(
LngLatAddressDTO:
:
getAddress
).
orElse
(
Maps
.
newHashMap
());
//获取车辆,工单信息
VehicleDeviceWorkOrder
commonInfo
=
vehicleDeviceService
.
getVehicleDeviceWorkOrderBySn
(
search
.
getSn
());
return
stayPointRecord
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
stayPoint
->
{
String
address
=
Optional
.
ofNullable
(
stayPoint
.
getStayGps
())
.
map
(
e
->
e
.
getElat
()
+
e
.
getElng
())
.
map
(
addressMap:
:
get
)
.
orElse
(
Constants
.
EMPTY_CONTENT_EXCEL
);
return
VehicleMonitorConvert
.
buildStayPointListExport
(
stayPoint
,
commonInfo
,
search
.
getSn
(),
address
);
})
.
collect
(
Collectors
.
toList
());
return
stayPointRecord
.
stream
().
filter
(
Objects:
:
nonNull
).
map
(
stayPoint
->
{
String
address
=
Optional
.
ofNullable
(
stayPoint
.
getStayGps
()).
map
(
e
->
e
.
getElat
()
+
e
.
getElng
()).
map
(
addressMap:
:
get
).
orElse
(
Constants
.
EMPTY_CONTENT_EXCEL
);
return
VehicleMonitorConvert
.
buildStayPointListExport
(
stayPoint
,
commonInfo
,
search
.
getSn
(),
address
);
}).
collect
(
Collectors
.
toList
());
}
/**
...
...
@@ -442,31 +423,25 @@ public class VehicleMonitorService {
*/
public
static
final
String
BEGIN_TIME
=
"beginTime"
;
public
static
final
String
DURATION
=
"duration"
;
private
List
<
StayPointRecordDTO
>
getStayPointList
(
StayPointSearch
search
,
StayPointRequest
request
)
{
List
<
StayPointRecordDTO
>
stayPointRecord
=
remoteFeignStayPointService
.
getStayPointRecord
(
request
);
if
(
CollectionUtils
.
isEmpty
(
stayPointRecord
))
{
return
Lists
.
newArrayList
();
}
//排序
if
(
Objects
.
nonNull
(
search
.
getSort
())
&&
StringUtils
.
isNotBlank
(
search
.
getSort
().
getFiled
()))
{
if
(
Objects
.
nonNull
(
search
.
getSort
())
&&
StringUtils
.
isNotBlank
(
search
.
getSort
().
getFiled
()))
{
if
(
Objects
.
equals
(
search
.
getSort
().
getFiled
(),
BEGIN_TIME
))
{
stayPointRecord
=
stayPointRecord
.
stream
()
.
sorted
(
Comparator
.
comparing
(
e
->
DateUtil
.
getTimestampMillisecond
(
e
.
getBeginTime
()),
CollectionSortUtil
.
order
(
search
.
getSort
().
getOrder
())))
.
collect
(
Collectors
.
toList
());
stayPointRecord
=
stayPointRecord
.
stream
().
sorted
(
Comparator
.
comparing
(
e
->
DateUtil
.
getTimestampMillisecond
(
e
.
getBeginTime
()),
CollectionSortUtil
.
order
(
search
.
getSort
().
getOrder
()))).
collect
(
Collectors
.
toList
());
}
if
(
Objects
.
equals
(
search
.
getSort
().
getFiled
(),
DURATION
))
{
stayPointRecord
=
stayPointRecord
.
stream
()
.
sorted
(
Comparator
.
comparing
(
StayPointRecordDTO:
:
getDuration
,
CollectionSortUtil
.
order
(
search
.
getSort
().
getOrder
())))
.
collect
(
Collectors
.
toList
());
stayPointRecord
=
stayPointRecord
.
stream
().
sorted
(
Comparator
.
comparing
(
StayPointRecordDTO:
:
getDuration
,
CollectionSortUtil
.
order
(
search
.
getSort
().
getOrder
()))).
collect
(
Collectors
.
toList
());
}
}
return
stayPointRecord
;
}
/**
* 常驻地列表
*/
...
...
@@ -482,18 +457,12 @@ public class VehicleMonitorService {
VehicleDeviceWorkOrder
commonInfo
=
vehicleDeviceService
.
getVehicleDeviceWorkOrderBySn
(
search
.
getSn
());
//获取地址信息
List
<
LngLatDTO
>
lngLats
=
residentList
.
stream
()
.
map
(
e
->
new
LngLatDTO
(
e
.
getElng
(),
e
.
getElat
()))
.
collect
(
Collectors
.
toList
());
List
<
LngLatDTO
>
lngLats
=
residentList
.
stream
().
map
(
e
->
new
LngLatDTO
(
e
.
getElng
(),
e
.
getElat
())).
collect
(
Collectors
.
toList
());
LngLatAddressDTO
addressDTO
=
remoteGpsBsService
.
getAddressMap
(
lngLats
);
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
)
.
map
(
LngLatAddressDTO:
:
getAddress
)
.
orElse
(
Maps
.
newHashMap
());
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
).
map
(
LngLatAddressDTO:
:
getAddress
).
orElse
(
Maps
.
newHashMap
());
return
residentList
.
stream
()
.
map
(
e
->
VehicleMonitorConvert
.
buildResidentListVO
(
e
,
commonInfo
,
addressMap
.
get
(
e
.
getElat
()
+
e
.
getElng
())))
.
collect
(
Collectors
.
toList
());
return
residentList
.
stream
().
map
(
e
->
VehicleMonitorConvert
.
buildResidentListVO
(
e
,
commonInfo
,
addressMap
.
get
(
e
.
getElat
()
+
e
.
getElng
()))).
collect
(
Collectors
.
toList
());
}
/**
...
...
@@ -511,18 +480,11 @@ public class VehicleMonitorService {
VehicleDeviceWorkOrder
commonInfo
=
vehicleDeviceService
.
getVehicleDeviceWorkOrderBySn
(
search
.
getSn
());
//获取地址信息
List
<
LngLatDTO
>
lngLats
=
residentList
.
stream
()
.
map
(
e
->
new
LngLatDTO
(
e
.
getElng
(),
e
.
getElat
()))
.
collect
(
Collectors
.
toList
());
List
<
LngLatDTO
>
lngLats
=
residentList
.
stream
().
map
(
e
->
new
LngLatDTO
(
e
.
getElng
(),
e
.
getElat
())).
collect
(
Collectors
.
toList
());
LngLatAddressDTO
addressDTO
=
remoteGpsBsService
.
getAddressMap
(
lngLats
);
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
)
.
map
(
LngLatAddressDTO:
:
getAddress
)
.
orElse
(
Maps
.
newHashMap
());
return
residentList
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
resident
->
VehicleMonitorConvert
.
buildResidentListExport
(
resident
,
commonInfo
,
addressMap
.
get
(
resident
.
getElat
()
+
resident
.
getElng
())))
.
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
addressMap
=
Optional
.
ofNullable
(
addressDTO
).
map
(
LngLatAddressDTO:
:
getAddress
).
orElse
(
Maps
.
newHashMap
());
return
residentList
.
stream
().
filter
(
Objects:
:
nonNull
).
map
(
resident
->
VehicleMonitorConvert
.
buildResidentListExport
(
resident
,
commonInfo
,
addressMap
.
get
(
resident
.
getElat
()
+
resident
.
getElng
()))).
collect
(
Collectors
.
toList
());
}
/**
...
...
@@ -538,9 +500,7 @@ public class VehicleMonitorService {
boolean
isGps
=
Objects
.
isNull
(
device
)
||
Objects
.
equals
(
device
.
getSource
(),
1
);
int
lacType
=
isGps
?
1
:
2
;
Date
deviceActivateTime
=
Optional
.
ofNullable
(
vehicleDevice
)
.
map
(
VehicleDevice:
:
getCreatedDate
)
.
orElse
(
new
Date
());
Date
deviceActivateTime
=
Optional
.
ofNullable
(
vehicleDevice
).
map
(
VehicleDevice:
:
getCreatedDate
).
orElse
(
new
Date
());
//转换前端时间
ImmutablePair
<
String
,
String
>
timeImmutablePair
=
convertTime
(
search
,
deviceActivateTime
);
...
...
@@ -550,6 +510,7 @@ public class VehicleMonitorService {
/**
* 转换开始结束时间
*
* @return 开始时间只取设备激活时间之后
*/
public
ImmutablePair
<
String
,
String
>
convertTime
(
ResidentSearch
search
,
Date
deviceActivateTime
)
{
...
...
@@ -580,7 +541,7 @@ public class VehicleMonitorService {
break
;
//自定义
case
ConstantsVehicle
.
RESIDENT_TYPE_CUSTOM
:
startDate
=
DateUtil
.
getAfterDateTimeStr
(
search
.
getStartTime
(),
deviceActivateTimeStr
);
startDate
=
DateUtil
.
getAfterDateTimeStr
(
search
.
getStartTime
(),
deviceActivateTimeStr
);
endDate
=
search
.
getEndTime
();
break
;
default
:
...
...
src/main/java/cn/com/glsx/admin/modules/service/WorkOrderService.java
View file @
d582abd
...
...
@@ -634,8 +634,7 @@ public class WorkOrderService extends AbstractCommonService {
if
(
workOrderId
==
null
)
{
return
null
;
}
WorkOrder
workOrder
=
workOrderMapper
.
selectById
(
workOrderId
);
return
workOrder
;
return
workOrderMapper
.
selectById
(
workOrderId
);
}
public
List
<
LinkVehicleVO
>
getLinkVehicleList
(
String
vin
)
{
...
...
@@ -769,4 +768,11 @@ public class WorkOrderService extends AbstractCommonService {
log
.
info
(
"vehicleList==="
+
JSONUtil
.
toJsonStr
(
vehicleList
));
return
CollectionUtil
.
isNotEmpty
(
vehicleList
);
}
public
WorkOrderVehicle
getWorkOrderVehicleInfoByWorkOrderId
(
Long
workOrderId
)
{
if
(
Objects
.
isNull
(
workOrderId
))
{
return
null
;
}
return
workOrderVehicleMapper
.
selectOneByOrderId
(
workOrderId
);
}
}
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