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
910ea282
Commit
910ea282
authored
May 31, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改报表查询
parent
e3d8a49b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
11 deletions
+43
-11
device-manager/db/menu.sql
device-manager/db/menu.sql
+14
-0
device-manager/db/params.sql
device-manager/db/params.sql
+10
-1
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceAlarmInfoServiceImpl.java
...odule/device/service/impl/DeviceAlarmInfoServiceImpl.java
+9
-6
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+10
-4
No files found.
device-manager/db/menu.sql
View file @
910ea282
...
...
@@ -56,3 +56,17 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '设备日志-菜单管理-维
-- ----------------------------
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备统计-菜单管理-查看'
,
'/device/stat/list,/device/stat/view,/device/stat/info,/device/stat/export,/device/stat/exportExcel,/device/stat/downloadTemplate,/device/stat/download'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备统计-菜单管理-维护'
,
'/device/stat/add,/device/stat/edit,/device/stat/delete,/device/stat/logicDelete,/device/stat/save,/device/stat/importData'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备告警日志-菜单管理-查看'
,
'/device/alarm/info/list,/device/alarm/info/view,/device/alarm/info/info,/device/alarm/info/export,/device/alarm/info/exportExcel,/device/alarm/info/downloadTemplate,/device/alarm/info/download'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备告警日志-菜单管理-维护'
,
'/device/alarm/info/add,/device/alarm/info/edit,/device/alarm/info/delete,/device/alarm/info/logicDelete,/device/alarm/info/save,/device/alarm/info/importData'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备告警配置-菜单管理-查看'
,
'/alarm/config/list,/alarm/config/view,/alarm/config/info,/alarm/config/export,/alarm/config/exportExcel,/alarm/config/downloadTemplate,/alarm/config/download'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备告警配置-菜单管理-维护'
,
'/alarm/config/add,/alarm/config/edit,/alarm/config/delete,/alarm/config/logicDelete,/alarm/config/save,/alarm/config/importData'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备模块信息-菜单管理-查看'
,
'/device/module/list,/device/module/view,/device/module/info,/device/module/export,/device/module/exportExcel,/device/module/downloadTemplate,/device/module/download'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'设备模块信息-菜单管理-维护'
,
'/device/module/add,/device/module/edit,/device/module/delete,/device/module/logicDelete,/device/module/save,/device/module/importData'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'短信发送记录-菜单管理-查看'
,
'/alarm/sms/send/list,/alarm/sms/send/view,/alarm/sms/send/info,/alarm/sms/send/export,/alarm/sms/send/exportExcel,/alarm/sms/send/downloadTemplate,/alarm/sms/send/download'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
INSERT
INTO
`mortals_xhx_resource`
VALUES
(
null
,
'短信发送记录-菜单管理-维护'
,
'/alarm/sms/send/add,/alarm/sms/send/edit,/alarm/sms/send/delete,/alarm/sms/send/logicDelete,/alarm/sms/send/save,/alarm/sms/send/importData'
,
3
,
0
,
NULL
,
NULL
,
NULL
,
0
);
\ No newline at end of file
device-manager/db/params.sql
View file @
910ea282
...
...
@@ -85,3 +85,12 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '推送方式,', 'AlarmConfig', 'a
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'推送方式,'
,
'AlarmConfig'
,
'alarmPusW1ay'
,
'1'
,
'短信'
,
1
,
4
,
0
,
'alarmPusW1ay'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'是否启用'
,
'AlarmConfig'
,
'enabled'
,
'0'
,
'不启用'
,
1
,
4
,
0
,
'enabled'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'是否启用'
,
'AlarmConfig'
,
'enabled'
,
'1'
,
'启用'
,
1
,
4
,
0
,
'enabled'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警类型,'
,
'DeviceAlarmInfo'
,
'alarmType'
,
'0'
,
'离线'
,
1
,
4
,
0
,
'alarmType'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警级别'
,
'DeviceAlarmInfo'
,
'alarmLevel'
,
'0'
,
'危险'
,
1
,
4
,
0
,
'alarmLevel'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警级别'
,
'DeviceAlarmInfo'
,
'alarmLevel'
,
'1'
,
'次要'
,
1
,
4
,
0
,
'alarmLevel'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警级别'
,
'DeviceAlarmInfo'
,
'alarmLevel'
,
'2'
,
'一般'
,
1
,
4
,
0
,
'alarmLevel'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警状态,来自工单系统'
,
'DeviceAlarmInfo'
,
'alarmStatus'
,
'0'
,
'未清除'
,
1
,
4
,
0
,
'alarmStatus'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警状态,来自工单系统'
,
'DeviceAlarmInfo'
,
'alarmStatus'
,
'1'
,
'清除未确认'
,
1
,
4
,
0
,
'alarmStatus'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'告警状态,来自工单系统'
,
'DeviceAlarmInfo'
,
'alarmStatus'
,
'2'
,
'清除已确认'
,
1
,
4
,
0
,
'alarmStatus'
,
NULL
,
NULL
,
NULL
);
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceAlarmInfoServiceImpl.java
View file @
910ea282
...
...
@@ -10,6 +10,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import
com.mortals.xhx.common.code.AlarmLevelEnum
;
import
com.mortals.xhx.common.code.AlarmTypeEnum
;
import
com.mortals.xhx.common.code.DeviceSrcEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
...
...
@@ -54,11 +55,13 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
@Override
public
Rest
<
DeviceAlarmInfoEntity
>
alarmStats
(
DeviceAlarmInfoEntity
deviceAlarmInfo
,
Context
context
)
{
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
))
{
Rest
<
List
<
SitePdu
>>
rest
=
siteFeign
.
getFlatSitesBySiteId
(
new
SitePdu
().
id
(
deviceAlarmInfo
.
getSiteId
()
));
// Rest<RespData<List<SitePdu>>> rest = siteFeign.list(new SitePdu(
));
if
(
rest
.
getCode
()
==
YesNoEnum
.
NO
.
getValue
(
))
{
return
Rest
.
fail
(
"获取站点列表异常!"
);
}
Map
<
Long
,
SitePdu
>
siteMap
=
rest
.
getData
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
y
->
y
,
(
o
,
n
)
->
n
));
Map
<
Long
,
FirmEntity
>
FirmMap
=
firmService
.
findToMap
(
new
FirmEntity
(),
context
);
Long
siteId
=
deviceAlarmInfo
.
getSiteId
();
...
...
@@ -81,7 +84,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
Integer
deviceTotalCount
=
deviceList
.
size
();
deviceAlarmInfo
.
setDeviceTotalCount
(
deviceTotalCount
);
//监控站点数量
int
siteSize
=
rest
.
getData
().
getData
().
size
();
int
siteSize
=
rest
.
getData
().
size
();
deviceAlarmInfo
.
setSiteSize
(
siteSize
);
//分站点统计设备数量
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
910ea282
...
...
@@ -471,7 +471,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceStatEntity
.
setDeviceOnlineCount
(
deviceOnlineCount
.
intValue
());
//在线率=在线设备/所有激活设备
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceOnlineRatio
(
new
BigDecimal
(
deviceOnlineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
2
,
ROUND_HALF_DOWN
));
deviceStatEntity
.
setDeviceOnlineRatio
(
new
BigDecimal
(
deviceOnlineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
4
,
ROUND_HALF_DOWN
));
}
//离线数量
...
...
@@ -482,7 +482,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
count
();
deviceStatEntity
.
setDeviceOfflineCount
(
deviceOfflineCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceOfflineRatio
(
new
BigDecimal
(
deviceOfflineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
2
,
ROUND_HALF_DOWN
));
deviceStatEntity
.
setDeviceOfflineRatio
(
new
BigDecimal
(
deviceOfflineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
4
,
ROUND_HALF_DOWN
));
}
//停用数量
Long
deviceStopCount
=
deviceList
.
parallelStream
()
...
...
@@ -491,13 +491,13 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
count
();
deviceStatEntity
.
setDeviceStopCount
(
deviceStopCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceStopRatio
(
new
BigDecimal
(
deviceStopCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
2
,
ROUND_HALF_DOWN
));
deviceStatEntity
.
setDeviceStopRatio
(
new
BigDecimal
(
deviceStopCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
4
,
ROUND_HALF_DOWN
));
}
deviceStatEntity
.
setDeviceUnActiveCount
(
deviceUnActiveCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceUnActiveRatio
(
new
BigDecimal
(
deviceUnActiveCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
2
,
ROUND_HALF_DOWN
));
deviceStatEntity
.
setDeviceUnActiveRatio
(
new
BigDecimal
(
deviceUnActiveCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
4
,
ROUND_HALF_DOWN
));
}
//今日告警数量
...
...
@@ -811,6 +811,12 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
System
.
out
.
println
(
bigDecimal1
.
toString
());
BigDecimal
divide
=
new
BigDecimal
(
deviceOnlineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
4
,
ROUND_HALF_DOWN
);
System
.
out
.
println
(
divide
.
toString
());
}
...
...
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