| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |