Browse Source

首页气象预测图表展示

xusl 7 months ago
parent
commit
e668604c0a

+ 221 - 14
cpp-admin/src/main/java/com/cpp/web/controller/largeScreen/LargeScreenController.java

@@ -1,16 +1,22 @@
 package com.cpp.web.controller.largeScreen;
 package com.cpp.web.controller.largeScreen;
 
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ReflectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.cpp.common.core.cache.LocalCache;
 import com.cpp.common.core.cache.LocalCache;
 import com.cpp.common.core.domain.R;
 import com.cpp.common.core.domain.R;
+import com.cpp.common.core.domain.entity.SysDictData;
 import com.cpp.system.service.ISysConfigService;
 import com.cpp.system.service.ISysConfigService;
+import com.cpp.system.service.ISysDictDataService;
+import com.cpp.web.domain.cloud.NwpCloud;
 import com.cpp.web.domain.powerGeneration.DayPowerGeneration;
 import com.cpp.web.domain.powerGeneration.DayPowerGeneration;
 import com.cpp.web.domain.station.*;
 import com.cpp.web.domain.station.*;
 import com.cpp.web.domain.station.enums.ElectricFieldTypeEnum;
 import com.cpp.web.domain.station.enums.ElectricFieldTypeEnum;
 import com.cpp.web.dto.largeScreen.ElectricFieldDataTotalDto;
 import com.cpp.web.dto.largeScreen.ElectricFieldDataTotalDto;
 import com.cpp.web.dto.largeScreen.ForecastGeneratingDataDto;
 import com.cpp.web.dto.largeScreen.ForecastGeneratingDataDto;
+import com.cpp.web.dto.largeScreen.ForecastNwpDto;
 import com.cpp.web.dto.largeScreen.ProductionDataTotalDto;
 import com.cpp.web.dto.largeScreen.ProductionDataTotalDto;
+import com.cpp.web.service.cloud.NwpCloudService;
 import com.cpp.web.service.powerGeneation.DayPowerGenerationService;
 import com.cpp.web.service.powerGeneation.DayPowerGenerationService;
 import com.cpp.web.service.station.*;
 import com.cpp.web.service.station.*;
 import com.cpp.web.utils.DateTimeUtil;
 import com.cpp.web.utils.DateTimeUtil;
