Эх сурвалжийг харах

添加耕地保护研判接口,以及file文件读取

DESKTOP-2K9OVK9\siwei 4 сар өмнө
parent
commit
28a58f1f43
18 өөрчлөгдсөн 750 нэмэгдсэн , 57 устгасан
  1. 5 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/TGdbhYjjbntController.java
  2. 20 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/GdbhDto.java
  3. 107 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/TGdbhRwGeom.java
  4. 2 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhGdMapper.java
  5. 66 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhRwGeomMapper.java
  6. 64 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/ITGdbhRwGeomService.java
  7. 99 20
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhHandleService.java
  8. 8 24
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhServiceImpl.java
  9. 16 2
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java
  10. 101 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhRwGeomServiceImpl.java
  11. 22 2
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhYjjbntServiceImpl.java
  12. 11 0
      onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhGdMapper.xml
  13. 85 0
      onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhRwGeomMapper.xml
  14. 13 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/controller/SysFileController.java
  15. 2 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/ISpaceFileRecordService.java
  16. 30 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SpaceFileRecordServiceImpl.java
  17. 47 9
      onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/FileUtils.java
  18. 52 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/TifUtils.java

+ 5 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/TGdbhYjjbntController.java

@@ -1,6 +1,8 @@
 package com.onemap.apply.controller.gdbh;
 package com.onemap.apply.controller.gdbh;
 
 
+import com.onemap.apply.domain.gdbh.TGdbhGdServerDTO;
 import com.onemap.apply.domain.gdbh.TGdbhYjjbntServerDTO;
 import com.onemap.apply.domain.gdbh.TGdbhYjjbntServerDTO;
+import com.onemap.apply.service.gdbh.ITGdbhGdService;
 import com.onemap.apply.service.gdbh.ITGdbhYjjbntService;
 import com.onemap.apply.service.gdbh.ITGdbhYjjbntService;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.controller.BaseController;
 import com.onemap.common.core.web.controller.BaseController;
@@ -8,6 +10,9 @@ import com.onemap.common.core.web.domain.AjaxResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
+import java.util.Map;
+
 
 
 /**
 /**
  * 耕地保护-永久基本农田Controller
  * 耕地保护-永久基本农田Controller

+ 20 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/GdbhDto.java

@@ -35,6 +35,10 @@ public class GdbhDto {
     @TableField(value = "sum_number")
     @TableField(value = "sum_number")
     private Integer sumNumber;
     private Integer sumNumber;
     private String fxbg;//分析报告
     private String fxbg;//分析报告
+    @TableField(exist = false)
+    private Integer yptype;// 研判类型 0空间数据 1为shp 2为图斑
+    @TableField(value = "xzfw_ids")
+    private String xzfwIds;//分析报告
 
 
     public String getBsm() {
     public String getBsm() {
         return bsm;
         return bsm;
@@ -187,4 +191,20 @@ public class GdbhDto {
     public void setFxbg(String fxbg) {
     public void setFxbg(String fxbg) {
         this.fxbg = fxbg;
         this.fxbg = fxbg;
     }
     }
+
+    public Integer getYptype() {
+        return yptype;
+    }
+
+    public void setYptype(Integer yptype) {
+        this.yptype = yptype;
+    }
+
+    public String getXzfwIds() {
+        return xzfwIds;
+    }
+
+    public void setXzfwIds(String xzfwIds) {
+        this.xzfwIds = xzfwIds;
+    }
 }
 }

+ 107 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/TGdbhRwGeom.java

@@ -0,0 +1,107 @@
+package com.onemap.apply.domain.gdbh;
+
+import com.onemap.common.core.annotation.Excel;
+import com.onemap.common.core.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 耕地保护上传空间详情表对象 t_gdbh_rw_geom
+ * 
+ * @author ruoyi
+ * @date 2024-12-16
+ */
+public class TGdbhRwGeom extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String geom;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String rwbsm;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String geomJson;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer sort;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Double geomarea;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setGeom(String geom) 
+    {
+        this.geom = geom;
+    }
+
+    public String getGeom() 
+    {
+        return geom;
+    }
+    public void setRwbsm(String rwbsm) 
+    {
+        this.rwbsm = rwbsm;
+    }
+
+    public String getRwbsm() 
+    {
+        return rwbsm;
+    }
+    public void setGeomJson(String geomJson) 
+    {
+        this.geomJson = geomJson;
+    }
+
+    public String getGeomJson() 
+    {
+        return geomJson;
+    }
+    public void setSort(Integer sort)
+    {
+        this.sort = sort;
+    }
+
+    public Integer getSort()
+    {
+        return sort;
+    }
+    public void setGeomarea(Double geomarea)
+    {
+        this.geomarea = geomarea;
+    }
+
+    public Double getGeomarea()
+    {
+        return geomarea;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("geom", getGeom())
+            .append("rwbsm", getRwbsm())
+            .append("geomJson", getGeomJson())
+            .append("sort", getSort())
+            .append("geomarea", getGeomarea())
+            .toString();
+    }
+}

+ 2 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhGdMapper.java

