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 1dc0a78d
authored
Apr 27, 2026
by
王欣伟
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'develop'
2 parents
829c798d
8646a920
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
232 additions
and
68 deletions
.gitignore
src/main/java/cn/com/glsx/admin/modules/controller/DeviceActiveController.java
src/main/java/cn/com/glsx/admin/modules/controller/FakeOfflineController.java
src/main/java/cn/com/glsx/admin/modules/controller/FinalPositioningController.java
src/main/java/cn/com/glsx/admin/modules/controller/JourneyController.java
src/main/java/cn/com/glsx/admin/modules/controller/JudgmentController.java
src/main/java/cn/com/glsx/admin/modules/controller/OfflineController.java
src/main/java/cn/com/glsx/admin/modules/controller/RegionalSearchController.java
src/main/java/cn/com/glsx/admin/modules/controller/VehicleMonitorController.java
src/main/java/cn/com/glsx/admin/modules/model/export/JudgmentExport.java
src/main/java/cn/com/glsx/admin/modules/model/imports/VinWorkOrderNoImportListener.java
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
src/main/java/cn/com/glsx/admin/modules/service/JudgmentService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
.gitignore
View file @
1dc0a78
...
...
@@ -5,3 +5,7 @@ target
ne-shield-trialdrive-admin.iml
doc/neshield数据库文档V1.9.0.html
qodana.yaml
.mybatis/
.trae/
openspec/
src/main/java/cn/com/glsx/admin/modules/controller/DeviceActiveController.java
View file @
1dc0a78
...
...
@@ -3,7 +3,6 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.export.DeviceActiveExprot
;
import
cn.com.glsx.admin.modules.model.param.DeviceActiveSearch
;
import
cn.com.glsx.admin.modules.service.DeviceActiveService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
cn.hutool.core.date.StopWatch
;
import
com.github.pagehelper.Page
;
...
...
src/main/java/cn/com/glsx/admin/modules/controller/FakeOfflineController.java
View file @
1dc0a78
...
...
@@ -11,7 +11,6 @@ import cn.com.glsx.admin.modules.model.param.FakeOfficeSearch;
import
cn.com.glsx.admin.modules.service.DeviceService
;
import
cn.com.glsx.admin.modules.service.FakeOfflineService
;
import
cn.com.glsx.admin.modules.service.VehicleService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.FileTypeCheckUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
...
...
src/main/java/cn/com/glsx/admin/modules/controller/FinalPositioningController.java
View file @
1dc0a78
...
...
@@ -3,7 +3,6 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.export.FinalPositioningExport
;
import
cn.com.glsx.admin.modules.model.param.FinalPositioningSearch
;
import
cn.com.glsx.admin.modules.service.FinalPositioningService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
...
...
src/main/java/cn/com/glsx/admin/modules/controller/JourneyController.java
View file @
1dc0a78
...
...
@@ -12,7 +12,6 @@ import cn.com.glsx.admin.modules.model.param.JourneyDetailSearch;
import
cn.com.glsx.admin.modules.model.param.JourneySearch
;
import
cn.com.glsx.admin.modules.service.JourneyService
;
import
cn.com.glsx.admin.modules.utils.DateUtil
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
...
...
src/main/java/cn/com/glsx/admin/modules/controller/JudgmentController.java
View file @
1dc0a78
...
...
@@ -3,7 +3,6 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.export.JudgmentExport
;
import
cn.com.glsx.admin.modules.model.param.JudgmentSearch
;
import
cn.com.glsx.admin.modules.service.JudgmentService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.web.R
;
...
...
@@ -34,16 +33,40 @@ public class JudgmentController extends AbstractController {
@GetMapping
(
"/search"
)
@ApiOperation
(
value
=
"查询大数据研判列表"
)
public
R
findJudgmentList
(
JudgmentSearch
judgmentSearch
)
{
long
t0
=
System
.
currentTimeMillis
();
boolean
keywordsPresent
=
judgmentSearch
!=
null
&&
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
judgmentSearch
.
getKeywords
());
log
.
info
(
"judgment.search request: startTime={}, endTime={}, alarmType={}, alarmStatus={}, keywordsPresent={}"
,
judgmentSearch
!=
null
?
judgmentSearch
.
getStartTime
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getEndTime
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getAlarmType
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getAlarmStatus
()
:
null
,
keywordsPresent
);
PageInfo
pageInfo
=
judgmentService
.
findJudgmentList
(
judgmentSearch
);
log
.
info
(
"judgment.search response: totalRecords={}, costMs={}"
,
pageInfo
!=
null
?
pageInfo
.
getTotal
()
:
0
,
(
System
.
currentTimeMillis
()
-
t0
));
return
R
.
ok
().
putPageData
(
pageInfo
);
}
@GetMapping
(
"/export"
)
@ApiOperation
(
value
=
"导出大数据研判报表"
)
public
R
<
String
>
exportJudgmentList
(
JudgmentSearch
judgmentSearch
)
{
long
t0
=
System
.
currentTimeMillis
();
boolean
keywordsPresent
=
judgmentSearch
!=
null
&&
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
judgmentSearch
.
getKeywords
());
log
.
info
(
"judgment.export request: startTime={}, endTime={}, alarmType={}, alarmStatus={}, keywordsPresent={}"
,
judgmentSearch
!=
null
?
judgmentSearch
.
getStartTime
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getEndTime
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getAlarmType
()
:
null
,
judgmentSearch
!=
null
?
judgmentSearch
.
getAlarmStatus
()
:
null
,
keywordsPresent
);
String
fileName
=
StringUtil
.
getFileName
(
"大数据研判报表"
);
List
<
JudgmentExport
>
judgmentList
=
judgmentService
.
exportJudgmentList
(
judgmentSearch
);
String
url
=
super
.
uploadExcel
(
fileName
,
judgmentList
,
JudgmentExport
.
class
);
log
.
info
(
"judgment.export generated: fileName={}, rows={}, urlSize={}, costMs={}"
,
fileName
,
judgmentList
!=
null
?
judgmentList
.
size
()
:
0
,
url
!=
null
?
url
.
length
()
:
0
,
(
System
.
currentTimeMillis
()
-
t0
));
return
R
.
ok
().
data
(
url
);
}
}
src/main/java/cn/com/glsx/admin/modules/controller/OfflineController.java
View file @
1dc0a78
...
...
@@ -3,7 +3,6 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.export.OfflineExport
;
import
cn.com.glsx.admin.modules.model.param.OfflineSearch
;
import
cn.com.glsx.admin.modules.service.OfflineService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
...
...
src/main/java/cn/com/glsx/admin/modules/controller/RegionalSearchController.java
View file @
1dc0a78
package
cn
.
com
.
glsx
.
admin
.
modules
.
controller
;
import
cn.com.glsx.admin.modules.model.export.JudgmentExport
;
import
cn.com.glsx.admin.modules.model.export.TrialDriveReportExport
;
import
cn.com.glsx.admin.modules.model.param.RegionalSearch
;
import
cn.com.glsx.admin.modules.model.param.VehicleLocationDTO
;
import
cn.com.glsx.admin.modules.model.vo.RegionalSearchVO
;
import
cn.com.glsx.admin.modules.service.RegionalSearchService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
cn.hutool.core.date.StopWatch
;
import
cn.hutool.json.JSONUtil
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.enums.OperateType
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.time.DateFormatUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
src/main/java/cn/com/glsx/admin/modules/controller/VehicleMonitorController.java
View file @
1dc0a78
...
...
@@ -13,7 +13,6 @@ import cn.com.glsx.admin.modules.model.param.VehicleTreeSearch;
import
cn.com.glsx.admin.modules.model.vo.ResidentListVO
;
import
cn.com.glsx.admin.modules.model.vo.StayPointListVO
;
import
cn.com.glsx.admin.modules.service.VehicleMonitorService
;
import
cn.com.glsx.admin.modules.utils.FdfsUtils
;
import
cn.com.glsx.admin.modules.utils.StringUtil
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
com.glsx.plat.common.utils.StringUtils
;
...
...
src/main/java/cn/com/glsx/admin/modules/model/export/JudgmentExport.java
View file @
1dc0a78
...
...
@@ -111,12 +111,18 @@ public class JudgmentExport {
/**
* 报警生效时间
*/
@ExcelProperty
(
"
报警生效
时间"
)
@ExcelProperty
(
"
进入区域
时间"
)
private
String
alarmBeginTime
;
/**
* 报警失效时间
*/
@ExcelProperty
(
"
报警失效
时间"
)
@ExcelProperty
(
"
驶出区域
时间"
)
private
String
alarmEndTime
;
/**
* 报警持续时间
*/
@ExcelProperty
(
"停留时长"
)
private
String
alarmDuration
;
}
src/main/java/cn/com/glsx/admin/modules/model/imports/VinWorkOrderNoImportListener.java
View file @
1dc0a78
...
...
@@ -79,24 +79,11 @@ public class VinWorkOrderNoImportListener extends AnalysisEventListener<VinWorkO
*/
@Override
public
void
invokeHeadMap
(
Map
<
Integer
,
String
>
headMap
,
AnalysisContext
context
)
{
// 通过反射获取 ExcelProperty 内容比较headMap
log
.
info
(
" 解析到一条头数据:{}"
,
JSON
.
toJSONString
(
headMap
));
// 获取方法上的注解
Field
[]
fields
=
VinWorkOrderNoImport
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
ExcelProperty
property
=
field
.
getAnnotation
(
ExcelProperty
.
class
);
if
(
property
==
null
)
{
continue
;
}
String
excelPropertyName
=
property
.
value
()[
0
];
if
(
excelPropertyName
.
equals
(
"导入失败原因"
))
{
continue
;
}
String
excelColumnName
=
headMap
.
get
(
property
.
index
());
if
(!
excelPropertyName
.
equals
(
excelColumnName
))
{
log
.
error
(
"存在表头ExcelProperty.{},ExcelColumn.{}不一致情况!"
,
excelPropertyName
,
excelColumnName
);
throw
new
AdminException
(
ResultEnum
.
IMPORT_FAIL_FILE
);
}
String
col0
=
headMap
.
get
(
0
);
if
(!
"车架号"
.
equals
(
col0
)
&&
!
"VIN"
.
equalsIgnoreCase
(
col0
))
{
log
.
error
(
"表头不匹配,第一列表头应为 车架号/VIN,当前为:{}"
,
col0
);
throw
new
AdminException
(
ResultEnum
.
IMPORT_FAIL_FILE
);
}
receiverVehicleIds
=
vehicleService
.
receiverVehicleIds
(
receiverId
);
}
...
...
@@ -124,10 +111,35 @@ public class VinWorkOrderNoImportListener extends AnalysisEventListener<VinWorkO
public
void
saveData
()
{
List
<
VinWorkOrderNoImport
>
importList
=
new
ArrayList
<>();
list
.
forEach
(
woi
->
{
if
(
check
(
woi
))
{
importList
.
add
(
woi
);
}
else
{
if
(!
check
(
woi
))
{
failList
.
add
(
woi
);
return
;
}
List
<
Vehicle
>
vehicles
=
vehicleService
.
getVehiclesByVinInTenant
(
woi
.
getVin
());
Map
<
Long
,
String
>
vehicleBizOrderMap
=
vehicleService
.
getBizOrderNoMapByVin
(
woi
.
getVin
());
if
(
CollectionUtils
.
isEmpty
(
vehicles
))
{
VinWorkOrderNoImport
fail
=
copyFor
(
woi
,
null
);
fail
.
setImportFailReason
(
"当前租户未找到车辆"
);
failList
.
add
(
fail
);
return
;
}
for
(
Vehicle
vehicle
:
vehicles
)
{
if
(
VehicleSettleFlagEnum
.
SETTLED
.
getCode
().
equals
(
vehicle
.
getSettleFlag
()))
{
VinWorkOrderNoImport
fail
=
copyFor
(
woi
,
vehicleBizOrderMap
.
get
(
vehicle
.
getId
()));
fail
.
setImportFailReason
(
"车辆已结清"
);
failList
.
add
(
fail
);
continue
;
}
boolean
accorderHasPermit
=
vehicleService
.
checkAccorderPermit
(
vehicle
);
if
(!
accorderHasPermit
)
{
VinWorkOrderNoImport
fail
=
copyFor
(
woi
,
vehicleBizOrderMap
.
get
(
vehicle
.
getId
()));
fail
.
setImportFailReason
(
"数据权限受限"
);
failList
.
add
(
fail
);
continue
;
}
VinWorkOrderNoImport
ok
=
copyFor
(
woi
,
vehicleBizOrderMap
.
get
(
vehicle
.
getId
()));
ok
.
setVehicleId
(
vehicle
.
getId
());
importList
.
add
(
ok
);
}
});
List
<
VinWorkOrderNoImport
>
importFailList
=
vehicleService
.
batchAccorderVehicle
(
receiverId
,
importList
,
receiverVehicleIds
);
...
...
@@ -144,45 +156,31 @@ public class VinWorkOrderNoImportListener extends AnalysisEventListener<VinWorkO
* @return
*/
public
boolean
check
(
VinWorkOrderNoImport
vwi
)
{
if
(
StringUtils
.
isEmpty
(
vwi
.
getVin
())
||
StringUtils
.
isEmpty
(
vwi
.
getBizOrderNo
()))
{
vwi
.
setImportFailReason
(
"车架号/业务工单号必填"
);
if
(
StringUtils
.
isNotEmpty
(
vwi
.
getVin
()))
{
vwi
.
setVin
(
vwi
.
getVin
().
trim
().
toUpperCase
());
}
if
(
StringUtils
.
isEmpty
(
vwi
.
getVin
()))
{
vwi
.
setImportFailReason
(
"VIN 不能为空"
);
log
.
warn
(
vwi
.
toString
());
return
false
;
}
String
vkey
=
vwi
.
get
BizOrderNo
()
+
"-"
+
vwi
.
get
Vin
();
String
vkey
=
vwi
.
getVin
();
if
(
vehicleSet
.
contains
(
vkey
))
{
vwi
.
setImportFailReason
(
"重复导入数据"
);
//log.warn(vwi.toString());
vwi
.
setImportFailReason
(
"重复 VIN"
);
return
false
;
}
vehicleSet
.
add
(
vkey
);
// 2022/3/14 校验数据唯一性
Vehicle
vehicle
=
vehicleService
.
getBizWorkNoAndVin
(
vwi
.
getBizOrderNo
(),
vwi
.
getVin
());
if
(
vehicle
==
null
)
{
vwi
.
setImportFailReason
(
"工单车辆不存在"
);
log
.
warn
(
vwi
.
toString
());
return
false
;
}
if
(
VehicleSettleFlagEnum
.
SETTLED
.
getCode
().
equals
(
vehicle
.
getSettleFlag
()))
{
vwi
.
setImportFailReason
(
"工单车辆已结清"
);
log
.
warn
(
vwi
.
toString
());
return
false
;
}
// 2022/3/14 校验当前用户数据权限
boolean
accorderHasPermit
=
vehicleService
.
checkAccorderPermit
(
vehicle
);
if
(!
accorderHasPermit
)
{
vwi
.
setImportFailReason
(
"数据权限受限"
);
log
.
warn
(
vwi
.
toString
());
return
false
;
}
vwi
.
setVehicleId
(
vehicle
.
getId
());
return
true
;
}
private
VinWorkOrderNoImport
copyFor
(
VinWorkOrderNoImport
src
,
String
bizOrderNo
)
{
VinWorkOrderNoImport
dst
=
new
VinWorkOrderNoImport
();
dst
.
setVin
(
src
.
getVin
());
dst
.
setBizOrderNo
(
bizOrderNo
);
return
dst
;
}
/**
* 最后执行导入
*
...
...
src/main/java/cn/com/glsx/admin/modules/service/FakeOfflineService.java
View file @
1dc0a78
...
...
@@ -18,7 +18,6 @@ import cn.com.glsx.admin.modules.model.imports.WhiteListSnImport;
import
cn.com.glsx.admin.modules.model.param.FakeOfficeSearch
;
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.StringUtil
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsBsData
;
...
...
src/main/java/cn/com/glsx/admin/modules/service/JudgmentService.java
View file @
1dc0a78
...
...
@@ -8,6 +8,7 @@ import cn.com.glsx.admin.modules.remote.RemoteStuJudgeAlarmService;
import
cn.com.glsx.alarm.services.model.StuJudgeAlarmDto
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.common.utils.StringUtils
;
...
...
@@ -41,20 +42,36 @@ public class JudgmentService extends AbstractCommonService {
* 查询大数据研判数据列表
*
* @param search
*
* @return
*/
public
PageInfo
findJudgmentList
(
JudgmentSearch
search
)
{
long
allStart
=
System
.
currentTimeMillis
();
injectOrgChecked
(
search
);
List
<
JudgmentExport
>
judgmentList
=
vehicleMapper
.
findJudgmentList
(
search
);
if
(
CollectionUtil
.
isEmpty
(
judgmentList
))
{
log
.
info
(
"judgment.search early-return: baseListEmpty=true, costMs={}"
,
(
System
.
currentTimeMillis
()
-
allStart
));
return
new
PageInfo
<>();
}
log
.
info
(
"
查询大数据研判数据列表的条数"
+
judgmentList
.
size
());
log
.
info
(
"
judgment.search baseListSize={}"
,
judgmentList
.
size
());
List
<
String
>
snList
=
judgmentList
.
stream
().
map
(
JudgmentExport:
:
getSn
).
collect
(
Collectors
.
toList
());
PageInfo
stuJudgeAlarmListByPage
=
remoteStuJudgeAlarmService
.
searchStuJudgeAlarmListByPage
(
snList
,
search
);
long
remoteStart
=
System
.
currentTimeMillis
();
PageInfo
stuJudgeAlarmListByPage
;
try
{
stuJudgeAlarmListByPage
=
remoteStuJudgeAlarmService
.
searchStuJudgeAlarmListByPage
(
snList
,
search
);
}
catch
(
RuntimeException
ex
)
{
log
.
error
(
"judgment.search remote-call-failed: snSize={}, costMs={}, error={}"
,
snList
!=
null
?
snList
.
size
()
:
0
,
(
System
.
currentTimeMillis
()
-
remoteStart
),
ex
.
toString
());
throw
ex
;
}
log
.
info
(
"judgment.search remote-call-ok: snSize={}, remoteCount={}, costMs={}"
,
snList
!=
null
?
snList
.
size
()
:
0
,
stuJudgeAlarmListByPage
!=
null
&&
stuJudgeAlarmListByPage
.
getList
()
!=
null
?
stuJudgeAlarmListByPage
.
getList
().
size
()
:
0
,
(
System
.
currentTimeMillis
()
-
remoteStart
));
List
<
StuJudgeAlarmDto
>
stuJudgeAlarmList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
stuJudgeAlarmListByPage
.
getList
()),
StuJudgeAlarmDto
.
class
);
if
(
CollectionUtil
.
isEmpty
(
stuJudgeAlarmList
))
{
log
.
info
(
"judgment.search early-return: remoteListEmpty=true, costMs={}"
,
(
System
.
currentTimeMillis
()
-
allStart
));
return
new
PageInfo
<>();
}
...
...
@@ -81,6 +98,32 @@ public class JudgmentService extends AbstractCommonService {
// 如果警情为生效警情 则将失效时间设备为 --
judgmentExport
.
setAlarmEndTime
(
"--"
);
}
// 计算报警持续时间(驶出-进入):显示规则 <1天按小时;≥1天按X天Y小时;任一时间为"--"时显示"--"
if
(
"--"
.
equals
(
judgmentExport
.
getAlarmBeginTime
())
||
"--"
.
equals
(
judgmentExport
.
getAlarmEndTime
()))
{
judgmentExport
.
setAlarmDuration
(
"--"
);
}
else
{
try
{
java
.
util
.
Date
begin
=
DateUtil
.
parse
(
judgmentExport
.
getAlarmBeginTime
());
java
.
util
.
Date
end
=
DateUtil
.
parse
(
judgmentExport
.
getAlarmEndTime
());
long
diffMs
=
end
.
getTime
()
-
begin
.
getTime
();
if
(
diffMs
<=
0
)
{
judgmentExport
.
setAlarmDuration
(
"0小时"
);
}
else
{
long
hours
=
diffMs
/
(
1000
*
60
*
60
);
if
(
hours
<
24
)
{
judgmentExport
.
setAlarmDuration
(
hours
+
"小时"
);
}
else
{
long
days
=
hours
/
24
;
long
remainHours
=
hours
%
24
;
judgmentExport
.
setAlarmDuration
(
days
+
"天"
+
remainHours
+
"小时"
);
}
}
}
catch
(
Exception
e
)
{
judgmentExport
.
setAlarmDuration
(
"--"
);
}
}
judgmentExport
.
setAlarmLng
(
stuJudgeAlarm
.
getAlarmLng
());
judgmentExport
.
setAlarmLat
(
stuJudgeAlarm
.
getAlarmLat
());
judgmentExport
.
setAlarmAddress
(
stuJudgeAlarm
.
getAlarmAddress
());
...
...
@@ -90,20 +133,42 @@ public class JudgmentService extends AbstractCommonService {
}
});
stuJudgeAlarmListByPage
.
setList
(
judgmentExportList
);
if
(
log
.
isDebugEnabled
()
&&
CollectionUtil
.
isNotEmpty
(
judgmentExportList
))
{
JudgmentExport
s
=
judgmentExportList
.
get
(
0
);
log
.
debug
(
"judgment.search sample: sn={}, vin={}, alarmType={}, alarmStatus={}"
,
s
.
getSn
(),
s
.
getVin
(),
s
.
getAlarmType
(),
s
.
getAlarmStatus
());
}
log
.
info
(
"judgment.search assembledCount={}, totalCostMs={}"
,
judgmentExportList
.
size
(),
(
System
.
currentTimeMillis
()
-
allStart
));
return
stuJudgeAlarmListByPage
;
}
public
List
<
JudgmentExport
>
exportJudgmentList
(
JudgmentSearch
search
)
{
long
allStart
=
System
.
currentTimeMillis
();
injectOrgChecked
(
search
);
List
<
JudgmentExport
>
judgmentList
=
vehicleMapper
.
findJudgmentList
(
search
);
if
(
ObjectUtil
.
isNull
(
judgmentList
))
{
log
.
info
(
"judgment.export early-return: baseListNull=true, costMs={}"
,
(
System
.
currentTimeMillis
()
-
allStart
));
return
null
;
}
log
.
info
(
"
查询大数据研判数据列表的条数"
+
judgmentList
.
size
());
log
.
info
(
"
judgment.export baseListSize={}"
,
judgmentList
.
size
());
List
<
String
>
snList
=
judgmentList
.
stream
().
map
(
JudgmentExport:
:
getSn
).
collect
(
Collectors
.
toList
());
List
<
StuJudgeAlarmDto
>
stuJudgeAlarmDtoList
=
remoteStuJudgeAlarmService
.
searchStuJudgeAlarmDataList
(
snList
,
search
);
long
remoteStart
=
System
.
currentTimeMillis
();
List
<
StuJudgeAlarmDto
>
stuJudgeAlarmDtoList
;
try
{
stuJudgeAlarmDtoList
=
remoteStuJudgeAlarmService
.
searchStuJudgeAlarmDataList
(
snList
,
search
);
}
catch
(
RuntimeException
ex
)
{
log
.
error
(
"judgment.export remote-call-failed: snSize={}, costMs={}, error={}"
,
snList
!=
null
?
snList
.
size
()
:
0
,
(
System
.
currentTimeMillis
()
-
remoteStart
),
ex
.
toString
());
throw
ex
;
}
log
.
info
(
"judgment.export remote-call-ok: snSize={}, remoteCount={}, costMs={}"
,
snList
!=
null
?
snList
.
size
()
:
0
,
stuJudgeAlarmDtoList
!=
null
?
stuJudgeAlarmDtoList
.
size
()
:
0
,
(
System
.
currentTimeMillis
()
-
remoteStart
));
if
(
CollectionUtil
.
isEmpty
(
stuJudgeAlarmDtoList
))
{
log
.
info
(
"judgment.export early-return: remoteListEmpty=true, costMs={}"
,
(
System
.
currentTimeMillis
()
-
allStart
));
return
null
;
}
...
...
@@ -131,6 +196,32 @@ public class JudgmentService extends AbstractCommonService {
// 如果警情为生效警情 则将失效时间设备为 --
judgmentExport
.
setAlarmEndTime
(
"--"
);
}
// 计算报警持续时间(驶出-进入):显示规则 <1天按小时;≥1天按X天Y小时;任一时间为"--"时显示"--"
if
(
"--"
.
equals
(
judgmentExport
.
getAlarmBeginTime
())
||
"--"
.
equals
(
judgmentExport
.
getAlarmEndTime
()))
{
judgmentExport
.
setAlarmDuration
(
"--"
);
}
else
{
try
{
java
.
util
.
Date
begin
=
DateUtil
.
parse
(
judgmentExport
.
getAlarmBeginTime
());
java
.
util
.
Date
end
=
DateUtil
.
parse
(
judgmentExport
.
getAlarmEndTime
());
long
diffMs
=
end
.
getTime
()
-
begin
.
getTime
();
if
(
diffMs
<=
0
)
{
judgmentExport
.
setAlarmDuration
(
"0小时"
);
}
else
{
long
hours
=
diffMs
/
(
1000
*
60
*
60
);
if
(
hours
<
24
)
{
judgmentExport
.
setAlarmDuration
(
hours
+
"小时"
);
}
else
{
long
days
=
hours
/
24
;
long
remainHours
=
hours
%
24
;
judgmentExport
.
setAlarmDuration
(
days
+
"天"
+
remainHours
+
"小时"
);
}
}
}
catch
(
Exception
e
)
{
judgmentExport
.
setAlarmDuration
(
"--"
);
}
}
judgmentExport
.
setAlarmLng
(
stuJudgeAlarm
.
getAlarmLng
());
judgmentExport
.
setAlarmLat
(
stuJudgeAlarm
.
getAlarmLat
());
judgmentExport
.
setAlarmAddress
(
stuJudgeAlarm
.
getAlarmAddress
());
...
...
@@ -139,6 +230,13 @@ public class JudgmentService extends AbstractCommonService {
judgmentExportList
.
add
(
judgmentExport
);
}
});
if
(
log
.
isDebugEnabled
()
&&
CollectionUtil
.
isNotEmpty
(
judgmentExportList
))
{
JudgmentExport
s
=
judgmentExportList
.
get
(
0
);
log
.
debug
(
"judgment.export sample: sn={}, vin={}, alarmType={}, alarmStatus={}"
,
s
.
getSn
(),
s
.
getVin
(),
s
.
getAlarmType
(),
s
.
getAlarmStatus
());
}
log
.
info
(
"judgment.export assembledCount={}, totalCostMs={}"
,
judgmentExportList
.
size
(),
(
System
.
currentTimeMillis
()
-
allStart
));
return
judgmentExportList
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
1dc0a78
...
...
@@ -21,6 +21,7 @@ import cn.com.glsx.admin.modules.model.param.*;
import
cn.com.glsx.admin.modules.model.view.SimpleVehicleDTO
;
import
cn.com.glsx.admin.modules.model.view.VehiclePermitDTO
;
import
cn.com.glsx.admin.modules.model.vo.FreqInfoVO
;
import
cn.com.glsx.admin.modules.model.vo.LinkVehicleVO
;
import
cn.com.glsx.admin.modules.model.vo.RegionalSearchVO
;
import
cn.com.glsx.admin.modules.remote.*
;
import
cn.com.glsx.admin.modules.utils.FileIOUtil
;
...
...
@@ -2412,6 +2413,53 @@ public class VehicleService extends AbstractCommonService {
}
/**
* 按 VIN 在当前租户/可见范围内查询车辆列表(租户管理员限定本租户,超管不过滤)
*
* @param vin 车架号
* @return 匹配到的车辆列表
*/
public
List
<
Vehicle
>
getVehiclesByVinInTenant
(
String
vin
)
{
Long
tenantId
=
null
;
if
(!
ShieldContextHolder
.
isSuperAdmin
())
{
tenantId
=
ShieldContextHolder
.
getTenantId
();
}
return
vehicleMapper
.
getVehicleListByVinAndTenantId
(
vin
,
tenantId
);
}
/**
* 按 VIN 在当前租户/可见范围内查询单个车辆(若存在多条则返回首条)
*
* @param vin 车架号
* @return 匹配到的车辆(若存在多条则返回首条)
*/
public
Vehicle
getVehicleByVinInTenant
(
String
vin
)
{
List
<
Vehicle
>
list
=
getVehiclesByVinInTenant
(
vin
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
null
;
}
return
list
.
get
(
0
);
}
/**
* 通过 VIN 获取车辆ID -> 业务工单号 映射(批量)
*
* @param vin 车架号
* @return 车辆ID到业务工单号的映射
*/
public
Map
<
Long
,
String
>
getBizOrderNoMapByVin
(
String
vin
)
{
List
<
LinkVehicleVO
>
links
=
workOrderMapper
.
getLinkVehicleListByVin
(
vin
);
if
(
CollectionUtils
.
isEmpty
(
links
))
{
return
Collections
.
emptyMap
();
}
return
links
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toMap
(
LinkVehicleVO:
:
getVehicleId
,
link
->
link
.
getBizOrderNo
()
==
null
?
""
:
link
.
getBizOrderNo
(),
(
a
,
b
)
->
a
));
}
/**
* 检验授权人是否有数据权限(可能页面没刷新导致可见和权限不一致)
*
* @param vehicle
...
...
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