@@ -20,6 +26,7 @@ import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -55,9 +62,13 @@ public class LargeScreenController {
     WeatherStationStatusDataService weatherStationStatusDataService;
     WeatherStationStatusDataService weatherStationStatusDataService;
     @Autowired
     @Autowired
     DayPowerGenerationService dayPowerGenerationService;
     DayPowerGenerationService dayPowerGenerationService;
+    @Autowired
+    ISysDictDataService iSysDictDataService;
+    @Autowired
+    NwpCloudService nwpCloudService;
 
 
     @GetMapping("/getBizData")
     @GetMapping("/getBizData")
-    public R getBizData() {
+    public R getBizData(String weatherType) {
         // 获取所有场站
         // 获取所有场站
         List<ElectricField> electricFieldList = electricFieldService.list();
         List<ElectricField> electricFieldList = electricFieldService.list();
         // 首页左上角场站数据统计
         // 首页左上角场站数据统计
@@ -120,6 +131,14 @@ public class LargeScreenController {
         Map forecastGeneratingMap = calForecastGenerating();
         Map forecastGeneratingMap = calForecastGenerating();
         bizDataMap.put("forecastGeneratingMap",forecastGeneratingMap);
         bizDataMap.put("forecastGeneratingMap",forecastGeneratingMap);
 
 
+        // 获取首页中心侧nwp气象
+        Map<String,List> forecastNwpMap = centerForecastNwpAvgTotal();
+        bizDataMap.put("forecastNwpMap",forecastNwpMap);
+
+
+
+
+
         // 定义首页实际功率、可用、理论总和
         // 定义首页实际功率、可用、理论总和
         BigDecimal realSum = BigDecimal.ZERO;
         BigDecimal realSum = BigDecimal.ZERO;
         BigDecimal ableSum = BigDecimal.ZERO;
         BigDecimal ableSum = BigDecimal.ZERO;
@@ -372,19 +391,6 @@ public class LargeScreenController {
             forecastGeneratingSum = forecastGeneratingSum.add(dayPowerGeneration.getForecastPowerGeneration());
             forecastGeneratingSum = forecastGeneratingSum.add(dayPowerGeneration.getForecastPowerGeneration());
         }
         }
 
 
-
-//        Date dayEndTimeFor15 = DateTimeUtil.getMomentTimeFor15Minute(System.currentTimeMillis());
-//        QueryWrapper<ForecastPowerShortTermRegulation> forecastPowerShortTermRegulationQueryWrapper = new QueryWrapper<>();
-//        forecastPowerShortTermRegulationQueryWrapper.between("time", dayStartTime, dayEndTimeFor15);
-//        List<ForecastPowerShortTermRegulation> forecastPowerShortTermRegulationList = forecastPowerShortTermRegulationService.list(forecastPowerShortTermRegulationQueryWrapper);
-//        // 计算短期预测发电量
-//        BigDecimal forecastGeneratingSum = BigDecimal.ZERO;
-//        for (ForecastPowerShortTermRegulation forecastPowerShortTermRegulation : forecastPowerShortTermRegulationList) {
-//            if (forecastPowerShortTermRegulation.getFpValue()!=null){
-//                // 发电量(万kWh) = 预测值 * 0.25 * 0.1
-//                forecastGeneratingSum = forecastGeneratingSum.add(forecastPowerShortTermRegulation.getFpValue().multiply(new BigDecimal("0.25")).multiply(new BigDecimal("0.1")).setScale(2, RoundingMode.HALF_UP));
-//            }
-//        }
         ProductionDataTotalDto productionDataTotalDto = new ProductionDataTotalDto();
         ProductionDataTotalDto productionDataTotalDto = new ProductionDataTotalDto();
         productionDataTotalDto.setRealGeneratingSum(realGeneratingSum);
         productionDataTotalDto.setRealGeneratingSum(realGeneratingSum);
         productionDataTotalDto.setForecastGeneratingSum(forecastGeneratingSum);
         productionDataTotalDto.setForecastGeneratingSum(forecastGeneratingSum);
@@ -447,4 +453,205 @@ public class LargeScreenController {
         }
         }
         return forecastGeneratingMap;
         return forecastGeneratingMap;
     }
     }
