燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-06-18 07fe1bb1ef9bf716567c3287ecd7c4859b6ccb1d
1
已修改4个文件
27 ■■■■ 文件已修改
src/main/java/com/yssh/dao/WarningDetailMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Report.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapping/WarningDetailMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/dao/WarningDetailMapper.java
@@ -26,4 +26,6 @@
    List<WarningDetail> selectByTimeForYj(@Param("startTime") String startTime, @Param("endTime") String endTime);
    List<WarningDetail> selectByTimeForBj(@Param("startTime") String startTime, @Param("endTime") String endTime);
    Double getLastYearVal(@Param("id") long id);
}
src/main/java/com/yssh/entity/Report.java
@@ -22,7 +22,7 @@
    private double val;
    @ApiModelProperty(value = "去年数值")
    private double lastVal;
    private Double lastVal;
    @ApiModelProperty(value = "时间")
    private String time;
@@ -48,12 +48,11 @@
    public Report() {
    }
    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) {
    public Report(String name, double lon, double lat, double val, String time, double speed, String dir, double maxVal, double dis, String maxDir, int isSame) {
        this.name = name;
        this.lon = lon;
        this.lat = lat;
        this.val = val;
        this.lastVal = lastVal;
        this.time = time;
        this.speed = speed;
        this.dir = dir;
@@ -85,9 +84,9 @@
        double speed2 = CalculateUtils.getWindSpeed(suMax.getV(), suMax.getU());
        double direction2 = CalculateUtils.getWindDirection(suMax.getV(), suMax.getU());
        String maxDir = CalculateUtils.getDir(angle);
        int isSame = (Math.abs(direction1 - direction2) < 30 && Math.abs(speed1 - speed2) < 0.5) ? 1 : 0;
        int isSame = (Math.abs(direction1 - direction2) <= 45 && Math.abs(speed1 - speed2) <= 0.5) ? 1 : 0;
        return new Report(wd.getLocationName(), c1.getX(), c1.getY(), wd.getValue(), lastVal, time,
        return new Report(wd.getLocationName(), c1.getX(), c1.getY(), wd.getValue(), time,
                speed1, dir, maxVal, dis1, maxDir, isSame);
    }
@@ -123,11 +122,11 @@
        this.val = val;
    }
    public double getLastVal() {
    public Double getLastVal() {
        return lastVal;
    }
    public void setLastVal(double lastVal) {
    public void setLastVal(Double lastVal) {
        this.lastVal = lastVal;
    }
src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
@@ -385,6 +385,7 @@
            //list.add(new WarningVo(wd.getLocationName(), wd.getSuYuanId(), 0.0, 0.0, wd.getValue(), time));
            DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId());
            Double lastVal = warningDetailMapper.getLastYearVal(wd.getId());
            int rows = suYuanMapper.isTableExists(wd.getTableName());
            DistanceSuYuan suMax = null;
@@ -397,6 +398,8 @@
            }
            Report report = Report.calcReport(wd, suYuan, suMax);
            report.setLastVal(lastVal);
            list.add(report);
        }
src/main/resources/mapping/WarningDetailMapper.xml
@@ -85,6 +85,15 @@
            and value >= (select jcbj from rs)
        order by value;
    </select>
    <select id="getLastYearVal" resultType="java.lang.Double">
        with rs as (
            select su_yuan_id "id", date_sub(create_time, interval 1 year) "time"
            from warning_detail where id = ${id})
        select format(value, 2) "val"
        from warning_detail
        where su_yuan_id = (select id from rs) and create_time = (select time from rs);
    </select>
    
    <insert id="batchInsert">
        INSERT INTO warning_detail (table_name, su_yuan_id, location_name, type, create_time, value)VALUES