Преглед на файлове

[0924] 优化风速取值

taosj преди 1 месец
родител
ревизия
f04de7ba87

+ 17 - 7
forecast-backend-server/src/main/java/com/ufo/project/forecast/shortterm/weather/service/impl/DataShortTermWeatherForecastRawServiceImpl.java

@@ -78,7 +78,7 @@ public class DataShortTermWeatherForecastRawServiceImpl implements IDataShortTer
         for (DataShortTermWeatherForecastRaw record : list)
         {
             // 风速:优先取ws10,ws10为空或无法解析时取ws100
-            Double ws = parseDouble(record.getWs10());
+            Double ws = getWs(record);
             String wdValue = record.getWd10();
             if (ws == null)
             {
@@ -154,12 +154,8 @@ public class DataShortTermWeatherForecastRawServiceImpl implements IDataShortTer
 
         for (DataShortTermWeatherForecastRaw record : list)
         {
-            // 风速:优先取ws10,ws10为空或无法解析时取ws100
-            Double ws = parseDouble(record.getWs10());
-            if (ws == null)
-            {
-                ws = parseDouble(record.getWs100());
-            }
+            // 风速
+            Double ws = getWs(record);
             // 过滤风速为空或不能转为数字的记录
             if (ws == null)
             {
@@ -191,6 +187,20 @@ public class DataShortTermWeatherForecastRawServiceImpl implements IDataShortTer
         return result;
     }
 
+    private Double getWs(DataShortTermWeatherForecastRaw record)
+    {
+        Double ws = parseDouble(record.getWs());
+        if(ws == null)
+        {
+            ws = parseDouble(record.getWs10());
+        }
+        if(ws == null)
+        {
+            ws = parseDouble(record.getWs100());
+        }
+        return ws;
+    }
+
     /**
      * 统计场站指定时间范围内的温度曲线数据
      *

+ 5 - 5
forecast-backend-server/src/main/resources/mybatis/weather/DataShortTermWeatherForecastRawMapper.xml

@@ -387,7 +387,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             data_model_id, data_model_name, source_id, source_name,
             entity_id, entity_type, create_time, start_time, forecast_time,
             pre_days, lead_time, station_id, station_name,
-            tcc, hcc, lcc, mcc, tsfc, rhsfc, diffirr, directirr, tirr
+            tcc, hcc, lcc, mcc, tsfc, rhsfc, diffirr, directirr, tirr, ws,
         ) values
         <foreach collection="list" item="item" separator=",">
             (
@@ -400,7 +400,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{item.preDays}, #{item.leadTime}, #{item.stationId}, #{item.stationName},
                 #{item.tcc,jdbcType=VARCHAR}, #{item.hcc,jdbcType=VARCHAR}, #{item.lcc,jdbcType=VARCHAR},
                 #{item.mcc,jdbcType=VARCHAR}, #{item.tsfc,jdbcType=VARCHAR}, #{item.rhsfc,jdbcType=VARCHAR},
-                #{item.diffirr,jdbcType=VARCHAR}, #{item.directirr,jdbcType=VARCHAR}, #{item.tirr,jdbcType=VARCHAR}
+                #{item.diffirr,jdbcType=VARCHAR}, #{item.directirr,jdbcType=VARCHAR}, #{item.tirr,jdbcType=VARCHAR}, #{item.ws,jdbcType=VARCHAR}
             )
         </foreach>
     </insert>
@@ -411,7 +411,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         set latitude = v.latitude, longitude = v.longitude,
             tcc = v.tcc, hcc = v.hcc, lcc = v.lcc, mcc = v.mcc,
             tsfc = v.tsfc, rhsfc = v.rhsfc,
-            diffirr = v.diffirr, directirr = v.directirr, tirr = v.tirr
+            diffirr = v.diffirr, directirr = v.directirr, tirr = v.tirr, ws = v.ws
         from (values
         <foreach collection="list" item="item" separator=",">
             (#{item.Id}::bigint,
@@ -420,9 +420,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              #{item.lcc,jdbcType=VARCHAR}::varchar, #{item.mcc,jdbcType=VARCHAR}::varchar,
              #{item.tsfc,jdbcType=VARCHAR}::varchar, #{item.rhsfc,jdbcType=VARCHAR}::varchar,
              #{item.diffirr,jdbcType=VARCHAR}::varchar, #{item.directirr,jdbcType=VARCHAR}::varchar,
-             #{item.tirr,jdbcType=VARCHAR}::varchar)
+             #{item.tirr,jdbcType=VARCHAR}::varchar, #{item.ws,jdbcType=VARCHAR}::varchar)
         </foreach>
-        ) as v(_id, latitude, longitude, tcc, hcc, lcc, mcc, tsfc, rhsfc, diffirr, directirr, tirr)
+        ) as v(_id, latitude, longitude, tcc, hcc, lcc, mcc, tsfc, rhsfc, diffirr, directirr, tirr, ws)
         where t._id = v._id
     </update>
 </mapper>