Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-miniappserver
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 a64c31ff
authored
Jul 14, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化查询
1 parent
13b8732d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
src/main/java/cn/com/glsx/app/modules/service/DashboardService.java
src/main/java/cn/com/glsx/app/modules/service/DashboardService.java
View file @
a64c31f
...
@@ -187,17 +187,17 @@ public class DashboardService extends AbstractCommonService {
...
@@ -187,17 +187,17 @@ public class DashboardService extends AbstractCommonService {
}
}
public
StatisticalInfoVO
getStatisticalInfo
()
{
public
StatisticalInfoVO
getStatisticalInfo
()
{
long
t1
=
System
.
currentTimeMillis
();
StatSearch
activeSearch
=
new
StatSearch
().
setStatPattern
(
"%Y-%m-%d"
);
StatSearch
activeSearch
=
new
StatSearch
().
setStatPattern
(
"%Y-%m-%d"
);
injectSettled
(
activeSearch
);
injectSettled
(
activeSearch
);
StopWatch
stopWatch
=
new
StopWatch
();
StopWatch
stopWatch
=
new
StopWatch
();
//激活设备总数
//激活设备总数
TODO 警情迁移后需要单独查询激活数量
stopWatch
.
start
();
//
stopWatch.start();
List
<
Integer
>
listActiveDevice
=
vehicleDeviceMapper
.
countDeviceWithAuth
(
new
RangeTimeDTO
(),
activeSearch
);
//
List<Integer> listActiveDevice = vehicleDeviceMapper.countDeviceWithAuth(new RangeTimeDTO(), activeSearch);
int
totalActiveDevice
=
listActiveDevice
.
stream
().
reduce
(
0
,
Integer:
:
sum
);
//
int totalActiveDevice = listActiveDevice.stream().reduce(0, Integer::sum);
stopWatch
.
stop
();
//
stopWatch.stop();
log
.
info
(
"{} 耗时:{} ms"
,
"看板统计信息 - 激活设备总数查询"
,
stopWatch
.
getLastTaskTimeMillis
());
//
log.info("{} 耗时:{} ms", "看板统计信息 - 激活设备总数查询", stopWatch.getLastTaskTimeMillis());
//车辆总数
//车辆总数
stopWatch
.
start
();
stopWatch
.
start
();
...
@@ -214,9 +214,10 @@ public class DashboardService extends AbstractCommonService {
...
@@ -214,9 +214,10 @@ public class DashboardService extends AbstractCommonService {
stopWatch
.
stop
();
stopWatch
.
stop
();
log
.
info
(
"{} 耗时:{} ms"
,
"看板统计信息 - 今日激活查询"
,
stopWatch
.
getLastTaskTimeMillis
());
log
.
info
(
"{} 耗时:{} ms"
,
"看板统计信息 - 今日激活查询"
,
stopWatch
.
getLastTaskTimeMillis
());
//
断电报警
//
查询新E盾sn
stopWatch
.
start
();
stopWatch
.
start
();
List
<
String
>
sns
=
vehicleMapper
.
getAllDeviceSnByAuth
();
List
<
String
>
sns
=
vehicleMapper
.
getAllDeviceSnByAuth
();
int
totalActiveDevice
=
sns
.
size
();
stopWatch
.
stop
();
stopWatch
.
stop
();
log
.
info
(
"{} 耗时:{} ms"
,
"看板统计信息 - sn查询"
,
stopWatch
.
getLastTaskTimeMillis
());
log
.
info
(
"{} 耗时:{} ms"
,
"看板统计信息 - sn查询"
,
stopWatch
.
getLastTaskTimeMillis
());
...
@@ -242,7 +243,6 @@ public class DashboardService extends AbstractCommonService {
...
@@ -242,7 +243,6 @@ public class DashboardService extends AbstractCommonService {
//在线率
//在线率
String
onlineRate
=
getOnLineRate
(
totalActiveDevice
);
String
onlineRate
=
getOnLineRate
(
totalActiveDevice
);
int
powerOffCount
;
int
powerOffCount
;
int
lightCount
;
int
lightCount
;
try
{
try
{
...
@@ -251,6 +251,8 @@ public class DashboardService extends AbstractCommonService {
...
@@ -251,6 +251,8 @@ public class DashboardService extends AbstractCommonService {
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
long
t2
=
System
.
currentTimeMillis
();
log
.
info
(
"{} 总耗时:{} ms"
,
"看板统计信息"
,
t2
-
t1
);
return
new
StatisticalInfoVO
(
totalActiveDevice
,
totalVehicle
,
todayActiveDevice
,
powerOffCount
,
fenceCount
,
lightCount
,
onlineRate
);
return
new
StatisticalInfoVO
(
totalActiveDevice
,
totalVehicle
,
todayActiveDevice
,
powerOffCount
,
fenceCount
,
lightCount
,
onlineRate
);
}
}
...
...
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