Răsfoiți Sursa

Merge branch 'dev' of http://114.244.114.158:8802/siwei/sanya-data-management-back into dev

gushoubang 6 luni în urmă
părinte
comite
a5b4186a66
24 a modificat fișierele cu 789 adăugiri și 127 ștergeri
  1. 6 7
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/GdbhReportServiceImpl.java
  2. 0 8
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/GdbhController.java
  3. 5 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/TGdbhYjjbntController.java
  4. 20 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/GdbhDto.java
  5. 107 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/TGdbhRwGeom.java
  6. 2 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhGdMapper.java
  7. 66 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhRwGeomMapper.java
  8. 64 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/ITGdbhRwGeomService.java
  9. 84 4
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhHandleService.java
  10. 12 37
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhJgService.java
  11. 11 24
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhServiceImpl.java
  12. 16 2
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java
  13. 3 2
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhJctbServiceImpl.java
  14. 101 0
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhRwGeomServiceImpl.java
  15. 22 2
      onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhYjjbntServiceImpl.java
  16. 11 0
      onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhGdMapper.xml
  17. 85 0
      onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhRwGeomMapper.xml
  18. 22 4
      onemap-modules/onemap-file/src/main/java/com/onemap/file/controller/SysFileController.java
  19. 9 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/TUploadGeomDTO.java
  20. 2 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/ISpaceFileRecordService.java
  21. 31 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SpaceFileRecordServiceImpl.java
  22. 47 9
      onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/FileUtils.java
  23. 52 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/TifUtils.java
  24. 11 28
      sql/pgsql/0_init.sql

+ 6 - 7
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/GdbhReportServiceImpl.java

