奥体项目增加报警功能
正在显示
3 个修改的文件
包含
154 行增加
和
3 行删除
... | @@ -71,6 +71,16 @@ public class OlympicCenterController { | ... | @@ -71,6 +71,16 @@ public class OlympicCenterController { |
71 | return result; | 71 | return result; |
72 | } | 72 | } |
73 | 73 | ||
74 | @ApiOperation(value="新获取整体实时数据给V3.0", notes="新获取整体实时数据给V3.0") | ||
75 | @GetMapping(value = "/getRealDataToUE") | ||
76 | public Result<Map<String,Object>> getRealDataToUE(){ | ||
77 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | ||
78 | Map<String,Object> map = olympicCenterService.getRealDataToUENew(); | ||
79 | result.setResult(map); | ||
80 | result.setSuccess(true); | ||
81 | return result; | ||
82 | } | ||
83 | |||
74 | /** | 84 | /** |
75 | * 获取泵站指标历史趋势曲线 | 85 | * 获取泵站指标历史趋势曲线 |
76 | * @param field ssll:瞬时流量 ljll:累计流量 rll:日流量 | 86 | * @param field ssll:瞬时流量 ljll:累计流量 rll:日流量 | ... | ... |
... | @@ -30,6 +30,8 @@ public interface IOlympicCenterService { | ... | @@ -30,6 +30,8 @@ public interface IOlympicCenterService { |
30 | 30 | ||
31 | Map<String, Object> getRealTimeDataToUENew(); | 31 | Map<String, Object> getRealTimeDataToUENew(); |
32 | 32 | ||
33 | Map<String, Object> getRealDataToUENew(); | ||
34 | |||
33 | List<Map<String, Object>> getFlowData(String equipId); | 35 | List<Map<String, Object>> getFlowData(String equipId); |
34 | 36 | ||
35 | List<Map<String, Object>> getRealTimeReport(String dataType, String loction); | 37 | List<Map<String, Object>> getRealTimeReport(String dataType, String loction); |
... | @@ -47,4 +49,5 @@ public interface IOlympicCenterService { | ... | @@ -47,4 +49,5 @@ public interface IOlympicCenterService { |
47 | List<EchartResult> getHistoryTrendsByDate(InputQueryParams inputQueryParams); | 49 | List<EchartResult> getHistoryTrendsByDate(InputQueryParams inputQueryParams); |
48 | 50 | ||
49 | List<Map<String, Object>> getAlarmList(AlarmParams alarmParams); | 51 | List<Map<String, Object>> getAlarmList(AlarmParams alarmParams); |
52 | |||
50 | } | 53 | } | ... | ... |
... | @@ -16,7 +16,6 @@ import org.springframework.jdbc.core.JdbcTemplate; | ... | @@ -16,7 +16,6 @@ import org.springframework.jdbc.core.JdbcTemplate; |
16 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
17 | 17 | ||
18 | import java.text.DateFormat; | 18 | import java.text.DateFormat; |
19 | import java.text.ParseException; | ||
20 | import java.text.SimpleDateFormat; | 19 | import java.text.SimpleDateFormat; |
21 | import java.util.*; | 20 | import java.util.*; |
22 | 21 | ||
... | @@ -1059,8 +1058,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1059,8 +1058,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1059 | for (WhatStructData whatStructData:otherList) { | 1058 | for (WhatStructData whatStructData:otherList) { |
1060 | if(whatStructData.getMonitorId()!=null){ | 1059 | if(whatStructData.getMonitorId()!=null){ |
1061 | if("pressure".equals(whatStructData.getEquipType())){ | 1060 | if("pressure".equals(whatStructData.getEquipType())){ |
1062 | double pResult = formatDouble(Double.parseDouble(monitorMap.get(whatStructData.getMonitorId()).toString())*Double.parseDouble(whatStructData.getMonitorZoom())); | 1061 | if(monitorMap.get(whatStructData.getMonitorId())==null){ |
1063 | map.put(whatStructData.getId(),String.valueOf(pResult)); | 1062 | map.put(whatStructData.getId(),"--"); |
1063 | }else{ | ||
1064 | double pResult = formatDouble(Double.parseDouble(monitorMap.get(whatStructData.getMonitorId()).toString())*Double.parseDouble(whatStructData.getMonitorZoom())); | ||
1065 | map.put(whatStructData.getId(),String.valueOf(pResult)); | ||
1066 | } | ||
1064 | }else{ | 1067 | }else{ |
1065 | map.put(whatStructData.getId(),monitorMap.get(whatStructData.getMonitorId())); | 1068 | map.put(whatStructData.getId(),monitorMap.get(whatStructData.getMonitorId())); |
1066 | } | 1069 | } |
... | @@ -1083,6 +1086,141 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1083,6 +1086,141 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1083 | return map; | 1086 | return map; |
1084 | } | 1087 | } |
1085 | 1088 | ||
1089 | /** | ||
1090 | * 获取30秒内报警数据 | ||
1091 | * @return | ||
1092 | */ | ||
1093 | public Map<String, Object> getNowAlarmData(){ | ||
1094 | Map<String, Object> map = new HashMap<>(); | ||
1095 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
1096 | Date now = new Date(); | ||
1097 | Date before = new Date(now.getTime() - 30 * 1000); | ||
1098 | JdbcTemplate alarmDB = (JdbcTemplate) SpringContextUtils.getBean("mysql-alarm"); | ||
1099 | List<Map<String, Object>> list = alarmDB.queryForList("select DISTINCT alarm_param_code as alarmCode from alert_record_history " + | ||
1100 | " where handle_status = 0 " + | ||
1101 | " and record_time between '"+dateFormat.format(before)+"' and '"+dateFormat.format(now)+"' " + | ||
1102 | " ORDER BY record_time"); | ||
1103 | if(list.size()>0){ | ||
1104 | for (Map<String, Object> bean : list) { | ||
1105 | if(bean.get("alarm_param_code")!=null){ | ||
1106 | map.put(bean.get("alarm_param_code").toString(),"abnormal"); | ||
1107 | } | ||
1108 | } | ||
1109 | return map; | ||
1110 | }else{ | ||
1111 | return map; | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | @Override | ||
1116 | public Map<String, Object> getRealDataToUENew() { | ||
1117 | List<WhatStructData> list = whatStructDataMapper.getListForUENew(); | ||
1118 | List<WhatStructData> fList = new ArrayList<>(); | ||
1119 | List<WhatStructData> otherList = new ArrayList<>(); | ||
1120 | Map<String, Object> map = new HashMap<>(); | ||
1121 | Map<String, Object> monitorMap = new HashMap<>(); | ||
1122 | Map<String, Object> alarmMap = getNowAlarmData(); | ||
1123 | String pgField = ""; | ||
1124 | for (WhatStructData whatStructData:list) { | ||
1125 | pgField = pgField +","+whatStructData.getMonitorId(); | ||
1126 | if("flow".equals(whatStructData.getEquipType())){ | ||
1127 | fList.add(whatStructData); | ||
1128 | } | ||
1129 | if(!whatStructData.getEquipType().contains("flow")){ | ||
1130 | otherList.add(whatStructData); | ||
1131 | } | ||
1132 | } | ||
1133 | List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField); | ||
1134 | if(monitorList.size()==1){ | ||
1135 | monitorMap = monitorList.get(0); | ||
1136 | for (WhatStructData whatStructData:fList) { | ||
1137 | if(whatStructData.getMonitorId()!=null){ | ||
1138 | String fId = whatStructData.getId(); | ||
1139 | Map<String, Object> beanMap = new HashMap<>(); | ||
1140 | for (WhatStructData bean : list) { | ||
1141 | Map<String, Object> dataMap = new HashMap<>(); | ||
1142 | dataMap.put("value","--"); | ||
1143 | dataMap.put("status","abnormal"); | ||
1144 | if(bean.getId().startsWith(fId)){ | ||
1145 | if(monitorMap.get(bean.getMonitorId())!=null){ | ||
1146 | dataMap.put("value",monitorMap.get(bean.getMonitorId())); | ||
1147 | if(alarmMap.get(bean.getMonitorId())==null){ | ||
1148 | dataMap.put("status","normal"); | ||
1149 | }else{ | ||
1150 | dataMap.put("status","abnormal"); | ||
1151 | } | ||
1152 | beanMap.put(bean.getEquipType(), dataMap); | ||
1153 | }else{ | ||
1154 | dataMap.put("value","--"); | ||
1155 | dataMap.put("status","abnormal"); | ||
1156 | beanMap.put(bean.getEquipType(), dataMap); | ||
1157 | } | ||
1158 | } | ||
1159 | } | ||
1160 | map.put(fId,beanMap); | ||
1161 | }else{ | ||
1162 | Map<String, Object> kMap = new HashMap<>(); | ||
1163 | Map<String, Object> dataMap = new HashMap<>(); | ||
1164 | dataMap.put("value","--"); | ||
1165 | dataMap.put("status","abnormal"); | ||
1166 | kMap.put("flow", dataMap); | ||
1167 | kMap.put("flow_ljll", dataMap); | ||
1168 | kMap.put("flow_rljll", dataMap); | ||
1169 | map.put(whatStructData.getId(),kMap); | ||
1170 | } | ||
1171 | } | ||
1172 | for (WhatStructData whatStructData:otherList) { | ||
1173 | if(whatStructData.getMonitorId()!=null){ | ||
1174 | Map<String, Object> dataMap = new HashMap<>(); | ||
1175 | dataMap.put("value","--"); | ||
1176 | dataMap.put("status","abnormal"); | ||
1177 | if("pressure".equals(whatStructData.getEquipType())){ | ||
1178 | if(monitorMap.get(whatStructData.getMonitorId())==null){ | ||
1179 | map.put(whatStructData.getId(),dataMap); | ||
1180 | }else{ | ||
1181 | double pResult = formatDouble(Double.parseDouble(monitorMap.get(whatStructData.getMonitorId()).toString())*Double.parseDouble(whatStructData.getMonitorZoom())); | ||
1182 | dataMap.put("value",String.valueOf(pResult)); | ||
1183 | if(alarmMap.get(whatStructData.getMonitorId())==null){ | ||
1184 | dataMap.put("status","normal"); | ||
1185 | }else{ | ||
1186 | dataMap.put("status","abnormal"); | ||
1187 | } | ||
1188 | map.put(whatStructData.getId(),dataMap); | ||
1189 | } | ||
1190 | }else{ | ||
1191 | dataMap.put("value",monitorMap.get(whatStructData.getMonitorId())); | ||
1192 | if(alarmMap.get(whatStructData.getMonitorId())==null){ | ||
1193 | dataMap.put("status","normal"); | ||
1194 | }else{ | ||
1195 | dataMap.put("status","abnormal"); | ||
1196 | } | ||
1197 | map.put(whatStructData.getId(),dataMap); | ||
1198 | } | ||
1199 | }else{ | ||
1200 | Map<String, Object> dataMap = new HashMap<>(); | ||
1201 | dataMap.put("value","--"); | ||
1202 | dataMap.put("status","abnormal"); | ||
1203 | map.put(whatStructData.getId(),dataMap); | ||
1204 | } | ||
1205 | } | ||
1206 | }else{ | ||
1207 | Map<String, Object> dataMap = new HashMap<>(); | ||
1208 | dataMap.put("value","--"); | ||
1209 | dataMap.put("status","abnormal"); | ||
1210 | for (WhatStructData whatStructData:fList) { | ||
1211 | Map<String, Object> kMap = new HashMap<>(); | ||
1212 | kMap.put("flow", dataMap); | ||
1213 | kMap.put("flow_ljll", dataMap); | ||
1214 | kMap.put("flow_rljll", dataMap); | ||
1215 | map.put(whatStructData.getId(),kMap); | ||
1216 | } | ||
1217 | for (WhatStructData whatStructData:otherList) { | ||
1218 | map.put(whatStructData.getId(),dataMap); | ||
1219 | } | ||
1220 | } | ||
1221 | return map; | ||
1222 | } | ||
1223 | |||
1086 | @Override | 1224 | @Override |
1087 | public List<Map<String, Object>> getFlowData(String equipId) { | 1225 | public List<Map<String, Object>> getFlowData(String equipId) { |
1088 | List<Map<String, Object>> list = new ArrayList<>(); | 1226 | List<Map<String, Object>> list = new ArrayList<>(); | ... | ... |
-
请 注册 或 登录 后发表评论