+
+    /**
+     * 首页中心预测nwp气象站数据总体平均值
+     * @return
+     */
+    private Map<String,List> centerForecastNwpAvgTotal(){
+        // 根据类型获取所有场站
+        Map<String,List> stationMap = new HashMap();
+        List<ElectricField> list = electricFieldService.list();
+        List<String> windStationCodeList = new ArrayList<>();
+        List<String> gfStationCodeList = new ArrayList<>();
+        for (ElectricField electricField:list){
+            if (electricField.getElectricFieldTypeEnum().equals("E1")){
+                gfStationCodeList.add(electricField.getStationCode());
+            }
+            else{
+                windStationCodeList.add(electricField.getStationCode());
+            }
+        }
+        stationMap.put("gf",gfStationCodeList);
+        stationMap.put("wind",windStationCodeList);
+        Map<String,List> forecastWeatherAvgDataMap = new HashMap<>();
+        // 循环光和风
+        Iterator<Map.Entry<String, List>> stationIterator = stationMap.entrySet().iterator();
+        while (stationIterator.hasNext()) {
+            Map.Entry<String, List> entry = stationIterator.next();
+            List<String> stationCodeList = entry.getValue();
+            Date dayStartTime = DateTimeUtil.getDayStartTime(System.currentTimeMillis());
+            Date dayEndTime = DateTimeUtil.getDayLastTime(System.currentTimeMillis());
+            Map<Long, List<NwpCloud>>  nwpCloudMap = new HashMap<>();
+            Map<String,String> nwpWshubheightMap = new HashMap<>();
+            if (entry.getKey().equals("wind")){
+                // 获取字典中nwp风速轮毂设置
+                SysDictData sysDictData = new SysDictData();
+                sysDictData.setDictType("nwp_wshubheight");
+                List<SysDictData> nwpWshubheightList = iSysDictDataService.selectDictDataList(sysDictData);
+                nwpWshubheightMap = nwpWshubheightList.stream().collect(Collectors.toMap(SysDictData::getDictLabel,SysDictData::getDictValue));
+            }
+            if (!stationCodeList.isEmpty()){
+                int counts = 10;
+                for (int i=1; i<=counts; i++) {
+                    QueryWrapper<NwpCloud> nwpCloudQueryWrapper = new QueryWrapper<>();
+                    nwpCloudQueryWrapper.eq("forecast_how_long_ago",i);
+                    nwpCloudQueryWrapper.between("time",dayStartTime,dayEndTime);
+                    nwpCloudQueryWrapper.in("station_code", stationCodeList);
+                    List<NwpCloud> nwpCloudList = nwpCloudService.list(nwpCloudQueryWrapper);
+                    if (!nwpCloudList.isEmpty()){
+                        nwpCloudMap = nwpCloudList.stream().collect(Collectors.groupingBy(n->n.getTime().getTime(), Collectors.toList()));
+                        // 查出数据,并且有今日的预测数据,就退出当前循环。
+                        break;
+                    }
+                    else{
+                        // 否则,日期往前推一天,再查
+                    }
+                }
+            }
+            Long momentTime = 15 * 60 * 1000L;
+            List<ForecastNwpDto> forecastNwpDtoList = new ArrayList<>();
+            for (Long tempTime = dayStartTime.getTime(); tempTime <= dayEndTime.getTime(); tempTime = tempTime + momentTime) {
+                ForecastNwpDto totalForecastNwpDto = new ForecastNwpDto();
+                totalForecastNwpDto.setTime(DateUtil.format(new Date(tempTime),"HH:mm"));
+                if ("wind".equals(entry.getKey())){
+                    totalForecastNwpDto.setName("平均轮毂风速");
+                }
+                else{
+                    totalForecastNwpDto.setName("平均总辐射");
+                }
+
+                if (nwpCloudMap.get(tempTime)!=null){
+                    // 当前时间点所有站点数据
+                    List<NwpCloud> nwpCloudList = nwpCloudMap.get(tempTime);
+                    BigDecimal sum = BigDecimal.ZERO;
+                    // 循环每个站封装点位以及统计总和
+                    for (NwpCloud nwpCloud:nwpCloudList){
+                        if ("wind".equals(entry.getKey())){
+                            if (nwpWshubheightMap.get(nwpCloud.getStationCode())!=null){
+                                // 场站配置了轮毂高度,根据轮毂高度反射获取字段值
+                                Field field = ReflectUtil.getField(NwpCloud.class, "ws"+nwpWshubheightMap.get(nwpCloud.getStationCode()));
+                                // 设置为可访问,私有字段也可以访问
+                                field.setAccessible(true);
+                                try {
+                                    // 获取字段值
+                                    Object fieldValue = field.get(nwpCloud);
+                                    sum = sum.add(new BigDecimal(fieldValue.toString()));
+                                } catch (IllegalAccessException e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        }
+                        else{
+                            sum = sum.add(nwpCloud.getSwr());
+                        }
+                    }
+                    totalForecastNwpDto.setValue(sum);
+                }
+                else{
+                    // 时间点位为空
+                    totalForecastNwpDto.setValue(BigDecimal.ZERO);
+                }
+                forecastNwpDtoList.add(totalForecastNwpDto);
+            }
+            forecastWeatherAvgDataMap.put(entry.getKey(),forecastNwpDtoList);
+        }
+        return forecastWeatherAvgDataMap;
+    }
+
+    /**
+     * 预测气象放大窗口获取每个站的数据
+     * @param weatherType
+     * @return
+     */
+
+    @GetMapping("/forecastNwpFull")
+    public R forecastNwpFull(String weatherType) {
+        Map<String, String> nwpWshubheightMap = new HashMap<>();
+        QueryWrapper wrapper = new QueryWrapper<>();
+        if ("wind".equals(weatherType)){
+            // 过滤出风场站
+            wrapper.eq("electric_field_type_enum", "E2");
+
+            // 获取字典中nwp风速轮毂设置
+            SysDictData sysDictData = new SysDictData();
+            sysDictData.setDictType("nwp_wshubheight");
+            List<SysDictData> nwpWshubheightList = iSysDictDataService.selectDictDataList(sysDictData);
+            nwpWshubheightMap = nwpWshubheightList.stream().collect(Collectors.toMap(SysDictData::getDictLabel,SysDictData::getDictValue));
+        }
+        else{
+            // 过滤出光场站
+            wrapper.eq("electric_field_type_enum", "E1");
+        }
+        List<ElectricField> list = electricFieldService.list(wrapper);
+        // 遍历获取场站nwp数据
+        List<String> stationCodeList = new ArrayList<>();
+        for (ElectricField electricField:list){
+            stationCodeList.add(electricField.getStationCode());
+        }
+        // 查询当日所有站的nwp数据
+        Date dayStartTime = DateTimeUtil.getDayStartTime(System.currentTimeMillis());
+        Date dayEndTime = DateTimeUtil.getDayLastTime(System.currentTimeMillis());
+        Map<String, List<NwpCloud>>  nwpCloudMap = new HashMap<>();
+        if (!stationCodeList.isEmpty()){
+            int counts = 10;
+            for (int i=1; i<=counts; i++) {
+                QueryWrapper<NwpCloud> nwpCloudQueryWrapper = new QueryWrapper<>();
+                nwpCloudQueryWrapper.eq("forecast_how_long_ago",i);
+                nwpCloudQueryWrapper.between("time",dayStartTime,dayEndTime);
+                nwpCloudQueryWrapper.in("station_code", stationCodeList);
+                List<NwpCloud> nwpCloudList = nwpCloudService.list(nwpCloudQueryWrapper);
+                if (!nwpCloudList.isEmpty()){
+                    nwpCloudMap = nwpCloudList.stream().collect(Collectors.groupingBy(n->n.getStationCode(), Collectors.toList()));
+                    // 查出数据,并且有今日的预测数据,就退出当前循环。
+                    break;
+                }
+                else{
+                    // 否则,日期往前推一天,再查
+                }
+            }
+        }
+        Map<String,List<BigDecimal>> forecastWeatherDataMap = new HashMap<>();
+        Long momentTime = 15 * 60 * 1000L;
+        for (ElectricField electricField:list){
+            List<BigDecimal> nwpList = new ArrayList<>();
+            // 获取场站nwp
+            if (nwpCloudMap.get(electricField.getStationCode())!=null){
+                List<NwpCloud> nwpCloudList = nwpCloudMap.get(electricField.getStationCode());
+                Map<Long, NwpCloud> tempMap = nwpCloudList.stream().collect(Collectors.toMap(s->s.getTime().getTime(),s->s));
+                for (Long tempTime = dayStartTime.getTime(); tempTime <= dayEndTime.getTime(); tempTime = tempTime + momentTime) {
+                    BigDecimal value = BigDecimal.ZERO;
+                    if (tempMap.get(tempTime)!=null){
+                        NwpCloud nwpCloud = tempMap.get(tempTime);
+                        if ("wind".equals(weatherType)){
+                            if (nwpWshubheightMap.get(nwpCloud.getStationCode())!=null){
+                                // 场站配置了轮毂高度,根据轮毂高度反射获取字段值
+                                Field field = ReflectUtil.getField(NwpCloud.class, "ws"+nwpWshubheightMap.get(nwpCloud.getStationCode()));
+                                // 设置为可访问,私有字段也可以访问
+                                field.setAccessible(true);
+                                try {
+                                    // 获取字段值
+                                    Object fieldValue = field.get(nwpCloud);
+                                    value = new BigDecimal(fieldValue.toString());
+                                } catch (IllegalAccessException e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        }
+                        else{
+                            value = nwpCloud.getSwr();
+                        }
+                    }
+                    nwpList.add(value);
+                }
+            }
+            else{
+                for (Long tempTime = dayStartTime.getTime(); tempTime <= dayEndTime.getTime(); tempTime = tempTime + momentTime) {
+                    nwpList.add(BigDecimal.ZERO);
+                }
+            }
+            forecastWeatherDataMap.put(electricField.getName(),nwpList);
+        }
+        return R.ok(forecastWeatherDataMap);
+    }
 }
 }

+ 21 - 0
cpp-admin/src/main/java/com/cpp/web/dto/largeScreen/ForecastNwpDto.java

@@ -0,0 +1,21 @@
+package com.cpp.web.dto.largeScreen;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 首页预测气象DTO
+ *
+ * @author jy
+ * @since 2024/11/11
+ */
+@Data
+public class ForecastNwpDto {
+    // 名称
+    private String name;
+    // 时间
+    private String time;
+    // 值
+    private BigDecimal value;
+}

+ 296 - 19
cpp-ui/src/views/largeScreen/components/right-middle.vue

@@ -30,6 +30,7 @@
 
 
 <script>
 <script>
 import {chartsResize, weatherLineOption} from '../echarts-data'
 import {chartsResize, weatherLineOption} from '../echarts-data'
+import * as echarts from "echarts";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -37,8 +38,209 @@ export default {
       screenHeight: window.innerHeight,
       screenHeight: window.innerHeight,
       weatherChart: null,
       weatherChart: null,
       fullChart: null,
       fullChart: null,
-      chartData: {},
-      type:'wind'
+      gfChartData: [],
+      windChartData: [],
+      type:'wind',
+      lineStyle: [
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(219,50,51,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(219,50,51)',
+              borderColor: 'rgba(219,50,51,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(219,196,50,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(219,196,50)',
+              borderColor: 'rgba(219,196,50,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(101,219,50,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(101,219,50)',
+              borderColor: 'rgba(101,219,50,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(50,219,171,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(50,219,171)',
+              borderColor: 'rgba(50,219,171,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(50,118,219,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(50,118,219)',
+              borderColor: 'rgba(50,118,219,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(140,50,219,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(140,50,219)',
+              borderColor: 'rgba(140,50,219,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(202,50,219,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(202,50,219)',
+              borderColor: 'rgba(202,50,219,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(50,199,219,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(50,199,219)',
+              borderColor: 'rgba(50,199,219,0.2)',
+              borderWidth: 12
+            }
+          },
+        },
+        {
+          areaStyle: {
+            normal: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                offset: 0,
+                color: 'rgba(219,143,50,0.3)'
+              }, {
+                offset: 0.8,
+                color: 'rgba(219, 50, 51, 0)'
+              }], false),
+              shadowColor: 'rgba(0, 0, 0, 0.1)',
+              shadowBlur: 10
+            }
+          },
+          itemStyle: {
+            normal: {
+              color: 'rgb(219,143,50)',
+              borderColor: 'rgba(219,143,50,0.2)',
+              borderWidth: 12
+            }
+          },
+        }
+      ],
     }
     }
   },
   },
   props: {
   props: {
@@ -48,8 +250,9 @@ export default {
     params: {
     params: {
       // immediate: true,// 第一次立即监听
       // immediate: true,// 第一次立即监听
       handler(value) {
       handler(value) {
-        this.chartData = value
-        this.setOptions(this.chartData)
+        this.gfChartData = value.gf
+        this.windChartData = value.wind
+        this.setOptions()
       }
       }
     }
     }
   },
   },
@@ -85,7 +288,7 @@ export default {
         this.type = 'wind'
         this.type = 'wind'
       }
       }
       this.weatherChart = this.$echarts.init(document.getElementById('weatherChart'));
       this.weatherChart = this.$echarts.init(document.getElementById('weatherChart'));
