Browse Source

kljoiuoiiuooi8p

xusl 6 months ago
parent
commit
917674c278

+ 20 - 6
cpp-admin/src/main/java/com/cpp/web/controller/regulation/DqRegulationController.java

@@ -1,12 +1,11 @@
 package com.cpp.web.controller.regulation;
 
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateTime;
+
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.cpp.common.core.domain.R;
 import com.cpp.common.utils.DateUtils;
+import com.cpp.system.service.ISysConfigService;
 import com.cpp.web.domain.accuracy.AccuracyPassRate;
 import com.cpp.web.domain.enums.DataSourcesEnum;
 import com.cpp.web.domain.enums.ForecastTypeEnum;
@@ -15,8 +14,6 @@ import com.cpp.web.domain.regulation.TempShortUsual;
 import com.cpp.web.domain.regulation.TempShortUsualDetail;
 import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.domain.station.ForecastPowerShortTermStation;
-import com.cpp.web.domain.station.WeatherStationStatusData;
-import com.cpp.web.domain.station.WindTurbineInfo;
 import com.cpp.web.dto.TempShortRegulationDto;
 import com.cpp.web.service.accuracy.AccuracyPassRateService;
 import com.cpp.web.service.regulation.TempShortRegulationService;
@@ -26,7 +23,6 @@ import com.cpp.web.service.station.ElectricFieldService;
 import com.cpp.web.service.station.ForecastPowerShortTermStationService;
 import com.cpp.web.utils.DateTimeUtil;
 import lombok.RequiredArgsConstructor;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -56,6 +52,8 @@ public class DqRegulationController {
     TempShortUsualService tempShortUsualService;
     @Autowired
     TempShortUsualDetailService tempShortUsualDetailService;
+    @Autowired
+    ISysConfigService configService;
 
 
 
@@ -275,4 +273,20 @@ public class DqRegulationController {
         }
         return R.ok(trialList);
     }
+    /**
+     * 获取短期上报截止时间
+     * @return
+     */
+
+    @GetMapping("/getDqEndTime")
+    public R getDqEndTime() {
+        String dqEndTime = configService.selectConfigByKey("dqEndTime");
+        String[] times = dqEndTime.trim().split(":");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(times[0]));
+        calendar.set(Calendar.MINUTE, Integer.parseInt(times[1]));
+        calendar.set(Calendar.SECOND, 0);
+        return R.ok(DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss"));
+    }
 }

+ 140 - 16
cpp-ui/src/views/regulation/dqRegulation/index.vue

@@ -31,7 +31,7 @@
     <el-row>
       <el-col :span="7">
         <div class="divDescribe">调控策略</div>
-        <div class="divDescribe">调控截止时间:2023-06-01 00:00:00</div>
+        <div class="divDescribe">调控截止时间:{{ this.dqEndTime }}</div>
         <div class="divDescribe">调控方式:调控值=原始值*系数+数值</div>
         <div class="divDescribeBtn">
           <div class="dark-el-input dark-el-button">
@@ -103,7 +103,8 @@
       </el-col>
     </el-row>
     <div class="dark-el-dialog">
-      <el-dialog :visible.sync="usualOpen" :close-on-click-modal="false" width="450px" height="600px">
+      <el-dialog :visible.sync="usualOpen" :before-close="cancelUsual" :close-on-click-modal="false" width="450px"
+                 height="600px">
 
         <el-form ref="usualForm" :model="usualForm" width="430px" label-width="70px">
           <el-row class="mb4">
@@ -147,11 +148,15 @@
       <el-dialog :visible.sync="quickUseOpen" :before-close="cancelQuickUse" :close-on-click-modal="false"
                  style="height: calc(100% - 50px)">
         <div class="reg-config-container flex justify-between">
-          <div>
+          <div class="reg-config-con">
             <!--  策略列表          -->
-            <div class="reg-config flex items-center">
-              <el-radio v-model="vradio" label="1" @click.native.prevent="radioChange('1')">快捷选择历史策略:</el-radio>
-              <div>
+            <div class="reg-config flex">
+              <div class="reg-config-radio" style="margin-top: 15px">
+                <el-radio v-model="vradio" label="1" @click.native.prevent="radioChange('1')">快捷选择历史策略:
+                </el-radio>
+              </div>
+
+              <div class="flex-column reg-config-btu">
                 <!-- 循环生成按钮 -->
                 <el-button
                     v-for="(button, index) in buttons"