@@ -15,6 +15,8 @@ public interface TGdbhGdMapper {
 
 
     public Map<String, Object> ntzl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
     public Map<String, Object> ntzl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
 
 
+    public Map<String, Object> gdnhmb(@Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
+
     public List<Map<String, Object>> ntzlfl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
     public List<Map<String, Object>> ntzlfl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
 
 
     public List<Map<String, Object>> qxfl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);
     public List<Map<String, Object>> qxfl(@Param("sjy") String sjy, @Param("areacolumn") String areacolumn, @Param("yaer") String yaer, @Param("xzqhdm") String xzqhdm, @Param("dlbm") String dlbm);

+ 66 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhRwGeomMapper.java

@@ -0,0 +1,66 @@
+package com.onemap.apply.mapper.gdbh;
+
+import java.util.List;
+import java.util.Map;
+
+import com.onemap.apply.domain.gdbh.TGdbhRwGeom;
+import com.onemap.common.datasource.annotation.Slave;
+
+/**
+ * 耕地保护上传空间详情表Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-12-16
+ */
+@Slave
+public interface TGdbhRwGeomMapper {
+    /**
+     * 查询耕地保护上传空间详情表
+     *
+     * @param id 耕地保护上传空间详情表主键
+     * @return 耕地保护上传空间详情表
+     */
+    public TGdbhRwGeom selectTGdbhRwGeomById(String id);
+
+    public Map<String, Object> sumTGdbhRwGeomByRwbsm(String rwbsm);
+
+    /**
+     * 查询耕地保护上传空间详情表列表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 耕地保护上传空间详情表集合
+     */
+    public List<TGdbhRwGeom> selectTGdbhRwGeomList(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 新增耕地保护上传空间详情表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    public int insertTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 修改耕地保护上传空间详情表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    public int updateTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 删除耕地保护上传空间详情表
+     *
+     * @param id 耕地保护上传空间详情表主键
+     * @return 结果
+     */
+    public int deleteTGdbhRwGeomById(String id);
+
+    /**
+     * 批量删除耕地保护上传空间详情表
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTGdbhRwGeomByIds(String[] ids);
+}

+ 64 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/ITGdbhRwGeomService.java

@@ -0,0 +1,64 @@
+package com.onemap.apply.service.gdbh;
+
+import java.util.List;
+import java.util.Map;
+
+import com.onemap.apply.domain.gdbh.TGdbhRwGeom;
+
+/**
+ * 耕地保护上传空间详情表Service接口
+ *
+ * @author ruoyi
+ * @date 2024-12-16
+ */
+public interface ITGdbhRwGeomService {
+    /**
+     * 查询耕地保护上传空间详情表
+     *
+     * @param id 耕地保护上传空间详情表主键
+     * @return 耕地保护上传空间详情表
+     */
+    public TGdbhRwGeom selectTGdbhRwGeomById(String id);
+
+    public Map<String,Object> sumTGdbhRwGeomByRwbsm(String rwbsm);
+
+    /**
+     * 查询耕地保护上传空间详情表列表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 耕地保护上传空间详情表集合
+     */
+    public List<TGdbhRwGeom> selectTGdbhRwGeomList(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 新增耕地保护上传空间详情表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    public int insertTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 修改耕地保护上传空间详情表
+     *
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    public int updateTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom);
+
+    /**
+     * 批量删除耕地保护上传空间详情表
+     *
+     * @param ids 需要删除的耕地保护上传空间详情表主键集合
+     * @return 结果
+     */
+    public int deleteTGdbhRwGeomByIds(String[] ids);
+
+    /**
+     * 删除耕地保护上传空间详情表信息
+     *
+     * @param id 耕地保护上传空间详情表主键
+     * @return 结果
+     */
+    public int deleteTGdbhRwGeomById(String id);
+}

+ 99 - 20
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhHandleService.java

@@ -1,5 +1,6 @@
 package com.onemap.apply.service.gdbh.impl;
 package com.onemap.apply.service.gdbh.impl;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.onemap.apply.domain.config.fzss.FxrwrzDTO;
 import com.onemap.apply.domain.config.fzss.FxrwrzDTO;
@@ -9,9 +10,12 @@ import com.onemap.apply.mapper.gdbh.GdbhMapper;
 import com.onemap.apply.mapper.gdbh.GdbhRwJgMapper;
 import com.onemap.apply.mapper.gdbh.GdbhRwJgMapper;
 import com.onemap.apply.mapper.gdbh.GdbhYzMapper;
 import com.onemap.apply.mapper.gdbh.GdbhYzMapper;
 import com.onemap.apply.service.analyse.HttpAnalyseService;
 import com.onemap.apply.service.analyse.HttpAnalyseService;
+import com.onemap.apply.service.gdbh.ITGdbhJctbService;
+import com.onemap.apply.service.gdbh.ITGdbhRwGeomService;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.system.api.AnalyseService;
 import com.onemap.system.api.AnalyseService;
+import com.onemap.system.api.RemoteFileService;
 import com.onemap.system.api.domain.IntersectionTableWktVo;
 import com.onemap.system.api.domain.IntersectionTableWktVo;
 import com.onemap.system.api.domain.TablesAIdsVo;
 import com.onemap.system.api.domain.TablesAIdsVo;
 import com.onemap.system.api.domain.TargetTableVo;
 import com.onemap.system.api.domain.TargetTableVo;
@@ -37,10 +41,17 @@ public class GdbhHandleService {
     private AnalyseService analyseService;
     private AnalyseService analyseService;
     @Resource
     @Resource
     private FxrwrzMapper fxrwrzMapper;
     private FxrwrzMapper fxrwrzMapper;
+    @Resource
+    private RemoteFileService fileService;
+    @Resource
+    private ITGdbhRwGeomService iTGdbhRwGeomService;
+    @Resource
+    private ITGdbhJctbService itGdbhJctbService;
 
 
     void gdbhAnalysisHandle(GdbhDto gdbhDto) {
     void gdbhAnalysisHandle(GdbhDto gdbhDto) {
         //获取范围
         //获取范围
         String d_RawTableName = gdbhDto.getXzfwTbaleName();
         String d_RawTableName = gdbhDto.getXzfwTbaleName();
+        List<String> d_RawTableAids = Arrays.asList(gdbhDto.getXzfwIds().split(","));
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析开始。。。", "info");
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析开始。。。", "info");
         updateGdbg(gdbhDto.getBsm(), 1, new Date(), null, null);
         updateGdbg(gdbhDto.getBsm(), 1, new Date(), null, null);
         //获取因子
         //获取因子
@@ -53,8 +64,6 @@ public class GdbhHandleService {
                 yzDataMap.put(yz.getId(), yz);
                 yzDataMap.put(yz.getId(), yz);
             }
             }
         }
         }
-
-
         //计算
         //计算
         List<GdbhRwMxDto> mxlist = gdbhDto.getMxlist();
         List<GdbhRwMxDto> mxlist = gdbhDto.getMxlist();
         if (mxlist == null || mxlist.size() == 0) {
         if (mxlist == null || mxlist.size() == 0) {
@@ -86,6 +95,7 @@ public class GdbhHandleService {
 
 
                 TablesAIdsVo tablesAIdsVo = new TablesAIdsVo();
                 TablesAIdsVo tablesAIdsVo = new TablesAIdsVo();
                 tablesAIdsVo.setTableNameA(d_RawTableName);
                 tablesAIdsVo.setTableNameA(d_RawTableName);
+                tablesAIdsVo.setTableIdsA(d_RawTableAids);
                 tablesAIdsVo.setTableNameB(d_analysis_table);
                 tablesAIdsVo.setTableNameB(d_analysis_table);
                 String tableName = httpAnalyseService.intersectionTables(tablesAIdsVo);
                 String tableName = httpAnalyseService.intersectionTables(tablesAIdsVo);
 
 
@@ -98,6 +108,7 @@ public class GdbhHandleService {
                 targetTableVo.setSiweiArea(true);
                 targetTableVo.setSiweiArea(true);
                 targetTableVo.setTargetTableName(tableName);
                 targetTableVo.setTargetTableName(tableName);
                 targetTableVo.setRawTableName(d_RawTableName);
                 targetTableVo.setRawTableName(d_RawTableName);
+                targetTableVo.setIds(d_RawTableAids);
                 targetTableVo.setColumns(columns);
                 targetTableVo.setColumns(columns);
                 List<Map> map = httpAnalyseService.targetTable(targetTableVo);
                 List<Map> map = httpAnalyseService.targetTable(targetTableVo);
 
 
@@ -116,26 +127,26 @@ public class GdbhHandleService {
             }
             }
             insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护" + mx.getBsmmc() + "分析结束。。。", "info");
             insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护" + mx.getBsmmc() + "分析结束。。。", "info");
         }
         }
-        insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成开始。。。", "info");
-        RequestResult res_1 = gdbhJgService.gdbhAnalysisHandle(gdbhDto.getBsm());
-        if (res_1.isError()) {
-            insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成失败。。。", "error");
-            updateGdbg(gdbhDto.getBsm(), 3, null, new Date(), null);
-            return;
-        }
-        Map jdMap_0 = (Map) res_1.get(RequestResult.DATA_TAG);
-        RequestResult res_2 = analyseService.gdbhGenerateDocx(jdMap_0);
-        if (res_2.isError()) {
-            insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成失败。。。", "error");
-            updateGdbg(gdbhDto.getBsm(), 3, null, new Date(), null);
-            return;
-        }
-        String path_0 = (String) res_2.get(RequestResult.DATA_TAG);
-        System.out.println("path_0:"+path_0);
+//        insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成开始。。。", "info");
+//        RequestResult res_1 = gdbhJgService.gdbhAnalysisHandle(gdbhDto.getBsm());
+//        if (res_1.isError()) {
+//            insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成失败。。。", "error");
+//            updateGdbg(gdbhDto.getBsm(), 3, null, new Date(), null);
+//            return;
+//        }
+//        Map jdMap_0 = (Map) res_1.get(RequestResult.DATA_TAG);
+//        RequestResult res_2 = analyseService.gdbhGenerateDocx(jdMap_0);
+//        if (res_2.isError()) {
+//            insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成失败。。。", "error");
+//            updateGdbg(gdbhDto.getBsm(), 3, null, new Date(), null);
+//            return;
+//        }
+//        String path_0 = (String) res_2.get(RequestResult.DATA_TAG);
+//        System.out.println("path_0:"+path_0);
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成结束。。。", "info");
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析报告生成结束。。。", "info");
 
 
-        updateGdbg(gdbhDto.getBsm(), 2, null, new Date(), path_0);
-//        updateGdbg(gdbhDto.getBsm(), 2, null, new Date(), null);
+//        updateGdbg(gdbhDto.getBsm(), 2, null, new Date(), path_0);
+        updateGdbg(gdbhDto.getBsm(), 2, null, new Date(), null);
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析结束。。。", "info");
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析结束。。。", "info");
     }
     }
 
 
@@ -198,4 +209,72 @@ public class GdbhHandleService {
         wrapper.eq("bsm", bsm);
         wrapper.eq("bsm", bsm);
         gdbhMapper.update(gdbhDto, wrapper);
         gdbhMapper.update(gdbhDto, wrapper);
     }
     }
+
+    public GdbhDto AddGdbhYpGeom(String xzfw, Integer yptype, GdbhDto gdbhDto) {
+        if (yptype != null && yptype == 2) {
+            //2 为图斑数据,从图像表中获取
+            String[] ids = xzfw.split(",");
+            int i0 = 0;
+            for (String id : ids) {
+                if (StringUtils.isNotEmpty(id)) {
+                    TGdbhJctb dto0 = itGdbhJctbService.selectTGdbhJctbById(id);
+                    if (dto0 != null) {
+                        String jsonString = JSON.toJSONString(dto0);
+                        TGdbhRwGeom tGdbhRwGeom = new TGdbhRwGeom();
+                        tGdbhRwGeom.setGeom(dto0.getGeom());
+                        tGdbhRwGeom.setGeomarea(dto0.getJcmj());
+                        tGdbhRwGeom.setGeomJson(jsonString);
+                        tGdbhRwGeom.setSort(i0);
+                        tGdbhRwGeom.setId(StringUtils.getUUID());
+                        tGdbhRwGeom.setRwbsm(gdbhDto.getBsm());
+                        iTGdbhRwGeomService.insertTGdbhRwGeom(tGdbhRwGeom);
+                        i0++;
+                    }
+                }
+            }
+            if (i0 == 0) {
+                return null;
+            }
+            Map<String, Object> retd0 = iTGdbhRwGeomService.sumTGdbhRwGeomByRwbsm(gdbhDto.getBsm());
+            Double area = Double.valueOf(retd0.get("geomarea").toString());
+            String ewkt = (String) retd0.get("geom");
+            Long number = (Long) retd0.get("geomnumber");
+            String d0_ids = (String) retd0.get("ids");
+            gdbhDto.setGeom(ewkt);
+            gdbhDto.setSumNumber(number.intValue());
+            gdbhDto.setXzfwTbaleId("tableId");
+            gdbhDto.setXzmj(area);
+            gdbhDto.setXzfwIds(d0_ids);
+        } else {
+            RequestResult resultGeom = fileService.uploadGeomV1Query(xzfw, 1);
+            if (resultGeom.isError()) {
+                return null;
+            }
+            String jsonString = JSON.toJSONString(resultGeom.get(RequestResult.DATA_TAG));
+            if (StringUtils.isEmpty(jsonString) || "null".equals(jsonString)) {
+                return null;
+            }
+            TUploadGeomDTO tUploadGeomDTO = JSON.parseObject(jsonString, TUploadGeomDTO.class);
+            List<TUploadGeomDetailsDTO> tUploadGeomDetailsDTOList = tUploadGeomDTO.gettUploadGeomDetailsDTOList();
+            StringBuilder xzfwIds = new StringBuilder();
+            for (TUploadGeomDetailsDTO tUploadGeomDetailsDTO : tUploadGeomDetailsDTOList) {
+                TGdbhRwGeom tGdbhRwGeom = new TGdbhRwGeom();
+                tGdbhRwGeom.setGeom(tUploadGeomDetailsDTO.getGeom());
+                tGdbhRwGeom.setGeomarea(tUploadGeomDetailsDTO.getGeomarea());
+                tGdbhRwGeom.setGeomJson(tUploadGeomDetailsDTO.getGeomJson());
+                tGdbhRwGeom.setSort(tUploadGeomDetailsDTO.getSort());
+                tGdbhRwGeom.setId(tUploadGeomDetailsDTO.getId());
+                tGdbhRwGeom.setRwbsm(gdbhDto.getBsm());
+                iTGdbhRwGeomService.insertTGdbhRwGeom(tGdbhRwGeom);
+                xzfwIds.append(tUploadGeomDetailsDTO.getId()).append(",");
+            }
+            gdbhDto.setGeom(tUploadGeomDTO.getGeom());
+            gdbhDto.setSumNumber(tUploadGeomDTO.getSpotsnumber());
+            gdbhDto.setXzmj(tUploadGeomDTO.getSpotsarea());
+            gdbhDto.setXzfwIds(xzfwIds.toString());
+        }
+        gdbhDto.setXzfwTbaleName("t_gdbh_rw_geom");
+        return gdbhDto;
+    }
+
 }
 }

