From 64b4e6fbbf2c3f89166cb39e3bfd1ede976181c6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 16 九月 2023 20:06:35 +0800 Subject: [PATCH] 栅格分析的结果以消息推送的形式返回-1 --- src/main/java/com/moon/server/entity/all/StaticData.java | 2 ++ src/main/java/com/moon/server/service/data/RasterAnalysisService.java | 7 +++++++ src/main/java/com/moon/server/controller/data/RasterAnalysisController.java | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 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 index c866f6d..4fc1887 100644 --- a/src/main/java/com/moon/server/controller/data/RasterAnalysisController.java +++ b/src/main/java/com/moon/server/controller/data/RasterAnalysisController.java @@ -3,7 +3,9 @@ import com.moon.server.annotation.SysLog; import com.moon.server.controller.all.BaseController; import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; import com.moon.server.service.data.RasterAnalysisService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -14,6 +16,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.*; /** @@ -112,4 +116,34 @@ return fail(ex, null); } } + + @SysLog() + @ApiOperation(value = "浣跨敤WKT鏌ヨ鍒嗘瀽锛岀粨鏋滀互娑堟伅鎺ㄩ��") + @ApiImplicitParams({ + @ApiImplicitParam(name = "wkt", value = "WKT瀛楃涓�", dataType = "String", example = "POLYGON ((56.61 33.94,115.04 33.56,114.09 -7.17,52.22 -6.22,56.61 33.94))"), + @ApiImplicitParam(name = "size", value = "鍍忕礌鍊�(鐐�)鎴栬妭鐐规暟(绾�)", dataType = "Integer", example = "16") + }) + @GetMapping(value = "/selectByWktForPost") + public void selectByWktForPost(String wkt, Integer size, HttpServletRequest req, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(wkt)) { + WebHelper.writeStr2Page(res, "WKT瀛楃涓蹭笉鑳戒负绌�"); + return; + } + Geometry geo = Geometry.CreateFromWkt(wkt); + if (null == geo || geo.GetGeometryType() != ogr.wkbPolygon) { + WebHelper.writeStr2Page(res, "WKT瀛楃涓蹭笉姝g‘"); + return; + } + if (null == size || size < 0 || size > StaticData.I1024) { + WebHelper.writeStr2Page(res, "鍍忕礌鍊�(鐐�)鎴栬妭鐐规暟(绾�)鍊间笉姝g‘"); + return; + } + + String token = WebHelper.getToken(req); + rasterService.analysisForPost(geo, size, token); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } } diff --git a/src/main/java/com/moon/server/entity/all/StaticData.java b/src/main/java/com/moon/server/entity/all/StaticData.java index 2cda5d1..5e44dd5 100644 --- a/src/main/java/com/moon/server/entity/all/StaticData.java +++ b/src/main/java/com/moon/server/entity/all/StaticData.java @@ -82,6 +82,8 @@ public static final int I1000 = 1000; + public static final int I1024 = 1024; + public static final int I2050 = 2050; public static final int I4326 = 4326; diff --git a/src/main/java/com/moon/server/service/data/RasterAnalysisService.java b/src/main/java/com/moon/server/service/data/RasterAnalysisService.java index a391cbb..ced8ed4 100644 --- a/src/main/java/com/moon/server/service/data/RasterAnalysisService.java +++ b/src/main/java/com/moon/server/service/data/RasterAnalysisService.java @@ -51,6 +51,13 @@ } /** + * 浣跨敤WKT鏌ヨ鍒嗘瀽锛岀粨鏋滀互娑堟伅鎺ㄩ�� + */ + public void analysisForPost(Geometry geo, Integer size, String token) { + // + } + + /** * 鍒嗘瀽鏂规硶 */ public List<AnalysisResultEntity> analysis(Geometry geo, Integer size) { -- Gitblit v1.9.3