@@ -163,7 +168,9 @@
               </div>
             </div>
             <div class="reg-config flex items-center">
-              <el-radio v-model="vradio" label="2" @click.native.prevent="radioChange('2')">选择历史策略:</el-radio>
+              <div class="reg-config-radio">
+                <el-radio v-model="vradio" label="2" @click.native.prevent="radioChange('2')">选择历史策略:</el-radio>
+              </div>
               <div>
                 <el-select ref="selectUsualName" v-model="usualId" placeholder="请选择" popper-class="cpp-popper"
                            :disabled="disabled" @change="changeUsualName">
@@ -176,7 +183,7 @@
                 </el-select>
               </div>
             </div>
-            <div id="currentSelectFunction" style="display: none" class="reg-config flex items-center">
+            <div id="currentSelectFunction" style="display: none;margin-top: 10px" class="reg-config flex items-center">
               <div>当前选择策略:</div>
               <div style="width: 200px">
                 {{ this.currentStrategy }}
@@ -194,6 +201,7 @@
           <!--          <el-divider direction="vertical" style="height: calc(100% - 30px)"></el-divider>-->
           <div>
             <!--   预览表格         -->
+            <span class="flex justify-center" style="font-size: 16px;font-weight: bold;">预览策略展示</span>
             <el-table
                 :data="trialData"
                 height="550px"