+ 8 - 24
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhServiceImpl.java

@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.onemap.apply.domain.gdbh.*;
 import com.onemap.apply.domain.gdbh.*;
 import com.onemap.apply.mapper.gdbh.*;
 import com.onemap.apply.mapper.gdbh.*;
 import com.onemap.apply.service.gdbh.IGdbhService;
 import com.onemap.apply.service.gdbh.IGdbhService;
+import com.onemap.apply.service.gdbh.ITGdbhRwGeomService;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.system.api.RemoteFileService;
 import com.onemap.system.api.RemoteFileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
@@ -36,6 +38,8 @@ public class GdbhServiceImpl implements IGdbhService {
     private GdbhJgService gdbhJgService;
     private GdbhJgService gdbhJgService;
     @Autowired
     @Autowired
     private RemoteFileService remoteFileService;
     private RemoteFileService remoteFileService;
+    @Resource
+    private ITGdbhRwGeomService iTGdbhRwGeomService;
 
 
     @Override
     @Override
     public RequestResult GetMxList(String param) {
     public RequestResult GetMxList(String param) {
@@ -93,7 +97,9 @@ public class GdbhServiceImpl implements IGdbhService {
         if (StringUtils.isNull(gdbhDto)) {
         if (StringUtils.isNull(gdbhDto)) {
             return RequestResult.error("未查询到数据");
             return RequestResult.error("未查询到数据");
         }
         }
-        return remoteFileService.uploadGeomQuery(gdbhDto.getXzfw(), 1);
+        TGdbhRwGeom gdbhRwGeom = new TGdbhRwGeom();
+        gdbhRwGeom.setRwbsm(bsm);
+        return RequestResult.success(iTGdbhRwGeomService.selectTGdbhRwGeomList(gdbhRwGeom));
     }
     }
 
 
     @Override
     @Override
@@ -110,31 +116,9 @@ public class GdbhServiceImpl implements IGdbhService {
     @Override
     @Override
     public RequestResult AddGdbh(GdbhDto gdbhDto) {
     public RequestResult AddGdbh(GdbhDto gdbhDto) {
         try {
         try {
-            RequestResult resultData = remoteFileService.uploadGeomQuery(gdbhDto.getXzfw(), 0);
-            if (resultData.isError()) {
-                return resultData;
-            }
-            Map<String, Object> xzfw = (Map) resultData.get(RequestResult.DATA_TAG);
-            if (xzfw == null) {
-                return RequestResult.error("选址范围参数为空");
-            }
-            Double area = Double.valueOf(xzfw.get("area").toString());
-            String ewkt = (String) xzfw.get("geom");
-            String tableName = (String) xzfw.get("tableName");
-            String tableId = (String) xzfw.get("filepath");
-            Integer number = (Integer) xzfw.get("number");
-            if (StringUtils.isEmpty(ewkt)) {
-                return RequestResult.error("选址范围参数为空");
-            }
-
             String rebsm = StringUtils.getUUID();
             String rebsm = StringUtils.getUUID();
-            gdbhDto.setGeom(ewkt);
-            gdbhDto.setXzfwTbaleName(tableName);
-            gdbhDto.setXzfwTbaleId(tableId);
-            gdbhDto.setSumNumber(number);
-            gdbhDto.setXzfwTbaleId(tableId);
-            gdbhDto.setXzmj(area);
             gdbhDto.setBsm(rebsm);
             gdbhDto.setBsm(rebsm);
+            gdbhDto = gdbhHandleService.AddGdbhYpGeom(gdbhDto.getXzfw(), gdbhDto.getYptype(), gdbhDto);
             gdbhDto.setStatus(1);
             gdbhDto.setStatus(1);
             gdbhDto.setRwzt(0);
             gdbhDto.setRwzt(0);
             gdbhDto.setRwcjsj(new Date());
             gdbhDto.setRwcjsj(new Date());

+ 16 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java

@@ -46,6 +46,20 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
         String areacolumn = d2.getAreaColumn();
         String areacolumn = d2.getAreaColumn();
         String sjy = d2.getSjy();
         String sjy = d2.getSjy();
         Map<String, Object> retMap = tGdbhGdMapper.ntzl(sjy, areacolumn, yaer, xzqhdm, dlbm);
         Map<String, Object> retMap = tGdbhGdMapper.ntzl(sjy, areacolumn, yaer, xzqhdm, dlbm);
+        Map<String, Object> gdnhmbMap = tGdbhGdMapper.gdnhmb(xzqhdm, dlbm);
+        if (gdnhmbMap == null || gdnhmbMap.size() == 0) {
+            retMap.put("zb", "暂无");
+            retMap.put("bh_mj", "暂无");
+        } else {
+            BigDecimal yjjbnt_mj = (BigDecimal) retMap.get("mj");
+            BigDecimal gd_mj = (BigDecimal) gdnhmbMap.get("mj");
+            if (yjjbnt_mj.doubleValue() != 0 && gd_mj.doubleValue() != 0) {
+                retMap.put("zb", yjjbnt_mj.divide(gd_mj, 2, BigDecimal.ROUND_HALF_UP));
+            } else {
+                retMap.put("zb", 0);
+            }
+            retMap.put("bh_mj", gd_mj);
+        }
         return retMap;
         return retMap;
     }
     }
 
 
@@ -107,12 +121,12 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
         }
         }
 
 
         Map<String, Object> d4map = new HashMap<>();
         Map<String, Object> d4map = new HashMap<>();
-        d4map.put("gs",0);
+        d4map.put("gs", 0);
         d4map.put("mj", 0);
         d4map.put("mj", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_qm", 0);
         d4map.put("mj_qm", 0);
-        d4map.put("mjbh",0);
+        d4map.put("mjbh", 0);
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         retList.add(d4map);
         retList.add(d4map);
         return retList;
         return retList;

+ 101 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhRwGeomServiceImpl.java

@@ -0,0 +1,101 @@
+package com.onemap.apply.service.gdbh.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.onemap.apply.mapper.gdbh.TGdbhRwGeomMapper;
+import com.onemap.apply.domain.gdbh.TGdbhRwGeom;
+import com.onemap.apply.service.gdbh.ITGdbhRwGeomService;
+
+/**
+ * 耕地保护上传空间详情表Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-12-16
+ */
+@Service
+public class TGdbhRwGeomServiceImpl implements ITGdbhRwGeomService 
+{
+    @Autowired
+    private TGdbhRwGeomMapper tGdbhRwGeomMapper;
+
+    /**
+     * 查询耕地保护上传空间详情表
+     * 
+     * @param id 耕地保护上传空间详情表主键
+     * @return 耕地保护上传空间详情表
+     */
+    @Override
+    public TGdbhRwGeom selectTGdbhRwGeomById(String id)
+    {
+        return tGdbhRwGeomMapper.selectTGdbhRwGeomById(id);
+    }
+
+    @Override
+    public Map<String,Object> sumTGdbhRwGeomByRwbsm(String rwbsm)
+    {
+        return tGdbhRwGeomMapper.sumTGdbhRwGeomByRwbsm(rwbsm);
+    }
+
+    /**
+     * 查询耕地保护上传空间详情表列表
+     * 
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 耕地保护上传空间详情表
+     */
+    @Override
+    public List<TGdbhRwGeom> selectTGdbhRwGeomList(TGdbhRwGeom tGdbhRwGeom)
+    {
+        return tGdbhRwGeomMapper.selectTGdbhRwGeomList(tGdbhRwGeom);
+    }
+
+    /**
+     * 新增耕地保护上传空间详情表
+     * 
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    @Override
+    public int insertTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom)
+    {
+        return tGdbhRwGeomMapper.insertTGdbhRwGeom(tGdbhRwGeom);
+    }
+
+    /**
+     * 修改耕地保护上传空间详情表
+     * 
+     * @param tGdbhRwGeom 耕地保护上传空间详情表
+     * @return 结果
+     */
+    @Override
+    public int updateTGdbhRwGeom(TGdbhRwGeom tGdbhRwGeom)
+    {
+        return tGdbhRwGeomMapper.updateTGdbhRwGeom(tGdbhRwGeom);
+    }
+
+    /**
+     * 批量删除耕地保护上传空间详情表
+     * 
+     * @param ids 需要删除的耕地保护上传空间详情表主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTGdbhRwGeomByIds(String[] ids)
+    {
+        return tGdbhRwGeomMapper.deleteTGdbhRwGeomByIds(ids);
+    }
+
+    /**
+     * 删除耕地保护上传空间详情表信息
+     * 
+     * @param id 耕地保护上传空间详情表主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTGdbhRwGeomById(String id)
+    {
+        return tGdbhRwGeomMapper.deleteTGdbhRwGeomById(id);
+    }
+}

+ 22 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhYjjbntServiceImpl.java

@@ -6,16 +6,19 @@ import com.onemap.apply.mapper.gdbh.TGdbhJctbFileMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhJctbMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhJctbMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhYjjbntMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhYjjbntMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhYjjbntServerMapper;
 import com.onemap.apply.mapper.gdbh.TGdbhYjjbntServerMapper;
+import com.onemap.apply.service.gdbh.ITGdbhGdService;
 import com.onemap.apply.service.gdbh.ITGdbhJctbService;
 import com.onemap.apply.service.gdbh.ITGdbhJctbService;
 import com.onemap.apply.service.gdbh.ITGdbhYjjbntService;
 import com.onemap.apply.service.gdbh.ITGdbhYjjbntService;
 import com.onemap.common.core.utils.DateUtils;
 import com.onemap.common.core.utils.DateUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.system.api.RemoteFileService;
 import com.onemap.system.api.RemoteFileService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.File;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -34,6 +37,9 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
     @Resource
     @Resource
     private TGdbhYjjbntMapper tGdbhYjjbntMapper;
     private TGdbhYjjbntMapper tGdbhYjjbntMapper;
 
 
+    @Autowired
+    private ITGdbhGdService itGdbhGdService;
+
     @Override
     @Override
     public List<TGdbhYjjbntServerDTO> selectTGdbhYjjbntServerList(TGdbhYjjbntServerDTO tGdbhYjjbntServer) {
     public List<TGdbhYjjbntServerDTO> selectTGdbhYjjbntServerList(TGdbhYjjbntServerDTO tGdbhYjjbntServer) {
         return tGdbhYjjbntServerMapper.selectTGdbhYjjbntServerList(tGdbhYjjbntServer);
         return tGdbhYjjbntServerMapper.selectTGdbhYjjbntServerList(tGdbhYjjbntServer);
@@ -51,6 +57,20 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
         String areacolumn = d2.getAreaColumn();
         String areacolumn = d2.getAreaColumn();
         String sjy = d2.getSjy();
         String sjy = d2.getSjy();
         Map<String, Object> retMap = tGdbhYjjbntMapper.ntzl(sjy, areacolumn, yaer, xzqhdm, dlbm);
         Map<String, Object> retMap = tGdbhYjjbntMapper.ntzl(sjy, areacolumn, yaer, xzqhdm, dlbm);
+        Map<String, Object> gdMap = itGdbhGdService.ntzllist(yaer, xzqhdm, dlbm);
+        if (gdMap == null || gdMap.size() == 0) {
+            retMap.put("zb", "暂无");
+            retMap.put("gd_mj", "暂无");
+        } else {
+            BigDecimal yjjbnt_mj = (BigDecimal) retMap.get("mj");
+            BigDecimal gd_mj = (BigDecimal) gdMap.get("mj");
+            if (yjjbnt_mj.doubleValue() != 0 && gd_mj.doubleValue() != 0) {
+                retMap.put("zb", yjjbnt_mj.divide(gd_mj, 2, BigDecimal.ROUND_HALF_UP));
+            } else {
+                retMap.put("zb", 0);
+            }
+            retMap.put("gd_mj", gd_mj);
+        }
         return retMap;
         return retMap;
     }
     }
 
 
@@ -113,12 +133,12 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
         }
         }
 
 
         Map<String, Object> d4map = new HashMap<>();
         Map<String, Object> d4map = new HashMap<>();
-        d4map.put("gs",0);
+        d4map.put("gs", 0);
         d4map.put("mj", 0);
         d4map.put("mj", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_qm", 0);
         d4map.put("mj_qm", 0);
-        d4map.put("mjbh",0);
+        d4map.put("mjbh", 0);
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         retList.add(d4map);
         retList.add(d4map);
         return retList;
         return retList;

+ 11 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhGdMapper.xml

@@ -15,6 +15,17 @@
         )t1)t2
         )t1)t2
     </select>
     </select>
 
 
+    <select id="gdnhmb" parameterType="String" resultType="map">
+        select t2.*, round(mj*0.0015,2) mj_m, round(mj*0.0001,2) mj_gq, round(mj*0.000001,2) mj_qm from (
+        select round((coalesce(sum(mj::numeric), 0)),2) mj ,count(*) gs  from (
+        select "tbmj" as mj from vector."TB_GDBHMB"
+        where bsm like concat(#{xzqhdm},'%')
+        <if test="dlbm!=null and dlbm!='' ">
+            and dlbm like concat(#{dlbm},'%')
+        </if>
+        )t1)t2
+    </select>
+
     <select id="ntzlfl" parameterType="String" resultType="map">
     <select id="ntzlfl" parameterType="String" resultType="map">
         select t2.*, round(t2.mj*0.0015,2) mj_m, round(t2.mj*0.0001,2) mj_gq, round(t2.mj*0.000001,2) mj_qm,t2.dlmc from
         select t2.*, round(t2.mj*0.0015,2) mj_m, round(t2.mj*0.0001,2) mj_gq, round(t2.mj*0.000001,2) mj_qm,t2.dlmc from
         (
         (

+ 85 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhRwGeomMapper.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.onemap.apply.mapper.gdbh.TGdbhRwGeomMapper">
+    
+    <resultMap type="TGdbhRwGeom" id="TGdbhRwGeomResult">
+        <result property="id"    column="id"    />
+        <result property="geom"    column="geom"    />
+        <result property="rwbsm"    column="rwbsm"    />
+        <result property="geomJson"    column="geom_json"    />
+        <result property="sort"    column="sort"    />
+        <result property="geomarea"    column="geomarea"    />
+    </resultMap>
+
+    <sql id="selectTGdbhRwGeomVo">
+        select id, geom, rwbsm, geom_json, sort, geomarea from t_gdbh_rw_geom
+    </sql>
+
+    <select id="selectTGdbhRwGeomList" parameterType="TGdbhRwGeom" resultMap="TGdbhRwGeomResult">
+        <include refid="selectTGdbhRwGeomVo"/>
+        <where>  
+            <if test="geom != null  and geom != ''"> and geom = #{geom}</if>
+            <if test="rwbsm != null  and rwbsm != ''"> and rwbsm = #{rwbsm}</if>
+            <if test="geomJson != null  and geomJson != ''"> and geom_json = #{geomJson}</if>
+            <if test="sort != null  and sort != ''"> and sort = #{sort}</if>
+            <if test="geomarea != null  and geomarea != ''"> and geomarea = #{geomarea}</if>
+        </where>
+    </select>
+    
+    <select id="selectTGdbhRwGeomById" parameterType="String" resultMap="TGdbhRwGeomResult">
+        <include refid="selectTGdbhRwGeomVo"/>
+        where id = #{id}
+    </select>
+
+
+    <select id="sumTGdbhRwGeomByRwbsm" parameterType="String" resultType="map">
+        select  public.st_asewkt(public.st_union(geom)) geom, sum(geomarea) geomarea, count(*) geomnumber,STRING_AGG(id, ',') AS ids from t_gdbh_rw_geom
+        where rwbsm = #{rwbsm}
+
+    </select>
+
+    <insert id="insertTGdbhRwGeom" parameterType="TGdbhRwGeom">
+        insert into t_gdbh_rw_geom
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="geom != null">geom,</if>
+            <if test="rwbsm != null and rwbsm != ''">rwbsm,</if>
+            <if test="geomJson != null">geom_json,</if>
+            <if test="sort != null">sort,</if>
+            <if test="geomarea != null">geomarea,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="geom != null">public.st_transform(public.st_geomfromewkt(#{geom}), 4326),</if>
+            <if test="rwbsm != null and rwbsm != ''">#{rwbsm},</if>
+            <if test="geomJson != null">#{geomJson},</if>
+            <if test="sort != null">#{sort},</if>
+            <if test="geomarea != null">#{geomarea},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTGdbhRwGeom" parameterType="TGdbhRwGeom">
+        update t_gdbh_rw_geom
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="geom != null">geom = #{geom},</if>
+            <if test="rwbsm != null and rwbsm != ''">rwbsm = #{rwbsm},</if>
+            <if test="geomJson != null">geom_json = #{geomJson},</if>
+            <if test="sort != null">sort = #{sort},</if>
+            <if test="geomarea != null">geomarea = #{geomarea},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTGdbhRwGeomById" parameterType="String">
+        delete from t_gdbh_rw_geom where id = #{id}
+    </delete>
+
+    <delete id="deleteTGdbhRwGeomByIds" parameterType="String">
+        delete from t_gdbh_rw_geom where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 13 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/controller/SysFileController.java

@@ -374,5 +374,18 @@ public class SysFileController {
         }
         }
     }
     }
 
 
+    @GetMapping("/read/tif/to/png/**")
+    public RequestResult readTifToPng(HttpServletRequest request, HttpServletResponse response) {
+        try {
+            String path = request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE).toString();
+            String bestMatchingPattern = request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE).toString();
+            // 提取与模式相匹配的部分(不包括通配符)
+            String extractedPath = antPathMatcher.extractPathWithinPattern(bestMatchingPattern, path);
+            return RequestResult.success(spaceFileRecordService.readTifToPng(URLDecoder.decode(extractedPath)));
+        } catch (Exception e) {
+            return RequestResult.error("生成失败");
+        }
+    }
+
 
 
 }
 }

+ 2 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/ISpaceFileRecordService.java

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.FileNotFoundException;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.IOException;
+import java.util.Map;
 
 
 public interface ISpaceFileRecordService {
 public interface ISpaceFileRecordService {
 
 
@@ -95,4 +96,5 @@ public interface ISpaceFileRecordService {
      */
      */
     String uploadAbsolutePath(String file);
     String uploadAbsolutePath(String file);
 
 
+    Map<String,Object> readTifToPng(String file);
 }
 }

+ 30 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SpaceFileRecordServiceImpl.java

@@ -14,6 +14,7 @@ import com.onemap.file.mapper.TUploadGeomDetailsMapper;
 import com.onemap.file.mapper.TUploadGeomMapper;
 import com.onemap.file.mapper.TUploadGeomMapper;
 import com.onemap.file.service.ISpaceFileRecordService;
 import com.onemap.file.service.ISpaceFileRecordService;
 import com.onemap.file.utils.FileUtils;
 import com.onemap.file.utils.FileUtils;
+import com.onemap.file.utils.TifUtils;
 import com.onemap.file.utils.UnPackageUtils;
 import com.onemap.file.utils.UnPackageUtils;
 import com.onemap.system.api.AnalyseService;
 import com.onemap.system.api.AnalyseService;
 import com.onemap.system.api.ApplyService;
 import com.onemap.system.api.ApplyService;
@@ -47,6 +48,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -392,4 +394,32 @@ public class SpaceFileRecordServiceImpl implements ISpaceFileRecordService {
         String unzipPath = uploadFilePath + "/" + file;
         String unzipPath = uploadFilePath + "/" + file;
         return unzipPath;
         return unzipPath;
     }
     }
+
+    @Override
+    public Map<String, Object> readTifToPng(String file) {
+        Map<String, Object> retMap = new HashMap<>();
+        String tifPath = uploadFilePath + "/" + file;
+        int do_len = tifPath.lastIndexOf(".");
+        if (do_len < 0) {
+            return retMap;
+        }
+        String do_type = tifPath.substring(do_len);
+        if (!do_type.equals(".tif")) {
+            return retMap;
+        }
+        String pngPath = "/temp/" + StringUtils.getUUID() + ".png";
+        try {
+            if (new File(tifPath).exists()){
+                FileUtils.TifToPng(tifPath, uploadFilePath + pngPath);
+                String base64 = FileUtils.convertImageToBase64Str(tifPath);
+                double[] doubles = TifUtils.readTifEnvelopeTransformWGS84(tifPath);
+                retMap.put("pngpath", pngPath);
+                retMap.put("pngbase64", base64);
+                retMap.put("pngenvelope", doubles);
+            }
+        } catch (Exception e) {
+            return retMap;
+        }
+        return retMap;
+    }
 }
 }

