From bfaff41b5881aa10c1c4411e8afb093885a526ae Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 23 八月 2023 11:21:10 +0800 Subject: [PATCH] 添加栅格分析的控制器 --- src/main/java/com/moon/server/controller/data/RasterAnalysisController.java | 134 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/moon/server/controller/data/RasterAnalysisController.java b/src/main/java/com/moon/server/controller/data/RasterAnalysisController.java new file mode 100644 index 0000000..71e4217 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/RasterAnalysisController.java @@ -0,0 +1,134 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.helper.WebHelper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鏍呮牸鍒嗘瀽 + * @author WWW + * @date 2023-08-23 + */ +@Api(tags = "鏁版嵁绠$悊\\鏍呮牸鍒嗘瀽") +@RestController +@RequestMapping("/rasterAnalysis") +public class RasterAnalysisController extends BaseController { + @SysLog() + @ApiOperation(value = "鏌ヨ鐐瑰垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "鐐筗KT", dataType = "String", example = "") + }) + @GetMapping(value = "/selectByPoint") + public ResponseMsg<Object> selectByPoint(String wkt) { + try { + Map<String, Double> map = new HashMap<>(5); + map.put("鍥惧眰鍚�", 0.0); + + return success(map); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绾垮垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "绾縒KT", dataType = "String", example = "") + }) + @GetMapping(value = "/selectByPolyline") + public ResponseMsg<Object> selectByPolyline(String wkt) { + try { + Map<String, List<Double>> map = new HashMap<>(5); + List<Double> list = new ArrayList<>(); + list.add(0.0); + map.put("鍥惧眰鍚�", list); + + return success(map); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ闈㈠垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "闈KT", dataType = "String", example = "") + }) + @GetMapping(value = "/selectByPolygon") + public ResponseMsg<Object> selectByPolygon(String wkt) { + try { + Map<String, Double> map = new HashMap<>(5); + map.put("鍥惧眰鍚�", 0.0); + + return success(map); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鐐瑰垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "鐐筗KT", dataType = "String", example = "") + }) + @RequestMapping(value = "/downloadByPoint") + public void downloadByPoint(String wkt, HttpServletRequest req, HttpServletResponse res) { + try { + // ... + + String filePath = "鐢熸垚鏂囦欢鐨勮矾寰�"; + WebHelper.download(filePath, "鏂囦欢鍚�", res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇绾垮垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "绾縒KT", dataType = "String", example = "") + }) + @RequestMapping(value = "/downloadByPolyline") + public void downloadByPolyline(String wkt, HttpServletRequest req, HttpServletResponse res) { + try { + // ... + + String filePath = "鐢熸垚鏂囦欢鐨勮矾寰�"; + WebHelper.download(filePath, "鏂囦欢鍚�", res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇闈㈠垎鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "闈KT", dataType = "String", example = "") + }) + @RequestMapping(value = "/downloadByPolygon") + public void downloadByPolygon(String wkt, HttpServletRequest req, HttpServletResponse res) { + try { + // ... + + String filePath = "鐢熸垚鏂囦欢鐨勮矾寰�"; + WebHelper.download(filePath, "鏂囦欢鍚�", res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } +} -- Gitblit v1.9.3