From 024c9f73fce8ab5f94c3af0c237bcf102a547766 Mon Sep 17 00:00:00 2001
From: dcb <xgybdcb@163.com>
Date: 星期三, 25 六月 2025 17:09:11 +0800
Subject: [PATCH] 将实时模拟的帧数调整为可配置参数

---
 src/main/java/com/se/nsl/service/RealTimeSimulationService.java |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/se/nsl/service/RealTimeSimulationService.java b/src/main/java/com/se/nsl/service/RealTimeSimulationService.java
index c835224..404d4c3 100644
--- a/src/main/java/com/se/nsl/service/RealTimeSimulationService.java
+++ b/src/main/java/com/se/nsl/service/RealTimeSimulationService.java
@@ -3,7 +3,7 @@
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.se.nsl.config.GaugeServer;
+import com.se.nsl.config.RealTimeSimulationConfig;
 import com.se.nsl.config.PropertiesConfig;
 import com.se.nsl.domain.dto.*;
 import com.se.nsl.domain.po.RainGauge;
@@ -47,7 +47,7 @@
 
     private final ObjectMapper mapper = new ObjectMapper();
     @Resource
-    private GaugeServer gaugeServer;
+    private RealTimeSimulationConfig rtsConfig;
     private static final long MILLIS_OF_ONE_DAY = 86400000;
 
     public String realTimeSimulate(Simu simu) throws IOException {
@@ -71,7 +71,7 @@
     }
 
     private long getCurrentTime() {
-        double offsetDays = gaugeServer.getOffsetDays();
+        double offsetDays = rtsConfig.getOffsetDays();
         long millis = (long) (offsetDays * MILLIS_OF_ONE_DAY);
         return System.currentTimeMillis() - millis;
     }
@@ -186,7 +186,7 @@
             configVo.setStation(stationFile.getAbsolutePath());
         }
         int realTimeSimulateTime = 300; //妯℃嫙鏃堕棿锛岄粯璁や负5min锛屽嵆300s
-        int realTimeInterval = 60; //姣忓抚鐨勯棿闅旀椂闂达紝榛樿涓�60s,60s鐢熸垚涓�甯�
+        int realTimeInterval = rtsConfig.getRealTimeInterval(); //姣忓抚鐨勯棿闅旀椂闂�
         List<String> rainGauge = new ArrayList<>();
         rainGauge.add(newDatFile.getAbsolutePath());//raingage file
         rainGauge.add("mm/min");
@@ -211,7 +211,7 @@
             configVo.setStation(stationFile.getAbsolutePath());
         }
         int realTimeSimulateTime = 300; //妯℃嫙鏃堕棿锛岄粯璁や负5min锛屽嵆300s
-        int realTimeInterval = 60; //姣忓抚鐨勯棿闅旀椂闂达紝榛樿涓�60s,60s鐢熸垚涓�甯�
+        int realTimeInterval = rtsConfig.getRealTimeInterval(); //姣忓抚鐨勯棿闅旀椂闂�
         configVo.getRaingage().set(0, newDatFile.getAbsolutePath()); //raingage file
         ResultVo result = configVo.getResult();
         Integer lastFrames = result.getLastFrames();
@@ -259,7 +259,7 @@
         int hour = dateTime.getHour();
         int minute = dateTime.getMinute();
         String id = gauge.getId();
-        long someMinutesAgo = currentTime - TimeUnit.MINUTES.toMillis(gaugeServer.getRequestOffsetMinutes());
+        long someMinutesAgo = currentTime - TimeUnit.MINUTES.toMillis(rtsConfig.getRequestOffsetMinutes());
         String startTime = TimeFormatUtil.formatTime(someMinutesAgo, YYYY_MM_DD_HH_MM_SS);
         String endTime = TimeFormatUtil.formatTime(currentTime, YYYY_MM_DD_HH_MM_SS);
         double intensity = getIntensityByDeviceId(id, startTime, endTime); //淇濈暀鎸囧畾浣嶆暟灏忔暟
@@ -276,8 +276,8 @@
         filterObject.setDeviceCode(deviceId);
         filterObject.setSendTimeList(Arrays.asList(startTime, endTime));
         input.setFilterObject(filterObject);
-        String url = gaugeServer.getUrl();
-        String token = gaugeServer.getToken();
+        String url = rtsConfig.getUrl();
+        String token = rtsConfig.getToken();
         ResponseEntity<String> post = HttpRequestUtil.post(url, input, String.class, token);
         String body = post.getBody();
         JsonNode jsonNode = mapper.readTree(body);

--
Gitblit v1.9.3