Selaa lähdekoodia

修改风机曲线展示,

songhaodong 2 vuotta sitten
vanhempi
commit
faa0423fcd

+ 32 - 147
ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/charts/index.vue

@@ -14,7 +14,7 @@
     watch: {
       drawData: {
         handler(newValue, oldValue) {
-          this.draw(newValue,newValue.Fan1, newValue.Fan2,newValue.Fan3,newValue.Fan4,newValue.Fan5, newValue.xData)
+          this.draw(newValue,newValue.title, newValue.data, newValue.xData)
         },
         deep: true
       },
@@ -53,7 +53,7 @@
       this.chart = null
     },
     methods: {
-      draw(newValue,Fan1, Fan2,Fan3,Fan4,Fan5,xData) {
+      draw(newValue,title,data,xData) {
         this.chart = echarts.init(document.getElementById('rpcharts'))
           var option = {
           backgroundColor: 'transparent',
@@ -142,153 +142,38 @@
               }
             }
           }],
-          series: [{
-            name: '机组1',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.sj,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan1
-          }]
+          series: []
         }
 
-          option.legend.data = ['机组1','机组2','机组3','机组4','机组5']
-          option.series.push({
-            name: '机组2',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.kygl,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan2
-          },{
-            name: '机组3',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.llgl,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan3
-          },{
-            name: '机组4',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-
-            itemStyle: {
-              normal: {
-
-                color: cc.line6,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan4
-          },{
-            name: '机组5',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-
-            itemStyle: {
-              normal: {
-
-                color: cc.ybjf,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan5
-          },)
-
-
-
-        // if(newValue.hasChartLine == 'true'){
-        //   var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24"]
-        //
-        //   var arr = newValue.powerChartLine
-        //   for (let i = 0; i < arr.length; i++) {
-        //     option.legend.data.push(arr[i].title)
-        //     option.series.push({
-        //       name: arr[i].title,
-        //       type: 'line',
-        //       smooth: true,
-        //       symbol: 'circle',
-        //       symbolSize: 5,
-        //       showSymbol: false,
-        //       lineStyle: {
-        //         normal: {
-        //           width: 2
-        //         }
-        //       },
-        //
-        //       itemStyle: {
-        //         normal: {
-        //
-        //           color: carr[i],
-        //           borderColor: 'rgba(219,50,51,0.2)',
-        //           borderWidth: 12
-        //         }
-        //       },
-        //       data: newValue[arr[i].field]
-        //     })
-        //   }
-        //
-        // }
+        var titles = new Array();
+        titles = title;
+        var datas = new Array();
+        datas = data;
+        var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24","#983680","#5cb3cc","#57c3c2","#2bae85","#bacf65"]
+             for (let i = 0; i < titles.length; i++) {
+               option.legend.data.push(titles[i])
+               option.series.push({
+                name: titles[i],
+                 type: 'line',
+                 smooth: true,
+                 symbol: 'circle',
+                 symbolSize: 5,
+                 showSymbol: false,
+                 lineStyle: {
+                   normal: {
+                     width: 2
+                   }
+                 },
+                 itemStyle: {
+                   normal: {
+                     color: carr[i],
+                     borderColor: 'rgba(219,50,51,0.2)',
+                     borderWidth: 12
+                   }
+                 },
+                 data: datas[i]
+               })
+             }
         this.chart.setOption(option,true)
       },
     }

+ 7 - 6
ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/index.vue

@@ -15,12 +15,12 @@
         </el-upload>
         <el-button size="small" type="primary" @click="exportToExcel">导出</el-button>
       </div>
-      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="fstToolBar" custom >
-        <template v-slot:buttons>
-          <vxe-button class="downloadButton" style="border:none;"  @click="exportDataEvent"><i class="vxe-icon--download" ></i></vxe-button>
-        </template>
-      </vxe-toolbar></div>
-      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="nwpToolBar" custom></vxe-toolbar></div>
+<!--      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="fstToolBar" custom >-->
+<!--        <template v-slot:buttons>-->
+<!--          <vxe-button class="downloadButton" style="border:none;"  @click="exportDataEvent"><i class="vxe-icon&#45;&#45;download" ></i></vxe-button>-->
+<!--        </template>-->
+<!--      </vxe-toolbar></div>-->
+<!--      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="nwpToolBar" custom></vxe-toolbar></div>-->
     </div>
 
     <div class="content">
@@ -196,6 +196,7 @@
         this.drawLoading = true
         this.$axios.get('/windTurbinePowerCurve/new/').then((res) => {
 
+          console.log(res.data+"-------------");
           this.drawData = res.data
           this.drawLoading = false
           if(!this.drawLoading && !this.tableLoading){

+ 3 - 3
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindTurbinePowerCurveController.java

@@ -74,9 +74,9 @@ public class WindTurbinePowerCurveController {
    */
   @GetMapping(value = "/new")
   public ResponseVO getBySpeedBetweenForPage(){
-    Map<String, Object> map;
-    map = this.windTurbinePowerCurveService.getByFanId();
-    return ResponseVO.success(map);
+    // Map<String, Object> map;
+    // map = this.windTurbinePowerCurveService.getByFanId();
+    return ResponseVO.success(windTurbinePowerCurveService.getByFanId());
   }
   /**
    * 获取风机编号

+ 22 - 25
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindTurbinePowerCurveService.java

@@ -121,39 +121,36 @@ public class WindTurbinePowerCurveService {
    */
   public Map<String, Object> getByFanId() {
     Map<String, Object> map = new HashMap<>();
+    Map<String, List<Float>> map2 = new HashMap<>();
+
+    List<String> title = new ArrayList<>();
+    List<List<Float>> datas = new ArrayList<>();
 
     DecimalFormat df1 = new DecimalFormat("#.00");
     List<String> xData = new ArrayList<>();
     List<WindTurbinePowerCurve> wList = this.getAll();
-    List<Float> w1List = new ArrayList<>();
-    List<Float> w2List = new ArrayList<>();
-    List<Float> w3List = new ArrayList<>();
-    List<Float> w4List = new ArrayList<>();
-    List<Float> w5List = new ArrayList<>();
-    for(WindTurbinePowerCurve w: wList){
-      if(w.getFanId() == 1){
-        w1List.add(w.getPower());
-      }else if(w.getFanId() == 2){
-        w2List.add(w.getPower());
-      }else if(w.getFanId() == 3){
-        w3List.add(w.getPower());
-      }else if(w.getFanId() == 4){
-        w4List.add(w.getPower());
-      }else {
-        w5List.add(w.getPower());
-      }
-    }
-    float j = 1;
-    for(int i = 0; i <= 190; i++){
+    Map<Integer, List<WindTurbinePowerCurve>> collect = wList.stream().collect(Collectors.groupingBy(WindTurbinePowerCurve::getFanId));
+
+    collect.forEach((fanId,v)->{
+      List<WindTurbinePowerCurve> collect2 = v.stream().sorted(Comparator.comparing(WindTurbinePowerCurve::getSpeed)).collect(Collectors.toList());
+      List<Float> collect1 = collect2.stream().map(WindTurbinePowerCurve::getPower).collect(Collectors.toList());
+      map2.put(String.valueOf(fanId),collect1);
+    });
+
+    map2.forEach((k,v) -> {
+      title.add("机组"+k);
+      datas.add(v);
+    });
+
+    // x轴风速
+    float j = 1.1f;
+    for(int i = 0; i < 190; i++){
       xData.add(df1.format(j));
       j = j + 0.1f;
     }
 
-    map.put("Fan1",w1List);
-    map.put("Fan2",w2List);
-    map.put("Fan3",w3List);
-    map.put("Fan4",w4List);
-    map.put("Fan5",w5List);
+    map.put("title",title);
+    map.put("data",datas);
     map.put("xData", xData);
     return map;
   }