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 f73d7c0a
authored
Mar 21, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
首页统计代码优化
1 parent
dfb98e97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
src/main/java/cn/com/glsx/admin/modules/service/HomeService.java
src/main/java/cn/com/glsx/admin/modules/service/HomeService.java
View file @
f73d7c0
...
...
@@ -166,11 +166,9 @@ public class HomeService {
//List<ActiveDeviceVo> list = vehicleMapper.getActiveDeviceInfoWithAuth(appendSql, period);
StatSearch
search
=
new
StatSearch
();
StatSearch
search
=
new
StatSearch
()
.
setStatPattern
(
"%Y-%m-%d"
)
;
if
(
period
==
1
||
period
==
2
)
{
search
.
setStatPattern
(
"%H"
);
}
else
{
search
.
setStatPattern
(
"%Y-%m-%d"
);
}
search
.
setAppendSql
(
appendSql
);
List
<
StatActivatedVehicleDevice
>
activeDeviceList
=
vehicleDeviceMapper
.
getActiveDeviceWithAuth
(
search
);
...
...
@@ -331,7 +329,6 @@ public class HomeService {
}
public
List
<
DeviceBindVo
>
getNewBindDeviceInfo
()
throws
ParseException
{
List
<
DeviceBindVo
>
retList
=
Lists
.
newArrayList
();
String
appendSql
=
DateUtil
.
appendSqlByTimeRange
(
11
,
"tvd.created_date"
);
//List<DeviceBindVo> list = vehicleMapper.getBindDeviceInfoWithAuth(appendSql);
...
...
@@ -340,7 +337,8 @@ public class HomeService {
search
.
setAppendSql
(
appendSql
);
List
<
StatActivatedVehicleDevice
>
activeDeviceList
=
vehicleDeviceMapper
.
getActiveDeviceWithAuth
(
search
);
Map
<
String
,
List
<
StatActivatedVehicleDevice
>>
groupByActiveTimeMap
=
activeDeviceList
.
stream
().
collect
(
Collectors
.
groupingBy
(
StatActivatedVehicleDevice:
:
getActiveTime
));
Map
<
String
,
Map
<
Long
,
List
<
StatActivatedVehicleDevice
>>>
groupByActiveTimeMap
=
activeDeviceList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
StatActivatedVehicleDevice:
:
getActiveTime
,
Collectors
.
groupingBy
(
StatActivatedVehicleDevice:
:
getVehicleId
)));
List
<
DeviceBindVo
>
list
=
convertDeviceBindVoList
(
groupByActiveTimeMap
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
...
...
@@ -348,14 +346,20 @@ public class HomeService {
}
Date
recThirtyBegin
=
DateUtils
.
parseDate
(
DateUtil
.
getReductionDay
(
29
),
PARSE_PATTERN
);
Date
recThirtyEnd
=
DateUtils
.
parseDate
(
DateUtil
.
getTodayDate
(),
PARSE_PATTERN
);
retList
=
fillIfNullByDateForBind
(
recThirtyBegin
,
recThirtyEnd
,
list
);
List
<
DeviceBindVo
>
retList
=
fillIfNullByDateForBind
(
recThirtyBegin
,
recThirtyEnd
,
list
);
ComparatorBindDeviceModel
comparator
=
new
ComparatorBindDeviceModel
();
retList
.
sort
(
comparator
);
return
retList
;
}
public
List
<
DeviceBindVo
>
convertDeviceBindVoList
(
Map
<
String
,
List
<
StatActivatedVehicleDevice
>>
groupByActiveTimeMap
)
{
/**
* 按激活设备日期统计的绑定车辆
*
* @param groupByActiveTimeMap
* @return
*/
public
List
<
DeviceBindVo
>
convertDeviceBindVoList
(
Map
<
String
,
Map
<
Long
,
List
<
StatActivatedVehicleDevice
>>>
groupByActiveTimeMap
)
{
List
<
DeviceBindVo
>
list
=
Lists
.
newArrayList
();
groupByActiveTimeMap
.
forEach
((
k
,
v
)
->
list
.
add
(
new
DeviceBindVo
(
k
,
v
.
size
())));
return
list
;
...
...
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