-      this.setOptions(this.chartData)
+      this.setOptions()
     },
     },
     openFull(){
     openFull(){
       const _this = this
       const _this = this
@@ -93,17 +296,40 @@ export default {
       _this.$nextTick(() => {
       _this.$nextTick(() => {
         const chartFul = this.$refs.fullChart
         const chartFul = this.$refs.fullChart
         if (chartFul) {
         if (chartFul) {
-          _this.setFullOptions(_this.chartData)// 画图
+          _this.setFullOptions()// 画图
         }
         }
       })
       })
     },
     },
-    setOptions({realList,dqList,cdqList} = {}) {
-      const _this = this
+    setOptions() {
       let option = JSON.parse(JSON.stringify(weatherLineOption))
       let option = JSON.parse(JSON.stringify(weatherLineOption))
-      option.series[0].data = realList
-      option.series[1].data = dqList
-      option.series[2].data = cdqList
-      option.series[3].data = cdqList
+      if(sessionStorage.getItem('screen-weather-type')){
+        if (sessionStorage.getItem('screen-weather-type').includes('wind')){
+          option.legend.data = ['平均轮毂风速']
+          option.yAxis[0].name='m/s'
+          option.series=[{
+            name:'平均轮毂风速',
+            type:'line',
+            data: this.windChartData.map(_=>_.value)
+          }]
+        }
+        else{
+          option.legend.data = ['平均总辐射']
+          option.yAxis[0].name='W/㎡'
+          option.series=[{
+            name:'平均总辐射',
+            type:'line',
+            data: this.gfChartData.map(_=>_.value)
+          }]
+        }
+      }else{
+        option.legend.data = ['平均轮毂风速']
+        option.yAxis[0].name='m/s'
+        option.series=[{
+          name:'平均轮毂风速',
+          type:'line',
+          data: this.windChartData.map(_=>_.value)
+        }]
+      }
       this.weatherChart.setOption(option, true)
       this.weatherChart.setOption(option, true)
       window.addEventListener("resize", this.chartsResize);
       window.addEventListener("resize", this.chartsResize);
     },
     },
@@ -112,14 +338,64 @@ export default {
         this.weatherChart.resize();
         this.weatherChart.resize();
       }
       }
     },
     },
