192b5a18 张雷

奥体项目增加报警功能

1 个父辈 a6407388
......@@ -71,6 +71,16 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="新获取整体实时数据给V3.0", notes="新获取整体实时数据给V3.0")
@GetMapping(value = "/getRealDataToUE")
public Result<Map<String,Object>> getRealDataToUE(){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = olympicCenterService.getRealDataToUENew();
result.setResult(map);
result.setSuccess(true);
return result;
}
/**
* 获取泵站指标历史趋势曲线
* @param field ssll:瞬时流量 ljll:累计流量 rll:日流量
......
......@@ -30,6 +30,8 @@ public interface IOlympicCenterService {
Map<String, Object> getRealTimeDataToUENew();
Map<String, Object> getRealDataToUENew();
List<Map<String, Object>> getFlowData(String equipId);
List<Map<String, Object>> getRealTimeReport(String dataType, String loction);
......@@ -47,4 +49,5 @@ public interface IOlympicCenterService {
List<EchartResult> getHistoryTrendsByDate(InputQueryParams inputQueryParams);
List<Map<String, Object>> getAlarmList(AlarmParams alarmParams);
}
......
......@@ -16,7 +16,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -1059,8 +1058,12 @@ 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())*Double.parseDouble(whatStructData.getMonitorZoom()));
map.put(whatStructData.getId(),String.valueOf(pResult));
if(monitorMap.get(whatStructData.getMonitorId())==null){
map.put(whatStructData.getId(),"--");
}else{
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()));
}
......@@ -1083,6 +1086,141 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return map;
}
/**
* 获取30秒内报警数据
* @return
*/
public Map<String, Object> getNowAlarmData(){
Map<String, Object> map = new HashMap<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
Date before = new Date(now.getTime() - 30 * 1000);
JdbcTemplate alarmDB = (JdbcTemplate) SpringContextUtils.getBean("mysql-alarm");
List<Map<String, Object>> list = alarmDB.queryForList("select DISTINCT alarm_param_code as alarmCode from alert_record_history " +
" where handle_status = 0 " +
" and record_time between '"+dateFormat.format(before)+"' and '"+dateFormat.format(now)+"' " +
" ORDER BY record_time");
if(list.size()>0){
for (Map<String, Object> bean : list) {
if(bean.get("alarm_param_code")!=null){
map.put(bean.get("alarm_param_code").toString(),"abnormal");
}
}
return map;
}else{
return map;
}
}
@Override
public Map<String, Object> getRealDataToUENew() {
List<WhatStructData> list = whatStructDataMapper.getListForUENew();
List<WhatStructData> fList = new ArrayList<>();
List<WhatStructData> otherList = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
Map<String, Object> monitorMap = new HashMap<>();
Map<String, Object> alarmMap = getNowAlarmData();
String pgField = "";
for (WhatStructData whatStructData:list) {
pgField = pgField +","+whatStructData.getMonitorId();
if("flow".equals(whatStructData.getEquipType())){
fList.add(whatStructData);
}
if(!whatStructData.getEquipType().contains("flow")){
otherList.add(whatStructData);
}
}
List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
if(monitorList.size()==1){
monitorMap = monitorList.get(0);
for (WhatStructData whatStructData:fList) {
if(whatStructData.getMonitorId()!=null){
String fId = whatStructData.getId();
Map<String, Object> beanMap = new HashMap<>();
for (WhatStructData bean : list) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
if(bean.getId().startsWith(fId)){
if(monitorMap.get(bean.getMonitorId())!=null){
dataMap.put("value",monitorMap.get(bean.getMonitorId()));
if(alarmMap.get(bean.getMonitorId())==null){
dataMap.put("status","normal");
}else{
dataMap.put("status","abnormal");
}
beanMap.put(bean.getEquipType(), dataMap);
}else{
dataMap.put("value","--");
dataMap.put("status","abnormal");
beanMap.put(bean.getEquipType(), dataMap);
}
}
}
map.put(fId,beanMap);
}else{
Map<String, Object> kMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
kMap.put("flow", dataMap);
kMap.put("flow_ljll", dataMap);
kMap.put("flow_rljll", dataMap);
map.put(whatStructData.getId(),kMap);
}
}
for (WhatStructData whatStructData:otherList) {
if(whatStructData.getMonitorId()!=null){
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
if("pressure".equals(whatStructData.getEquipType())){
if(monitorMap.get(whatStructData.getMonitorId())==null){
map.put(whatStructData.getId(),dataMap);
}else{
double pResult = formatDouble(Double.parseDouble(monitorMap.get(whatStructData.getMonitorId()).toString())*Double.parseDouble(whatStructData.getMonitorZoom()));
dataMap.put("value",String.valueOf(pResult));
if(alarmMap.get(whatStructData.getMonitorId())==null){
dataMap.put("status","normal");
}else{
dataMap.put("status","abnormal");
}
map.put(whatStructData.getId(),dataMap);
}
}else{
dataMap.put("value",monitorMap.get(whatStructData.getMonitorId()));
if(alarmMap.get(whatStructData.getMonitorId())==null){
dataMap.put("status","normal");
}else{
dataMap.put("status","abnormal");
}
map.put(whatStructData.getId(),dataMap);
}
}else{
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
map.put(whatStructData.getId(),dataMap);
}
}
}else{
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
for (WhatStructData whatStructData:fList) {
Map<String, Object> kMap = new HashMap<>();
kMap.put("flow", dataMap);
kMap.put("flow_ljll", dataMap);
kMap.put("flow_rljll", dataMap);
map.put(whatStructData.getId(),kMap);
}
for (WhatStructData whatStructData:otherList) {
map.put(whatStructData.getId(),dataMap);
}
}
return map;
}
@Override
public List<Map<String, Object>> getFlowData(String equipId) {
List<Map<String, Object>> list = new ArrayList<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!