From dc0601492c12ea8009ab0e47ff25ec0e78f60903 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 02 十一月 2024 08:29:14 +0800 Subject: [PATCH] 添加查询建筑物涉水深度接口 --- src/main/java/com/se/simu/controller/WaterController.java | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/se/simu/controller/WaterController.java b/src/main/java/com/se/simu/controller/WaterController.java index fdeba3f..4befa5a 100644 --- a/src/main/java/com/se/simu/controller/WaterController.java +++ b/src/main/java/com/se/simu/controller/WaterController.java @@ -2,6 +2,7 @@ import com.se.simu.domain.po.SimuPo; import com.se.simu.domain.vo.R; +import com.se.simu.helper.StringHelper; import com.se.simu.helper.WebHelper; import com.se.simu.service.SimuService; import com.se.simu.service.WaterService; @@ -145,13 +146,13 @@ } @ApiOperation(value = "鏍规嵁鍧愭爣鏌ヨ绉按娣卞害") - @GetMapping("/{serviceName}/getWaterHeight") @ApiImplicitParams({ @ApiImplicitParam(name = "serviceName", value = "鏈嶅姟鍚�", dataType = "String", paramType = "path", example = "20241010095328"), @ApiImplicitParam(name = "x", value = "X", dataType = "double", paramType = "query", example = "116.6447998"), @ApiImplicitParam(name = "y", value = "Y", dataType = "double", paramType = "query", example = "39.8868915"), @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) { try { SimuPo simu = simuService.getSimuByServiceName(serviceName); @@ -167,6 +168,47 @@ } } + @ApiOperation(value = "鏍规嵁seid鏌ヨ寤虹瓚鐗╂秹姘存繁搴�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "serviceName", value = "鏈嶅姟鍚�", dataType = "String", paramType = "path", example = "20241010095328"), + @ApiImplicitParam(name = "seid", value = "X", dataType = "String", paramType = "query", example = "5_f128d8b1aba6455c88d2f42334ca62bb") + }) + @GetMapping("/{serviceName}/getBuildingDepthBySeid") + public R<Object> getBuildingDepthBySeid(@PathVariable String serviceName, String seid) { + try { + if (StringHelper.isEmpty(serviceName) || StringHelper.isEmpty(seid)) { + return null; + } + + // 鏍规嵁鏈嶅姟鍚�+鏃堕棿鎴�+鍧愭爣锛屾煡璇㈠搴旂殑绉按娣卞害 + return success(waterService.getBuildingDepthBySeid(serviceName, seid)); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return fail(ex); + } + } + + + @ApiOperation(value = "鏍规嵁timestamp鏌ヨ寤虹瓚鐗╂秹姘存繁搴�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "serviceName", value = "鏈嶅姟鍚�", dataType = "String", paramType = "path", example = "20241010095328"), + @ApiImplicitParam(name = "timestamp", value = "鏃堕棿鎴�", dataType = "Long", paramType = "query", example = "1730217660000") + }) + @GetMapping("/{serviceName}/getBuildingDepthByTime") + public R<Object> getBuildingDepthByTime(@PathVariable String serviceName, Long timestamp) { + try { + if (StringHelper.isEmpty(serviceName) || null == timestamp) { + return null; + } + + // 鏍规嵁鏈嶅姟鍚�+鏃堕棿鎴�+鍧愭爣锛屾煡璇㈠搴旂殑绉按娣卞害 + return success(waterService.getBuildingDepthByTime(serviceName, timestamp)); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return fail(ex); + } + } + private boolean validate(String serviceName, HttpServletResponse res) { if (WebHelper.isEmpty(serviceName)) { return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "鏈嶅姟鍚嶄笉鑳戒负绌�"); -- Gitblit v1.9.3