2aa800a1 张雷

奥体项目数据报表时间修改

1 个父辈 d07e8068
...@@ -182,4 +182,15 @@ public class OlympicCenterController { ...@@ -182,4 +182,15 @@ public class OlympicCenterController {
182 return result; 182 return result;
183 } 183 }
184 184
185 @ApiOperation(value="获取历史数据表头", notes="获取历史数据表头")
186 @GetMapping(value = "/getHistoryReportClos")
187 public Result<List<Map<String,Object>>> getHistoryReportClos(String dataType,String loction){
188 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
189 List<Map<String,Object>> list = new ArrayList<>();
190 list = olympicCenterService.getHistoryReportClos(dataType, loction);
191 result.setResult(list);
192 result.setSuccess(true);
193 return result;
194 }
195
185 } 196 }
......
...@@ -35,4 +35,6 @@ public interface IOlympicCenterService { ...@@ -35,4 +35,6 @@ public interface IOlympicCenterService {
35 Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId); 35 Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId);
36 36
37 List<Map<String, Object>> getPumpRealTimeReport(String sourceType); 37 List<Map<String, Object>> getPumpRealTimeReport(String sourceType);
38
39 List<Map<String, Object>> getHistoryReportClos(String dataType, String loction);
38 } 40 }
......
...@@ -425,22 +425,22 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -425,22 +425,22 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
425 return list; 425 return list;
426 } 426 }
427 427
428 public static void main(String[] args) throws ParseException { 428 // public static void main(String[] args) throws ParseException {
429 DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 429 // DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
430 String start = "2023-04-01"; 430 // String start = "2023-04-01";
431 String end = "2023-04-24"; 431 // String end = "2023-04-24";
432 432 //
433 Long startTime = df.parse(start).getTime(); 433 // Long startTime = df.parse(start).getTime();
434 Long endTime = df.parse(end).getTime(); 434 // Long endTime = df.parse(end).getTime();
435 Long oneDay = 1000 * 60 * 60 * 24l; 435 // Long oneDay = 1000 * 60 * 60 * 24l;
436 436 //
437 Long time = startTime; 437 // Long time = startTime;
438 while (time <= endTime) { 438 // while (time <= endTime) {
439 Date d = new Date(time); 439 // Date d = new Date(time);
440 System.out.println(df.format(d)); 440 // System.out.println(df.format(d));
441 time += oneDay; 441 // time += oneDay;
442 } 442 // }
443 } 443 // }
444 444
445 @Override 445 @Override
446 public Map<String, Object> getBzRealTimeData(String sourceType) { 446 public Map<String, Object> getBzRealTimeData(String sourceType) {
...@@ -1047,6 +1047,19 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1047,6 +1047,19 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1047 return list; 1047 return list;
1048 } 1048 }
1049 1049
1050 //时间戳转时间字符串
1051 private String timeStampToDateStr(Object time) {
1052 SimpleDateFormat sdf=new SimpleDateFormat("MM-dd HH:mm");
1053 if(time==null){
1054 return "";
1055 }else{
1056 long timeStamp = Long.parseLong(time.toString()+"000");
1057 // 时间戳转换成时间
1058 String sd = sdf.format(new Date(timeStamp));
1059 return sd;
1060 }
1061 }
1062
1050 @Override 1063 @Override
1051 public List<Map<String, Object>> getRealTimeReport(String dataType, String loction) { 1064 public List<Map<String, Object>> getRealTimeReport(String dataType, String loction) {
1052 List<Map<String, Object>> list = new ArrayList<>(); 1065 List<Map<String, Object>> list = new ArrayList<>();
...@@ -1101,7 +1114,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1101,7 +1114,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1101 map.put("flow_rljll",""); 1114 map.put("flow_rljll","");
1102 for (Map<String, Object> mMap : monitorList ) { 1115 for (Map<String, Object> mMap : monitorList ) {
1103 if(whatStructData.getId().equals(mMap.get("equipId"))){ 1116 if(whatStructData.getId().equals(mMap.get("equipId"))){
1104 map.put("time",mMap.get("time")); 1117 map.put("time",timeStampToDateStr(mMap.get("time")));
1105 if("flow".equals(mMap.get("equipType"))){ 1118 if("flow".equals(mMap.get("equipType"))){
1106 map.put("flow",mMap.get("monitorvalue")); 1119 map.put("flow",mMap.get("monitorvalue"));
1107 }else if("flow_ljll".equals(mMap.get("equipType"))){ 1120 }else if("flow_ljll".equals(mMap.get("equipType"))){
...@@ -1125,7 +1138,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1125,7 +1138,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1125 for (Map<String, Object> mMap : monitorList ) { 1138 for (Map<String, Object> mMap : monitorList ) {
1126 if(whatStructData.getMonitorId()!=null){ 1139 if(whatStructData.getMonitorId()!=null){
1127 if(whatStructData.getMonitorId().equals(mMap.get("monitorid"))){ 1140 if(whatStructData.getMonitorId().equals(mMap.get("monitorid"))){
1128 map.put("time",mMap.get("time")); 1141 map.put("time",timeStampToDateStr(mMap.get("time")));
1129 map.put("value",formatDouble(Double.parseDouble(mMap.get("monitorvalue").toString())*Double.parseDouble(whatStructData.getMonitorZoom()))); 1142 map.put("value",formatDouble(Double.parseDouble(mMap.get("monitorvalue").toString())*Double.parseDouble(whatStructData.getMonitorZoom())));
1130 } 1143 }
1131 }else{ 1144 }else{
...@@ -1249,6 +1262,50 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1249,6 +1262,50 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1249 return list; 1262 return list;
1250 } 1263 }
1251 1264
1265 @Override
1266 public List<Map<String, Object>> getHistoryReportClos(String dataType, String loction) {
1267 List<Map<String, Object>> list = new ArrayList<>();
1268 List<WhatStructData> closList = new ArrayList<>();
1269 if("flow".equals(dataType)){
1270 closList = whatStructDataMapper.getFlowList(loction);
1271 for (WhatStructData whatStructData : closList) {
1272 Map<String, Object> map = new HashMap<>();
1273 map.put("field",whatStructData.getId());
1274 String str = "";
1275 if("flow".equals(whatStructData.getEquipType())){
1276 str = "瞬时流量";
1277 }else if("flow_ljll".equals(whatStructData.getEquipType())){
1278 str = "正向累计";
1279 }else if("flow_rljll".equals(whatStructData.getEquipType())){
1280 str = "反向累计";
1281 }else{
1282 str = "";
1283 }
1284 map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "")+str);
1285 list.add(map);
1286 }
1287 }else if("pressure".equals(dataType)){
1288 closList = whatStructDataMapper.getPressureList(loction);
1289 for (WhatStructData whatStructData : closList) {
1290 Map<String, Object> map = new HashMap<>();
1291 map.put("field",whatStructData.getId());
1292 map.put("title",whatStructData.getId());
1293 list.add(map);
1294 }
1295 }else if("temperature".equals(dataType)){
1296 closList = whatStructDataMapper.getTemperatureList(loction);
1297 for (WhatStructData whatStructData : closList) {
1298 Map<String, Object> map = new HashMap<>();
1299 map.put("field",whatStructData.getId());
1300 map.put("title",whatStructData.getId());
1301 list.add(map);
1302 }
1303 }else{
1304 return list;
1305 }
1306 return list;
1307 }
1308
1252 private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) { 1309 private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
1253 String status = "停止"; 1310 String status = "停止";
1254 Map<String, Object> bean = list.get(0); 1311 Map<String, Object> bean = list.get(0);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!