@@ -253,6 +261,9 @@ export default {
   name: 'inverterinfo',
   data() {
     return {
+      dqEndTime: '',
+      markLineData: new Array(),
+      visualMapPieces: new Array(),
       trialData: [],
       disabled: true,
       vradio: '1',
@@ -344,6 +355,12 @@ export default {
           bottom: '10%',
           containLabel: true
         },
+        visualMap: {
+          show: false,
+          dimension: 0,
+          seriesIndex: 1,
+          pieces: this.visualMapPieces
+        },
         xAxis: [{
           type: 'category',
           boundaryGap: false,
@@ -392,22 +409,29 @@ export default {
             id: 'a',
             name: '调控值',
             type: 'line',
+            showSymbol: false,
             smooth: true,
             symbol: 'circle',
             symbolSize: 10,
-            showSymbol: false,
             connectNulls: true,
             lineStyle: {
               normal: {
+                color: 'rgb(0,136,212)',
                 width: 2
               }
             },
             itemStyle: {
               normal: {
                 color: 'rgb(0,136,212)',
-                borderWidth: 12
+                borderWidth: 50
               }
             },
+            markLine: {
+              symbol: ['none', 'none'],
+              label: {show: false},
+              data: this.markLineData
+            },
+            areaStyle: {},
             data: []
           },
           {
@@ -460,7 +484,7 @@ export default {
   },
   created() {
     this.getStationCode()
-
+    this.getDqEndTime()
   },
   mounted() {
     this.initChart()
@@ -474,6 +498,51 @@ export default {
   },
   computed: {},
   methods: {
+    // 对改动区域阴影展示
+    getShadow() {
+      this.visualMapPieces = []
+      this.markLineData = []
+      // 定义临时暂存调控点位
+      let tempTkPoint = new Array()
+      // 遍历调控曲线数据,组装阴影修改的部分·
+      for (let i = 0; i < this.tableData.length; i++) {
+        if (this.tableData[i].ysValue != this.tableData[i].tkValue) {
+          tempTkPoint.push(i)
+        }
+      }
+
+      // 封装阴影数据
+      if (!Array.isArray(tempTkPoint) || tempTkPoint.length === 0) {
+        return
+      }
+      tempTkPoint.sort((a, b) => a - b); // 先对数组进行排序
+      let currentGroup = [];
+      let prevNum = tempTkPoint[0] - 1; // 初始化为一个不可能的值
+      for (let num of tempTkPoint) {
+        if (num === prevNum + 1) {
+          currentGroup.push(num);
+        } else {
+          if (currentGroup.length > 0) {
+            const minNum = Math.min(...currentGroup);
+            const maxNum = Math.max(...currentGroup);
+            this.visualMapPieces.push({gt: minNum, lt: maxNum, color: 'rgba(0, 0, 180, 0.4)'});
+            this.markLineData.push({xAxis: minNum})
+            this.markLineData.push({xAxis: maxNum})
+            currentGroup = [];
+          }
+          currentGroup.push(num);
+        }
+        prevNum = num;
+      }
+      // 处理最后一组
+      if (currentGroup.length > 0) {
+        const minNum = Math.min(...currentGroup);
+        const maxNum = Math.max(...currentGroup);
+        this.visualMapPieces.push({gt: minNum, lt: maxNum, color: 'rgba(0, 0, 180, 0.4)'});
+        this.markLineData.push({xAxis: minNum})
+        this.markLineData.push({xAxis: maxNum})
+      }
+    },
     // 策略名称下拉框选择
     changeUsualName(id) {
       const item = this.usualList.find(item => item.id == id)
@@ -587,7 +656,7 @@ export default {
     renderUsual() {
       this.buttons = []
       this.usualId = ''
-      this.currentStrategy=''
+      this.currentStrategy = ''
       // 先获取常用下拉框
       this.$axios.get('/dqUsualController/getUsualList').then(response => {
         this.usualList = response.data
@@ -658,6 +727,13 @@ export default {
       this.resetUsual();
     },
     tkDialog() {
+      // 判断截止时间,超出时间不允许调控
+      const now = new Date();
+      if (now.getTime() > new Date(this.dqEndTime)) {
+        this.$message.warning("截止时间已过,不能进行调控!")
+        return
+      }
+
       if (this.tableData.length == 0) {
         this.$message.warning("调控列表为空,不能操作!")
         return
@@ -721,6 +797,11 @@ export default {
         }
         this.tkData = tkArray
         this.chartOption.series[1].data = this.tkData
+        // 获取阴影
+        this.getShadow()
+        this.chartOption.visualMap.pieces = this.visualMapPieces
+        this.chartOption.series[1].markLine.data = this.markLineData
+
         this.chart.setOption(this.chartOption)
         //再调用updatePosition
         this.updatePosition()
@@ -741,6 +822,7 @@ export default {
         this.refDownData = response.data.refDownData
         this.tkData = response.data.tkDataList
         this.draData()
+
         this.loading = false
       }).catch(() => {
         this.tableData = []
@@ -763,7 +845,11 @@ export default {
       this.chartOption.series[1].data = this.tkData
       this.chartOption.series[2].data = this.refUpData
       this.chartOption.series[3].data = this.refDownData
-      // let data = this.tkData
+      // 获取阴影
+      this.getShadow()
+      this.chartOption.visualMap.pieces = this.visualMapPieces
+      this.chartOption.series[1].markLine.data = this.markLineData
+
       let myChart = this.chart
       let cap = this.capacity
       setTimeout(function () {
@@ -842,6 +928,12 @@ export default {
       this1.tableData[dataIndex].tkValue = this1.tkData[dataIndex][1]
       // 根据调控值更新表格中数值字段,数值=调控值-(原始值*系数)
       this1.tableData[dataIndex].sz = (this1.tkData[dataIndex][1] - (this1.tableData[dataIndex].ysValue * this1.tableData[dataIndex].xs)).toFixed(2)
+      // 获取阴影
+      this.getShadow()
+      this.chartOption.visualMap.pieces = this.visualMapPieces
+      this.chartOption.series[1].markLine.data = this.markLineData
+
+      myChart.setOption(this.chartOption)
       // Update data
       myChart.setOption({
         series: [
@@ -853,8 +945,12 @@ export default {
       });
       this.updatePosition()
     },
-
-
+    // 获取短期截止时间
+    getDqEndTime() {
+      this.$axios({url: '/dqRegulationController/getDqEndTime', method: 'get'}).then(response => {
+        this.dqEndTime = response.data
+      })
+    },
     getStationCode() {
       this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
         this.stationList = response.data
@@ -876,7 +972,7 @@ export default {
   }
 }
 </script>
-<style>
+<style scoped>
 .divDescribe {
   position: relative;
   top: 20px; /* 向下移动15px */
@@ -905,7 +1001,35 @@ export default {
   text-align: center
 }
 
+.reg-config-con {
+//width: 50%; height: 350px;
+  position: relative;
+}
+
 .reg-config {
   margin-top: 5px;
 }
+.reg-config-radio{
+  width: 150px;
+}
+.reg-config-btu {
+  width: 215px;
+  height: 190px;
+  margin-top: 5px;
+}
+
+.dialog-footer {
+  position: absolute;
+  bottom: 0;
+  left: 35%;
+//text-align: center;
+}
+
+/deep/ .reg-config-btu .el-button {
+  margin-top: 5px;
+}
+
+/deep/ .reg-config-btu .el-button + .el-button {
+  margin-left: 0px;
+}
 </style>