Quellcode durchsuchen

测风塔风速时间及空值修改展示

xusl vor 7 Monaten
Ursprung
Commit
df9fc00df1

+ 63 - 32
cpp-admin/src/main/java/com/cpp/web/controller/stationDataQuery/WindTowerStatusDataController.java

@@ -19,6 +19,7 @@ import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
@@ -65,7 +66,11 @@ public class WindTowerStatusDataController {
         queryWrapper.eq("station_code", stationCode);
         List<WindTowerStatusData> talbeList = windTowerStatusDataService.list(queryWrapper);
         talbeList.sort(Comparator.comparing(WindTowerStatusData::getTime));
-
+        Map<String, WindTowerStatusData> dataGroupMap = new HashMap<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        for (WindTowerStatusData windTowerStatusData : talbeList) {
+            dataGroupMap.put(sdf.format(windTowerStatusData.getTime()), windTowerStatusData);
+        }
         // 封装各层高风速
         List<String> timeList = new ArrayList<>();
         List<BigDecimal> wsHubHeightList = new ArrayList<>();
@@ -78,37 +83,63 @@ public class WindTowerStatusDataController {
         List<BigDecimal> ws90List = new ArrayList<>();
         List<BigDecimal> ws100List = new ArrayList<>();
         LinkedHashMap<String, List> wsMap = new LinkedHashMap<>();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        for (int i = 0; i < talbeList.size(); i++) {
-            WindTowerStatusData windTowerStatusData = talbeList.get(i);
-            timeList.add(sdf.format(windTowerStatusData.getTime()));
-            // 风速轮毂
-            BigDecimal wsHubHeight = windTowerStatusData.getWsHubHeight();
-            wsHubHeightList.add(wsHubHeight);
-            // ws10
-            BigDecimal ws10 = windTowerStatusData.getWs10();
-            ws10List.add(ws10);
-            // ws30
-            BigDecimal ws30 = windTowerStatusData.getWs30();
-            ws30List.add(ws30);
-            // ws50
-            BigDecimal ws50 = windTowerStatusData.getWs50();
-            ws50List.add(ws50);
-            // ws60
-            BigDecimal ws60 = windTowerStatusData.getWs60();
-            ws60List.add(ws60);
-            // ws70
-            BigDecimal ws70 = windTowerStatusData.getWs70();
-            ws70List.add(ws70);
-            // ws80
-            BigDecimal ws80 = windTowerStatusData.getWs80();
-            ws80List.add(ws80);
-            // ws90
-            BigDecimal ws90 = windTowerStatusData.getWs90();
-            ws90List.add(ws90);
-            // ws100
-            BigDecimal ws100 = windTowerStatusData.getWs100();
-            ws100List.add(ws100);
+
+
+        Long momentTime = 5 * 60 * 1000L;
+        for (Long tempTime = startTime; tempTime <= endTime; tempTime = tempTime + momentTime) {
+            // 设置时间
+            String tempTimeStr  = sdf.format(tempTime);
+            timeList.add(tempTimeStr);
+            if (dataGroupMap.get(tempTimeStr)!=null){
+                WindTowerStatusData windTowerStatusData = dataGroupMap.get(tempTimeStr);
+                // 风速轮毂
+                BigDecimal wsHubHeight = windTowerStatusData.getWsHubHeight();
+                wsHubHeightList.add(wsHubHeight);
+                // ws10
+                BigDecimal ws10 = windTowerStatusData.getWs10();
+                ws10List.add(ws10);
+                // ws30
+                BigDecimal ws30 = windTowerStatusData.getWs30();
+                ws30List.add(ws30);
+                // ws50
+                BigDecimal ws50 = windTowerStatusData.getWs50();
+                ws50List.add(ws50);
+                // ws60
+                BigDecimal ws60 = windTowerStatusData.getWs60();
+                ws60List.add(ws60);
+                // ws70
+                BigDecimal ws70 = windTowerStatusData.getWs70();
+                ws70List.add(ws70);
+                // ws80
+                BigDecimal ws80 = windTowerStatusData.getWs80();
+                ws80List.add(ws80);
+                // ws90
+                BigDecimal ws90 = windTowerStatusData.getWs90();
+                ws90List.add(ws90);
+                // ws100
+                BigDecimal ws100 = windTowerStatusData.getWs100();
+                ws100List.add(ws100);
+            }
+            else{
+                // 风速轮毂
+                wsHubHeightList.add(null);
+                // ws10
+                ws10List.add(null);
+                // ws30
+                ws30List.add(null);
+                // ws50
+                ws50List.add(null);
+                // ws60
+                ws60List.add(null);
+                // ws70
+                ws70List.add(null);
+                // ws80
+                ws80List.add(null);
+                // ws90
+                ws90List.add(null);
+                // ws100
+                ws100List.add(null);
+            }
         }
 
         wsMap.put("轮毂风速", wsHubHeightList);

+ 157 - 23
cpp-ui/src/views/stationDataQuery/windtowerstatusdata/index.vue

@@ -83,7 +83,7 @@
           <div style="float:left;width: 95%;height: 550px" id="wscharts"></div>
         </el-tab-pane>
         <el-tab-pane label="风向玫瑰图" name="three">
-          <div id="roseChartsId" style="float:left;width: 95%;height: 550px"></div>
+          <div style="float:left;width: 95%;height: 550px" id="wdcharts"></div>
         </el-tab-pane>
       </el-tabs>
     </div>
@@ -98,12 +98,7 @@ export default {
   data() {
     return {
       wsChart: null,
-      chart: null,
-      charts: null,
-      wsData: {
-        wsCharts: {},
-        times: {}
-      },
+      wdChart: null,
       activeName: 'first',
       dateTime: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000-5*1000*60],
       total: 0,
@@ -696,6 +691,11 @@ export default {
     }
     this.wsChart.dispose()
     this.wsChart = null
+    if (!this.wdChart) {
+      return
+    }
+    this.wdChart.dispose()
+    this.wdChart = null
   },
   computed: {},
   methods: {
@@ -705,11 +705,11 @@ export default {
           this.wsChart.resize();
         })
       }
-      // if (this.activeName == 'three') {
-      //   this.$nextTick(function() {
-      //     this.rosechart.resize();
-      //   })
-      // }
+      if (this.activeName == 'three') {
+        this.$nextTick(function() {
+          this.wdChart.resize();
+        })
+      }
     },
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
@@ -760,16 +760,13 @@ export default {
         }
       })
     },
