Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
ebb278a6
由
张雷
编写于
2023-05-30 12:16:05 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目数据报表接口修改
1 个父辈
a30d7c24
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
240 行增加
和
22 行删除
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
fm-product/src/main/java/com/skua/modules/business/entity/WhatStructData.java
fm-product/src/main/java/com/skua/modules/business/mapper/WhatStructDataMapper.java
fm-product/src/main/java/com/skua/modules/business/mapper/xml/WhatStructDataMapper.xml
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/monitor/service/IFmPgQueryService.java
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
查看文件 @
ebb278a
...
...
@@ -39,7 +39,7 @@ public class OlympicCenterController {
return
result
;
}
@ApiOperation
(
value
=
"获取整体实时数据
"
,
notes
=
"获取整体实时数据
"
)
@ApiOperation
(
value
=
"获取整体实时数据
new"
,
notes
=
"获取整体实时数据new
"
)
@GetMapping
(
value
=
"/getRealTimeDataNew"
)
public
Result
<
Map
<
String
,
Object
>>
getRealTimeDataNew
(
String
sourceType
){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
...
...
@@ -59,7 +59,7 @@ public class OlympicCenterController {
return
result
;
}
@ApiOperation
(
value
=
"
获取整体实时数据给UE"
,
notes
=
"
获取整体实时数据给UE"
)
@ApiOperation
(
value
=
"
新获取整体实时数据给UE"
,
notes
=
"新
获取整体实时数据给UE"
)
@GetMapping
(
value
=
"/getRealTimeDataToUENew"
)
public
Result
<
Map
<
String
,
Object
>>
getRealTimeDataToUENew
(){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
...
...
@@ -128,7 +128,7 @@ public class OlympicCenterController {
return
result
;
}
@ApiOperation
(
value
=
"获取趋势图
"
,
notes
=
"获取趋势图
"
)
@ApiOperation
(
value
=
"获取趋势图
new"
,
notes
=
"获取趋势图new
"
)
@GetMapping
(
value
=
"/getPressureChartNew"
)
public
Result
<
List
<
EchartResult
>>
getPressureChartNew
(
String
equipId
,
String
type
){
Result
<
List
<
EchartResult
>>
result
=
new
Result
<
List
<
EchartResult
>>();
...
...
@@ -139,4 +139,26 @@ public class OlympicCenterController {
return
result
;
}
@ApiOperation
(
value
=
"获取流量计详细数据"
,
notes
=
"获取流量计详细数据"
)
@GetMapping
(
value
=
"/getFlowData"
)
public
Result
<
List
<
Map
<
String
,
Object
>>>
getFlowData
(
String
equipId
){
Result
<
List
<
Map
<
String
,
Object
>>>
result
=
new
Result
<
List
<
Map
<
String
,
Object
>>>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
list
=
olympicCenterService
.
getFlowData
(
equipId
);
result
.
setResult
(
list
);
result
.
setSuccess
(
true
);
return
result
;
}
@ApiOperation
(
value
=
"获取实时数据报表"
,
notes
=
"获取实时数据报表"
)
@GetMapping
(
value
=
"/getRealTimeReport"
)
public
Result
<
List
<
Map
<
String
,
Object
>>>
getRealTimeReport
(
String
dataType
,
String
loction
){
Result
<
List
<
Map
<
String
,
Object
>>>
result
=
new
Result
<
List
<
Map
<
String
,
Object
>>>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
list
=
olympicCenterService
.
getRealTimeReport
(
dataType
,
loction
);
result
.
setResult
(
list
);
result
.
setSuccess
(
true
);
return
result
;
}
}
...
...
fm-product/src/main/java/com/skua/modules/business/entity/WhatStructData.java
查看文件 @
ebb278a
...
...
@@ -44,6 +44,9 @@ public class WhatStructData {
/**点实时值*/
@ApiModelProperty
(
value
=
"点实时值"
)
private
String
monitorValue
;
/**缩放倍数*/
@ApiModelProperty
(
value
=
"缩放倍数"
)
private
String
monitorZoom
;
/**所属泵站*/
@ApiModelProperty
(
value
=
"所属泵站"
)
private
String
pumpCode
;
...
...
fm-product/src/main/java/com/skua/modules/business/mapper/WhatStructDataMapper.java
查看文件 @
ebb278a
...
...
@@ -21,4 +21,10 @@ public interface WhatStructDataMapper {
List
<
WhatStructData
>
getDataList
(
@Param
(
"equipId"
)
String
equipId
);
List
<
WhatStructData
>
getListForUENew
();
List
<
WhatStructData
>
getFlowList
(
@Param
(
"loction"
)
String
loction
);
List
<
WhatStructData
>
getPressureList
(
@Param
(
"loction"
)
String
loction
);
List
<
WhatStructData
>
getTemperatureList
(
@Param
(
"loction"
)
String
loction
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/mapper/xml/WhatStructDataMapper.xml
查看文件 @
ebb278a
...
...
@@ -33,4 +33,25 @@
select * from what_struct_data_bak order by monitor_sort
</select>
<select
id=
"getFlowList"
resultType=
"com.skua.modules.business.entity.WhatStructData"
>
select * from what_struct_data_bak where equip_type like CONCAT('flow','%')
<if
test=
"loction!=null and loction!=''"
>
and pump_code = #{loction}
</if>
</select>
<select
id=
"getPressureList"
resultType=
"com.skua.modules.business.entity.WhatStructData"
>
select * from what_struct_data_bak where equip_type like CONCAT('pressure','%')
<if
test=
"loction!=null and loction!=''"
>
and pump_code = #{loction}
</if>
</select>
<select
id=
"getTemperatureList"
resultType=
"com.skua.modules.business.entity.WhatStructData"
>
select * from what_struct_data_bak where equip_type like CONCAT('temperature','%')
<if
test=
"loction!=null and loction!=''"
>
and pump_code = #{loction}
</if>
</select>
</mapper>
\ No newline at end of file
...
...
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
查看文件 @
ebb278a
...
...
@@ -27,4 +27,8 @@ public interface IOlympicCenterService {
List
<
EchartResult
>
getPressureChartNew
(
String
equipId
,
String
type
);
Map
<
String
,
Object
>
getRealTimeDataToUENew
();
List
<
Map
<
String
,
Object
>>
getFlowData
(
String
equipId
);
List
<
Map
<
String
,
Object
>>
getRealTimeReport
(
String
dataType
,
String
loction
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
ebb278a
...
...
@@ -76,7 +76,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -125,7 +125,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -190,7 +190,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -387,7 +387,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
EchartResult
echartResult
=
new
EchartResult
();
echartResult
.
setName
(
map
.
get
(
"time"
).
toString
());
if
(
"p"
.
equals
(
type
)){
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
map
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
map
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
whatStructData
.
getMonitorZoom
())
);
echartResult
.
setValue
(
String
.
valueOf
(
pResult
));
echartResult
.
setSeries
(
"压力表"
);
}
else
if
(
"f"
.
equals
(
type
)){
...
...
@@ -530,7 +530,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for
(
WhatStructData
whatStructData:
list
)
{
if
(
whatStructData
.
getMonitorId
()!=
null
){
if
(
"pressure"
.
equals
(
whatStructData
.
getEquipType
())){
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
whatStructData
.
getMonitorZoom
())
);
map
.
put
(
whatStructData
.
getId
(),
String
.
valueOf
(
pResult
));
}
else
{
map
.
put
(
whatStructData
.
getId
(),
monitorMap
.
get
(
whatStructData
.
getMonitorId
()));
...
...
@@ -591,7 +591,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -667,7 +667,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -759,7 +759,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
())==
null
){
textResult
.
setValue
(
"--"
);
}
else
{
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
pybList
.
get
(
i
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
pybList
.
get
(
i
).
getMonitorZoom
())
);
textResult
.
setValue
(
String
.
valueOf
(
pResult
));
}
}
else
{
...
...
@@ -890,7 +890,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
EchartResult
echartResult
=
new
EchartResult
();
echartResult
.
setName
(
map
.
get
(
"time"
).
toString
());
if
(
"p"
.
equals
(
type
)){
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
map
.
get
(
wList
.
get
(
0
).
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
map
.
get
(
wList
.
get
(
0
).
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
wList
.
get
(
0
).
getMonitorZoom
())
);
echartResult
.
setValue
(
String
.
valueOf
(
pResult
));
echartResult
.
setSeries
(
"压力表"
);
list
.
add
(
echartResult
);
...
...
@@ -977,7 +977,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for
(
WhatStructData
whatStructData:
otherList
)
{
if
(
whatStructData
.
getMonitorId
()!=
null
){
if
(
"pressure"
.
equals
(
whatStructData
.
getEquipType
())){
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
/
100
);
double
pResult
=
formatDouble
(
Double
.
parseDouble
(
monitorMap
.
get
(
whatStructData
.
getMonitorId
()).
toString
())
*
Double
.
parseDouble
(
whatStructData
.
getMonitorZoom
())
);
map
.
put
(
whatStructData
.
getId
(),
String
.
valueOf
(
pResult
));
}
else
{
map
.
put
(
whatStructData
.
getId
(),
monitorMap
.
get
(
whatStructData
.
getMonitorId
()));
...
...
@@ -1001,14 +1001,134 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return
map
;
}
// public static void main(String[] args) {
// for (int i = 0; i < 24; i++) {
// Calendar date = Calendar.getInstance();
// date.add(Calendar.HOUR, i-24);
// String newDate = new SimpleDateFormat("HH:00").format(date.getTime());
// System.out.println("=========="+newDate+"============");
// }
// }
@Override
public
List
<
Map
<
String
,
Object
>>
getFlowData
(
String
equipId
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
WhatStructData
>
wList
=
whatStructDataMapper
.
getDataList
(
equipId
);
String
pgField
=
""
;
if
(
wList
.
size
()
==
0
){
list
=
getMnData
();
return
list
;
}
else
{
for
(
WhatStructData
whatStructData:
wList
)
{
pgField
=
pgField
+
","
+
whatStructData
.
getMonitorId
();
}
}
Map
<
String
,
Object
>
monitorMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
monitorList
=
fmPgQueryService
.
queryFactoryMonitorFromRealTimeData
(
AT_ID
,
pgField
);
if
(
monitorList
.
size
()==
1
){
monitorMap
=
monitorList
.
get
(
0
);
for
(
WhatStructData
whatStructData:
wList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
whatStructData
.
getEquipType
());
if
(
monitorMap
.
get
(
whatStructData
.
getMonitorId
())==
null
){
map
.
put
(
"value"
,
"--"
);
}
else
{
map
.
put
(
"value"
,
monitorMap
.
get
(
whatStructData
.
getMonitorId
()));
}
list
.
add
(
map
);
}
}
else
{
list
=
getMnData
();
return
list
;
}
return
list
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
getRealTimeReport
(
String
dataType
,
String
loction
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
WhatStructData
>
wList
=
new
ArrayList
<>();
List
<
WhatStructData
>
flowList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
flowMap
=
new
HashMap
<>();
String
pgField
=
""
;
if
(
"flow"
.
equals
(
dataType
)){
wList
=
whatStructDataMapper
.
getFlowList
(
loction
);
for
(
WhatStructData
whatStructData:
wList
)
{
flowMap
.
put
(
whatStructData
.
getMonitorId
(),
whatStructData
.
getId
());
if
(
"flow"
.
equals
(
whatStructData
.
getEquipType
())){
flowList
.
add
(
whatStructData
);
}
}
}
else
if
(
"pressure"
.
equals
(
dataType
)){
wList
=
whatStructDataMapper
.
getPressureList
(
loction
);
}
else
if
(
"temperature"
.
equals
(
dataType
)){
wList
=
whatStructDataMapper
.
getTemperatureList
(
loction
);
}
else
{
return
list
;
}
for
(
WhatStructData
whatStructData:
wList
)
{
pgField
=
pgField
+
","
+
whatStructData
.
getMonitorId
();
}
List
<
Map
<
String
,
Object
>>
monitorList
=
fmPgQueryService
.
queryMonitorForReport
(
AT_ID
,
pgField
);
if
(
"flow"
.
equals
(
dataType
)){
for
(
Map
<
String
,
Object
>
beanMap
:
monitorList
)
{
boolean
status
=
flowMap
.
get
(
beanMap
.
get
(
"monitorid"
)).
toString
().
contains
(
"_"
);
if
(
status
){
beanMap
.
put
(
"equipId"
,
flowMap
.
get
(
beanMap
.
get
(
"monitorid"
)).
toString
().
split
(
"_"
)[
0
]);
String
type
=
flowMap
.
get
(
beanMap
.
get
(
"monitorid"
)).
toString
().
split
(
"_"
)[
1
];
if
(
"LJLL"
.
equals
(
type
)){
beanMap
.
put
(
"equipType"
,
"flow_ljll"
);
}
else
if
(
"RLJLL"
.
equals
(
type
)){
beanMap
.
put
(
"equipType"
,
"flow_rljll"
);
}
else
{
beanMap
.
put
(
"equipType"
,
""
);
}
}
else
{
beanMap
.
put
(
"equipId"
,
flowMap
.
get
(
beanMap
.
get
(
"monitorid"
)));
beanMap
.
put
(
"equipType"
,
"flow"
);
}
}
for
(
WhatStructData
whatStructData:
flowList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
whatStructData
.
getId
());
map
.
put
(
"name"
,
whatStructData
.
getId
());
map
.
put
(
"time"
,
""
);
map
.
put
(
"flow"
,
""
);
map
.
put
(
"flow_ljll"
,
""
);
map
.
put
(
"flow_rljll"
,
""
);
for
(
Map
<
String
,
Object
>
mMap
:
monitorList
)
{
if
(
whatStructData
.
getId
().
equals
(
mMap
.
get
(
"equipId"
))){
map
.
put
(
"time"
,
mMap
.
get
(
"time"
));
if
(
"flow"
.
equals
(
mMap
.
get
(
"equipType"
))){
map
.
put
(
"flow"
,
mMap
.
get
(
"monitorvalue"
));
}
else
if
(
"flow_ljll"
.
equals
(
mMap
.
get
(
"equipType"
))){
map
.
put
(
"flow_ljll"
,
mMap
.
get
(
"monitorvalue"
));
}
else
if
(
"flow_rljll"
.
equals
(
mMap
.
get
(
"equipType"
))){
map
.
put
(
"flow_rljll"
,
mMap
.
get
(
"monitorvalue"
));
}
else
{
map
.
put
(
"other"
,
mMap
.
get
(
"monitorvalue"
));
}
}
}
list
.
add
(
map
);
}
}
else
if
(
"pressure"
.
equals
(
dataType
)){
return
list
;
}
else
if
(
"temperature"
.
equals
(
dataType
)){
return
list
;
}
else
{
return
list
;
}
return
list
;
}
private
List
<
Map
<
String
,
Object
>>
getMnData
(){
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
Map
<
String
,
Object
>
flowMap
=
new
HashMap
<>();
flowMap
.
put
(
"name"
,
"flow"
);
flowMap
.
put
(
"value"
,
"--"
);
Map
<
String
,
Object
>
fflowMap
=
new
HashMap
<>();
//
fflowMap
.
put
(
"name"
,
"flow_ljll"
);
fflowMap
.
put
(
"value"
,
"--"
);
Map
<
String
,
Object
>
rflowMap
=
new
HashMap
<>();
//
rflowMap
.
put
(
"name"
,
"flow_rljll"
);
rflowMap
.
put
(
"value"
,
"--"
);
list
.
add
(
flowMap
);
list
.
add
(
fflowMap
);
list
.
add
(
rflowMap
);
return
list
;
}
/**
* 获取大于等于min,小于max的随机小数
...
...
fm-product/src/main/java/com/skua/modules/monitor/service/IFmPgQueryService.java
查看文件 @
ebb278a
...
...
@@ -10,4 +10,6 @@ public interface IFmPgQueryService {
List
<
Map
<
String
,
Object
>>
queryFactoryMonitorFromRealTimeData
(
String
factoryId
,
String
fields
);
List
<
Map
<
String
,
Object
>>
queryMonitorForReport
(
String
factoryId
,
String
fields
);
}
...
...
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
查看文件 @
ebb278a
...
...
@@ -11,7 +11,7 @@ import java.text.SimpleDateFormat;
import
java.util.*
;
/**
*
数据指标信息表
*
实时数据查询
*/
@Service
public
class
FmPgQueryServiceImpl
implements
IFmPgQueryService
{
...
...
@@ -94,4 +94,44 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
}
return
timeStemp
/
1000
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryMonitorForReport
(
String
factoryId
,
String
fields
)
{
String
[]
factoryIdArray
=
factoryId
.
split
(
","
);
String
sqlPart
=
""
;
for
(
String
id
:
factoryIdArray
)
{
sqlPart
=
sqlPart
+
",'"
+
id
+
"'"
;
}
sqlPart
=
sqlPart
.
substring
(
1
);
JdbcTemplate
pgDb
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<
Map
<
String
,
Object
>>();
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
List
<
Map
<
String
,
Object
>>
factoryDesign
=
masterDB
.
queryForList
(
"select * from sys_factory_device where factory_id in ("
+
sqlPart
+
")"
);
if
(
factoryDesign
==
null
||
factoryDesign
.
size
()==
0
)
{
return
result
;
}
StringBuilder
str
=
new
StringBuilder
();
String
[]
fieldsArr
=
fields
.
split
(
","
);
for
(
int
i
=
0
;
i
<
fieldsArr
.
length
;
++
i
){
if
(!
StringUtils
.
isEmpty
(
fieldsArr
[
i
])&&!
fieldsArr
[
i
].
equals
(
"null"
))
{
str
.
append
(
"'"
+
fieldsArr
[
i
]+
"'"
).
append
(
","
);
}
}
if
(
fieldsArr
.
length
>
0
){
str
.
append
(
"''"
);
}
else
{
return
result
;
}
String
deviceIds
=
""
;
for
(
Map
<
String
,
Object
>
map:
factoryDesign
)
{
deviceIds
=
deviceIds
+
",'"
+
map
.
get
(
"device_id"
)+
"'"
;
}
deviceIds
=
deviceIds
.
substring
(
1
);
//获取pg数据库时间,向前推采集频率的三倍时间,做数据容错
String
sql
=
"select ts as time,nm as monitorId,v as monitorValue from realtimedata where nm in("
+
str
.
toString
()+
") and factoryname in ("
+
deviceIds
+
")"
;
result
=
pgDb
.
queryForList
(
sql
);
return
result
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论