1
13693261870
2024-11-06 84a874883f190fb8022382ff591e50b5bb049690
1
已添加1个文件
已修改3个文件
57 ■■■■■ 文件已修改
src/main/java/com/se/simu/controller/WaterController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/vo/PondingVo.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/helper/ShpHelper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/WaterService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/controller/WaterController.java
@@ -1,6 +1,7 @@
package com.se.simu.controller;
import com.se.simu.domain.po.SimuPo;
import com.se.simu.domain.vo.PondingVo;
import com.se.simu.domain.vo.R;
import com.se.simu.helper.StringHelper;
import com.se.simu.helper.WebHelper;
@@ -153,15 +154,17 @@
            @ApiImplicitParam(name = "timestamp", value = "时间戳", dataType = "long", paramType = "query", example = "1730217660000")
    })
    @GetMapping("/{serviceName}/getWaterHeight")
    public R<Double> getWaterHeight(@PathVariable String serviceName, double x, double y, long timestamp, HttpServletResponse res) {
    public R<Object> getWaterHeight(@PathVariable String serviceName, double x, double y, long timestamp, HttpServletResponse res) {
        try {
            SimuPo simu = simuService.getSimuByServiceName(serviceName);
            if (null == simu) {
                return null;
            }
            // æ ¹æ®æœåŠ¡å+时间戳+坐标,查询对应的积水深度
            return success(waterService.getWaterHeight(simu, x, y, timestamp));
            Double depth = waterService.getWaterHeight(simu, x, y, timestamp);
            Double area = waterService.getWaterArea(simu, x, y, timestamp);
            return success(new PondingVo(depth, area));
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return fail(ex);
src/main/java/com/se/simu/domain/vo/PondingVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
package com.se.simu.domain.vo;
import io.swagger.annotations.ApiModelProperty;
/**
 * ç§¯æ°´è§†å›¾ç±»
 *
 * @author WWW
 * @date 2024-11-06
 */
@SuppressWarnings("ALL")
public class PondingVo {
    @ApiModelProperty("积水深度")
    private Double depth;
    @ApiModelProperty("积水面积")
    private Double area;
    public PondingVo() {
    }
    public PondingVo(Double depth, Double area) {
        this.depth = depth;
        this.area = area;
    }
    public Double getDepth() {
        return depth;
    }
    public void setDepth(Double depth) {
        this.depth = depth;
    }
    public Double getArea() {
        return area;
    }
    public void setArea(Double area) {
        this.area = area;
    }
}
src/main/java/com/se/simu/helper/ShpHelper.java
@@ -342,7 +342,7 @@
            dataSource = driver.CreateDataSource(filePath, null);
            if (null == dataSource) return false;
            layer = dataSource.CreateLayer(FileUtil.getName(filePath), ds.GetSpatialRef(), ogr.wkbPolygon, getOptions());
            layer = dataSource.CreateLayer(FileUtil.getName(filePath), ds.GetSpatialRef(), ogr.wkbPolygon);
            if (null == layer) return false;
            layer.CreateField(new FieldDefn("val", ogr.OFTReal));
src/main/java/com/se/simu/service/WaterService.java
@@ -171,6 +171,10 @@
        return !Double.isNaN(val) && val > Integer.MIN_VALUE;
    }
    public Double getWaterArea(SimuPo simu, double x, double y, Long timestamp) {
        return null;
    }
    public List<BuildingDepthVo> getBuildingDepthBySeid(String serviceName, String seid) {
        List<BuildingDepthVo> list = readBuildingJson(serviceName);
        if (CollectionUtils.isEmpty(list)) return null;