From 2f55cebbad3dea187a5f91d16ec80a9677dab699 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 13 十一月 2024 11:16:53 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/entity/Report.java | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 233 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yssh/entity/Report.java b/src/main/java/com/yssh/entity/Report.java new file mode 100644 index 0000000..a6850fa --- /dev/null +++ b/src/main/java/com/yssh/entity/Report.java @@ -0,0 +1,233 @@ +package com.yssh.entity; + +import com.yssh.utils.CalculateUtils; +import io.swagger.annotations.ApiModelProperty; + +public class Report { + @ApiModelProperty(value = "婧簮ID") + private String id; + + @ApiModelProperty(value = "鐐逛綅鍚嶇О") + private String name; + + @ApiModelProperty(value = "缁忓害") + private double lon; + + @ApiModelProperty(value = "绾害") + private double lat; + + @ApiModelProperty(value = "鏁板��") + private double val; + + @ApiModelProperty(value = "鍘诲勾鏁板��") + private Double lastVal; + + @ApiModelProperty(value = "鏃堕棿") + private String time; + + @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; + + @ApiModelProperty(value = "鏈�澶у�肩殑ID") + private String maxId; + + @ApiModelProperty(value = "鏈�澶у�肩殑鍦板悕") + private String maxAddr; + + @ApiModelProperty(value = "婧簮绫�") + private SuYuan700 su; + + public Report() { + } + + public Report(String id, String name, double lon, double lat, double val, String time, double speed, + String dir, double maxVal, double dis, String maxDir, int isSame, String maxId, String maxAddr) { + this.id = id; + this.name = name; + this.lon = lon; + this.lat = lat; + this.val = val; + this.time = time; + this.speed = speed; + this.dir = dir; + this.maxVal = maxVal; + this.dis = dis; + this.maxDir = maxDir; + this.isSame = isSame; + this.maxId = maxId; + this.maxAddr = maxAddr; + } + + /** + * 璁$畻鐢熸垚鎶ュ憡 + */ + public static Report calcReport(WarningDetail wd, DistanceSuYuan suYuan, DistanceSuYuan suMax) { + Coordinate c1 = CalculateUtils.getCoordinate(suYuan); + Coordinate c2 = CalculateUtils.getCoordinate(suMax); + + String time = wd.getTableName().replace("su_yuan_", ""); + double speed1 = CalculateUtils.round2(CalculateUtils.getWindSpeed(suYuan.getV(), suYuan.getU())); + double direction1 = CalculateUtils.getWindDirection(suYuan.getV(), suYuan.getU()); + String dir = CalculateUtils.getDir(direction1); + + double maxVal = suMax.getVocsValue(); + + //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.getAngle2(c1.getX(), c1.getY(), c2.getX(), c2.getY()); + + double speed2 = CalculateUtils.getWindSpeed(suMax.getV(), suMax.getU()); + double direction2 = CalculateUtils.getWindDirection(suMax.getV(), suMax.getU()); + String maxDir = CalculateUtils.getDir(direction2); // CalculateUtils.getDir(angle); + int isSame = (Math.abs(direction1 - direction2) <= 45 && Math.abs(speed1 - speed2) <= 0.5) ? 1 : 0; + + String[] strs = suMax.getId().split("_"); + String maxId = (Integer.parseInt(strs[0]) / 10) + "_" + (Integer.parseInt(strs[1]) / 10); + + return new Report(wd.getSuYuanId(), wd.getLocationName(), c1.getX(), c1.getY(), wd.getValue(), time, + speed1, dir, maxVal, dis1, maxDir, isSame, maxId, suMax.getAddr()); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getVal() { + return val; + } + + public void setVal(double val) { + this.val = val; + } + + public Double getLastVal() { + return lastVal; + } + + public void setLastVal(Double lastVal) { + this.lastVal = lastVal; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public double getSpeed() { + return speed; + } + + 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() { + return dis; + } + + public void setDis(double dis) { + this.dis = dis; + } + + public String getMaxDir() { + return maxDir; + } + + public void setMaxDir(String maxDir) { + this.maxDir = maxDir; + } + + public int getIsSame() { + return isSame; + } + + public void setIsSame(int isSame) { + this.isSame = isSame; + } + + public String getMaxId() { + return maxId; + } + + public void setMaxId(String maxId) { + this.maxId = maxId; + } + + public String getMaxAddr() { + return maxAddr; + } + + public void setMaxAddr(String maxAddr) { + this.maxAddr = maxAddr; + } + + public SuYuan700 getSu() { + return su; + } + + public void setSu(SuYuan700 su) { + this.su = su; + } +} -- Gitblit v1.9.3