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
a3c983bc
Commit
a3c983bc
authored
Apr 01, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计逻辑
parent
d1ca66ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMessageStatServiceImpl.java
...ule/device/service/impl/DeviceMessageStatServiceImpl.java
+4
-11
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceMessageStatController.java
...ls/xhx/module/device/web/DeviceMessageStatController.java
+15
-0
No files found.
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMessageStatServiceImpl.java
View file @
a3c983bc
...
...
@@ -80,17 +80,6 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
int
alarmTotalCount
=
deviceAlarmInfoService
.
count
(
deviceAlarmInfoQuery
,
null
);
deviceStatEntity
.
setAlarmTotalCount
(
alarmTotalCount
);
/* //上行下行数量
DeviceLogQuery deviceLogQuery = new DeviceLogQuery();
deviceLogQuery.setCreateTimeStart(DateUtils.getCurrStrDate());
deviceLogQuery.setCreateTimeEnd(DateUtils.getCurrStrDate());
deviceLogQuery.setLogType(LogTypeEnum.上报事件.getValue());
int uploadMessageTotalCount = deviceLogService.count(deviceLogQuery, null);
deviceLogQuery.setLogType(LogTypeEnum.下发服务.getValue());
int downloadMessageTotalCount = deviceLogService.count(deviceLogQuery, null);
deviceStatEntity.setUploadMessageTotalCount(uploadMessageTotalCount);
deviceStatEntity.setDownloadMessageTotalCount(downloadMessageTotalCount);*/
if
(
deviceStatEntity
.
newEntity
())
{
deviceStatEntity
.
setCreateTime
(
new
Date
());
this
.
save
(
deviceStatEntity
);
...
...
@@ -117,4 +106,8 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
return
deviceStatEntityResult
;
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceMessageStatController.java
View file @
a3c983bc
package
com.mortals.xhx.module.device.web
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.module.device.model.DeviceMessageStatEntity
;
import
com.mortals.xhx.module.device.service.DeviceMessageStatService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 设备消息统计
...
...
@@ -35,4 +39,15 @@ public class DeviceMessageStatController extends BaseCRUDJsonBodyMappingControll
}
@Override
protected
int
doListAfter
(
DeviceMessageStatEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
List
<
DeviceMessageStatEntity
>
statEntities
=
(
List
<
DeviceMessageStatEntity
>)
model
.
get
(
KEY_RESULT_DATA
);
//重新分组返回 [{date:2024-8}]
if
(!
ObjectUtils
.
isEmpty
(
statEntities
)){
//按月分组
Map
<
Integer
,
Map
<
String
,
List
<
DeviceMessageStatEntity
>>>
collect
=
statEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getMonth
,
Collectors
.
groupingBy
(
DeviceMessageStatEntity:
:
getProductCode
)));
model
.
put
(
"stat"
,
collect
);
}
return
super
.
doListAfter
(
query
,
model
,
context
);
}
}
\ No newline at end of file
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