2d3ecf2c 张雷

奥体项目接口修改(添加曲线最大最小值)

1 个父辈 2018bbf1
...@@ -12,9 +12,6 @@ import com.skua.modules.monitor.service.IFmPgQueryService; ...@@ -12,9 +12,6 @@ import com.skua.modules.monitor.service.IFmPgQueryService;
12 12
13 import java.text.ParseException; 13 import java.text.ParseException;
14 import java.text.SimpleDateFormat; 14 import java.text.SimpleDateFormat;
15 import java.time.LocalDate;
16 import java.time.YearMonth;
17 import java.time.format.DateTimeFormatter;
18 import java.util.*; 15 import java.util.*;
19 16
20 /** 17 /**
...@@ -23,6 +20,8 @@ import java.util.*; ...@@ -23,6 +20,8 @@ import java.util.*;
23 @Service 20 @Service
24 public class FmPgQueryServiceImpl implements IFmPgQueryService { 21 public class FmPgQueryServiceImpl implements IFmPgQueryService {
25 22
23 private static String COUNT_TABLENAME = "a01a21a03_count";//奥体项目计算表
24
26 @Override 25 @Override
27 public List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields) { 26 public List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields) {
28 String[] factoryIdArray = factoryId.split(","); 27 String[] factoryIdArray = factoryId.split(",");
...@@ -365,7 +364,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -365,7 +364,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
365 List<Map<String, Object>> dataList = new ArrayList<>(); 364 List<Map<String, Object>> dataList = new ArrayList<>();
366 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取 365 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
367 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db"); 366 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
368 String countTableName = "a01a21a03_count";
369 //获取要查询的指标 367 //获取要查询的指标
370 String fieldSqlPart = ""; 368 String fieldSqlPart = "";
371 String[] fieldsArr = fields.split(","); 369 String[] fieldsArr = fields.split(",");
...@@ -381,7 +379,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -381,7 +379,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
381 String sql = "SELECT nm, " + 379 String sql = "SELECT nm, " +
382 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), "+strCount+") AS time, " + 380 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), "+strCount+") AS time, " +
383 " SUM(v::numeric) AS value " + 381 " SUM(v::numeric) AS value " +
384 " FROM " + countTableName + 382 " FROM " + COUNT_TABLENAME +
385 " WHERE nm in ("+fieldSqlPart+")" + 383 " WHERE nm in ("+fieldSqlPart+")" +
386 " AND type = 'def'" + 384 " AND type = 'def'" +
387 " AND ts >= ? AND ts < ? " + 385 " AND ts >= ? AND ts < ? " +
...@@ -399,7 +397,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -399,7 +397,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
399 List<Map<String, Object>> dataList = new ArrayList<>(); 397 List<Map<String, Object>> dataList = new ArrayList<>();
400 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取 398 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
401 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db"); 399 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
402 String countTableName = "a01a21a03_count";
403 //获取要查询的指标 400 //获取要查询的指标
404 String fieldSqlPart = ""; 401 String fieldSqlPart = "";
405 String[] fieldsArr = fields.split(","); 402 String[] fieldsArr = fields.split(",");
...@@ -416,7 +413,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -416,7 +413,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
416 "SELECT nm, " + 413 "SELECT nm, " +
417 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, " + 414 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, " +
418 " SUM(v::numeric) AS value " + 415 " SUM(v::numeric) AS value " +
419 " FROM " + countTableName + 416 " FROM " + COUNT_TABLENAME +
420 " WHERE nm in ("+fieldSqlPart+")" + 417 " WHERE nm in ("+fieldSqlPart+")" +
421 " AND type = 'def'" + 418 " AND type = 'def'" +
422 " AND ts >= ? AND ts < ? " + 419 " AND ts >= ? AND ts < ? " +
...@@ -436,7 +433,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -436,7 +433,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
436 List<Map<String, Object>> dataList = new ArrayList<>(); 433 List<Map<String, Object>> dataList = new ArrayList<>();
437 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取 434 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
438 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db"); 435 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
439 String countTableName = "a01a21a03_count";
440 //获取要查询的指标 436 //获取要查询的指标
441 String fieldSqlPart = ""; 437 String fieldSqlPart = "";
442 String[] fieldsArr = fields.split(","); 438 String[] fieldsArr = fields.split(",");
...@@ -452,7 +448,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -452,7 +448,7 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
452 String sql = "SELECT nm, " + 448 String sql = "SELECT nm, " +
453 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, " + 449 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, " +
454 " SUM(v::numeric) AS value " + 450 " SUM(v::numeric) AS value " +
455 " FROM " + countTableName + 451 " FROM " + COUNT_TABLENAME +
456 " WHERE nm in ("+fieldSqlPart+")" + 452 " WHERE nm in ("+fieldSqlPart+")" +
457 " AND type = 'def'" + 453 " AND type = 'def'" +
458 " AND ts >= ? AND ts < ? " + 454 " AND ts >= ? AND ts < ? " +
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!