-
-
-
     wsDraw(wsTime,wsMap) {
       this.wsChart = echarts.init(document.getElementById('wscharts'))
-      var option = {
+      let option = {
         backgroundColor: 'transparent',
         title: {
           top: 20,
-          text: '测风塔信息-风速',
+          text: '测风塔风速',
           textStyle: {
             fontWeight: 'normal',
             fontSize: 16,
@@ -862,12 +859,9 @@ export default {
       var index = 0;
 
       for (var key in wsMap) {
-        // var keyName = '';
-        // for (let thFormatKey in this.thFormat) {
-        //   if (key == thFormatKey) {
-        //     keyName = this.thFormat[thFormatKey];
-        //   }
-        // }
+        for (let i=0;i<wsMap[key].length;i++){
+          wsMap[key][i] = wsMap[key][i]==-99?null:wsMap[key][i]
+        }
         option.legend.data.push(key)
         if (key=='轮毂风速') {
           option.legend.selected[key] = true
@@ -902,7 +896,147 @@ export default {
         _this.wsChart.resize();
       });
     },
+    wdDraw(wdData) {
+      this.wdChart = echarts.init(document.getElementById('wdcharts'))
+      const option = {
+        backgroundColor: 'transparent',
+        color: ['#4A99FF', '#4BFFFC', '#ff654a', '#edff4a', '#65ff4a', '#4affea', '#894aff', '#d84aff', '#ff4aae'],
+        title: {
+          top: 20,
+          text: '测风塔风向玫瑰图\n\n50米主风向:' + this.wd50 + '\n70米主风向:' + this.wd70,
+          textStyle: {
+            fontWeight: 'normal',
+            fontSize: 16,
+            color: '#000'
+          },
+          left: '1%'
+        },
+        legend: {
+          top: 20,
+          width: 50,
+          icon: 'rect',
+          itemWidth: 14,
+          itemHeight: 5,
+          itemGap: 13,
+          data: [],
+          right: '4%',
+          textStyle: {
+            fontSize: 12,
+            // color: '#F1F1F3'
+          },
+          selected: {}
+        },
+        tooltip: {
+          confine: true,
+          trigger: 'axis',
+          axisPointer: {
+            lineStyle: {
+              color: '#57617B'
+            }
+          }
+        },
+        radar: [
+          {
+            name: {
+              textStyle: {
+                color: '#000',
+                fontSize: 16
+              },
+            },
+            splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
+              show: true,
+              areaStyle: { // 分隔区域的样式设置。
+                color: ['rgba(255,255,255,0)', 'rgba(255,255,255,0)'], // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
+              }
+            },
+            axisLine: { //指向外圈文本的分隔线样式
+              lineStyle: {
+                color: '#000'
+              }
+            },
+            splitLine: {
+              lineStyle: {
+                color: '#000', // 分隔线颜色
+                width: 1, // 分隔线线宽
+              }
+            },
+            indicator: [
+              {text: 'N', max: 1},
+              {text: 'NNW', max: 1},
+              {text: 'NW', max: 1},
+              {text: 'WNW', max: 1},
+              {text: 'W', max: 1},
+              {text: 'WSW', max: 1},
+              {text: 'SW', max: 1},
+              {text: 'SSW', max: 1},
+              {text: 'S', max: 1},
+              {text: 'SSE', max: 1},
+              {text: 'SE', max: 1},
+              {text: 'ESE', max: 1},
+              {text: 'E', max: 1},
+              {text: 'ENE', max: 1},
+              {text: 'NE', max: 1},
+              {text: 'NNE', max: 1},
+            ],
+            center: ['50%', '50%'],
+            radius: '70%'
+          },
+        ],
+        series: [
+          {
+            type: 'radar',
+            tooltip: {
+              trigger: 'item',
+            },
+            areaStyle: {},
+            data: []
+          }
+        ],
+        props: {
+          wdData: {
+            type: Object
+          },
+          wd70: {
+            type: String
+          },
+          wd50: {
+            type: String
+          },
+          thFormat: {
+            type: Array
+          }
+        },
+      }
+      var index = 0;
+      for (var key in wdData) {
+        var keyName = '';
+        for (let thFormatKey in this.thFormat) {
+          if (key == thFormatKey) {
+            keyName = this.thFormat[thFormatKey];
+          }
+        }
+        option.legend.data.push(keyName)
+        if (index > 3) {
+          option.legend.selected[keyName] = false
+        } else {
+          option.legend.selected[keyName] = true
+        }
+        var wd = new Object
+        wd.name = keyName
+        wd.value = wdData[key]
+        wd.connectNulls = true
+        wd.itemStyle = this.itemStyle[index].itemStyle
+        wd.areaStyle = this.itemStyle[index].areaStyle
+        option.series[0].data.push(wd)
+        index++;
+      }
 
+      this.chart.setOption(option, true)
+      var _this = this
+      window.addEventListener("resize", function () {
+        _this.chart.resize();
+      });
+    },
   },
 }
 </script>