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 813536c4
authored
May 10, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
10665da6
1b67a203
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
258 additions
and
37 deletions
src/main/java/cn/com/glsx/admin/common/constants/ConstantsVehicle.java
src/main/java/cn/com/glsx/admin/modules/controller/VehicleMonitorController.java
src/main/java/cn/com/glsx/admin/modules/converter/WorkOrderVehicleConvert.java
src/main/java/cn/com/glsx/admin/modules/model/param/ResidentSearch.java
src/main/java/cn/com/glsx/admin/modules/model/vo/ResidentListVO.java
src/main/java/cn/com/glsx/admin/modules/remote/RemoteFeignResidentService.java
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleMonitorService.java
src/main/java/cn/com/glsx/admin/modules/utils/DateUtil.java
src/main/java/cn/com/glsx/admin/common/constants/ConstantsVehicle.java
View file @
813536c
...
...
@@ -41,4 +41,30 @@ public final class ConstantsVehicle {
}
/**
* 常驻地查询时间范围;1:一个月 2:三个月 3:半年内 4:截至到目前,5:自定义,-1测试用
*/
public
static
final
String
RESIDENT_TYPE_ONE
=
"1"
;
/**
* 常驻地查询时间范围; 2:三个月
*/
public
static
final
String
RESIDENT_TYPE_THREE
=
"2"
;
/**
* 常驻地查询时间范围; 3:半年内
*/
public
static
final
String
RESIDENT_TYPE_SIX
=
"3"
;
/**
* 常驻地查询时间范围; 4:截至到目前
*/
public
static
final
String
RESIDENT_TYPE_PRESENT
=
"4"
;
/**
* 常驻地查询时间范围;,5:自定义
*/
public
static
final
String
RESIDENT_TYPE_CUSTOM
=
"5"
;
}
src/main/java/cn/com/glsx/admin/modules/controller/VehicleMonitorController.java
View file @
813536c
...
...
@@ -168,9 +168,9 @@ public class VehicleMonitorController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResidentListVO
.
class
),
})
@GetMapping
(
"/residentList"
)
public
R
<
List
<
ResidentListVO
>>
queryResidentList
(
ResidentSearch
search
){
ResidentListVO
element
=
new
ResidentListVO
(
);
return
R
.
ok
().
data
(
Lists
.
newArrayList
(
element
)
);
public
R
<
List
<
ResidentListVO
>>
queryResidentList
(
ResidentSearch
search
)
{
List
<
ResidentListVO
>
residentList
=
vehicleMonitorService
.
queryResidentList
(
search
);
return
R
.
ok
().
data
(
residentList
);
}
/**
...
...
src/main/java/cn/com/glsx/admin/modules/converter/WorkOrderVehicleConvert.java
0 → 100644
View file @
813536c
package
cn
.
com
.
glsx
.
admin
.
modules
.
converter
;
import
cn.com.glsx.admin.modules.entity.VehicleDeviceWorkOrder
;
import
cn.com.glsx.admin.modules.model.export.StayPointListExport
;
import
cn.com.glsx.admin.modules.model.param.ResidentSearch
;
import
cn.com.glsx.admin.modules.model.param.StayPointSearch
;
import
cn.com.glsx.admin.modules.model.vo.ResidentListVO
;
import
cn.com.glsx.admin.modules.model.vo.StayPointListVO
;
import
cn.com.glsx.admin.modules.utils.DateUtil
;
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.GpsLocation
;
import
cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO
;
import
java.util.Optional
;
/**
* @author xiangyanlin
* @date 2022/5/10
*/
public
class
WorkOrderVehicleConvert
{
public
static
StayPointListVO
buildStayPointListVO
(
StayPointRecordDTO
stayPointRecordDTO
,
VehicleDeviceWorkOrder
vehicleDeviceWorkOrder
,
String
sn
)
{
StayPointListVO
stayPointListVO
=
new
StayPointListVO
();
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getWorkOrderNo
)
.
ifPresent
(
stayPointListVO:
:
setWorkOrderNo
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getOwnerName
)
.
ifPresent
(
stayPointListVO:
:
setOwnerName
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getOwnerName
)
.
ifPresent
(
stayPointListVO:
:
setOwnerName
);
stayPointListVO
.
setSn
(
sn
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getVin
)
.
ifPresent
(
stayPointListVO:
:
setVin
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getShopName
)
.
ifPresent
(
stayPointListVO:
:
setShopName
);
stayPointListVO
.
setBeginTime
(
stayPointRecordDTO
.
getBeginTime
());
stayPointListVO
.
setEndTime
(
stayPointRecordDTO
.
getEndTime
());
//时长
Optional
.
ofNullable
(
stayPointRecordDTO
.
getDuration
())
.
map
(
e
->
e
*
1000
)
.
map
(
Integer:
:
longValue
)
.
map
(
DateUtil:
:
normalFormatDuration
)
.
ifPresent
(
stayPointListVO:
:
setDuration
);
stayPointListVO
.
setLocationType
(
"GPS"
);
Optional
.
ofNullable
(
stayPointRecordDTO
)
.
map
(
StayPointRecordDTO:
:
getStayGps
)
.
map
(
GpsLocation:
:
getElat
)
.
ifPresent
(
stayPointListVO:
:
setElat
);
Optional
.
ofNullable
(
stayPointRecordDTO
)
.
map
(
StayPointRecordDTO:
:
getStayGps
)
.
map
(
GpsLocation:
:
getElng
)
.
ifPresent
(
stayPointListVO:
:
setElng
);
return
stayPointListVO
;
}
public
static
StayPointListExport
buildStayPointListExport
(
StayPointRecordDTO
stayPointRecordDTO
,
VehicleDeviceWorkOrder
vehicleDeviceWorkOrder
,
String
sn
,
String
address
)
{
StayPointListExport
stayPointListExport
=
new
StayPointListExport
();
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getWorkOrderNo
)
.
ifPresent
(
stayPointListExport:
:
setWorkOrderNo
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getOwnerName
)
.
ifPresent
(
stayPointListExport:
:
setOwnerName
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getOwnerName
)
.
ifPresent
(
stayPointListExport:
:
setOwnerName
);
stayPointListExport
.
setSn
(
sn
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getVin
)
.
ifPresent
(
stayPointListExport:
:
setVin
);
Optional
.
ofNullable
(
vehicleDeviceWorkOrder
)
.
map
(
VehicleDeviceWorkOrder:
:
getShopName
)
.
ifPresent
(
stayPointListExport:
:
setShopName
);
stayPointListExport
.
setBeginTime
(
stayPointRecordDTO
.
getBeginTime
());
stayPointListExport
.
setEndTime
(
stayPointRecordDTO
.
getEndTime
());
//时长
Optional
.
ofNullable
(
stayPointRecordDTO
.
getDuration
())
.
map
(
e
->
e
*
1000
)
.
map
(
Integer:
:
longValue
)
.
map
(
DateUtil:
:
normalFormatDuration
)
.
ifPresent
(
stayPointListExport:
:
setDuration
);
stayPointListExport
.
setLocationType
(
"GPS"
);
stayPointListExport
.
setAddress
(
address
);
return
stayPointListExport
;
}
public
static
StayPointRequest
buildStayPointRequest
(
StayPointSearch
search
)
{
StayPointRequest
request
=
new
StayPointRequest
();
request
.
setSn
(
search
.
getSn
());
request
.
setPeriodType
(
search
.
getTimes
());
request
.
setBeginTime
(
DateUtil
.
parseDateYmd
(
search
.
getStartTime
()));
request
.
setEndTime
(
DateUtil
.
parseDateYmd
(
search
.
getEndTime
()));
request
.
setMax
(
search
.
getMaxTime
());
request
.
setMin
(
search
.
getMinTime
());
return
request
;
}
public
static
ResidentRequest
buildResidentRequest
(
ResidentSearch
search
,
String
beginTime
,
String
endTime
,
Integer
locInfoType
)
{
ResidentRequest
residentRequest
=
new
ResidentRequest
();
residentRequest
.
setSn
(
search
.
getSn
());
residentRequest
.
setBeginTime
(
beginTime
);
residentRequest
.
setEndTime
(
endTime
);
residentRequest
.
setTimes
(
search
.
getTimes
());
residentRequest
.
setLocInfoType
(
locInfoType
);
return
residentRequest
;
}
public
static
ResidentListVO
buildResidentListVO
(
ResidentDTO
residentDTO
,
VehicleDeviceWorkOrder
common
)
{
ResidentListVO
residentListVO
=
new
ResidentListVO
();
Optional
.
ofNullable
(
common
)
.
map
(
VehicleDeviceWorkOrder:
:
getWorkOrderNo
)
.
ifPresent
(
residentListVO:
:
setWorkOrderNo
);
Optional
.
ofNullable
(
common
)
.
map
(
VehicleDeviceWorkOrder:
:
getOwnerName
)
.
ifPresent
(
residentListVO:
:
setOwnerName
);
Optional
.
ofNullable
(
common
)
.
map
(
VehicleDeviceWorkOrder:
:
getSn
)
.
ifPresent
(
residentListVO:
:
setSn
);
Optional
.
ofNullable
(
common
)
.
map
(
VehicleDeviceWorkOrder:
:
getVin
)
.
ifPresent
(
residentListVO:
:
setVin
);
Optional
.
ofNullable
(
common
)
.
map
(
VehicleDeviceWorkOrder:
:
getShopName
)
.
ifPresent
(
residentListVO:
:
setShopName
);
Optional
.
ofNullable
(
residentDTO
.
getTotalDuration
())
.
map
(
e
->
e
*
1000
)
.
map
(
Integer:
:
longValue
)
.
map
(
DateUtil:
:
normalFormatDuration
)
.
ifPresent
(
residentListVO:
:
setTotalDurationString
);
residentListVO
.
setTotalTimes
(
residentDTO
.
getTotalTimes
());
residentListVO
.
setLongitude
(
residentDTO
.
getLongitude
());
residentListVO
.
setLatitude
(
residentDTO
.
getLatitude
());
residentListVO
.
setBlat
(
residentDTO
.
getBlat
());
residentListVO
.
setBlng
(
residentDTO
.
getBlng
());
residentListVO
.
setElat
(
residentDTO
.
getElat
());
residentListVO
.
setElng
(
residentDTO
.
getElng
());
return
residentListVO
;
}
}
src/main/java/cn/com/glsx/admin/modules/model/param/ResidentSearch.java
View file @
813536c
...
...
@@ -29,6 +29,18 @@ public class ResidentSearch implements Serializable {
private
String
sn
;
/**
* 开始时间
*/
@ApiModelProperty
(
value
=
"开始时间"
)
private
String
startTime
;
/**
* 截止时间
*/
@ApiModelProperty
(
value
=
"截止时间"
)
private
String
endTime
;
/**
* 时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天
*/
@ApiModelProperty
(
value
=
"时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天"
)
...
...
src/main/java/cn/com/glsx/admin/modules/model/vo/ResidentListVO.java
View file @
813536c
...
...
@@ -64,7 +64,7 @@ public class ResidentListVO implements Serializable {
* 经度
*/
@ApiModelProperty
(
value
=
"经度"
)
private
String
l
ng
;
private
String
l
ongitude
;
/**
* 纬度
...
...
src/main/java/cn/com/glsx/admin/modules/remote/RemoteFeignResidentService.java
0 → 100644
View file @
813536c
package
cn
.
com
.
glsx
.
admin
.
modules
.
remote
;
import
cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest
;
import
cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO
;
import
cn.com.glsx.devicemonitor.api.feign.ResidentFeignService
;
import
com.glsx.plat.core.web.R
;
import
com.google.gson.reflect.TypeToken
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 常驻地服务
* @author xiangyanlin
* @date 2022/5/10
*/
@Slf4j
@Service
public
class
RemoteFeignResidentService
{
@Autowired
private
ResidentFeignService
residentFeignService
;
public
List
<
ResidentDTO
>
getResidentList
(
ResidentRequest
request
)
{
R
<
List
<
ResidentDTO
>>
residentList
=
residentFeignService
.
getResidentList
(
request
);
return
residentList
.
getDataList
(
new
TypeToken
<
List
<
ResidentDTO
>>()
{
}.
getType
());
}
}
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
View file @
813536c
...
...
@@ -18,9 +18,7 @@ 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.dto.response.GpsBsData
;
import
cn.com.glsx.devicemonitor.api.enums.DeviceStatusEnum
;
import
cn.com.glsx.stdinterface.enums.FakeOfficeTypeEnum
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.json.JSONUtil
;
...
...
@@ -105,14 +103,6 @@ public class FakeOfflineService extends AbstractCommonService {
// log.info("假性离线查询参数:" + JSONUtil.toJsonStr(search));
List
<
FakeOfficeExport
>
fakeOfficeList
=
fakeOfflineVinMapper
.
searchFakeOfficeList
(
search
);
log
.
info
(
"查询假性离线的列表大小:"
+
fakeOfficeList
.
size
());
// 获取假性多设备单离线的设备状态
List
<
String
>
sns
=
fakeOfficeList
.
stream
().
filter
(
fakeOfficeExport
->
FakeOfficeReasonEnum
.
SINGLE_OFFLINE
.
getCode
().
equals
(
reasonMap
.
get
(
fakeOfficeExport
.
getVin
()))).
flatMap
(
fakeOfficeExport
->
{
List
<
String
>
snsList
=
Arrays
.
asList
(
fakeOfficeExport
.
getSns
().
split
(
","
));
return
snsList
.
stream
();
}).
collect
(
Collectors
.
toList
());
log
.
info
(
"设备号集合==="
+
JSONUtil
.
toJsonStr
(
sns
));
Map
<
String
,
DeviceStatusModel
>
deviceStatusMap
=
remoteFeignDeviceService
.
listDeviceStatusBySns
(
sns
);
// 仅对查询数据 批量获取定位数据
Map
<
String
,
GpsBsData
>
lastGpsBsBatchMap
=
Maps
.
newHashMap
();
...
...
@@ -134,21 +124,6 @@ public class FakeOfflineService extends AbstractCommonService {
}
else
if
(
FakeOfficeReasonEnum
.
RESIDENCE
.
getCode
().
equals
(
code
))
{
//对于触碰围栏假性离线的设备 封装家庭地址和工作地址
buildPredictAddr
(
fakeOfficeExport
,
vin
);
}
else
if
(
FakeOfficeReasonEnum
.
SINGLE_OFFLINE
.
getCode
().
equals
(
code
))
{
String
snsStr
=
fakeOfficeExport
.
getSns
();
String
[]
snArr
=
snsStr
.
split
(
","
);
StringBuilder
builder
=
new
StringBuilder
(
"车辆多设备组合【"
);
for
(
String
sn
:
snArr
)
{
DeviceStatusModel
deviceStatusModel
=
deviceStatusMap
.
get
(
sn
);
if
(
deviceStatusModel
!=
null
)
{
Integer
status
=
deviceStatusModel
.
getStatus
();
if
(
status
!=
null
&&
!
Objects
.
equals
(
DeviceStatusEnum
.
OFFLINE
.
getCode
(),
status
))
{
builder
.
append
(
sn
).
append
(
"("
).
append
(
TypeConverseEunm
.
SourceStatusEnum
.
getStrBySourceType
(
deviceStatusModel
.
getSource
())).
append
(
") "
);
}
}
}
builder
.
append
(
"】设备在线"
);
fakeOfficeExport
.
setReason
(
builder
.
toString
());
}
// 仅对查询数据 设置是否有定位标记位
if
(
TypeConverseEunm
.
SearchTypeEnum
.
SEARCH
.
getType
().
equals
(
flag
))
{
...
...
@@ -239,24 +214,18 @@ public class FakeOfflineService extends AbstractCommonService {
//离线车辆
Map
<
String
,
Integer
>
offlineVehicleNumMap
=
offlineVehicleNumMapList
.
stream
().
collect
(
Collectors
.
toMap
(
FakeOfficeMapDto:
:
getVin
,
FakeOfficeMapDto:
:
getNum
,
(
o
,
n
)
->
n
));
//获取多设备单离线车架号
List
<
String
>
singleDeviceOfficeVinList
=
Lists
.
newArrayList
();
//获取全部设备离线车架号
List
<
String
>
allDeviceOfficeVinList
=
Lists
.
newArrayList
();
offlineVehicleNumMap
.
forEach
((
vin
,
num
)
->
{
Integer
totalNum
=
vehicleNumMap
.
get
(
vin
);
// 如果设备绑定总数和车辆上的设备离线数不同 则是假性离线
if
(!
totalNum
.
equals
(
num
))
{
singleDeviceOfficeVinList
.
add
(
vin
);
}
else
{
if
(
totalNum
.
equals
(
num
))
{
allDeviceOfficeVinList
.
add
(
vin
);
}
});
List
<
String
>
vinList
=
Lists
.
newArrayList
();
singleDeviceOfficeVinList
.
forEach
(
vin
->
reasonMap
.
put
(
vin
,
FakeOfficeReasonEnum
.
SINGLE_OFFLINE
.
getCode
()));
log
.
info
(
"假性离线多设备单离线车架号 size:"
+
singleDeviceOfficeVinList
.
size
());
vinList
.
addAll
(
singleDeviceOfficeVinList
);
// 二 获取设备都离线 最后定位点在家庭围栏或者工作地围栏 获取车架通过权限控制 当存在设备都离线的车辆时才进行计算
if
(
CollectionUtil
.
isNotEmpty
(
allDeviceOfficeVinList
))
{
...
...
src/main/java/cn/com/glsx/admin/modules/service/VehicleMonitorService.java
View file @
813536c
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/glsx/admin/modules/utils/DateUtil.java
View file @
813536c
...
...
@@ -10,6 +10,8 @@ import org.eclipse.jetty.util.StringUtil;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -1526,6 +1528,15 @@ public class DateUtil extends org.apache.commons.lang.time.DateUtils {
return
DurationFormatUtils
.
formatDuration
(
timestamp
,
"HH 时 mm 分 ss 秒"
);
}
/**
* 获取当前时间
* @return yyyy-MM-dd HH:mm:ss
*/
public
static
String
getNowDateTimeFormat
()
{
LocalDateTime
now
=
LocalDateTime
.
now
();
return
now
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
}
public
static
void
main
(
String
[]
args
)
{
// System.out.println(formatDate(getStartDateOfCurrentDay(new Date())));
System
.
out
.
println
(
getMaxDayOfCurrentMonth
());
...
...
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