dcb
2025-05-26 6d817179edaf2a6c793595056f5d250eb4396ab0
src/main/java/com/se/nsl/controller/SimuController.java
@@ -1,6 +1,7 @@
package com.se.nsl.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.se.nsl.domain.po.Simu;
import com.se.nsl.domain.po.SimuData;
@@ -94,12 +95,15 @@
                return fail("geom对象不是多边形");
            int rows = simuService.insert(simu);
            System.out.println(String.format("id:%s", simu.getId()));
            if (rows > 0 && (null == data.getRainfalls() || data.getRainfalls().size() < 2)) {
                resolveService.createRainfall(simu);
                simuService.updateById(simu);
            }
            return success(rows);
            JSONObject json = new JSONObject();
            json.put("id", simu.getId());
            return success(json);
        } catch (Exception ex) {
            return fail(ex, null);
        }
@@ -156,4 +160,23 @@
            return fail(ex, null);
        }
    }
    @ApiOperation(value = "position")
    @GetMapping("/position")
    public R<Object> queryByPosition(double lon, double lat, String time, String serviceName) {
        if (lon > 180 || lon < -180) {
            return fail("经度范围应该在-180到180");
        }
        if (lat > 90 || lat < -90) {
            return fail("纬度范围应该在-90到90");
        }
        if (time == null || time.trim().isEmpty()) {
            return fail("时间戳不能为空");
        }
        if (serviceName == null || serviceName.trim().isEmpty()) {
            return fail("服务名不能为空");
        }
        return null;
    }
}