Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hp-smart
Commits
d6d4e1d1
Commit
d6d4e1d1
authored
Oct 20, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-10-19 设备驾驶舱接口
parent
66491520
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
356 additions
and
0 deletions
+356
-0
ServiceHPBI003.java
.../java/com/baosight/hpjx/hp/bi/service/ServiceHPBI003.java
+83
-0
HPBI003.xml
src/main/java/com/baosight/hpjx/hp/bi/sql/HPBI003.xml
+273
-0
No files found.
src/main/java/com/baosight/hpjx/hp/bi/service/ServiceHPBI003.java
View file @
d6d4e1d1
...
@@ -346,4 +346,87 @@ public class ServiceHPBI003 extends ServiceBase {
...
@@ -346,4 +346,87 @@ public class ServiceHPBI003 extends ServiceBase {
return
inInfo
;
return
inInfo
;
}
}
/**
* 查询报设备状态
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"设备监控"
,
operType
=
"查询"
,
operDesc
=
"查询设备状态"
)
public
EiInfo
queryBySbStatus
(
EiInfo
inInfo
)
{
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
List
<
Map
>
result
=
DaoBase
.
getInstance
().
query
(
"HPBI003.queryBySbStatus"
,
params
);
inInfo
.
set
(
"result"
,
result
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
return
inInfo
;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public
EiInfo
querySbYes
(
EiInfo
inInfo
){
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
params
.
put
(
"logValues"
,
Arrays
.
asList
(
"1"
,
"2"
,
"4"
));
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
listMap
=
DaoBase
.
getInstance
().
query
(
"HPBI003.queryBySbYes"
,
params
,
0
,
100
);
List
listMap2
=
listMap
.
stream
().
map
(
map
->
map
.
get
(
"date"
)).
sorted
().
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Object
,
List
<
Map
>>
listMap1
=
listMap
.
stream
().
collect
(
Collectors
.
groupingBy
(
m
->
m
.
get
(
"deviceCode"
)));
for
(
Object
key:
listMap1
.
keySet
())
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
key
);
map
.
put
(
"type"
,
"line"
);
map
.
put
(
"stack"
,
"Total"
);
List
list1
=
new
ArrayList
<>();
for
(
Map
map1:
listMap1
.
get
(
key
))
{
list1
.
add
(
map1
.
get
(
"num"
));
}
map
.
put
(
"data"
,
list1
);
result
.
add
(
map
);
}
inInfo
.
set
(
"date"
,
listMap2
);
inInfo
.
set
(
"name"
,
listMap1
.
keySet
());
inInfo
.
set
(
EiConstant
.
resultBlock
,
result
);
return
inInfo
;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public
EiInfo
querySbNo
(
EiInfo
inInfo
){
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
params
.
put
(
"logValues"
,
Arrays
.
asList
(
"3"
,
"5"
,
"6"
));
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
listMap
=
DaoBase
.
getInstance
().
query
(
"HPBI003.queryBySbYes"
,
params
,
0
,
100
);
List
listMap2
=
listMap
.
stream
().
map
(
map
->
map
.
get
(
"date"
)).
sorted
().
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Object
,
List
<
Map
>>
listMap1
=
listMap
.
stream
().
collect
(
Collectors
.
groupingBy
(
m
->
m
.
get
(
"deviceCode"
)));
for
(
Object
key:
listMap1
.
keySet
())
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
key
);
map
.
put
(
"type"
,
"line"
);
map
.
put
(
"stack"
,
"Total"
);
List
list1
=
new
ArrayList
<>();
for
(
Map
map1:
listMap1
.
get
(
key
))
{
list1
.
add
(
map1
.
get
(
"count"
));
}
map
.
put
(
"data"
,
list1
);
result
.
add
(
map
);
}
inInfo
.
set
(
"date"
,
listMap2
);
inInfo
.
set
(
"name"
,
listMap1
.
keySet
());
inInfo
.
set
(
EiConstant
.
resultBlock
,
result
);
return
inInfo
;
}
}
}
src/main/java/com/baosight/hpjx/hp/bi/sql/HPBI003.xml
View file @
d6d4e1d1
...
@@ -29,6 +29,36 @@
...
@@ -29,6 +29,36 @@
order by c.CREATED_TIME desc
order by c.CREATED_TIME desc
</select>
</select>
<select
id=
"queryBySbStatus"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_NAME as "deviceName",
a.DEVICE_MODEL as "deviceModel",
case when c.LOG_VALUE = 3 || c.LOG_VALUE = 5 || c.LOG_VALUE = 6 then '关机' else '开机' end as status
from ${hpjxSchema}.t_hpsb003 a
join ${hpjxSchema}.t_hpsb002 c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
and c.EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
c.CREATED_TIME =(
select MAX(CREATED_TIME) from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE' and left(CREATED_TIME,8) = #date#
)
</isNotEmpty>
order by a.DEVICE_CODE
</select>
<select
id=
"queryFactorycode"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
<select
id=
"queryFactorycode"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
select
...
@@ -769,4 +799,246 @@
...
@@ -769,4 +799,246 @@
order by
order by
date asc, SORT asc
date asc, SORT asc
</select>
</select>
<select
id=
"queryBySbYes"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_MODEL as "deviceModel",
a.DATE as "date",
a.NUM as "num"
from (
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
right(replace(#date#, '-', ''), 4) as DATE,
ifnull(c.NUM, 0) NUM
from ${hpjxSchema}.t_hpsb003 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from hpjx.t_hpsb002
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(#date#, '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
) a
order by a.DEVICE_CODE
</select>
</sqlMap>
</sqlMap>
\ 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