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

Merge remote-tracking branch 'origin/master'

xushili преди 2 години
родител
ревизия
03bd1a376c

+ 6 - 6
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/WindspeedforecastContrast.java

@@ -65,31 +65,31 @@ public class WindspeedforecastContrast implements Serializable {
 
     public String getActualpowerRate() {
         if (actualpowertq == null || actualpower == null || actualpower.equals(0.0f)) return null;
-        return String.format("%.2f", actualpowertq / actualpower) + "%";
+        return String.format("%.2f", actualpower / actualpowertq  * 100) + "%";
     }
 
     public String getForecastpowerRate() {
         if (forecastpowertq == null || forecastpower == null || forecastpower.equals(0.0f)) return null;
-        return String.format("%.2f", forecastpowertq / forecastpower) + "%";
+        return String.format("%.2f", forecastpower / forecastpowertq  * 100) + "%";
     }
 
     public String getForecastpowerspRate() {
         if (forecastpowersptq == null || forecastpowersp == null || forecastpowersp.equals(0.0f)) return null;
-        return String.format("%.2f", forecastpowersptq / forecastpowersp) + "%";
+        return String.format("%.2f", forecastpowersp / forecastpowersptq  * 100) + "%";
     }
 
     public String getActualwindspeedRate() {
         if (actualwindspeedtq == null || actualwindspeed == null || actualwindspeed.equals(0.0f)) return null;
-        return String.format("%.2f", actualwindspeedtq / actualwindspeed) + "%";
+        return String.format("%.2f", actualwindspeed / actualwindspeedtq  * 100) + "%";
     }
 
     public String getForecastwindspeedRate() {
         if (forecastwindspeedtq == null || forecastwindspeed == null || forecastwindspeed.equals(0.0f)) return null;
-        return String.format("%.2f", forecastwindspeedtq / forecastwindspeed) + "%";
+        return String.format("%.2f", forecastwindspeed / forecastwindspeedtq  * 100) + "%";
     }
 
     public String getForecastwindspeedspRate() {
         if (forecastwindspeedsptq == null || forecastwindspeedsp == null || forecastwindspeedsp.equals(0.0f)) return null;
-        return String.format("%.2f", forecastwindspeedsptq / forecastwindspeedsp) + "%";
+        return String.format("%.2f", forecastwindspeedsp / forecastwindspeedsptq  * 100) + "%";
     }
 }

+ 5 - 5
gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/master/WindspeedforecastshorttermServiceImpl.java

@@ -20,10 +20,7 @@ import org.apache.kudu.client.*;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -136,7 +133,10 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
             wsfcc.setForecastwindspeedsptq(l.getForecastwindspeed());
         });
 
-        return JsonResult.successData(ResultCode.SUCCESS,windspeedforecastContrasts);
+        //根据时间排序
+        List<WindspeedforecastContrast> collect = windspeedforecastContrasts.stream().sorted(Comparator.comparing(WindspeedforecastContrast::getCalctime)).collect(Collectors.toList());
+
+        return JsonResult.successData(ResultCode.SUCCESS, collect);
     }
 
     /**