Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
42db58e6
由
张雷
编写于
2023-04-14 15:02:19 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目接口开发
1 个父辈
5b848fa0
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
235 行增加
和
24 行删除
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/controller/OlympicCenterController.java
查看文件 @
42db58e
...
...
@@ -31,19 +31,40 @@ public class OlympicCenterController {
@ApiOperation
(
value
=
"获取整体实时数据"
,
notes
=
"获取整体实时数据"
)
@GetMapping
(
value
=
"/getRealTimeData"
)
public
Result
<
Map
<
String
,
Object
>>
getRealTimeData
(){
public
Result
<
Map
<
String
,
Object
>>
getRealTimeData
(
String
sourceType
){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
olympicCenterService
.
getRealTimeData
();
Map
<
String
,
Object
>
map
=
olympicCenterService
.
getRealTimeData
(
sourceType
);
result
.
setResult
(
map
);
result
.
setSuccess
(
true
);
return
result
;
}
@ApiOperation
(
value
=
"获取指标历史趋势曲线"
,
notes
=
"获取指标历史趋势曲线"
)
/**
* 获取泵站指标历史趋势曲线
* @param field ssll:瞬时流量 ljll:累计流量 rll:日流量
* @param sourceType feed:给水泵房 hot:热水锅炉站 fire:消防泵站
* @return
*/
@ApiOperation
(
value
=
"获取泵站指标历史趋势曲线"
,
notes
=
"获取泵站指标历史趋势曲线"
)
@GetMapping
(
value
=
"/getHistoryData"
)
public
Result
<
Map
<
String
,
Object
>>
getHistoryData
(
String
field
){
public
Result
<
List
<
EchartResult
>>
getHistoryData
(
String
field
,
String
sourceType
){
Result
<
List
<
EchartResult
>>
result
=
new
Result
<
List
<
EchartResult
>>();
List
<
EchartResult
>
list
=
olympicCenterService
.
getHistoryData
(
field
,
sourceType
);
result
.
setResult
(
list
);
result
.
setSuccess
(
true
);
return
result
;
}
/**
* 获取泵站指标实时数据
* @param sourceType feed:给水泵房 hot:热水锅炉站 fire:消防泵站
* @return
*/
@ApiOperation
(
value
=
"获取泵站指标实时数据"
,
notes
=
"获取泵站指标实时数据"
)
@GetMapping
(
value
=
"/getBzRealTimeData"
)
public
Result
<
Map
<
String
,
Object
>>
getBzRealTimeData
(
String
sourceType
){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
olympicCenterService
.
get
HistoryData
(
field
);
Map
<
String
,
Object
>
map
=
olympicCenterService
.
get
BzRealTimeData
(
sourceType
);
result
.
setResult
(
map
);
result
.
setSuccess
(
true
);
return
result
;
...
...
@@ -60,12 +81,18 @@ public class OlympicCenterController {
return
result
;
}
@ApiOperation
(
value
=
"获取压力趋势图"
,
notes
=
"获取压力趋势图"
)
/**
* 获取趋势图
* @param equipId
* @param type p:压力 f:流量计 t:温度计
* @return
*/
@ApiOperation
(
value
=
"获取趋势图"
,
notes
=
"获取趋势图"
)
@GetMapping
(
value
=
"/getPressureChart"
)
public
Result
<
List
<
EchartResult
>>
getPressureChart
(
String
equipId
){
public
Result
<
List
<
EchartResult
>>
getPressureChart
(
String
equipId
,
String
type
){
Result
<
List
<
EchartResult
>>
result
=
new
Result
<
List
<
EchartResult
>>();
List
<
EchartResult
>
list
=
new
ArrayList
<
EchartResult
>();
list
=
olympicCenterService
.
getPressureChart
(
equipId
);
list
=
olympicCenterService
.
getPressureChart
(
equipId
,
type
);
result
.
setResult
(
list
);
result
.
setSuccess
(
true
);
return
result
;
...
...
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
查看文件 @
42db58e
...
...
@@ -10,11 +10,13 @@ import java.util.Map;
*/
public
interface
IOlympicCenterService
{
Map
<
String
,
Object
>
getRealTimeData
();
Map
<
String
,
Object
>
getRealTimeData
(
String
sourceType
);
Map
<
String
,
Object
>
getHistoryData
(
String
field
);
List
<
EchartResult
>
getHistoryData
(
String
field
,
String
sourceType
);
List
<
EchartResult
>
getWaterChart
(
String
sourceType
,
String
dateType
,
String
start
,
String
end
);
List
<
EchartResult
>
getPressureChart
(
String
equipId
);
List
<
EchartResult
>
getPressureChart
(
String
equipId
,
String
type
);
Map
<
String
,
Object
>
getBzRealTimeData
(
String
sourceType
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
42db58e
...
...
@@ -3,6 +3,7 @@ package com.skua.modules.business.service.impl;
import
com.skua.core.service.IPgQueryService
;
import
com.skua.modules.business.service.IOlympicCenterService
;
import
com.skua.modules.business.vo.EchartResult
;
import
com.skua.modules.business.vo.TextResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -15,23 +16,120 @@ import java.util.*;
@Service
public
class
OlympicCenterServiceImpl
implements
IOlympicCenterService
{
@Autowired
private
IPgQueryService
pgQueryService
;
//
@Autowired
//
private IPgQueryService pgQueryService;
@Override
public
Map
<
String
,
Object
>
getRealTimeData
()
{
public
Map
<
String
,
Object
>
getRealTimeData
(
String
sourceType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
jsFields
=
"BKYHWSC_JS_Tag2,BKYHWSC_JS_Tag3"
;
List
<
Map
<
String
,
Object
>>
monitorList
=
pgQueryService
.
queryFactoryMonitorFromRealTimeData
(
""
,
jsFields
);
if
(
monitorList
.
size
()==
1
){
map
=
monitorList
.
get
(
0
);
// String jsFields = "BKYHWSC_JS_Tag2,BKYHWSC_JS_Tag3";
// List<Map<String, Object>> monitorList = pgQueryService.queryFactoryMonitorFromRealTimeData("",jsFields);
// if(monitorList.size()==1){
// map = monitorList.get(0);
// }
List
<
TextResult
>
pList
=
new
ArrayList
<>();
List
<
TextResult
>
fList
=
new
ArrayList
<>();
List
<
TextResult
>
wList
=
new
ArrayList
<>();
if
(
"feed"
.
equals
(
sourceType
)){
//压力14流量8
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"压力表"
+(
i
+
1
));
if
(
i
==
8
){
textResult
.
setValue
(
"0.41"
);
}
else
{
textResult
.
setValue
(
"0.00"
);
}
pList
.
add
(
i
,
textResult
);
}
for
(
int
j
=
0
;
j
<
8
;
j
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"流量计"
+(
j
+
1
));
textResult
.
setValue
(
"0.00"
);
fList
.
add
(
j
,
textResult
);
}
map
.
put
(
"pressure"
,
pList
);
map
.
put
(
"flow"
,
fList
);
}
else
if
(
"hot"
.
equals
(
sourceType
)){
//压力10流量4温度4;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"压力表"
+(
i
+
1
));
textResult
.
setValue
(
"0.00"
);
pList
.
add
(
i
,
textResult
);
}
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"流量计"
+(
j
+
1
));
textResult
.
setValue
(
"0.00"
);
fList
.
add
(
j
,
textResult
);
}
for
(
int
k
=
0
;
k
<
4
;
k
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"温度计"
+(
k
+
1
));
textResult
.
setValue
(
"--"
);
wList
.
add
(
k
,
textResult
);
}
map
.
put
(
"pressure"
,
pList
);
map
.
put
(
"flow"
,
fList
);
map
.
put
(
"temperature"
,
wList
);
}
else
if
(
"fire"
.
equals
(
sourceType
)){
//压力9流量2.
for
(
int
i
=
0
;
i
<
9
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"压力表"
+(
i
+
1
));
textResult
.
setValue
(
"0.00"
);
pList
.
add
(
i
,
textResult
);
}
for
(
int
j
=
0
;
j
<
2
;
j
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"流量计"
+(
j
+
1
));
textResult
.
setValue
(
"0.00"
);
fList
.
add
(
j
,
textResult
);
}
map
.
put
(
"pressure"
,
pList
);
map
.
put
(
"flow"
,
fList
);
}
else
{
for
(
int
i
=
0
;
i
<
33
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"压力表"
+(
i
+
1
));
if
(
i
==
8
){
textResult
.
setValue
(
"0.41"
);
}
else
{
textResult
.
setValue
(
"0.00"
);
}
pList
.
add
(
i
,
textResult
);
}
for
(
int
j
=
0
;
j
<
14
;
j
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"流量计"
+(
j
+
1
));
textResult
.
setValue
(
"0.00"
);
fList
.
add
(
j
,
textResult
);
}
for
(
int
k
=
0
;
k
<
4
;
k
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"温度计"
+(
k
+
1
));
textResult
.
setValue
(
"--"
);
wList
.
add
(
k
,
textResult
);
}
map
.
put
(
"pressure"
,
pList
);
map
.
put
(
"flow"
,
fList
);
map
.
put
(
"temperature"
,
wList
);
}
return
map
;
}
@Override
public
Map
<
String
,
Object
>
getHistoryData
(
String
field
)
{
return
null
;
public
List
<
EchartResult
>
getHistoryData
(
String
field
,
String
sourceType
)
{
List
<
EchartResult
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
24
;
i
++)
{
Calendar
date
=
Calendar
.
getInstance
();
date
.
add
(
Calendar
.
HOUR
,
i
-
24
);
String
newHour
=
new
SimpleDateFormat
(
"HH:00"
).
format
(
date
.
getTime
());
EchartResult
echartResult
=
new
EchartResult
();
echartResult
.
setName
(
newHour
);
echartResult
.
setValue
(
formatDouble
(
getRandom
(
0.00
,
1.00
)).
toString
());
echartResult
.
setSeries
(
field
);
list
.
add
(
echartResult
);
}
return
list
;
}
@Override
...
...
@@ -61,7 +159,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
@Override
public
List
<
EchartResult
>
getPressureChart
(
String
equipId
)
{
public
List
<
EchartResult
>
getPressureChart
(
String
equipId
,
String
type
)
{
//p:压力 f:流量计 t:温度计
List
<
EchartResult
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
30
;
i
++)
{
Calendar
date
=
Calendar
.
getInstance
();
...
...
@@ -69,18 +167,102 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
String
newDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
date
.
getTime
()).
substring
(
5
,
10
);
EchartResult
echartResult
=
new
EchartResult
();
echartResult
.
setName
(
newDate
);
if
(
"p"
.
equals
(
type
)){
echartResult
.
setValue
(
formatDouble
(
getRandom
(
0.40
,
0.50
)).
toString
());
echartResult
.
setSeries
(
"压力表"
);
}
else
if
(
"f"
.
equals
(
type
)){
echartResult
.
setValue
(
"0.00"
);
echartResult
.
setSeries
(
"流量计"
);
}
else
if
(
"t"
.
equals
(
type
)){
echartResult
.
setValue
(
"0.00"
);
echartResult
.
setSeries
(
"温度计"
);
}
else
{
echartResult
.
setValue
(
"--"
);
echartResult
.
setSeries
(
"--"
);
}
list
.
add
(
echartResult
);
}
return
list
;
}
@Override
public
Map
<
String
,
Object
>
getBzRealTimeData
(
String
sourceType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
TextResult
>
bList
=
new
ArrayList
<>();
if
(
"feed"
.
equals
(
sourceType
)){
TextResult
ssllResult
=
new
TextResult
();
ssllResult
.
setTitle
(
"瞬时流量"
);
ssllResult
.
setValue
(
"0.00"
);
TextResult
ljllResult
=
new
TextResult
();
ljllResult
.
setTitle
(
"累计流量"
);
ljllResult
.
setValue
(
"0.00"
);
TextResult
rllResult
=
new
TextResult
();
rllResult
.
setTitle
(
"日流量"
);
rllResult
.
setValue
(
"0.00"
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"泵"
+(
i
+
1
));
textResult
.
setValue
(
"0"
);
bList
.
add
(
i
,
textResult
);
}
map
.
put
(
"ssll"
,
ssllResult
);
map
.
put
(
"ljll"
,
ljllResult
);
map
.
put
(
"rll"
,
rllResult
);
map
.
put
(
"equip"
,
bList
);
}
else
if
(
"hot"
.
equals
(
sourceType
)){
//压力10流量4温度4;
TextResult
ssllResult
=
new
TextResult
();
ssllResult
.
setTitle
(
"瞬时流量"
);
ssllResult
.
setValue
(
"0.00"
);
TextResult
ljllResult
=
new
TextResult
();
ljllResult
.
setTitle
(
"累计流量"
);
ljllResult
.
setValue
(
"0.00"
);
TextResult
rllResult
=
new
TextResult
();
rllResult
.
setTitle
(
"日流量"
);
rllResult
.
setValue
(
"0.00"
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"泵"
+(
i
+
1
));
textResult
.
setValue
(
"0"
);
bList
.
add
(
i
,
textResult
);
}
map
.
put
(
"ssll"
,
ssllResult
);
map
.
put
(
"ljll"
,
ljllResult
);
map
.
put
(
"rll"
,
rllResult
);
map
.
put
(
"equip"
,
bList
);
}
else
if
(
"fire"
.
equals
(
sourceType
)){
//压力9流量2.
TextResult
ssllResult
=
new
TextResult
();
ssllResult
.
setTitle
(
"瞬时流量"
);
ssllResult
.
setValue
(
"0.00"
);
TextResult
ljllResult
=
new
TextResult
();
ljllResult
.
setTitle
(
"累计流量"
);
ljllResult
.
setValue
(
"0.00"
);
TextResult
rllResult
=
new
TextResult
();
rllResult
.
setTitle
(
"日流量"
);
rllResult
.
setValue
(
"0.00"
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
TextResult
textResult
=
new
TextResult
();
textResult
.
setTitle
(
"泵"
+(
i
+
1
));
textResult
.
setValue
(
"0"
);
bList
.
add
(
i
,
textResult
);
}
map
.
put
(
"ssll"
,
ssllResult
);
map
.
put
(
"ljll"
,
ljllResult
);
map
.
put
(
"rll"
,
rllResult
);
map
.
put
(
"equip"
,
bList
);
}
else
{
map
.
put
(
"ssll"
,
new
TextResult
());
map
.
put
(
"ljll"
,
new
TextResult
());
map
.
put
(
"rll"
,
new
TextResult
());
map
.
put
(
"equip"
,
new
ArrayList
<>());
}
return
map
;
}
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
30
;
i
++)
{
for
(
int
i
=
0
;
i
<
24
;
i
++)
{
Calendar
date
=
Calendar
.
getInstance
();
date
.
add
(
Calendar
.
DATE
,
i
-
30
);
String
newDate
=
new
SimpleDateFormat
(
"
yyyy-MM-dd"
).
format
(
date
.
getTime
()).
substring
(
5
,
10
);
date
.
add
(
Calendar
.
HOUR
,
i
-
24
);
String
newDate
=
new
SimpleDateFormat
(
"
HH:00"
).
format
(
date
.
getTime
()
);
System
.
out
.
println
(
"=========="
+
newDate
+
"============"
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论