+ 47 - 9
onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/FileUtils.java

@@ -2,15 +2,11 @@ package com.onemap.file.utils;
 
 
 import lombok.Data;
 import lombok.Data;
 
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.*;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileChannel;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 
 /**
 /**
  * 文件工具
  * 文件工具
@@ -188,8 +184,50 @@ public class FileUtils {
                     }
                     }
                 }
                 }
             }
             }
-        }else if(directory.isFile()&&directory.getName().endsWith(".shp")){
+        } else if (directory.isFile() && directory.getName().endsWith(".shp")) {
             shpFiles.add(directory);
             shpFiles.add(directory);
         }
         }
     }
     }
+
+    public static void TifToPng(String tifPath, String pngPath) throws IOException {
+        BufferedImage bufferegImage = ImageIO.read(new File(tifPath));
+        ImageIO.write(bufferegImage, "png", new File(pngPath));//可以是png等其它图片格式
+    }
+
+    /**
+     * 图片转Base64字符串
+     *
+     * @param imageFileName
+     * @return
+     */
+    public static String convertImageToBase64Str(String imageFileName) {
+        ByteArrayOutputStream baos = null;
+        try {
+            //获取图片类型
+            String suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1);
+            //构建文件
+            File imageFile = new File(imageFileName);
+            //通过ImageIO把文件读取成BufferedImage对象
+            BufferedImage bufferedImage = ImageIO.read(imageFile);
+            //构建字节数组输出流
+            baos = new ByteArrayOutputStream();
+            //写入流
+            ImageIO.write(bufferedImage, suffix, baos);
+            //通过字节数组流获取字节数组
+            byte[] bytes = baos.toByteArray();
+            //获取JDK8里的编码器Base64.Encoder转为base64字符
+            return Base64.getEncoder().encodeToString(bytes);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (baos != null) {
+                    baos.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
 }
 }