@@ -79,13 +79,12 @@ public class GdbhReportServiceImpl implements GdbhReportService {
         XWPFDocument document = null;
         OutputStream outputStream = null;// 把doc输出到输出流
         try {
-            RequestResult res_0 = applyService.QueryGdbhJgGeom(bsm);
-            if (res_0.isError()) {
-                throw new Exception(String.valueOf(res_0.get(RequestResult.MSG_TAG)));
-            }
-
-            Map res_1 = (Map) res_0.get(RequestResult.DATA_TAG);
-            String ewkt = (String) res_1.get("geom");
+//            RequestResult res_0 = applyService.QueryGdbhJgGeom(bsm);
+//            if (res_0.isError()) {
+//                throw new Exception(String.valueOf(res_0.get(RequestResult.MSG_TAG)));
+//            }
+//            Map res_1 = (Map) res_0.get(RequestResult.DATA_TAG);
+            String ewkt = (String) d_xmxx_0.get("geom");
 
             document = new XWPFDocument();
 

+ 0 - 8
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/GdbhController.java

@@ -102,12 +102,4 @@ public class GdbhController extends BaseController {
         return getDataTable(list);
     }
 
-    @GetMapping("/upload/geom")
-    public RequestResult SelectGdbhList(String type, String[] ids) {
-        System.out.println("type:" + type);
-        System.out.println("ids:" + Arrays.asList(ids).toString());
-        return RequestResult.success("处理成功", "0");
-    }
-
-
 }

+ 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;
 
+import com.onemap.apply.domain.gdbh.TGdbhGdServerDTO;
 import com.onemap.apply.domain.gdbh.TGdbhYjjbntServerDTO;
+import com.onemap.apply.service.gdbh.ITGdbhGdService;
 import com.onemap.apply.service.gdbh.ITGdbhYjjbntService;
 import com.onemap.common.core.utils.StringUtils;
 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.web.bind.annotation.*;
 
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * 耕地保护-永久基本农田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")
     private Integer sumNumber;
     private String fxbg;//分析报告
+    @TableField(exist = false)
+    private Integer yptype;// 研判类型 0空间数据 1为shp 2为图斑
+    @TableField(value = "xzfw_ids")
+    private String xzfwIds;//分析报告
 
     public String getBsm() {
         return bsm;
@@ -187,4 +191,20 @@ public class GdbhDto {
     public void setFxbg(String 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> 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>> 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);
+}

+ 84 - 4
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;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 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.GdbhYzMapper;
 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.web.domain.RequestResult;
 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.TablesAIdsVo;
 import com.onemap.system.api.domain.TargetTableVo;
@@ -37,10 +41,17 @@ public class GdbhHandleService {
     private AnalyseService analyseService;
     @Resource
     private FxrwrzMapper fxrwrzMapper;
+    @Resource
+    private RemoteFileService fileService;
+    @Resource
+    private ITGdbhRwGeomService iTGdbhRwGeomService;
+    @Resource
+    private ITGdbhJctbService itGdbhJctbService;
 
     void gdbhAnalysisHandle(GdbhDto gdbhDto) {
         //获取范围
         String d_RawTableName = gdbhDto.getXzfwTbaleName();
+        List<String> d_RawTableAids = Arrays.asList(gdbhDto.getXzfwIds().split(","));
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析开始。。。", "info");
         updateGdbg(gdbhDto.getBsm(), 1, new Date(), null, null);
         //获取因子
@@ -53,8 +64,6 @@ public class GdbhHandleService {
                 yzDataMap.put(yz.getId(), yz);
             }
         }
-
-
         //计算
         List<GdbhRwMxDto> mxlist = gdbhDto.getMxlist();
         if (mxlist == null || mxlist.size() == 0) {
@@ -86,6 +95,7 @@ public class GdbhHandleService {
 
                 TablesAIdsVo tablesAIdsVo = new TablesAIdsVo();
                 tablesAIdsVo.setTableNameA(d_RawTableName);
+                tablesAIdsVo.setTableIdsA(d_RawTableAids);
                 tablesAIdsVo.setTableNameB(d_analysis_table);
                 String tableName = httpAnalyseService.intersectionTables(tablesAIdsVo);
 
@@ -131,11 +141,10 @@ public class GdbhHandleService {
             return;
         }
         String path_0 = (String) res_2.get(RequestResult.DATA_TAG);
-        System.out.println("path_0:"+path_0);
+        System.out.println("path_0:" + path_0);
         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);
         insertFxrwrz(StringUtils.getUUID(), gdbhDto.getBsm(), gdbhDto.getXmmc(), "耕地保护分析结束。。。", "info");
     }
 
@@ -198,4 +207,75 @@ public class GdbhHandleService {
         wrapper.eq("bsm", bsm);
         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) {
+                        TGdbhRwGeom tGdbhRwGeom = new TGdbhRwGeom();
+                        tGdbhRwGeom.setGeom(dto0.getGeom());
+                        tGdbhRwGeom.setGeomarea(dto0.getJcmj());
+                        tGdbhRwGeom.setSort(i0);
+                        tGdbhRwGeom.setId(StringUtils.getUUID());
+                        tGdbhRwGeom.setRwbsm(gdbhDto.getBsm());
+                        dto0.setGeom(null);
+                        dto0.setHsxtif(null);
+                        dto0.setQsxtif(null);
+                        String jsonString = JSON.toJSONString(dto0);
+                        tGdbhRwGeom.setGeomJson(jsonString);
+                        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;
+    }
+
 }

+ 12 - 37
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhJgService.java

@@ -10,6 +10,7 @@ import com.onemap.apply.domain.res.ApiTTable;
 import com.onemap.apply.domain.res.ApiTTableFiled;
 import com.onemap.apply.mapper.gdbh.*;
 import com.onemap.apply.service.analyse.HttpAnalyseService;
+import com.onemap.apply.service.gdbh.ITGdbhRwGeomService;
 import com.onemap.common.core.utils.NumberUtil;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.AjaxResult;
@@ -19,10 +20,8 @@ import com.onemap.system.api.domain.RawTableVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import javax.annotation.Resource;
+import java.util.*;
 
 @Service
 public class GdbhJgService {
@@ -40,6 +39,8 @@ public class GdbhJgService {
     private GdbhRwMxYzMapper gdbhRwMxYzMapper;
     @Autowired
     private TableFiledRelationService tableFiledRelationService;
+    @Resource
+    private ITGdbhRwGeomService iTGdbhRwGeomService;
 
     public RequestResult gdbhAnalysisHandle(String rwBsm) {
         QueryWrapper<GdbhDto> wrapper0_1 = new QueryWrapper<>();
@@ -49,6 +50,10 @@ public class GdbhJgService {
             return RequestResult.error("未查询到数据");
         }
 
+        Map<String, Object> retd0 = iTGdbhRwGeomService.sumTGdbhRwGeomByRwbsm(gdbhDto.getBsm());
+        String ewkt = (String) retd0.get("geom");
+        gdbhDto.setGeom(ewkt);
+
         //计算1 模型
         QueryWrapper<GdbhRwMxDto> wrapper0_2 = new QueryWrapper<>();
         wrapper0_2.eq("rwbsm", rwBsm);
@@ -219,44 +224,14 @@ public class GdbhJgService {
             ret.add(mxMap);
         }
 
-        String d_RawTableName = gdbhDto.getXzfwTbaleName();
 
-        //查询tableid
-        String tableId = gdbhDto.getXzfwTbaleId();
-        AjaxResult ajaxResult = tableFiledRelationService.QueryTableFiledRelation(tableId);
-        if (!ajaxResult.isSuccess()) {
-            return null;
-        }
-        Object tableStr = ajaxResult.get(AjaxResult.DATA_TAG);
-        ApiTTable tTable = JSON.parseObject(JSON.toJSONString(tableStr), ApiTTable.class);
+//        @Resource
+//        private ITGdbhRwGeomService iTGdbhRwGeomService;
 
-        List<String> ids = new ArrayList<>();
-        ids.add(id);
 
-        List<ApiTTableFiled> filedList = tTable.getTableFiledlist();
-        List<String> columns = new ArrayList<>(); // 列名
-        for (ApiTTableFiled filed : filedList) {
-            columns.add(filed.getFiledName());
-        }
-        RawTableVo d0_vo = new RawTableVo();
-        d0_vo.setIds(ids);
-        d0_vo.setSrid(4525);
-        d0_vo.setRawTableName(d_RawTableName);
-        d0_vo.setSiweiArea(true);
-        d0_vo.setIsGeography(false);
-        d0_vo.setColumns(columns);
-        Object objectData = httpAnalyseService.getHttpAnalyse(d0_vo);
         Map<String, Object> retMap = new HashMap<>();
         retMap.put("yzjg", ret);
-        if (objectData != null) {
-            List<Map> objectDataList = (List<Map>) objectData;
-            for (Map d_map_01 : objectDataList) {
-                d_map_01.put("siweiarea", NumberUtil.double2TwoDecimal(Double.parseDouble(d_map_01.get("siweiarea").toString())));
-            }
-            if (objectDataList != null && objectDataList.size() > 0) {
-                retMap.put("tbxx", objectDataList.get(0));
-            }
-        }
+        retMap.put("tbxx", iTGdbhRwGeomService.selectTGdbhRwGeomById(id));
         return RequestResult.success(retMap);
     }
 }

+ 11 - 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.mapper.gdbh.*;
 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.web.domain.RequestResult;
 import com.onemap.system.api.RemoteFileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -36,6 +38,8 @@ public class GdbhServiceImpl implements IGdbhService {
     private GdbhJgService gdbhJgService;
     @Autowired
     private RemoteFileService remoteFileService;
+    @Resource
+    private ITGdbhRwGeomService iTGdbhRwGeomService;
 
     @Override
     public RequestResult GetMxList(String param) {
@@ -93,7 +97,9 @@ public class GdbhServiceImpl implements IGdbhService {
         if (StringUtils.isNull(gdbhDto)) {
             return RequestResult.error("未查询到数据");
         }
-        return remoteFileService.uploadGeomQuery(gdbhDto.getXzfw(), 1);
+        TGdbhRwGeom gdbhRwGeom = new TGdbhRwGeom();
+        gdbhRwGeom.setRwbsm(bsm);
+        return RequestResult.success(iTGdbhRwGeomService.selectTGdbhRwGeomList(gdbhRwGeom));
     }
 
     @Override
@@ -110,31 +116,12 @@ public class GdbhServiceImpl implements IGdbhService {
     @Override
     public RequestResult AddGdbh(GdbhDto gdbhDto) {
         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();
-            gdbhDto.setGeom(ewkt);
-            gdbhDto.setXzfwTbaleName(tableName);
-            gdbhDto.setXzfwTbaleId(tableId);
-            gdbhDto.setSumNumber(number);
-            gdbhDto.setXzfwTbaleId(tableId);
-            gdbhDto.setXzmj(area);
             gdbhDto.setBsm(rebsm);
+            gdbhDto = gdbhHandleService.AddGdbhYpGeom(gdbhDto.getXzfw(), gdbhDto.getYptype(), gdbhDto);
+            if (gdbhDto == null) {
+                return RequestResult.error("添加失败", null);
+            }
             gdbhDto.setStatus(1);
             gdbhDto.setRwzt(0);
             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 sjy = d2.getSjy();
         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;
     }
 
@@ -107,12 +121,12 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
         }
 
         Map<String, Object> d4map = new HashMap<>();
-        d4map.put("gs",0);
+        d4map.put("gs", 0);
         d4map.put("mj", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_qm", 0);
-        d4map.put("mjbh",0);
+        d4map.put("mjbh", 0);
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         retList.add(d4map);
         return retList;

+ 3 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhJctbServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.onemap.apply.mapper.gdbh.TGdbhJctbMapper;
 import com.onemap.apply.domain.gdbh.TGdbhJctb;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 
@@ -117,6 +118,7 @@ public class TGdbhJctbServiceImpl implements ITGdbhJctbService {
      * @return 结果
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public int handleUploadShpGdbhJctb(String uploadShpId) throws IOException {
         RequestResult resultGeom = fileService.uploadGeomV1Query(uploadShpId, 1);
         if (resultGeom.isError()) {
@@ -151,7 +153,6 @@ public class TGdbhJctbServiceImpl implements ITGdbhJctbService {
             gdbhJctbFileDTO.setReadstatus("1");
             gdbhJctbFileDTO.setReadmessage("验证DDOM文件夹缺失");
         }
-        gdbhJctbFileMapper.insertTGdbhJctbFile(gdbhJctbFileDTO);
         if ("0".equals(gdbhJctbFileDTO.getReadstatus())) {
             //数据迁移
             String doShpPath = tUploadGeomDTO.getShppath();
@@ -167,7 +168,6 @@ public class TGdbhJctbServiceImpl implements ITGdbhJctbService {
             gdbhJctbFileDTO.setShppath(d1_shpPath);
             gdbhJctbFileDTO.setUnzippath(d1_unzippath);
             String tifpath = d1_shpPath.substring(0, d1_shpPath.lastIndexOf("/"));
-
             List<TUploadGeomDetailsDTO> detailsList = tUploadGeomDTO.gettUploadGeomDetailsDTOList();
             for (TUploadGeomDetailsDTO d_dto : detailsList) {
                 TGdbhJctb tGdbhJctb = JSON.parseObject(d_dto.getGeomJson(), TGdbhJctb.class);
@@ -179,6 +179,7 @@ public class TGdbhJctbServiceImpl implements ITGdbhJctbService {
                 tGdbhJctbMapper.insertTGdbhJctb(tGdbhJctb);
             }
         }
+        gdbhJctbFileMapper.insertTGdbhJctbFile(gdbhJctbFileDTO);
         return 1;
     }
 

+ 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.TGdbhYjjbntMapper;
 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.ITGdbhYjjbntService;
 import com.onemap.common.core.utils.DateUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.system.api.RemoteFileService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.File;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -34,6 +37,9 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
     @Resource
     private TGdbhYjjbntMapper tGdbhYjjbntMapper;
 
+    @Autowired
+    private ITGdbhGdService itGdbhGdService;
+
     @Override
     public List<TGdbhYjjbntServerDTO> selectTGdbhYjjbntServerList(TGdbhYjjbntServerDTO tGdbhYjjbntServer) {
         return tGdbhYjjbntServerMapper.selectTGdbhYjjbntServerList(tGdbhYjjbntServer);
@@ -51,6 +57,20 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
         String areacolumn = d2.getAreaColumn();
         String sjy = d2.getSjy();
         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;
     }
 
@@ -113,12 +133,12 @@ public class TGdbhYjjbntServiceImpl implements ITGdbhYjjbntService {
         }
 
         Map<String, Object> d4map = new HashMap<>();
-        d4map.put("gs",0);
+        d4map.put("gs", 0);
         d4map.put("mj", 0);
         d4map.put("mj_m", 0);
         d4map.put("mj_gq", 0);
         d4map.put("mj_qm", 0);
-        d4map.put("mjbh",0);
+        d4map.put("mjbh", 0);
         d4map.put("year", d1.get(d1.size() - 1).getYear());
         retList.add(d4map);
         return retList;

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

@@ -15,6 +15,17 @@
         )t1)t2
     </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 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, public.st_asewkt(geom) 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>

+ 22 - 4
onemap-modules/onemap-file/src/main/java/com/onemap/file/controller/SysFileController.java

@@ -32,6 +32,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.List;
 
 /**
@@ -314,11 +315,15 @@ public class SysFileController {
             }
             // 设置HTTP头部信息
             HttpHeaders headers = new HttpHeaders();
+            //通过getHeaderNames获得所有头名字的Enumeration集合
+//            Enumeration<String> headNames = request.getHeaderNames();
+//            while (headNames.hasMoreElements()) {
+//                String headName = headNames.nextElement();
+//                headers.set(headName, request.getHeader(headName));
+//            }
             headers.add(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + URLEncoder.encode(resource.getFilename(), "UTF-8") + "\"");
-//            headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"");
             headers.setContentType(MediaType.parseMediaType(contentType));
-            headers.setAccessControlAllowOrigin("*");
-
+//            headers.setAccessControlAllowOrigin("*");
             // 返回文件资源
             return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath))  // 可选:设置内容长度
                     .body(resource);
@@ -362,7 +367,7 @@ public class SysFileController {
 //            headers.add(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + URLEncoder.encode(resource.getFilename(), "UTF-8") + "\"");
             headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(resource.getFilename() + "\""));
             headers.setContentType(MediaType.parseMediaType(contentType));
-            headers.setAccessControlAllowOrigin("*");
+//            headers.setAccessControlAllowOrigin("*");
 
             // 返回文件资源
             return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath))  // 可选:设置内容长度
@@ -374,5 +379,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("生成失败");
+        }
+    }
+
 
 }

+ 9 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/TUploadGeomDTO.java

@@ -20,6 +20,7 @@ public class TUploadGeomDTO {
     private String geom;
     private Integer spotsnumber;
     private Double spotsarea;
+    private Double area;
     private Integer sridarea;
     private String fromroute;
     private Integer fromtype;
@@ -144,4 +145,12 @@ public class TUploadGeomDTO {
     public void settUploadGeomDetailsDTOList(List<TUploadGeomDetailsDTO> tUploadGeomDetailsDTOList) {
         this.tUploadGeomDetailsDTOList = tUploadGeomDetailsDTOList;
     }
+
+    public Double getArea() {
+        return area;
+    }
+
+    public void setArea(Double area) {
+        this.area = area;
+    }
 }

+ 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 java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.Map;
 
 public interface ISpaceFileRecordService {
 
@@ -95,4 +96,5 @@ public interface ISpaceFileRecordService {
      */
     String uploadAbsolutePath(String file);
 
+    Map<String,Object> readTifToPng(String file);
 }

+ 31 - 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.service.ISpaceFileRecordService;
 import com.onemap.file.utils.FileUtils;
+import com.onemap.file.utils.TifUtils;
 import com.onemap.file.utils.UnPackageUtils;
 import com.onemap.system.api.AnalyseService;
 import com.onemap.system.api.ApplyService;
@@ -47,6 +48,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -360,6 +362,7 @@ public class SpaceFileRecordServiceImpl implements ISpaceFileRecordService {
         if (dto == null) {
             return null;
         }
+        dto.setArea(dto.getSpotsarea());
         if (isDetail != null && isDetail == 1) {
             TUploadGeomDetailsDTO uploadGeomDetailsDTO = new TUploadGeomDetailsDTO();
             uploadGeomDetailsDTO.setUploadId(dto.getId());
@@ -392,4 +395,32 @@ public class SpaceFileRecordServiceImpl implements ISpaceFileRecordService {
         String unzipPath = uploadFilePath + "/" + file;
         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 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.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);
         }
     }
+
+    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);
+    }
+
+}

+ 11 - 28
sql/pgsql/0_init.sql

@@ -1,30 +1,13 @@
 20241126
 修改表
-base.t_tdzzyj_sjy
-
-20241129 表修改
-vector."tb_qytdzz_jsydzl"
-
-20241129 表修改
-t_jsc_sql
-
--- 视图
-vector.v_qytuzz_qhtb
-
-2024 需要影像多年的影像(暂定数据库记录,超图的影像服务)
-土地整治模块问题说明(完成数据只有海棠区)
-1.全域土地综合整治试点基本情况表 缺少崖州区
-2.vector.tb_qytdzz_jsmb
-2.vector.t_qytdzz_tdlyxz
-3.需要将历届影像地址存入到 vector.t_qytdzz_image中
-4.新发的数据跟之前录入驾驶舱的整治项目信息不匹配,不仅项目个数不一致,而且面积金额也不一致(是否已新文档为主,所以数据需要重新录入)
-5.项目、试点范围、整治范围、前后土地利用现状数据缺失。历届影像地址缺失
-6.土地整治前后土地利用现状数需要发服务,并将服务地址添加到vector.tb_qytdzz_sd_server表中
-
-2024-12-3
-ssxf 表修改
-
-
-20241210
-base.t_gdbh_yjjbnt_server
-需要将服务跟数据进行联动
+1.apply
+# 本地文件上传
+file:
+  #domain: http://192.168.100.120:9201
+  #path: F:\新建文件夹\TempFile
+  #prefix: /statics
+  domain: http://192.168.60.2:9201
+  path: /onemapfile
+  prefix: /statics
+
+vector.t_gdbh_rw_geom