diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java index bbacbf7..957b949 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceLandController.java @@ -14,6 +14,7 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.pdf.PdfUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.space.SpaceUtils; import com.ruoyi.common.utils.translation.TranslateUtils; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.resource.domain.TResourceLand; @@ -230,6 +231,13 @@ 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)); } @@ -244,6 +252,12 @@ public class TResourceLandController extends BaseController return toAjax(tResourceLandService.deleteTResourceLandByFids(fids)); } + @Log(title = "空间字段置空", businessType = BusinessType.UPDATE) + @GetMapping("/clear/{fid}") + public AjaxResult clearTheGeom(@PathVariable("fid") Long fid) { + return toAjax(tResourceLandService.clearTheGeom(fid)); + } + /** * 打印地块属性 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index d60e143..12215e9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -82,6 +82,15 @@ public class SysDeptController extends BaseController { return success(deptService.selectDeptById(deptId)); } + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/getInfoByCode/{orgCode}") + public AjaxResult getInfoByCode(@PathVariable String orgCode) { + return success(deptService.selectDeptByOrgCode(orgCode)); + } + /** * 新增部门 */ diff --git a/ruoyi-business/src/main/java/com/ruoyi/resource/mapper/TResourceLandMapper.java b/ruoyi-business/src/main/java/com/ruoyi/resource/mapper/TResourceLandMapper.java index 2b88e79..37c13d2 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/resource/mapper/TResourceLandMapper.java +++ b/ruoyi-business/src/main/java/com/ruoyi/resource/mapper/TResourceLandMapper.java @@ -82,4 +82,12 @@ public interface TResourceLandMapper * @return 结果 */ public int deleteTResourceLandByFids(Long[] fids); + + /** + * 清空theGeom字段 + * + * @param fid + * @return + */ + public int clearTheGeom(Long fid); } diff --git a/ruoyi-business/src/main/java/com/ruoyi/resource/service/ITResourceLandService.java b/ruoyi-business/src/main/java/com/ruoyi/resource/service/ITResourceLandService.java index e93c093..653e7c2 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/resource/service/ITResourceLandService.java +++ b/ruoyi-business/src/main/java/com/ruoyi/resource/service/ITResourceLandService.java @@ -92,4 +92,12 @@ public interface ITResourceLandService * @return 结果 */ public int deleteTResourceLandByFid(Long fid); + + /** + * 清空theGeom字段 + * + * @param fid + * @return + */ + public int clearTheGeom(Long fid); } diff --git a/ruoyi-business/src/main/java/com/ruoyi/resource/service/impl/TResourceLandServiceImpl.java b/ruoyi-business/src/main/java/com/ruoyi/resource/service/impl/TResourceLandServiceImpl.java index 4e8c38a..8aeed94 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/resource/service/impl/TResourceLandServiceImpl.java +++ b/ruoyi-business/src/main/java/com/ruoyi/resource/service/impl/TResourceLandServiceImpl.java @@ -232,4 +232,15 @@ public class TResourceLandServiceImpl implements ITResourceLandService { return tResourceLandMapper.deleteTResourceLandByFid(fid); } + + /** + * 清空theGeom字段 + * + * @param fid + * @return + */ + @Override + public int clearTheGeom(Long fid) { + return tResourceLandMapper.clearTheGeom(fid); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/space/SpaceUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/space/SpaceUtils.java new file mode 100644 index 0000000..e97421f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/space/SpaceUtils.java @@ -0,0 +1,61 @@ +package com.ruoyi.common.utils.space; + +import java.util.ArrayList; + +/** + * author:Administrator + * date2021/7/16 + * + * @description; + */ +public class SpaceUtils { + + //面坐标装换 + public static String space(String theGeom){ + + //判断获取到数据是否是地图画质坐标,画制坐标第一位传入是:[ 否:M + if((theGeom != null && theGeom.startsWith("[") && theGeom !="")) { + //删除无用坐标数组括号 + String theGeom_left = theGeom.replaceAll("\\[", ""); + String theGeom_right = theGeom_left.replaceAll("]", ""); + String theGeomZb = null; + ArrayList theGeomList = new ArrayList(); + //按照逗号拆分传入数组 + String[] theGeomListLists = theGeom_right.split(","); + int bb = theGeomListLists.length - 1; //数组循环少循环一次 否则数组越界 + for (int i = 0; i < bb; i++) { + //前一位与后一位数组拼接 + theGeomZb = theGeomListLists[i] + " " + theGeomListLists[++i]; + theGeomList.add(theGeomZb); + } + //拼接需要保存坐标MULTIPOLYGON + String startMultipolygon = "MULTIPOLYGON((("; + String endMultipolygon = ")))"; + String allMultipolygon = startMultipolygon + theGeomList + endMultipolygon; + allMultipolygon = allMultipolygon.replaceAll("\\[", ""); + allMultipolygon = allMultipolygon.replaceAll("]", ""); + return theGeom =allMultipolygon; + } else { + //没有编辑图像则 the_geom空间数据不更新 + return theGeom =null; + } + + } + + //点坐标装换 + public static String point(String theGeom){ + //判断获取到数据是否是地图画质坐标,画制坐标第一位传入是:[ 否:M + if((theGeom != null && theGeom.startsWith("[") && theGeom !="")) { + //删除无用坐标数组括号 + //坐标转换 + String theGeom_left = theGeom.replaceAll("\\[", ""); + String theGeom_right = theGeom_left.replaceAll("]", ""); + String pointMap = theGeom_right.replaceAll(",", " "); + String point = "POINT(" + pointMap + ")"; + return point; + }else { + //没有编辑图像则 the_geom空间数据不更新 + return null; + } + } +}