From a6415c0c5116172db31fd353032fdfd11ac91544 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 01 十一月 2024 20:53:04 +0800 Subject: [PATCH] 1 --- src/main/java/com/se/simu/controller/WaterController.java | 57 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/se/simu/controller/WaterController.java b/src/main/java/com/se/simu/controller/WaterController.java index d0f2df3..fdeba3f 100644 --- a/src/main/java/com/se/simu/controller/WaterController.java +++ b/src/main/java/com/se/simu/controller/WaterController.java @@ -42,15 +42,49 @@ private final static long Y2000 = 949334400000L; - @ApiOperation(value = "鑾峰彇鍏冩暟鎹俊鎭�") + @ApiOperation(value = "鑾峰彇鍏冩暟鎹甁SON") @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 = "鑾峰彇寤虹瓚鐗╂秹姘碕SON") + @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()); -- Gitblit v1.9.3