From 495292b588949bcb2cb15eaa9657619aca7f5579 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 30 十月 2024 16:18:41 +0800
Subject: [PATCH] 修改降雨文件的jar

---
 src/main/java/com/se/simu/service/UwService.java |   48 ++++++++++++++++++++++++------------------------
 1 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/se/simu/service/UwService.java b/src/main/java/com/se/simu/service/UwService.java
index 634489b..ff3ecfc 100644
--- a/src/main/java/com/se/simu/service/UwService.java
+++ b/src/main/java/com/se/simu/service/UwService.java
@@ -26,6 +26,16 @@
     @Resource
     PropertiesConfig config;
 
+    static Rainfall _rainfall = null;
+
+    public static Rainfall getTainfall() throws Exception {
+        if (null == _rainfall) {
+            _rainfall = new Rainfall();
+        }
+
+        return _rainfall;
+    }
+
     /**
      * 鍒涘缓闄嶉洦鏂囦欢
      * <p>
@@ -40,7 +50,7 @@
         //MWCharArray station = new MWCharArray(config.getRainStation());
         //MWCharArray time = new MWCharArray(startTime);
 
-        Rainfall rainfall = new Rainfall();
+        Rainfall rainfall = getTainfall();
         //rainfall('D:\simu\in\RainGage.dat','Tongzhou','2024-09-29 00:00:00',60,0.5,10)
         Object[] rs = rainfall.rainfall(filePath, config.getRainStation(), startTime,
                 Double.valueOf(data.getDuration()), 0.5, config.getRainPeriod());
@@ -80,15 +90,15 @@
             nr = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"));
             er = new BufferedReader(new InputStreamReader(process.getErrorStream(), "GBK"));
 
-            String errorLine;
-            while ((errorLine = er.readLine()) != null) {
-                log.warn(errorLine);
-            }
-
             String line;
             StringBuilder sb = new StringBuilder();
             while ((line = nr.readLine()) != null) {
                 sb.append(line);
+            }
+
+            String errorLine;
+            while ((errorLine = er.readLine()) != null) {
+                log.warn(errorLine);
             }
 
             // 绛夊緟绋嬪簭鎵ц缁撴潫骞惰緭鍑虹姸鎬�
@@ -124,27 +134,17 @@
         }
     }
 
-    public String getKeyFrame(DataPo data) throws Exception {
-        String cmd = config.getKeyFrameBat() + " " + config.getInPath() + File.separator + data.getInPath() + File.separator + ".save" + File.separator + data.getInPath() + ".sww";
-
-        String str = exec(cmd);
-        if (StringHelper.isEmpty(str) || !str.contains("[")) {
-            throw new Exception("鐢熸垚鍏抽敭甯у嚭閿�");
-        }
-
-        String rs = str.split("\\[", 2)[1].replace("]", "").replace(" ", "");
-        if (StringHelper.isEmpty(rs)) {
-            throw new Exception("鍏抽敭甯т负绌�");
-        }
-
-        return rs;
-    }
-
     public void copeWaterFiles() {
         //
     }
 
-    public void copeDrainFiles() {
-        //
+    public String copeDrainFiles(DataPo data) throws Exception {
+        String time = StringHelper.YMDHMS_FORMAT.format(data.getStartTime());
+        String inPath = config.getInPath() + File.separator + data.getInPath();
+        String sww = inPath + File.separator + ".save" + File.separator + data.getInPath() + ".sww";
+
+        String cmd = config.getSww2tifBat() + " " + sww + " \"" + time + "\" " + data.getEpsg() + " " + inPath;
+
+        return exec(cmd);
     }
 }

--
Gitblit v1.9.3