d07e8068 张雷

奥体项目数据报表接口修改

1 个父辈 ebb278a6
...@@ -129,11 +129,11 @@ public class OlympicCenterController { ...@@ -129,11 +129,11 @@ public class OlympicCenterController {
129 } 129 }
130 130
131 @ApiOperation(value="获取趋势图new", notes="获取趋势图new") 131 @ApiOperation(value="获取趋势图new", notes="获取趋势图new")
132 @GetMapping(value = "/getPressureChartNew") 132 @GetMapping(value = "/getHistoryTrends")
133 public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){ 133 public Result<List<EchartResult>> getHistoryTrends(String equipId,String type){
134 Result<List<EchartResult>> result = new Result<List<EchartResult>>(); 134 Result<List<EchartResult>> result = new Result<List<EchartResult>>();
135 List<EchartResult> list = new ArrayList<EchartResult>(); 135 List<EchartResult> list = new ArrayList<EchartResult>();
136 list = olympicCenterService.getPressureChartNew(equipId,type); 136 list = olympicCenterService.getHistoryTrends(equipId,type);
137 result.setResult(list); 137 result.setResult(list);
138 result.setSuccess(true); 138 result.setSuccess(true);
139 return result; 139 return result;
...@@ -161,4 +161,25 @@ public class OlympicCenterController { ...@@ -161,4 +161,25 @@ public class OlympicCenterController {
161 return result; 161 return result;
162 } 162 }
163 163
164 @ApiOperation(value="获取泵站实时数据", notes="获取泵站实时数据")
165 @GetMapping(value = "/getPumpRealTimeData")
166 public Result<Map<String,Object>> getPumpRealTimeData(String sourceType,String pumpId){
167 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
168 Map<String,Object> map = olympicCenterService.getPumpRealTimeData(sourceType, pumpId);
169 result.setResult(map);
170 result.setSuccess(true);
171 return result;
172 }
173
174 @ApiOperation(value="获取设备状态表格", notes="获取设备状态表格")
175 @GetMapping(value = "/getPumpRealTimeReport")
176 public Result<List<Map<String,Object>>> getPumpRealTimeReport(String sourceType){
177 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
178 List<Map<String,Object>> list = new ArrayList<>();
179 list = olympicCenterService.getPumpRealTimeReport(sourceType);
180 result.setResult(list);
181 result.setSuccess(true);
182 return result;
183 }
184
164 } 185 }
......
...@@ -27,4 +27,8 @@ public interface WhatStructDataMapper { ...@@ -27,4 +27,8 @@ public interface WhatStructDataMapper {
27 List<WhatStructData> getPressureList(@Param("loction") String loction); 27 List<WhatStructData> getPressureList(@Param("loction") String loction);
28 28
29 List<WhatStructData> getTemperatureList(@Param("loction") String loction); 29 List<WhatStructData> getTemperatureList(@Param("loction") String loction);
30
31 List<WhatStructData> getEquipDataList(@Param("sourceType") String sourceType, @Param("pumpId") String pumpId);
32
33 List<WhatStructData> getEquipDataListBySource(@Param("sourceType") String sourceType);
30 } 34 }
......
...@@ -54,4 +54,14 @@ ...@@ -54,4 +54,14 @@
54 </if> 54 </if>
55 </select> 55 </select>
56 56
57 <select id="getEquipDataList" resultType="com.skua.modules.business.entity.WhatStructData">
58 select * from what_struct_data_bak
59 where pump_code = #{sourceType} and equip_code = #{pumpId}
60 </select>
61
62 <select id="getEquipDataListBySource" resultType="com.skua.modules.business.entity.WhatStructData">
63 select * from what_struct_data_bak
64 where pump_code = #{sourceType}
65 </select>
66
57 </mapper> 67 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,11 +24,15 @@ public interface IOlympicCenterService { ...@@ -24,11 +24,15 @@ public interface IOlympicCenterService {
24 24
25 Map<String, Object> getRealTimeDataNew(String sourceType); 25 Map<String, Object> getRealTimeDataNew(String sourceType);
26 26
27 List<EchartResult> getPressureChartNew(String equipId, String type); 27 List<EchartResult> getHistoryTrends(String equipId, String type);
28 28
29 Map<String, Object> getRealTimeDataToUENew(); 29 Map<String, Object> getRealTimeDataToUENew();
30 30
31 List<Map<String, Object>> getFlowData(String equipId); 31 List<Map<String, Object>> getFlowData(String equipId);
32 32
33 List<Map<String, Object>> getRealTimeReport(String dataType, String loction); 33 List<Map<String, Object>> getRealTimeReport(String dataType, String loction);
34
35 Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId);
36
37 List<Map<String, Object>> getPumpRealTimeReport(String sourceType);
34 } 38 }
......
...@@ -867,7 +867,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -867,7 +867,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
867 } 867 }
868 868
869 @Override 869 @Override
870 public List<EchartResult> getPressureChartNew(String equipId, String type) { 870 public List<EchartResult> getHistoryTrends(String equipId, String type) {
871 List<EchartResult> list = new ArrayList<>(); 871 List<EchartResult> list = new ArrayList<>();
872 List<WhatStructData> wList = whatStructDataMapper.getDataList(equipId); 872 List<WhatStructData> wList = whatStructDataMapper.getDataList(equipId);
873 String pgField = ""; 873 String pgField = "";
...@@ -898,8 +898,20 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -898,8 +898,20 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
898 for (WhatStructData whatStructData:wList) { 898 for (WhatStructData whatStructData:wList) {
899 EchartResult eResult = new EchartResult(); 899 EchartResult eResult = new EchartResult();
900 eResult.setName(map.get("time").toString()); 900 eResult.setName(map.get("time").toString());
901 if(whatStructData.getMonitorId()==null){
902 eResult.setValue("");
903 }else{
901 eResult.setValue(map.get(whatStructData.getMonitorId()).toString()); 904 eResult.setValue(map.get(whatStructData.getMonitorId()).toString());
905 }
906 if("flow".equals(whatStructData.getEquipType())){
907 eResult.setSeries("瞬时流量");
908 }else if("flow_ljll".equals(whatStructData.getEquipType())){
909 eResult.setSeries("正向累计流量");
910 }else if("flow_rljll".equals(whatStructData.getEquipType())){
911 eResult.setSeries("反向累计流量");
912 }else{
902 eResult.setSeries(whatStructData.getEquipType()); 913 eResult.setSeries(whatStructData.getEquipType());
914 }
903 list.add(eResult); 915 list.add(eResult);
904 } 916 }
905 }else if("t".equals(type)){ 917 }else if("t".equals(type)){
...@@ -1104,15 +1116,172 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1104,15 +1116,172 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1104 list.add(map); 1116 list.add(map);
1105 } 1117 }
1106 }else if("pressure".equals(dataType)){ 1118 }else if("pressure".equals(dataType)){
1107 return list; 1119 for (WhatStructData whatStructData:wList) {
1120 Map<String, Object> map = new HashMap<>();
1121 map.put("id",whatStructData.getId());
1122 map.put("name",whatStructData.getId());
1123 map.put("time","");
1124 map.put("value","");
1125 for (Map<String, Object> mMap : monitorList ) {
1126 if(whatStructData.getMonitorId()!=null){
1127 if(whatStructData.getMonitorId().equals(mMap.get("monitorid"))){
1128 map.put("time",mMap.get("time"));
1129 map.put("value",formatDouble(Double.parseDouble(mMap.get("monitorvalue").toString())*Double.parseDouble(whatStructData.getMonitorZoom())));
1130 }
1131 }else{
1132 break;
1133 }
1134 }
1135 list.add(map);
1136 }
1108 }else if("temperature".equals(dataType)){ 1137 }else if("temperature".equals(dataType)){
1109 return list; 1138 for (WhatStructData whatStructData:wList) {
1139 Map<String, Object> map = new HashMap<>();
1140 map.put("id",whatStructData.getId());
1141 map.put("name",whatStructData.getId());
1142 map.put("time","");
1143 map.put("value","");
1144 list.add(map);
1145 }
1110 }else{ 1146 }else{
1111 return list; 1147 return list;
1112 } 1148 }
1113 return list; 1149 return list;
1114 } 1150 }
1115 1151
1152 @Override
1153 public Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId) {
1154 Map<String, Object> map = new HashMap<>();
1155 map.put("status","变频运行");
1156 map.put("runtime","0.6563");
1157 map.put("name",pumpId);
1158 String pgField = "";
1159 List<Map<String, Object>> statusList = new ArrayList<>();
1160 List<WhatStructData> equipList = new ArrayList<>();
1161 equipList = whatStructDataMapper.getEquipDataList(sourceType, pumpId);
1162 if(equipList.size()==0){
1163 return map;
1164 }
1165 Map<String, Object> equipMap = new HashMap<>();
1166 for (WhatStructData whatStructData : equipList) {
1167 pgField = pgField +","+whatStructData.getMonitorId();
1168 if("equip_status".equals(whatStructData.getEquipType())){
1169 Map<String, Object> statusMap = new HashMap<>();
1170 statusMap.put("name",whatStructData.getId());
1171 statusMap.put("monitorid",whatStructData.getMonitorId());
1172 statusList.add(statusMap);
1173 if("0".equals(whatStructData.getMonitorZoom())){
1174 equipMap.put("show_model", "2");//根据两个点判断状态
1175 }else{
1176 equipMap.put("show_model", "1");//根据1个点判断状态
1177 }
1178 }
1179 if("equip_time".equals(whatStructData.getEquipType())){
1180 equipMap.put("runtime",whatStructData.getMonitorId());
1181 }
1182
1183 }
1184 equipMap.put("status",statusList);
1185 Map<String, Object> monitorMap = new HashMap<>();
1186 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
1187 if(monitorList.size()==1){
1188 monitorMap = monitorList.get(0);
1189 map.put("runtime", monitorMap.get(equipMap.get("runtime").toString()));
1190 String equipStatus = "停止";
1191 if("2".equals(equipMap.get("show_model"))){
1192 equipStatus = getStatus2(monitorMap,statusList,pumpId);
1193 }else{
1194 equipStatus = getStatus1(monitorMap,statusList,pumpId);
1195 }
1196 map.put("status",equipStatus);
1197 }
1198 return map;
1199 }
1200
1201 @Override
1202 public List<Map<String, Object>> getPumpRealTimeReport(String sourceType) {
1203 List<Map<String, Object>> list = new ArrayList<>();
1204 List<WhatStructData> timeList = new ArrayList<>();
1205 List<WhatStructData> equipList = new ArrayList<>();
1206 String pgField = "";
1207 equipList = whatStructDataMapper.getEquipDataListBySource(sourceType);
1208 if(equipList.size()==0){
1209 return null;
1210 }
1211 for (WhatStructData whatStructData : equipList) {
1212 pgField = pgField + "," + whatStructData.getMonitorId();
1213 if("equip_time".equals(whatStructData.getEquipType())){
1214 timeList.add(whatStructData);
1215 }
1216 }
1217 Map<String, Object> monitorMap = new HashMap<>();
1218 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
1219 if(monitorList.size()==1){
1220 monitorMap = monitorList.get(0);
1221 }
1222 for (WhatStructData whatStructData:timeList) {
1223 List<Map<String, Object>> list1 = new ArrayList<>();
1224 Map<String, Object> map = new HashMap<>();
1225 map.put("id",whatStructData.getEquipCode());
1226 map.put("name",whatStructData.getEquipCode());
1227 String equipCode = whatStructData.getEquipCode();
1228 for (WhatStructData whatStructData1 : equipList) {
1229 if(equipCode.equals(whatStructData1.getEquipCode())){
1230 Map<String, Object> statusMap = new HashMap<>();
1231 statusMap.put("name",whatStructData1.getId());
1232 if(whatStructData1.getMonitorId()!=null){
1233 statusMap.put("monitorid",whatStructData1.getMonitorId());
1234 }else{
1235 statusMap.put("monitorid","");
1236 }
1237 list1.add(statusMap);
1238 }
1239 }
1240 map.put("status", getStatus2(monitorMap,list1,equipCode));
1241 map.put("signal","--");
1242 if(whatStructData.getMonitorId()!=null){
1243 map.put("runtime",monitorMap.get(whatStructData.getMonitorId()));
1244 }else{
1245 map.put("runtime","--");
1246 }
1247 list.add(map);
1248 }
1249 return list;
1250 }
1251
1252 private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
1253 String status = "停止";
1254 Map<String, Object> bean = list.get(0);
1255 String monitorStatus = map.get(bean.get("monitorid").toString()).toString();
1256 if("2".equals(monitorStatus)){
1257 status = "故障";
1258 }else if("1".equals(monitorStatus)){
1259 status = "运行";
1260 }else{
1261 status = "停止";
1262 }
1263 return status;
1264 }
1265
1266 private String getStatus2(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
1267 String status = "停止";
1268 String bpName = pumpId+"_BP";
1269 String gpName = pumpId+"_GP";
1270 for (Map<String, Object> bean : list) {
1271 if(bpName.equals(bean.get("name"))){
1272 if("1".equals(map.get(bean.get("monitorid").toString()))){
1273 status = "变频运行";
1274 }
1275 }
1276 if(gpName.equals(bean.get("name"))){
1277 if("1".equals(map.get(bean.get("monitorid").toString()))){
1278 status = "工频运行";
1279 }
1280 }
1281 }
1282 return status;
1283 }
1284
1116 private List<Map<String, Object>> getMnData(){ 1285 private List<Map<String, Object>> getMnData(){
1117 List<Map<String, Object>> list = new ArrayList<>(); 1286 List<Map<String, Object>> list = new ArrayList<>();
1118 Map<String, Object> flowMap = new HashMap<>(); 1287 Map<String, Object> flowMap = new HashMap<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!