1
13693261870
2024-11-06 84a874883f190fb8022382ff591e50b5bb049690
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);