1
13693261870
2024-11-01 a6415c0c5116172db31fd353032fdfd11ac91544
src/main/java/com/se/simu/controller/WaterController.java
@@ -42,15 +42,49 @@
    private final static long Y2000 = 949334400000L;
    @ApiOperation(value = "获取元数据信息")
    @ApiOperation(value = "获取元数据JSON")
    @GetMapping("/{serviceName}/layer.json")
    public void getLayer(@PathVariable String serviceName, HttpServletResponse res) {
    public void getLayerJson(@PathVariable String serviceName, HttpServletResponse res) {
        try {
            if (!validate(serviceName, res)) {
                return;
            }
            byte[] bytes = waterService.getLayerJson(serviceName);
            byte[] bytes = waterService.getson(serviceName, "layer.json");
            WebHelper.writeBytes(bytes, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage());
        }
    }
    @ApiOperation(value = "获取降水曲线JSON")
    @GetMapping("/{serviceName}/rainfall.json")
    public void getRainfallJson(@PathVariable String serviceName, HttpServletResponse res) {
        try {
            if (!validate(serviceName, res)) {
                return;
            }
            byte[] bytes = waterService.getson(serviceName, "rainfall.json");
            WebHelper.writeBytes(bytes, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage());
        }
    }
    @ApiOperation(value = "获取建筑物涉水JSON")
    @GetMapping("/{serviceName}/building.json")
    public void getBuildingJson(@PathVariable String serviceName, HttpServletResponse res) {
        try {
            if (!validate(serviceName, res)) {
                return;
            }
            byte[] bytes = waterService.getson(serviceName, "building.json");
            WebHelper.writeBytes(bytes, res);
        } catch (Exception ex) {
@@ -104,23 +138,6 @@
            String file = waterService.getFlowMap(serviceName, width, height, timestamp);
            WebHelper.writePng(file, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage());
        }
    }
    @ApiOperation(value = "获取降水曲线文件曲线图")
    @GetMapping("/{serviceName}/rainfall.json")
    public void getRainfall(@PathVariable String serviceName, HttpServletResponse res) {
        try {
            if (!validate(serviceName, res)) {
                return;
            }
            byte[] bytes = waterService.getRainfall(serviceName);
            WebHelper.writeBytes(bytes, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage());