From 73ff23c1359f5688760ea0279c526136414127ac Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 16 六月 2023 19:01:17 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/entity/Report.java |  131 +++++++++++++++++++++++++++++--------------
 1 files changed, 88 insertions(+), 43 deletions(-)

diff --git a/src/main/java/com/yssh/entity/Report.java b/src/main/java/com/yssh/entity/Report.java
index 905c81b..42c4d25 100644
--- a/src/main/java/com/yssh/entity/Report.java
+++ b/src/main/java/com/yssh/entity/Report.java
@@ -3,8 +3,6 @@
 import com.yssh.utils.CalculateUtils;
 import io.swagger.annotations.ApiModelProperty;
 
-import java.text.SimpleDateFormat;
-
 /**
  * 鎶ュ憡
  * @author WWW
@@ -21,61 +19,76 @@
     private double lat;
 
     @ApiModelProperty(value = "鏁板��")
-    private double value;
+    private double val;
+
+    @ApiModelProperty(value = "鍘诲勾鏁板��")
+    private double lastVal;
 
     @ApiModelProperty(value = "鏃堕棿")
     private String time;
 
-    @ApiModelProperty(value = "500m鑼冨洿鏈�澶у��")
-    private double max;
-
-    @ApiModelProperty(value = "璺濈")
-    private double dis;
+    @ApiModelProperty(value = "椋庨��")
+    private double speed;
 
     @ApiModelProperty(value = "鏂瑰悜")
     private String dir;
 
+    @ApiModelProperty(value = "500m鑼冨洿鏈�澶у��")
+    private double maxVal;
+
+    @ApiModelProperty(value = "璺濈")
+    private double dis;
+
+    @ApiModelProperty(value = "500m鑼冨洿鏈�澶у�肩殑鏂瑰悜")
+    private String maxDir;
+
+    @ApiModelProperty(value = "鏄惁涓�鑷�")
+    private int isSame;
+
     public Report() {
     }
 
-    public Report(String name, double lon, double lat, double value, String time, double max, double dis, String dir) {
+    public Report(String name, double lon, double lat, double val, double lastVal, String time, double speed, String dir, double maxVal, double dis, String maxDir, int isSame) {
         this.name = name;
         this.lon = lon;
         this.lat = lat;
-        this.value = value;
+        this.val = val;
+        this.lastVal = lastVal;
         this.time = time;
-        this.max = max;
-        this.dis = dis;
+        this.speed = speed;
         this.dir = dir;
+        this.maxVal = maxVal;
+        this.dis = dis;
+        this.maxDir = maxDir;
+        this.isSame = isSame;
     }
 
     /**
      * 璁$畻鐢熸垚鎶ュ憡
      */
-    public static Report calcReport(WarningDetail wd, DistanceSuYuan suYuan) {
-        String[] sirs = wd.getSuYuanId().split("_");
-        int x = Integer.parseInt(sirs[0]);
-        int y = Integer.parseInt(sirs[1]);
-        double lon = CalculateUtils.getLon(x, y);
-        double lat = CalculateUtils.getLat(x, y);
+    public static Report calcReport(WarningDetail wd, DistanceSuYuan suYuan, DistanceSuYuan suMax) {
+        Coordinate c1 = CalculateUtils.getCoordinate(suYuan);
+        Coordinate c2 = CalculateUtils.getCoordinate(suMax);
 
-        String time = CalculateUtils.getYearMonthDayHour(wd.getCreateTime());
+        String time = wd.getTableName().replace("su_yuan_", "");
+        double lastVal = 0;
+        double speed1 = CalculateUtils.getWindSpeed(suYuan.getV(), suYuan.getU());
+        double direction1 = CalculateUtils.getWindDirection(suYuan.getV(), suYuan.getU());
+        String dir = CalculateUtils.getDir(direction1);
 
-        double max = suYuan.getVocsValue();
+        double maxVal = suMax.getVocsValue();
 
-        String[] sirs2=suYuan.getId().split("_");
-        int x2 = Integer.parseInt(sirs2[0]);
-        int y2 = Integer.parseInt(sirs2[1]);
-        double lon2 = CalculateUtils.getLon(x2, y2);
-        double lat2 = CalculateUtils.getLat(x2, y2);
+        double dis = CalculateUtils.getDistance2(c1.getX(), c1.getY(), c2.getX(), c2.getY());
+        double dis1 = CalculateUtils.getDistance1(c1.getX(), c1.getY(), c2.getX(), c2.getY());
+        double angle = CalculateUtils.getAngle(c1.getX(), c1.getY(), c2.getX(), c2.getY());
 
-        double dis = CalculateUtils.getDistance2(lon, lat, lon2, lat2);
-        double dis1 = CalculateUtils.getDistance1(lon, lat, lon2, lat2);
-        double angle = CalculateUtils.getAngle(lon, lat, lon2, lat2);
+        double speed2 = CalculateUtils.getWindSpeed(suMax.getV(), suMax.getU());
+        double direction2 = CalculateUtils.getWindDirection(suMax.getV(), suMax.getU());
+        String maxDir = CalculateUtils.getDir(direction2);
+        int isSame = (Math.abs(direction1 - direction2) < 15 && Math.abs(speed1 - speed2) < 0.3) ? 1 : 0;
 
-        String dir = "";
-
-        return new Report(wd.getLocationName(), lon, lat, wd.getValue(), time, max, dis, dir);
+        return new Report(wd.getLocationName(), c1.getX(), c1.getY(), wd.getValue(), lastVal, time,
+                speed1, dir, maxVal, dis, maxDir, isSame);
     }
 
     public String getName() {
@@ -102,12 +115,20 @@
         this.lat = lat;
     }
 
-    public double getValue() {
-        return value;
+    public double getVal() {
+        return val;
     }
 
-    public void setValue(double value) {
-        this.value = value;
+    public void setVal(double val) {
+        this.val = val;
+    }
+
+    public double getLastVal() {
+        return lastVal;
+    }
+
+    public void setLastVal(double lastVal) {
+        this.lastVal = lastVal;
     }
 
     public String getTime() {
@@ -118,12 +139,28 @@
         this.time = time;
     }
 
-    public double getMax() {
-        return max;
+    public double getSpeed() {
+        return speed;
     }
 
-    public void setMax(double max) {
-        this.max = max;
+    public void setSpeed(double speed) {
+        this.speed = speed;
+    }
+
+    public String getDir() {
+        return dir;
+    }
+
+    public void setDir(String dir) {
+        this.dir = dir;
+    }
+
+    public double getMaxVal() {
+        return maxVal;
+    }
+
+    public void setMaxVal(double maxVal) {
+        this.maxVal = maxVal;
     }
 
     public double getDis() {
@@ -134,11 +171,19 @@
         this.dis = dis;
     }
 
-    public String getDir() {
-        return dir;
+    public String getMaxDir() {
+        return maxDir;
     }
 
-    public void setDir(String dir) {
-        this.dir = dir;
+    public void setMaxDir(String maxDir) {
+        this.maxDir = maxDir;
+    }
+
+    public int getIsSame() {
+        return isSame;
+    }
+
+    public void setIsSame(int isSame) {
+        this.isSame = isSame;
     }
 }

--
Gitblit v1.9.3