-    setFullOptions({realList,dqList,cdqList} = {}) {
-      this.fullChart = this.$echarts.init(document.getElementById('main'));
+    setFullOptions() {
+      // 先调用后端获取每个场站具体曲线
+      let weatherType
+      if(sessionStorage.getItem('screen-weather-type')){
+        weatherType = sessionStorage.getItem('screen-weather-type')
+      }else{
+        weatherType = 'wind'
+      }
+      let queryParams = {
+        "weatherType": weatherType
+      }
       let option = JSON.parse(JSON.stringify(weatherLineOption))
       let option = JSON.parse(JSON.stringify(weatherLineOption))
-      option.series[0].data = realList
-      option.series[1].data = dqList
-      option.series[2].data = cdqList
-      option.series[3].data = cdqList
-      this.fullChart.setOption(option, true)
+      let index = 0;
+      this.$axios({url: '/largeScreenController/forecastNwpFull', method: 'get',params: queryParams}).then(response => {
+        let stationObj = response.data
+        for (let key in stationObj) {
+          for (let i = 0; i < stationObj[key].length; i++) {
+            stationObj[key][i] = stationObj[key][i] == -99 ? null : stationObj[key][i]
+          }
+          option.legend.data.push(key)
+
+          let sValue = {
+            name: key,
+            type: 'line',
+            yAxisIndex: 0,
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: this.lineStyle[index].itemStyle,
+            data: stationObj[key]
+          }
+          option.series.push(sValue)
+          index++;
+        }
+
+        if(sessionStorage.getItem('screen-weather-type')){
+          if (sessionStorage.getItem('screen-weather-type').includes('wind')){
+            option.yAxis[0].name='m/s'
+          }
+          else{
+            option.yAxis[0].name='W/㎡'
+
+          }
+        }else{
+          option.yAxis[0].name='m/s'
+        }
+        this.fullChart = this.$echarts.init(document.getElementById('main'));
+        this.fullChart.setOption(option, true)
+      }).catch(err => {
+      })
+      console.log(option)
+
     },
     },
     /**
     /**
      * 切换气象预测按钮
      * 切换气象预测按钮
@@ -132,6 +408,7 @@ export default {
       activeItem.classList.add('btu-no-checked')
       activeItem.classList.add('btu-no-checked')
       clickItem.classList.remove('btu-no-checked')
       clickItem.classList.remove('btu-no-checked')
       clickItem.classList.add('btu-checked')
       clickItem.classList.add('btu-checked')
+      this.setOptions()
     },
     },
   }
   }
 }
 }

+ 2 - 133
cpp-ui/src/views/largeScreen/echarts-data.js

@@ -370,7 +370,7 @@ export let weatherLineOption = {
     bottom: 30
     bottom: 30
   },
   },
   legend: {
   legend: {
-    data: ['实际功率', '短期', '超短期','辐照度'],
+    data: [],
     itemStyle: {
     itemStyle: {
       opacity: 0
       opacity: 0
     },
     },
@@ -448,140 +448,9 @@ export let weatherLineOption = {
           color: '#394458',
           color: '#394458',
         },
         },
       },
       },
-    },{
-      name: 'W/㎡',
-      type: 'value',
-      nameTextStyle: {color: '#89BFE5',fontSize: fontSize(.14)},
-      axisLabel: {
-        textStyle: {
-          fontSize: fontSize(.12), color: '#89BFE5'
-        }
-      },
-      axisTick: {
-        show: false,
-      },
-      axisLine: {
-        lineStyle: {
-          color: '#394458',
-        },
-      },
-      splitLine: {
-        lineStyle: {
-          type: 'dashed',
-          color: '#394458',
-        },
-      },
     }
     }
   ],
   ],
-  series: [
-    {
-      name: '实际功率',
-      type: 'line',
-      itemStyle: {
-        color: 'rgb(2,207,253)'
-      },
-      areaStyle: {
-        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-          {
-            offset: 0,
-            color: 'rgb(2,205,251)'
-          },
-          {
-            offset: 1,
-            color: 'rgba(2,205,251,0)'
-          }
-        ])
-      },
-      lineStyle: {
-        width: 1
-      },
-      emphasis: {
-        focus: 'series'
-      },
-      // prettier-ignore
-      data: []
-    },
-    {
-      name: '短期',
-      type: 'line',
-      itemStyle: {
-        color: 'rgb(175,129,251)'
-      },
-      areaStyle: {
-        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-          {
-            offset: 0,
-            color: 'rgb(174,128,249)'
-          },
-          {
-            offset: 1,
-            color: 'rgba(173,127,247,0)'
-          }
-        ])
-      },
-      lineStyle: {
-        width: 1
-      },
-      emphasis: {
-        focus: 'series'
-      },
-      // prettier-ignore
-      data: []
-    }, {
-      name: '超短期',
-      type: 'line',
-      itemStyle: {
-        color: 'rgb(135,247,207)'
-      },
-      areaStyle: {
-        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-          {
-            offset: 0,
-            color: 'rgb(134,245,205)'
-          },
-          {
-            offset: 1,
-            color: 'rgba(134,245,205,0)'
-          }
-        ])
-      },
-      lineStyle: {
-        width: 1
-      },
-      emphasis: {
-        focus: 'series'
-      },
-      // prettier-ignore
-      data: []
-    },{
-      name: '辐照度',
-      yAxisIndex:1,
-      type: 'line',
-      itemStyle: {
-        color: 'rgb(253,128,2)'
-      },
-      areaStyle: {
-        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-          {
-            offset: 0,
-            color: 'rgb(253,128,2)'
-          },
-          {
-            offset: 1,
-            color: 'rgba(2,205,251,0)'
-          }
-        ])
-      },
-      lineStyle: {
-        width: 1
-      },
-      emphasis: {
-        focus: 'series'
-      },
-      // prettier-ignore
-      data: []
-    },
-  ]
+  series: []
 }
 }
 
 
 /**
 /**

+ 16 - 1
cpp-ui/src/views/largeScreen/index.vue

@@ -556,7 +556,18 @@ export default {
       }
       }
     },
     },
     async getBizData() {
     async getBizData() {
-      await this.$axios({url: '/largeScreenController/getBizData', method: 'get'}).then(response => {
+      // 气象站预测按钮类型
+      let weatherType
+      if(sessionStorage.getItem('screen-weather-type')){
+        weatherType = sessionStorage.getItem('screen-weather-type')
+      }else{
+        weatherType = 'wind'
+      }
+      let queryParams = {
+        "weatherType": weatherType
+      }
+
+      await this.$axios({url: '/largeScreenController/getBizData', method: 'get',params: queryParams}).then(response => {
         this.mockData()
         this.mockData()
         // 顶部场站数据统计值
         // 顶部场站数据统计值
         let electricFieldDataTotalDto = response.data.electricFieldDataTotalDto
         let electricFieldDataTotalDto = response.data.electricFieldDataTotalDto
@@ -575,6 +586,10 @@ export default {
 
 
         this.rightBottomParams = response.data.forecastGeneratingMap
         this.rightBottomParams = response.data.forecastGeneratingMap
 
 
+
+        this.rightMiddleParams = response.data.forecastNwpMap
+
+
         // this.digitalDisk[0].num = this.formatNumber(sumMap.realSum) + ''
         // this.digitalDisk[0].num = this.formatNumber(sumMap.realSum) + ''
         // this.digitalDisk[1].num = this.formatNumber(sumMap.ableSum) + ''
         // this.digitalDisk[1].num = this.formatNumber(sumMap.ableSum) + ''
         // this.digitalDisk[2].num = this.formatNumber(sumMap.theorySum) + ''
         // this.digitalDisk[2].num = this.formatNumber(sumMap.theorySum) + ''

+ 9 - 11
cpp-ui/src/views/stationDataQuery/historyforecastdata/index.vue

@@ -100,7 +100,7 @@ export default {
       // 日期使用
       // 日期使用
       pickerOptions: {
       pickerOptions: {
         disabledDate: (time) => {
         disabledDate: (time) => {
-          return time.getTime() > new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000  - 1;
+          return time.getTime() > new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1;
         }
         }
       },
       },
       modId: '',//备用id
       modId: '',//备用id
@@ -709,18 +709,17 @@ export default {
       this.currentPage = currentPage
       this.currentPage = currentPage
       this.pageSize = pageSize
       this.pageSize = pageSize
     },
     },
-    exportFile(){
-      if (this.tableData.length>0){
+    exportFile() {
+      if (this.tableData.length > 0) {
         const item = this.stationList.find(item => item.value === this.stationCode)
         const item = this.stationList.find(item => item.value === this.stationCode)
         let filename = item.label
         let filename = item.label
         // 文件名日期
         // 文件名日期
         let startTime = this.$moment(this.dateTime[0]).format('YYYY-MM-DD')
         let startTime = this.$moment(this.dateTime[0]).format('YYYY-MM-DD')
         let endTime = this.$moment(this.dateTime[1]).format('YYYY-MM-DD')
         let endTime = this.$moment(this.dateTime[1]).format('YYYY-MM-DD')
-        if (startTime===endTime){
-          filename=filename+startTime
-        }
-        else{
-          filename=filename+startTime+'至'+endTime
+        if (startTime === endTime) {
+          filename = filename + startTime
+        } else {
+          filename = filename + startTime + '至' + endTime
         }
         }
         this.$refs.xTable.exportData({
         this.$refs.xTable.exportData({
           filename: filename,
           filename: filename,
@@ -729,8 +728,7 @@ export default {
           isFooter: true,
           isFooter: true,
           data: this.tableData
           data: this.tableData
         })
         })
-      }
-      else{
+      } else {
         this.$message.error("列表无数据不能导出文件!")
         this.$message.error("列表无数据不能导出文件!")
         return
         return
       }
       }
@@ -842,7 +840,7 @@ export default {
         },
         },
         xAxis: [{
         xAxis: [{
           type: 'category',
           type: 'category',
-          boundaryGap: false,
+          // boundaryGap: false,
           // axisLine: {
           // axisLine: {
           //   lineStyle: {
           //   lineStyle: {
           //     color: this.lineColor
           //     color: this.lineColor