Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
2d3ecf2c
由
张雷
编写于
2023-08-24 14:26:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目接口修改(添加曲线最大最小值)
1 个父辈
2018bbf1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
5 行增加
和
9 行删除
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
查看文件 @
2d3ecf2
...
...
@@ -12,9 +12,6 @@ import com.skua.modules.monitor.service.IFmPgQueryService;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.YearMonth
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
/**
...
...
@@ -23,6 +20,8 @@ import java.util.*;
@Service
public
class
FmPgQueryServiceImpl
implements
IFmPgQueryService
{
private
static
String
COUNT_TABLENAME
=
"a01a21a03_count"
;
//奥体项目计算表
@Override
public
List
<
Map
<
String
,
Object
>>
queryFactoryMonitorFromRealTimeData
(
String
factoryId
,
String
fields
)
{
String
[]
factoryIdArray
=
factoryId
.
split
(
","
);
...
...
@@ -365,7 +364,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate
pgDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
String
countTableName
=
"a01a21a03_count"
;
//获取要查询的指标
String
fieldSqlPart
=
""
;
String
[]
fieldsArr
=
fields
.
split
(
","
);
...
...
@@ -381,7 +379,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
String
sql
=
"SELECT nm, "
+
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), "
+
strCount
+
") AS time, "
+
" SUM(v::numeric) AS value "
+
" FROM "
+
countTableName
+
" FROM "
+
COUNT_TABLENAME
+
" WHERE nm in ("
+
fieldSqlPart
+
")"
+
" AND type = 'def'"
+
" AND ts >= ? AND ts < ? "
+
...
...
@@ -399,7 +397,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate
pgDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
String
countTableName
=
"a01a21a03_count"
;
//获取要查询的指标
String
fieldSqlPart
=
""
;
String
[]
fieldsArr
=
fields
.
split
(
","
);
...
...
@@ -416,7 +413,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
"SELECT nm, "
+
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, "
+
" SUM(v::numeric) AS value "
+
" FROM "
+
countTableName
+
" FROM "
+
COUNT_TABLENAME
+
" WHERE nm in ("
+
fieldSqlPart
+
")"
+
" AND type = 'def'"
+
" AND ts >= ? AND ts < ? "
+
...
...
@@ -436,7 +433,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate
pgDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
String
countTableName
=
"a01a21a03_count"
;
//获取要查询的指标
String
fieldSqlPart
=
""
;
String
[]
fieldsArr
=
fields
.
split
(
","
);
...
...
@@ -452,7 +448,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
String
sql
=
"SELECT nm, "
+
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, "
+
" SUM(v::numeric) AS value "
+
" FROM "
+
countTableName
+
" FROM "
+
COUNT_TABLENAME
+
" WHERE nm in ("
+
fieldSqlPart
+
")"
+
" AND type = 'def'"
+
" AND ts >= ? AND ts < ? "
+
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论