Ver código fonte

TASK 45751 地块属性和地块经营

master
yangfuda 1 semana atrás
pai
commit
f3688ffce9
2 arquivos alterados com 13 adições e 58 exclusões
  1. +0
    -7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java
  2. +13
    -51
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysGsiServiceImpl.java

+ 0
- 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java Ver arquivo

@@ -231,13 +231,6 @@ public class TResourceLandController extends BaseController
@PostMapping("/update")
public AjaxResult edit(@RequestBody TResourceLand tResourceLand)
{
if (tResourceLand.getTheGeom() != null && tResourceLand.getTheGeom().substring(0, 1).equals("[")) {
//坐标转换
String houseApplyProposedSituations = SpaceUtils.space(tResourceLand.getTheGeom());
tResourceLand.setTheGeom(houseApplyProposedSituations);
} else {
tResourceLand.setTheGeom(null);
}
return toAjax(tResourceLandService.updateTResourceLand(tResourceLand));
}



+ 13
- 51
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysGsiServiceImpl.java Ver arquivo

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.utils.space.SpaceUtils;
import com.ruoyi.system.domain.SysGis;
import com.ruoyi.system.domain.gis.Point;
import com.ruoyi.system.mapper.SysGisMapper;
@@ -33,64 +34,25 @@ public class SysGsiServiceImpl implements ISysGisService {

@Override
public int updateGeomByPolygon(SysGis gis) {
StringBuilder sb = new StringBuilder();
sb.append("MULTIPOLYGON(((");

//ObjectMapper mapper = new ObjectMapper();
try {
String theGeom = gis.getTheGeom();
//GeoPoint gp = mapper.readValue(theGeom, GeoPoint.class);
List<Point> pointList = JSON.parseArray(theGeom, Point.class);
//pointList.remove(pointList.size()-1);
// 检查第一个点和最后一个点是否相同
if (!pointList.get(0).equals(pointList.get(pointList.size() - 1))) {
// 如果不相同,添加第一个点作为最后一个点来闭合多边形
pointList.add(pointList.get(0));
}
pointList.forEach(p -> {
sb.append(p.getLongitude());
sb.append(" ");
sb.append(p.getLatitude());
sb.append(",");
});
sb.setLength(sb.length() - 1);
sb.append(")))");
} catch (Exception e) {
e.printStackTrace();
if (gis.getTheGeom() != null && gis.getTheGeom().substring(0, 1).equals("[")) {
//坐标转换
String houseApplyProposedSituations = SpaceUtils.space(gis.getTheGeom());
gis.setTheGeom(houseApplyProposedSituations);
} else {
gis.setTheGeom(null);
}
gis.setTheGeom(sb.toString());
return gisMapper.updateGeomByPolygon(gis);
}

@Override
public int updateGeomByPolygonPri(SysGis gis) {

StringBuilder sb = new StringBuilder();
sb.append("MULTIPOLYGON(((");

//ObjectMapper mapper = new ObjectMapper();
try {
String theGeom = gis.getTheGeom();
//GeoPoint gp = mapper.readValue(theGeom, GeoPoint.class);
List<Point> pointList = JSON.parseArray(theGeom, Point.class);
//pointList.remove(pointList.size()-1);
// 检查第一个点和最后一个点是否相同
if (!pointList.get(0).equals(pointList.get(pointList.size() - 1))) {
// 如果不相同,添加第一个点作为最后一个点来闭合多边形
pointList.add(pointList.get(0));
}
pointList.forEach(p -> {
sb.append(p.getLongitude());
sb.append(" ");
sb.append(p.getLatitude());
sb.append(",");
});
sb.setLength(sb.length() - 1);
sb.append(")))");
} catch (Exception e) {
e.printStackTrace();
if (gis.getTheGeom() != null && gis.getTheGeom().substring(0, 1).equals("[")) {
//坐标转换
String houseApplyProposedSituations = SpaceUtils.space(gis.getTheGeom());
gis.setTheGeom(houseApplyProposedSituations);
} else {
gis.setTheGeom(null);
}
gis.setTheGeom(sb.toString());
return gisMapper.updateGeomByPolygonPri(gis);
}



Carregando…
Cancelar
Salvar