+ 52 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/TifUtils.java

@@ -0,0 +1,52 @@
+package com.onemap.file.utils;
+
+import org.geotools.coverage.grid.GridCoverage2D;
+import org.geotools.gce.geotiff.GeoTiffReader;
+import org.geotools.referencing.CRS;
+import org.opengis.geometry.Envelope;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import java.io.File;
+
+/**
+ * 文件工具
+ */
+
+public class TifUtils {
+
+    public static double[] readTifEnvelope(String tifPath) throws Exception {
+        // 读取 TIF 文件
+        GeoTiffReader reader = new GeoTiffReader(new File(tifPath));
+        //获取文件的坐标系信息
+        CoordinateReferenceSystem crs = reader.getCoordinateReferenceSystem();
+        GridCoverage2D coverage = reader.read(null);
+        // 获取 TIF 文件的四角坐标,
+        Envelope envelope = coverage.getEnvelope();
+        double maxLon = envelope.getMaximum(0); // 最大经度
+        double maxLat = envelope.getMaximum(1); // 最大纬度
+        double minLon = envelope.getMinimum(0); // 最小经度
+        double minLat = envelope.getMinimum(1); // 最小纬度
+        return new double[]{minLat, minLon, maxLat, maxLon,};
+    }
+
+    public static double[] readTifEnvelopeTransformSrid(String tifPath, int srid) throws Exception {
+        // 读取 TIF 文件
+        GeoTiffReader reader = new GeoTiffReader(new File(tifPath));
+        //获取文件的坐标系信息
+        CoordinateReferenceSystem crs = reader.getCoordinateReferenceSystem();
+        GridCoverage2D coverage = reader.read(null);
+        // 获取 TIF 文件的四角坐标,
+        Envelope envelope = coverage.getEnvelope();
+        Envelope transformedEnvelope = CRS.transform(envelope, CRS.decode("EPSG:" + srid));
+        double maxLon = transformedEnvelope.getMaximum(0); // 最大经度
+        double maxLat = transformedEnvelope.getMaximum(1); // 最大纬度
+        double minLon = transformedEnvelope.getMinimum(0); // 最小经度
+        double minLat = transformedEnvelope.getMinimum(1); // 最小纬度
+        return new double[]{minLat, minLon, maxLat, maxLon,};
+    }
+
+    public static double[] readTifEnvelopeTransformWGS84(String tifPath) throws Exception {
+        return readTifEnvelopeTransformSrid(tifPath, 4326);
+    }
+
+}