Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
47275a79
Commit
47275a79
authored
Apr 01, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计逻辑
parent
b86da8ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceMessageStatController.java
...ls/xhx/module/device/web/DeviceMessageStatController.java
+6
-2
No files found.
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceMessageStatController.java
View file @
47275a79
...
...
@@ -49,7 +49,9 @@ public class DeviceMessageStatController extends BaseCRUDJsonBodyMappingControll
//重新分组返回 [{date:2024-8}]
if
(!
ObjectUtils
.
isEmpty
(
statEntities
))
{
//按月分组
Map
<
Integer
,
Map
<
String
,
List
<
DeviceMessageStatEntity
>>>
collect
=
statEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getMonth
,
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getProductName
,
Collectors
.
toList
())));
Map
<
Integer
,
Map
<
String
,
List
<
DeviceMessageStatEntity
>>>
collect
=
statEntities
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getMonth
,
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getProductName
,
Collectors
.
toList
())));
Map
<
Integer
,
Integer
>
monthStat
=
statEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getMonth
,
Collectors
.
summingInt
(
x
->
x
.
getAlarmTotalCount
())));
List
<
ProductEntity
>
productEntities
=
new
ArrayList
<
ProductEntity
>();
...
...
@@ -65,7 +67,7 @@ public class DeviceMessageStatController extends BaseCRUDJsonBodyMappingControll
Map
<
String
,
List
<
DeviceMessageStatEntity
>>
map
=
new
HashMap
<>();
for
(
ProductEntity
productEntity
:
productEntities
)
{
DeviceMessageStatEntity
deviceMessageStatEntity
=
new
DeviceMessageStatEntity
();
deviceMessageStatEntity
.
initAttrValue
(
);
deviceMessageStatEntity
.
setAlarmTotalCount
(
0
);
map
.
put
(
productEntity
.
getProductName
(),
Arrays
.
asList
(
deviceMessageStatEntity
));
}
collect
.
put
(
i
,
map
);
...
...
@@ -76,6 +78,8 @@ public class DeviceMessageStatController extends BaseCRUDJsonBodyMappingControll
}
model
.
put
(
"stat"
,
collect
);
model
.
put
(
"monthStat"
,
monthStat
);
model
.
put
(
KEY_RESULT_DATA
,
null
);
}
return
super
.
doListAfter
(
query
,
model
,
context
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment