| | |
| | | .description("接口文档") |
| | | .contact(new Contact("WuWeiwei", "http://127.0.0.1:" + serverPort + contextPath + "/doc.html", "252740454@qq.com")) |
| | | .version("0.2") |
| | | .title("AI后台服务接口文档") |
| | | .title("内涝仿真服务服务接口文档") |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | if (null == vo.getPid() || vo.getPid() < 0) { |
| | | vo.setPid(0); |
| | | } |
| | | if (StringHelper.isEmpty(vo.getName())) { |
| | | vo.setName(StringHelper.YMDHMS2_FORMAT.format(new Date())); |
| | | } |
| | | if (null == vo.getNum() || vo.getNum() < 1) { |
| | | vo.setNum(simuService.getMaxId() + 1); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用空间范围查询 管点,管线,建筑物 3个图层,且每个图层的数量大于0,返回 true。 |
| | | */ |
| | | @ApiOperation(value = "降水范围校验") |
| | | @GetMapping("/rangeVerif") |
| | | public R<Object> rangeVerif(@RequestParam @ApiParam("最小X") Double minx, |
| | | @RequestParam @ApiParam("最小y") Double miny, |
| | | @RequestParam @ApiParam("最大X") Double maxx, |
| | | @RequestParam @ApiParam("最大y") Double maxy) { |
| | | @GetMapping("/rangeVerify") |
| | | public R<Object> rangeVerify(@RequestParam @ApiParam("最小X") double minx, |
| | | @RequestParam @ApiParam("最小y") double miny, |
| | | @RequestParam @ApiParam("最大X") double maxx, |
| | | @RequestParam @ApiParam("最大y") double maxy) { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setMinx(minx); |
| | |
| | | data.setMaxx(maxx); |
| | | data.setMaxy(maxy); |
| | | data.setEpsg(4326); |
| | | |
| | | String token = gedbService.getToken(); |
| | | GeDb db = gedbService.connectGedb(token, data); |
| | | List<GeLayer> layers = gedbService.getLayers(token, db); |
| | | return success(gedbService.queryBboxCount(token,db, layers)); |
| | | |
| | | return success(gedbService.queryBboxCount(token, db, layers)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | return fail(ex, false); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | public boolean queryBboxCount(String token, GeDb db, List<GeLayer> layers) throws Exception { |
| | | |
| | | public boolean queryBboxCount(String token, GeDb db, List<GeLayer> layers) { |
| | | for (GeLayer layer : layers) { |
| | | int count = getCount(token, db, layer); |
| | | if (0 == count) throw new Exception(layer.getName() + ",图层数据为空"); |
| | | if (0 == count) return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private int getCount(String token, GeDb db, GeLayer layer) { |
| | | Map<String, Object> map = new HashMap<>(6); |
| | | map.put("token", token); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | |
| | | } |
| | | |
| | | public boolean create(CreateSimuVo vo) { |
| | | Date now = new Date(); |
| | | String date = StringHelper.YMDHMS2_FORMAT.format(now); |
| | | if (StringHelper.isEmpty(vo.getName())) { |
| | | vo.setName(date); |
| | | } |
| | | |
| | | DataPo data = BeanUtil.copyProperties(vo, DataPo.class); |
| | | data.setPath(vo.getName(), vo.getName()); |
| | | data.setPath(date, date); |
| | | initPath(data); |
| | | |
| | | SimuPo simu = new SimuPo(vo.getNum(), vo.getPid(), vo.getName(), JSONUtil.toJsonStr(data), 0, vo.getBak()); |
| | | simu.setCreateTime(new Timestamp(now.getTime())); |
| | | |
| | | int rows = simuMapper.insert(simu); |
| | | if (rows > 0) { |
| | |
| | | update(simu, 10, "完成"); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | update(simu, -10, ex.getMessage()); |
| | | update(simu, -simu.getStatus(), ex.getMessage()); |
| | | } |
| | | } |
| | | |