| | |
| | | import com.yssh.utils.CalculateUtils; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | |
| | | /** |
| | | * 报告 |
| | | * @author WWW |
| | | * @date 2023-06-18 |
| | | */ |
| | | public class Report { |
| | | @ApiModelProperty(value = "溯源ID") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "点位名称") |
| | | private String name; |
| | | |
| | |
| | | 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; |
| | | |
| | | @ApiModelProperty(value = "最大值的ID") |
| | | private String maxId; |
| | | |
| | | @ApiModelProperty(value = "最大值的地名") |
| | | private String maxAddr; |
| | | |
| | | @ApiModelProperty(value = "溯源类") |
| | | private SuYuan700 su; |
| | | |
| | | public Report() { |
| | | } |
| | | |
| | | public Report(String name, double lon, double lat, double value, String time, double max, double dis, String dir) { |
| | | 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.value = value; |
| | | this.val = val; |
| | | 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; |
| | | this.maxId = maxId; |
| | | this.maxAddr = maxAddr; |
| | | } |
| | | |
| | | /** |
| | | * 计算生成报告 |
| | | */ |
| | | 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 speed1 = CalculateUtils.round2(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.getAngle2(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); // CalculateUtils.getDir(angle); |
| | | int isSame = (Math.abs(direction1 - direction2) <= 45 && Math.abs(speed1 - speed2) <= 0.5) ? 1 : 0; |
| | | |
| | | String dir = ""; |
| | | String[] strs = suMax.getId().split("_"); |
| | | String maxId = (Integer.parseInt(strs[0]) / 10) + "_" + (Integer.parseInt(strs[1]) / 10); |
| | | |
| | | return new Report(wd.getLocationName(), lon, lat, wd.getValue(), time, max, dis, dir); |
| | | 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() { |
| | |
| | | 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() { |
| | |
| | | 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() { |
| | |
| | | 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; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |