Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
3ab28ffb
由
张雷
编写于
2023-07-24 14:41:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目时间粒度修改
1 个父辈
e1e02a5c
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
18 行删除
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/vo/ReportParams.java
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
查看文件 @
3ab28ff
...
...
@@ -6,6 +6,7 @@ import com.skua.modules.business.service.ISynthesizeService;
import
com.skua.modules.business.vo.AlarmParams
;
import
com.skua.modules.business.vo.EchartResult
;
import
com.skua.modules.business.vo.InputQueryParams
;
import
com.skua.modules.business.vo.ReportParams
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -142,10 +143,10 @@ public class OlympicCenterController {
@ApiOperation
(
value
=
"获取趋势图new"
,
notes
=
"获取趋势图new"
)
@GetMapping
(
value
=
"/getHistoryTrends"
)
public
Result
<
List
<
EchartResult
>>
getHistoryTrends
(
String
equipId
,
String
type
){
public
Result
<
List
<
EchartResult
>>
getHistoryTrends
(
ReportParams
reportParams
){
Result
<
List
<
EchartResult
>>
result
=
new
Result
<
List
<
EchartResult
>>();
List
<
EchartResult
>
list
=
new
ArrayList
<
EchartResult
>();
list
=
olympicCenterService
.
getHistoryTrends
(
equipId
,
type
);
list
=
olympicCenterService
.
getHistoryTrends
(
reportParams
);
result
.
setResult
(
list
);
result
.
setSuccess
(
true
);
return
result
;
...
...
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
查看文件 @
3ab28ff
...
...
@@ -3,6 +3,7 @@ package com.skua.modules.business.service;
import
com.skua.modules.business.vo.AlarmParams
;
import
com.skua.modules.business.vo.EchartResult
;
import
com.skua.modules.business.vo.InputQueryParams
;
import
com.skua.modules.business.vo.ReportParams
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,7 +27,7 @@ public interface IOlympicCenterService {
Map
<
String
,
Object
>
getRealTimeDataNew
(
String
sourceType
);
List
<
EchartResult
>
getHistoryTrends
(
String
equipId
,
String
type
);
List
<
EchartResult
>
getHistoryTrends
(
ReportParams
reportParams
);
Map
<
String
,
Object
>
getRealTimeDataToUENew
();
...
...
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
3ab28ff
...
...
@@ -5,10 +5,7 @@ import com.skua.core.service.IFactoryInfoService;
import
com.skua.modules.business.entity.WhatStructData
;
import
com.skua.modules.business.mapper.WhatStructDataMapper
;
import
com.skua.modules.business.service.IOlympicCenterService
;
import
com.skua.modules.business.vo.AlarmParams
;
import
com.skua.modules.business.vo.EchartResult
;
import
com.skua.modules.business.vo.InputQueryParams
;
import
com.skua.modules.business.vo.TextResult
;
import
com.skua.modules.business.vo.*
;
import
com.skua.modules.monitor.service.IFmPgQueryService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -928,9 +925,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
@Override
public
List
<
EchartResult
>
getHistoryTrends
(
String
equipId
,
String
type
)
{
public
List
<
EchartResult
>
getHistoryTrends
(
ReportParams
reportParams
)
{
List
<
EchartResult
>
list
=
new
ArrayList
<>();
List
<
WhatStructData
>
wList
=
whatStructDataMapper
.
getDataList
(
equipId
);
List
<
WhatStructData
>
wList
=
whatStructDataMapper
.
getDataList
(
reportParams
.
getEquipId
());
String
type
=
reportParams
.
getType
();
String
start
=
reportParams
.
getStartDate
()
+
" 00:00:00"
;
String
end
=
reportParams
.
getEndDate
()
+
" 23:59:59"
;
String
pgField
=
""
;
if
(
wList
.
size
()
==
0
){
return
list
;
...
...
@@ -939,12 +939,14 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
pgField
=
pgField
+
","
+
whatStructData
.
getMonitorId
();
}
}
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DATE
,
-
7
);
String
startDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
cal
.
getTime
());
String
start
=
startDate
+
" 00:00:00"
;
String
endDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
String
end
=
endDate
+
" 23:59:59"
;
if
(
reportParams
.
getStartDate
()==
null
||
reportParams
.
getEndDate
()==
null
){
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DATE
,
-
7
);
String
startDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
cal
.
getTime
());
start
=
startDate
+
" 00:00:00"
;
String
endDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
end
=
endDate
+
" 23:59:59"
;
}
List
<
Map
<
String
,
Object
>>
dataList
=
factoryInfoService
.
queryReportData
(
AT_ID
,
pgField
,
start
,
end
,
"hour"
);
if
(
dataList
.
size
()>
0
){
for
(
Map
<
String
,
Object
>
map:
dataList
)
{
...
...
@@ -1922,16 +1924,16 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
now
=
new
Date
();
// System.out.println("当前时间为:" + dateFormat.format(now));
Date
before
=
new
Date
(
now
.
getTime
()
-
minute
*
60
*
1000
);
// System.out.println("之前的时间为:" + dateFormat.format(before));
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
JdbcTemplate
alarmDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"mysql-alarm"
);
list
=
alarmDB
.
queryForList
(
"select alarm_content as alarmContent,alarm_param_code as alarmParamCode "
+
list
=
alarmDB
.
queryForList
(
"select max(record_time) as recordTime,alarm_param_name as alarmParamName,"
+
" alarm_content as alarmContent,alarm_param_code as alarmParamCode "
+
" from alert_record_history "
+
" where handle_status = 0 "
+
" and alarm_param_code like '"
+
AT_ID
+
"_%' "
+
" and record_time between '"
+
dateFormat
.
format
(
before
)+
"' and '"
+
dateFormat
.
format
(
now
)+
"' "
+
" GROUP BY alarm_param_name "
+
" ORDER BY record_time"
);
return
list
;
}
...
...
fm-product/src/main/java/com/skua/modules/business/vo/ReportParams.java
0 → 100644
查看文件 @
3ab28ff
package
com
.
skua
.
modules
.
business
.
vo
;
import
lombok.Data
;
@Data
public
class
ReportParams
{
private
String
equipId
;
private
String
type
;
private
String
startDate
;
private
String
endDate
;
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论