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
f7dfd861
Commit
f7dfd861
authored
May 27, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加智慧办公回调信息
parent
9c2ee29c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
5 deletions
+71
-5
device-manager/src/main/java/com/mortals/xhx/module/device/model/vo/DeviceAlarmInfoVo.java
...mortals/xhx/module/device/model/vo/DeviceAlarmInfoVo.java
+9
-2
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceAlarmInfoService.java
...als/xhx/module/device/service/DeviceAlarmInfoService.java
+3
-0
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceAlarmInfoServiceImpl.java
...odule/device/service/impl/DeviceAlarmInfoServiceImpl.java
+43
-3
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceAlarmInfoController.java
...tals/xhx/module/device/web/DeviceAlarmInfoController.java
+16
-0
No files found.
device-manager/src/main/java/com/mortals/xhx/module/device/model/vo/DeviceAlarmInfoVo.java
View file @
f7dfd861
package
com.mortals.xhx.module.device.model.vo
;
package
com.mortals.xhx.module.device.model.vo
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -26,8 +27,10 @@ public class DeviceAlarmInfoVo extends BaseEntityLong {
...
@@ -26,8 +27,10 @@ public class DeviceAlarmInfoVo extends BaseEntityLong {
*/
*/
private
String
alarmTimeEnd
;
private
String
alarmTimeEnd
;
/** 告警设备Id列表 */
/**
private
List
<
Long
>
alarmDeviceList
;
* 告警设备Id列表
*/
private
List
<
Long
>
alarmDeviceList
;
private
Integer
deviceTotalCount
;
private
Integer
deviceTotalCount
;
...
@@ -53,5 +56,9 @@ public class DeviceAlarmInfoVo extends BaseEntityLong {
...
@@ -53,5 +56,9 @@ public class DeviceAlarmInfoVo extends BaseEntityLong {
private
List
<
HashMap
<
String
,
Object
>>
deviceAlarmMapInfoList
;
private
List
<
HashMap
<
String
,
Object
>>
deviceAlarmMapInfoList
;
private
DeviceEntity
device
;
private
String
alarmTypeStr
;
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceAlarmInfoService.java
View file @
f7dfd861
...
@@ -5,6 +5,8 @@ import com.mortals.framework.model.Context;
...
@@ -5,6 +5,8 @@ import com.mortals.framework.model.Context;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.device.model.DeviceAlarmInfoEntity
;
import
com.mortals.xhx.module.device.model.DeviceAlarmInfoEntity
;
import
java.util.List
;
/**
/**
* DeviceAlarmInfoService
* DeviceAlarmInfoService
* <p>
* <p>
...
@@ -17,4 +19,5 @@ public interface DeviceAlarmInfoService extends ICRUDService<DeviceAlarmInfoEnti
...
@@ -17,4 +19,5 @@ public interface DeviceAlarmInfoService extends ICRUDService<DeviceAlarmInfoEnti
Rest
<
DeviceAlarmInfoEntity
>
alarmStats
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
);
Rest
<
DeviceAlarmInfoEntity
>
alarmStats
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
);
Rest
<
List
<
DeviceAlarmInfoEntity
>>
alarmStatList
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceAlarmInfoServiceImpl.java
View file @
f7dfd861
...
@@ -54,8 +54,6 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
...
@@ -54,8 +54,6 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
@Override
@Override
public
Rest
<
DeviceAlarmInfoEntity
>
alarmStats
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
)
{
public
Rest
<
DeviceAlarmInfoEntity
>
alarmStats
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
)
{
try
{
try
{
Rest
<
RespData
<
List
<
SitePdu
>>>
rest
=
siteFeign
.
list
(
new
SitePdu
());
Rest
<
RespData
<
List
<
SitePdu
>>>
rest
=
siteFeign
.
list
(
new
SitePdu
());
Map
<
Long
,
SitePdu
>
siteMap
=
rest
.
getData
().
getData
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
y
->
y
,
(
o
,
n
)
->
n
));
Map
<
Long
,
SitePdu
>
siteMap
=
rest
.
getData
().
getData
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
y
->
y
,
(
o
,
n
)
->
n
));
if
(
ObjectUtils
.
isEmpty
(
siteMap
))
{
if
(
ObjectUtils
.
isEmpty
(
siteMap
))
{
...
@@ -92,7 +90,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
...
@@ -92,7 +90,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
//分站点统计设备今日告警数量
//分站点统计设备今日告警数量
Map
<
String
,
Long
>
siteDeviceAlarmCollect
=
deviceAlarmInfoList
.
parallelStream
().
distinct
().
collect
(
groupingBy
(
x
->
x
.
getSiteId
(),
counting
()))
Map
<
String
,
Long
>
siteDeviceAlarmCollect
=
deviceAlarmInfoList
.
parallelStream
().
distinct
().
collect
(
groupingBy
(
x
->
x
.
getSiteId
(),
counting
()))
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
()))
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
()))
.
collect
(
Collectors
.
toMap
(
x
->
siteMap
.
get
(
x
.
getKey
())==
null
?
"未知站点"
:
siteMap
.
get
(
x
.
getKey
()).
getSiteName
(),
y
->
y
.
getValue
(),(
o
,
n
)->
n
));
.
collect
(
Collectors
.
toMap
(
x
->
siteMap
.
get
(
x
.
getKey
())
==
null
?
"未知站点"
:
siteMap
.
get
(
x
.
getKey
()).
getSiteName
(),
y
->
y
.
getValue
(),
(
o
,
n
)
->
n
));
deviceAlarmInfo
.
setSiteDeviceAlarmCollect
(
siteDeviceAlarmCollect
);
deviceAlarmInfo
.
setSiteDeviceAlarmCollect
(
siteDeviceAlarmCollect
);
//设备类型分布
//设备类型分布
Map
<
String
,
String
>
deviceConnTypeCollect
=
deviceList
.
parallelStream
().
collect
(
groupingBy
(
x
->
DeviceSrcEnum
.
getByValue
(
x
.
getDeviceSrc
()).
getDesc
(),
Collectors
.
collectingAndThen
(
counting
(),
y
->
Map
<
String
,
String
>
deviceConnTypeCollect
=
deviceList
.
parallelStream
().
collect
(
groupingBy
(
x
->
DeviceSrcEnum
.
getByValue
(
x
.
getDeviceSrc
()).
getDesc
(),
Collectors
.
collectingAndThen
(
counting
(),
y
->
...
@@ -143,4 +141,46 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
...
@@ -143,4 +141,46 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
return
Rest
.
fail
(
e
.
getMessage
());
return
Rest
.
fail
(
e
.
getMessage
());
}
}
}
}
@Override
public
Rest
<
List
<
DeviceAlarmInfoEntity
>>
alarmStatList
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
)
{
ArrayList
<
DeviceAlarmInfoEntity
>
infoList
=
new
ArrayList
<>();
try
{
Rest
<
RespData
<
List
<
SitePdu
>>>
rest
=
siteFeign
.
list
(
new
SitePdu
());
Map
<
Long
,
SitePdu
>
siteMap
=
rest
.
getData
().
getData
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
y
->
y
,
(
o
,
n
)
->
n
));
if
(
ObjectUtils
.
isEmpty
(
siteMap
))
{
return
Rest
.
fail
(
"获取站点列表异常!"
);
}
Long
siteId
=
deviceAlarmInfo
.
getSiteId
();
DeviceAlarmInfoQuery
deviceAlarmInfoQuery
=
new
DeviceAlarmInfoQuery
();
deviceAlarmInfoQuery
.
setSiteId
(
siteId
);
deviceAlarmInfoQuery
.
setAlarmTimeStart
(
DateUtil
.
today
());
deviceAlarmInfoQuery
.
setAlarmTimeEnd
(
DateUtil
.
today
());
deviceAlarmInfoQuery
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"alarmTime"
,
OrderCol
.
DESCENDING
)));
List
<
DeviceAlarmInfoEntity
>
deviceAlarmInfoList
=
this
.
find
(
deviceAlarmInfoQuery
);
Map
<
Long
,
Map
<
Integer
,
List
<
DeviceAlarmInfoEntity
>>>
collect
=
deviceAlarmInfoList
.
parallelStream
().
collect
(
groupingBy
(
x
->
x
.
getAlarmDevice
(),
groupingBy
(
y
->
y
.
getAlarmType
())));
collect
.
entrySet
().
stream
().
forEach
(
entry
->
{
Long
key
=
entry
.
getKey
();
Map
<
Integer
,
List
<
DeviceAlarmInfoEntity
>>
listMap
=
entry
.
getValue
();
listMap
.
entrySet
().
stream
().
forEach
(
entry1
->
{
List
<
DeviceAlarmInfoEntity
>
vals
=
entry1
.
getValue
();
DeviceAlarmInfoEntity
deviceAlarmInfoEntity
=
new
DeviceAlarmInfoEntity
();
deviceAlarmInfoEntity
.
initAttrValue
();
DeviceEntity
extCache
=
deviceService
.
getCache
(
key
.
toString
());
deviceAlarmInfoEntity
.
setDevice
(
extCache
);
deviceAlarmInfoEntity
.
setAlarmTime
(
vals
.
get
(
0
).
getAlarmTime
());
deviceAlarmInfoEntity
.
setAlarmTypeStr
(
AlarmTypeEnum
.
getByValue
(
vals
.
get
(
0
).
getAlarmType
()).
getDesc
());
deviceAlarmInfoEntity
.
setTodayAlarmInfoCount
(
vals
.
size
());
infoList
.
add
(
deviceAlarmInfoEntity
);
});
});
return
Rest
.
ok
(
infoList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设备告警信息统计异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceAlarmInfoController.java
View file @
f7dfd861
...
@@ -84,4 +84,20 @@ public class DeviceAlarmInfoController extends BaseCRUDJsonBodyMappingController
...
@@ -84,4 +84,20 @@ public class DeviceAlarmInfoController extends BaseCRUDJsonBodyMappingController
}
}
}
}
/**
* 设备告警信息统计
*/
@PostMapping
(
value
=
"statlist"
)
public
Rest
<
List
<
DeviceAlarmInfoEntity
>>
alarmStatList
(
@RequestBody
DeviceAlarmInfoEntity
deviceAlarmInfo
)
{
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备告警统计"
;
try
{
Rest
<
List
<
DeviceAlarmInfoEntity
>>
rest
=
this
.
service
.
alarmStatList
(
deviceAlarmInfo
,
getContext
());
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
return
rest
;
}
catch
(
Exception
e
)
{
log
.
error
(
"设备告警信息统计"
,
e
);
return
Rest
.
fail
(
super
.
convertException
(
e
));
}
}
}
}
\ 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