Kaynağa Gözat

增加nwp时间条件与参数关联

xusl 2 yıl önce
ebeveyn
işleme
e4cf48089d

+ 28 - 0
backend/src/main/java/com/jiayue/ssi/controller/ForecastPowerShortTermController.java

@@ -29,6 +29,8 @@ import java.util.Map;
 public class ForecastPowerShortTermController {
     @Autowired
     ForecastPowerShortTermService forecastPowerShortTermService;
+    @Autowired
+    SysParameterService sysParameterService;
 
     /**
      * 获取短期分页信息
@@ -66,6 +68,32 @@ public class ForecastPowerShortTermController {
                 return ResponseVO.fail("pageSize不能是空!");
             }
 
+            if (NumberUtil.isLong(startTime) && NumberUtil.isLong(endTime)){
+                if (Long.parseLong(endTime)-Long.parseLong(startTime)<0){
+                    return ResponseVO.fail("开始时间大于截止时间!");
+                }
+            }
+            else {
+                return ResponseVO.fail("查询时间不正确!");
+            }
+
+            int day = 3;
+            String ycMaxDay = sysParameterService.queryByKey("YC_MAX_DAY","3");
+            if (NumberUtil.isInteger(ycMaxDay)){
+                day = Integer.parseInt(ycMaxDay);
+                if (day<1 || day>7){
+                    return ResponseVO.fail("获取参数中预测最大天数应该是1-7天之间");
+                }
+            }
+            else{
+                return ResponseVO.fail("预测查询最大天数不是整型数值!");
+            }
+
+            // 页面日期天数是否<=参数值
+            if (Long.parseLong(endTime)-Long.parseLong(startTime)> 60 * 60 * 24 * 1000*day){
+                return ResponseVO.fail("最多查询"+day+"天的数据哦!");
+            }
+
             QueryWrapper<ForecastPowerShortTerm> wrapper = new QueryWrapper<>();
             if (StringUtils.isNotEmpty(startTime)) {
                 wrapper.ge("forecast_time", startTime);

+ 1 - 1
backend/src/test/java/com/jiayue/ssi/service/Test.java

@@ -66,6 +66,6 @@ public class Test {
 //        System.out.println(map.get("username"));
 //        System.out.println(map.get("password"));
 
-        System.out.println(SmUtil.sm3("Xsl258369").toUpperCase());
+        System.out.println(SmUtil.sm3("Czp258369").toUpperCase());
     }
 }

+ 10 - 13
ui/src/views/bizManager/forecastPowerShortTerm/index.vue

@@ -108,9 +108,6 @@ export default {
   mounted() {
     this.queryStartTime = this.startTime
     this.queryEndTime = this.endTime
-    this.getDraw()
-    this.getTable()
-
   },
   methods:{
     async getDraw(){
@@ -154,8 +151,15 @@ export default {
       }
       this.$axios.get('/forecastPowerShortTermController/getAll',
         {params: searchParams}).then((res) => {
-        this.tableData = res.data.records
-        this.total = res.data.total
+        if (res.code=='0'){
+          this.tableData = res.data.records
+          this.total = res.data.total
+          this.getDraw()
+        }
+        else if (res.code=='1'){
+          this.$message.error(res.data)
+          return
+        }
       }).catch((error) => {
         // this.$message.error(error)
       })
@@ -216,16 +220,9 @@ export default {
         this.loading = false
         return
       }
-      if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*3){
-        // this.startTime = this.queryStartTime
-        // this.endTime = this.queryEndTime
-        this.$message.error("只能最多查询3天的数据哦")
-        this.loading = false
-        return
-      }
+
       this.queryStartTime = this.startTime
       this.queryEndTime = this.endTime
-      this.getDraw(this.queryStartTime,this.queryEndTime)
       this.currentPage = 1
       this.pageSize = 10
       this.getTable()

+ 1 - 13
ui/src/views/bizManager/nwp/index.vue

@@ -112,16 +112,10 @@ export default {
     }
   },
   created () {
-    // 获取后端业务参数
-
-
   },
   mounted() {
     this.queryStartTime = this.startTime
     this.queryEndTime = this.endTime
-    // this.getDraw()
-    // this.getTable()
-
   },
   methods:{
     async getDraw(){
@@ -232,13 +226,7 @@ export default {
         this.loading = false
         return
       }
-      // if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*3){
-      //   // this.startTime = this.queryStartTime
-      //   // this.endTime = this.queryEndTime
-      //   this.$message.error("只能最多查询3天的数据哦")
-      //   this.loading = false
-      //   return
-      // }
+
       this.queryStartTime = this.startTime
       this.queryEndTime = this.endTime
       this.currentPage = 1