Bladeren bron

添加shp解析接口

LAPTOP-BJJ3IV5R\SIWEI 7 maanden geleden
bovenliggende
commit
38793c8e6e
33 gewijzigde bestanden met toevoegingen van 1036 en 199 verwijderingen
  1. 3 2
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/AnalyseService.java
  2. 4 1
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/SpatialService.java
  3. 6 1
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/TableFiledRelationService.java
  4. 15 0
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/domain/GeomGroupSummaryVo.java
  5. 5 0
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/AnalyseFallbackFactory.java
  6. 5 0
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/SpatialFallbackFactory.java
  7. 7 0
      onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/TableFiledRelationFactory.java
  8. 12 4
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/GetTableDateController.java
  9. 15 0
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/GeomGroupSummaryVo.java
  10. 3 4
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/TableDataMapper.java
  11. 3 4
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/ITableDateService.java
  12. 9 4
      onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/TableDateServiceImpl.java
  13. 43 0
      onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/TableDateMapper.xml
  14. 13 4
      onemap-modules/onemap-file/src/main/java/com/onemap/file/controller/SysFileController.java
  15. 28 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/SpaceFileRecordDTO.java
  16. 171 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/ApiTTable.java
  17. 166 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/ApiTTableFiled.java
  18. 31 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/TableDataVo.java
  19. 15 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/mapper/SpaceFileRecordMapper.java
  20. 33 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/ISpaceFileRecordService.java
  21. 0 11
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/SaveFileService.java
  22. 1 65
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/LocalSysFileServiceImpl.java
  23. 1 19
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SaveFileImpl.java
  24. 234 0
      onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SpaceFileRecordServiceImpl.java
  25. 46 0
      onemap-modules/onemap-file/src/main/resources/mapper/postgresql/SpaceFileRecordMapper.xml
  26. 8 1
      onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/controller/ShpController.java
  27. 1 0
      onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/IShpFileSaveService.java
  28. 45 2
      onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/impl/ShpFileSaveServiceImpl.java
  29. 2 8
      onemap-modules/onemap-system/src/main/java/com/onemap/system/controller/TTableController.java
  30. 10 9
      onemap-modules/onemap-system/src/main/java/com/onemap/system/controller/TTableFiledRelationController.java
  31. 79 60
      onemap-modules/onemap-system/src/main/java/com/onemap/system/domain/TTable.java
  32. 3 0
      onemap-modules/onemap-system/src/main/java/com/onemap/system/service/ITTableFiledRelationService.java
  33. 19 0
      onemap-modules/onemap-system/src/main/java/com/onemap/system/service/impl/TTableFiledRelationServiceImpl.java

+ 3 - 2
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/AnalyseService.java

@@ -7,8 +7,6 @@ import com.onemap.system.api.factory.AnalyseFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-import java.util.Map;
 
 /**
  * 分析服务
@@ -38,6 +36,9 @@ public interface AnalyseService {
     @PostMapping("/table/date/raw_table_length")
     public RequestResult rawTableLength(@RequestBody RawTableLengthVo rawTableLengthVo);
 
+    @PostMapping("/table/date/geom_group_summary")
+    public RequestResult getGeomGroupSummary(@RequestBody GeomGroupSummaryVo geomGroupSummaryVo);
+
     @PostMapping("/hgxfx/generate/docx")
     public RequestResult hgxfxGenerateDocx(@RequestBody HgxfxReportVo hgxfxReportVo);
 }

+ 4 - 1
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/SpatialService.java

@@ -16,6 +16,9 @@ public interface SpatialService {
     @PostMapping("/image/sensing")
     RequestResult getImage(@RequestBody WktsVo wktsVo);
 
-    @GetMapping("/shp/read/file")
+    @PostMapping("/shp/read/file")
     RequestResult shpReadFile(@RequestParam("filepath") String filepath);
+
+    @PostMapping("/shp/read/ewkt")
+    RequestResult shpReadEwkt(@RequestParam("ewkt") String ewkt);
 }

+ 6 - 1
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/TableFiledRelationService.java

@@ -4,8 +4,10 @@ import com.onemap.common.core.constant.ServiceNameConstants;
 import com.onemap.common.core.web.domain.AjaxResult;
 import com.onemap.system.api.factory.TableFiledRelationFactory;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.Map;
 
@@ -20,6 +22,9 @@ public interface TableFiledRelationService {
      * tableDescribe string
      * tableColumns  List<Map<String, String>> (key 字段名 ,value 字段类型)
      */
-    @PostMapping("/relation//add")
+    @PostMapping("/relation/add")
     AjaxResult AddTableFiledRelation(@RequestBody Map<String, Object> tTableFiledRelation);
+
+    @GetMapping("/relation/query/table")
+    AjaxResult QueryTableFiledRelation(@RequestParam("tableid") String tableid);
 }

+ 15 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/domain/GeomGroupSummaryVo.java

@@ -0,0 +1,15 @@
+package com.onemap.system.api.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class GeomGroupSummaryVo {
+    private String tableName; // 原始表名
+    private List<String> tableIds;  // tableIds
+    private List<String> groupColumns; // 列名
+    private Boolean siweiArea; // 是否需要计算面积
+    private Integer srid;  // srid,默认4326
+    private Boolean isGeography = true;
+}

+ 5 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/AnalyseFallbackFactory.java

@@ -56,6 +56,11 @@ public class AnalyseFallbackFactory implements FallbackFactory<AnalyseService> {
                 return RequestResult.error("内部错误");
             }
 
+            @Override
+            public RequestResult getGeomGroupSummary(@RequestBody GeomGroupSummaryVo geomGroupSummaryVo) {
+                return RequestResult.error("内部错误");
+            }
+
             @Override
             public RequestResult intersectionTables(@RequestBody TablesAIdsVo tablesAIdsVo) {
                 return RequestResult.error("内部错误");

+ 5 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/SpatialFallbackFactory.java

@@ -24,6 +24,11 @@ public class SpatialFallbackFactory implements FallbackFactory<SpatialService> {
             public RequestResult shpReadFile(String filepath) {
                 return RequestResult.error("内部错误");
             }
+
+            @Override
+            public RequestResult shpReadEwkt(String ewkt) {
+                return RequestResult.error("内部错误");
+            }
         };
     }
 }

+ 7 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/TableFiledRelationFactory.java

@@ -5,6 +5,8 @@ import com.onemap.system.api.TableFiledRelationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.Map;
 
@@ -19,6 +21,11 @@ public class TableFiledRelationFactory implements FallbackFactory<TableFiledRela
             public AjaxResult AddTableFiledRelation(Map<String, Object> tTableFiledRelation) {
                 return AjaxResult.error("内部错误");
             }
+
+            @Override
+            public AjaxResult QueryTableFiledRelation(String tableId) {
+                return AjaxResult.error("内部错误");
+            }
         };
     }
 }

+ 12 - 4
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/analyse/GetTableDateController.java

@@ -1,9 +1,6 @@
 package com.onemap.analyse.controller.analyse;
 
-import com.onemap.analyse.domain.vo.RawTableLengthVo;
-import com.onemap.analyse.domain.vo.RawTableVo;
-import com.onemap.analyse.domain.vo.TableNameIdsVo;
-import com.onemap.analyse.domain.vo.TargetTableVo;
+import com.onemap.analyse.domain.vo.*;
 import com.onemap.analyse.service.ITableDateService;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.datasource.annotation.Slave;
@@ -76,4 +73,15 @@ public class GetTableDateController {
         map.put("ewkt", ewkt);
         return RequestResult.success(map);
     }
+
+
+    /**
+     * 查询表格,生成表格查询数据分组汇总信息
+     */
+    @PostMapping("/geom_group_summary")
+    @Slave
+    public RequestResult getGeomGroupSummary(@RequestBody GeomGroupSummaryVo geomGroupSummaryVo) {
+        List<Map<String, Object>> mapInfos = tableDateService.getGeomGroupSummary(geomGroupSummaryVo);
+        return RequestResult.success(mapInfos);
+    }
 }

+ 15 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/vo/GeomGroupSummaryVo.java

@@ -0,0 +1,15 @@
+package com.onemap.analyse.domain.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class GeomGroupSummaryVo {
+    private String tableName; // 原始表名
+    private List<String> tableIds;  // tableIds
+    private List<String> groupColumns; // 列名
+    private Boolean siweiArea; // 是否需要计算面积
+    private Integer srid;  // srid,默认4326
+    private Boolean isGeography = true;
+}

+ 3 - 4
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/TableDataMapper.java

@@ -1,9 +1,6 @@
 package com.onemap.analyse.mapper.vector;
 
-import com.onemap.analyse.domain.vo.RawTableLengthVo;
-import com.onemap.analyse.domain.vo.RawTableVo;
-import com.onemap.analyse.domain.vo.TableNameIdsVo;
-import com.onemap.analyse.domain.vo.TargetTableVo;
+import com.onemap.analyse.domain.vo.*;
 import com.onemap.common.datasource.annotation.Slave;
 import org.apache.ibatis.annotations.Param;
 
@@ -22,6 +19,8 @@ public interface TableDataMapper {
 
     Integer getTableCount(String tableName);
 
+    List<Map<String, Object>> getGeomGroupSummary(GeomGroupSummaryVo geomGroupSummaryVo);
+
     void delByLandType(@Param("temporaryTable") String temporaryTable, @Param("rawTable") String rawTable, @Param("landTypeCode") String landTypeCode);
 
     void delByAreaOr(@Param("tableName") String tableName, @Param("minArea") float minArea, @Param("maxArea") float maxArea);

+ 3 - 4
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/ITableDateService.java

@@ -1,10 +1,7 @@
 package com.onemap.analyse.service;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.onemap.analyse.domain.vo.RawTableLengthVo;
-import com.onemap.analyse.domain.vo.RawTableVo;
-import com.onemap.analyse.domain.vo.TableNameIdsVo;
-import com.onemap.analyse.domain.vo.TargetTableVo;
+import com.onemap.analyse.domain.vo.*;
 import com.onemap.common.datasource.annotation.Slave;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,6 +22,8 @@ public interface ITableDateService {
 
     Integer getTableCount(String tableName);
 
+    List<Map<String, Object>> getGeomGroupSummary(GeomGroupSummaryVo geomGroupSummaryVo);
+
     void delByLandType(String temporaryTable, String rawTable, String landTypeCode);
 
     void delByAreaOr(String temporaryTable, float minArea, float maxArea);

+ 9 - 4
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/TableDateServiceImpl.java

@@ -1,16 +1,14 @@
 package com.onemap.analyse.service.impl;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.onemap.analyse.domain.vo.RawTableLengthVo;
-import com.onemap.analyse.domain.vo.RawTableVo;
-import com.onemap.analyse.domain.vo.TableNameIdsVo;
-import com.onemap.analyse.domain.vo.TargetTableVo;
+import com.onemap.analyse.domain.vo.*;
 import com.onemap.analyse.mapper.vector.TableDataMapper;
 import com.onemap.analyse.service.ITableDateService;
 import com.onemap.analyse.utils.JsonUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -42,12 +40,19 @@ public class TableDateServiceImpl implements ITableDateService {
         return ewkt;
     }
 
+
     @Override
     public Integer getTableCount(String tableName) {
         Integer integer = tableDataMapper.getTableCount(tableName);
         return integer;
     }
 
+    @Override
+    public List<Map<String, Object>> getGeomGroupSummary(GeomGroupSummaryVo geomGroupSummaryVo) {
+        List<Map<String, Object>> list = tableDataMapper.getGeomGroupSummary(geomGroupSummaryVo);
+        return list;
+    }
+
 
     @Override
     public void delByAreaOr(String tableName, float minArea, float maxArea) {

+ 43 - 0
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/TableDateMapper.xml

@@ -115,6 +115,7 @@
         public.st_asewkt(public.st_union(geom)) AS geom
         FROM
         "${tableName}"
+        "${tableName}"
         <if test="tableIds != null and tableIds.size()>0 ">
             WHERE
             (id::varchar) IN
@@ -124,6 +125,48 @@
         </if>
     </select>
 
+    <select id="getGeomGroupSummary" resultType="Map">
+        SELECT
+        <if test="groupColumns != null and groupColumns.size()>0 ">
+            <foreach item="column" collection="groupColumns" separator=",">
+                "${column}"
+            </foreach>
+            ,
+        </if>
+        public.st_asewkt(public.st_union(geom)) AS geom,
+        count(1) AS siweiCount,
+        <if test="siweiArea == true">
+            public.st_area(
+            <choose>
+                <when test="srid!=null">
+                    public.st_transform(public.st_union(geom),#{srid})
+                </when>
+                <otherwise>
+                    public.st_union(geom)
+                </otherwise>
+            </choose>
+            <if test="isGeography==true">
+                ::public.geography
+            </if>
+            ) AS siweiArea
+        </if>
+        FROM
+        "${tableName}"
+        <if test="tableIds != null and tableIds.size()>0 ">
+            WHERE
+            (id::varchar) IN
+            <foreach item="tableId" collection="tableIds" open="(" separator="," close=")">
+                #{tableId}
+            </foreach>
+        </if>
+        <if test="groupColumns != null and groupColumns.size()>0 ">
+            group by
+            <foreach item="column" collection="groupColumns" separator="," >
+                "${column}"
+            </foreach>
+        </if>
+    </select>
+
     <select id="getTableCount" resultType="Integer">
         SELECT count(1)
         FROM "${sjy}"

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

@@ -2,6 +2,7 @@ package com.onemap.file.controller;
 
 import com.onemap.common.core.domain.UploadZipDTO;
 import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.file.service.ISpaceFileRecordService;
 import com.onemap.file.service.SaveFileService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,6 +29,8 @@ public class SysFileController {
     @Autowired
     private ISysFileService sysFileService;
     @Autowired
+    private ISpaceFileRecordService spaceFileRecordService;
+    @Autowired
     private SaveFileService saveFileService;
 
     /**
@@ -197,14 +200,13 @@ public class SysFileController {
      * @param fromRoute 来源
      */
     @PostMapping("/upload/geom")
-    public RequestResult geomAdd(MultipartFile file, Integer fromType, String geom, String fromRoute) {
+    public RequestResult uploadGeom(MultipartFile file, Integer fromType, String geom, String fromRoute) {
         try {
             RequestResult res = null;
             if (fromType == 1) {
-                String id = saveFileService.saveDraw(geom, fromRoute);
-                res = RequestResult.success("上传成功", saveFileService.getById(id));
+                res = spaceFileRecordService.uploadAddShpDraw(geom, fromRoute);
             } else {
-                res = sysFileService.uploadAddShpFile(file, fromRoute);
+                res = spaceFileRecordService.uploadAddShpFile(file, fromRoute);
             }
             return res;
         } catch (Exception e) {
@@ -212,4 +214,11 @@ public class SysFileController {
             return RequestResult.error("上传失败!", null);
         }
     }
+
+    @GetMapping("/upload/geom/query")
+    public RequestResult uploadGeomQuery(String id, Integer isDetail) {
+        return RequestResult.error("上传失败!", spaceFileRecordService.querySpaceFileRecord(id, isDetail));
+    }
+
+
 }

+ 28 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/SpaceFileRecordDTO.java

@@ -0,0 +1,28 @@
+package com.onemap.file.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.onemap.file.domain.res.TableDataVo;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@TableName("t_space_file_record")
+@Data
+public class SpaceFileRecordDTO {
+    private String id;
+    private String filepath;
+    private String zippath;
+    @TableField(value = "from_type")
+    private Integer fromType;// 1:手绘,2:shp导入
+    @TableField(value = "create_time")
+    private Date createTime;
+    @TableField(value = "from_route")
+    private String fromRoute;
+    private String geom;
+    private Double area;
+    private Integer number;
+    @TableField(exist = false)
+    List<List<TableDataVo>> dataList;
+}

+ 171 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/ApiTTable.java

@@ -0,0 +1,171 @@
+package com.onemap.file.domain.res;
+
+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;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】对象 t_table
+ *
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public class ApiTTable extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private String id;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String tableName;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String tableDescribe;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer tableType;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer isExist;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Date deleteTime;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String createUserId;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String deleteUserId;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String version;
+
+    //table的字段集合
+    private List<ApiTTableFiled> tableFiledlist;
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableDescribe(String tableDescribe) {
+        this.tableDescribe = tableDescribe;
+    }
+
+    public String getTableDescribe() {
+        return tableDescribe;
+    }
+
+    public void setTableType(Integer tableType) {
+        this.tableType = tableType;
+    }
+
+    public Integer getTableType() {
+        return tableType;
+    }
+
+    public void setIsExist(Integer isExist) {
+        this.isExist = isExist;
+    }
+
+    public Integer getIsExist() {
+        return isExist;
+    }
+
+    public void setDeleteTime(Date deleteTime) {
+        this.deleteTime = deleteTime;
+    }
+
+    public Date getDeleteTime() {
+        return deleteTime;
+    }
+
+    public void setCreateUserId(String createUserId) {
+        this.createUserId = createUserId;
+    }
+
+    public String getCreateUserId() {
+        return createUserId;
+    }
+
+    public void setDeleteUserId(String deleteUserId) {
+        this.deleteUserId = deleteUserId;
+    }
+
+    public String getDeleteUserId() {
+        return deleteUserId;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("tableName", getTableName())
+                .append("tableDescribe", getTableDescribe())
+                .append("tableType", getTableType())
+                .append("isExist", getIsExist())
+                .append("createTime", getCreateTime())
+                .append("deleteTime", getDeleteTime())
+                .append("createUserId", getCreateUserId())
+                .append("deleteUserId", getDeleteUserId())
+                .append("version", getVersion())
+                .toString();
+    }
+
+    public List<ApiTTableFiled> getTableFiledlist() {
+        return tableFiledlist;
+    }
+
+    public void setTableFiledlist(List<ApiTTableFiled> tableFiledlist) {
+        this.tableFiledlist = tableFiledlist;
+    }
+}

+ 166 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/ApiTTableFiled.java

@@ -0,0 +1,166 @@
+package com.onemap.file.domain.res;
+
+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;
+
+import java.util.Date;
+
+/**
+ * 【请填写功能名称】对象 t_table_filed
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public class ApiTTableFiled extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedName;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedZh;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedDescribe;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedType;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedTypeLen;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filedDict;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Date deleteTime;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String createUserId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String deleteUserId;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setFiledName(String filedName) 
+    {
+        this.filedName = filedName;
+    }
+
+    public String getFiledName() 
+    {
+        return filedName;
+    }
+    public void setFiledZh(String filedZh) 
+    {
+        this.filedZh = filedZh;
+    }
+
+    public String getFiledZh() 
+    {
+        return filedZh;
+    }
+    public void setFiledDescribe(String filedDescribe) 
+    {
+        this.filedDescribe = filedDescribe;
+    }
+
+    public String getFiledDescribe() 
+    {
+        return filedDescribe;
+    }
+    public void setFiledType(String filedType) 
+    {
+        this.filedType = filedType;
+    }
+
+    public String getFiledType() 
+    {
+        return filedType;
+    }
+    public void setFiledTypeLen(String filedTypeLen) 
+    {
+        this.filedTypeLen = filedTypeLen;
+    }
+
+    public String getFiledTypeLen() 
+    {
+        return filedTypeLen;
+    }
+    public void setFiledDict(String filedDict) 
+    {
+        this.filedDict = filedDict;
+    }
+
+    public String getFiledDict() 
+    {
+        return filedDict;
+    }
+    public void setDeleteTime(Date deleteTime) 
+    {
+        this.deleteTime = deleteTime;
+    }
+
+    public Date getDeleteTime() 
+    {
+        return deleteTime;
+    }
+    public void setCreateUserId(String createUserId) 
+    {
+        this.createUserId = createUserId;
+    }
+
+    public String getCreateUserId() 
+    {
+        return createUserId;
+    }
+    public void setDeleteUserId(String deleteUserId) 
+    {
+        this.deleteUserId = deleteUserId;
+    }
+
+    public String getDeleteUserId() 
+    {
+        return deleteUserId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("filedName", getFiledName())
+            .append("filedZh", getFiledZh())
+            .append("filedDescribe", getFiledDescribe())
+            .append("filedType", getFiledType())
+            .append("filedTypeLen", getFiledTypeLen())
+            .append("filedDict", getFiledDict())
+            .append("createTime", getCreateTime())
+            .append("deleteTime", getDeleteTime())
+            .append("createUserId", getCreateUserId())
+            .append("deleteUserId", getDeleteUserId())
+            .toString();
+    }
+}

+ 31 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/domain/res/TableDataVo.java

@@ -0,0 +1,31 @@
+package com.onemap.file.domain.res;
+
+public class TableDataVo {
+    private String filed;
+    private String filedZH;
+    private Object data;
+
+    public String getFiled() {
+        return filed;
+    }
+
+    public void setFiled(String filed) {
+        this.filed = filed;
+    }
+
+    public String getFiledZH() {
+        return filedZH;
+    }
+
+    public void setFiledZH(String filedZH) {
+        this.filedZH = filedZH;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+}

+ 15 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/mapper/SpaceFileRecordMapper.java

@@ -0,0 +1,15 @@
+package com.onemap.file.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.common.datasource.annotation.Master;
+import com.onemap.file.domain.SpaceFileRecordDTO;
+
+@Master
+public interface SpaceFileRecordMapper extends BaseMapper<SpaceFileRecordDTO> {
+
+    int saveSpaceFileRecord(SpaceFileRecordDTO spaceFileRecordDTO);
+
+    SpaceFileRecordDTO querySpaceFileRecordById(String id);
+
+    int updateSpaceFileRecord(SpaceFileRecordDTO spaceFileRecordDTO);
+}

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

@@ -0,0 +1,33 @@
+package com.onemap.file.service;
+
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.file.domain.SpaceFileRecordDTO;
+import org.springframework.web.multipart.MultipartFile;
+
+public interface ISpaceFileRecordService {
+
+    /**
+     * 将解析数据单独保存到表中
+     *
+     * @param file
+     * @param fromRoute
+     * @return
+     * @throws Exception
+     */
+    RequestResult uploadAddShpFile(MultipartFile file, String fromRoute) throws Exception;
+
+    RequestResult uploadAddShpDraw(String geom, String fromRoute) throws Exception;
+
+    String saveSpaceFileRecord(SpaceFileRecordDTO spaceFileRecordDTO) throws Exception;
+
+    /**
+     * 根据ID查询空间信息,
+     *
+     * @param id
+     * @param isDetail 是否查询详情,1是 其他否
+     * @return
+     * @throws Exception
+     */
+    SpaceFileRecordDTO querySpaceFileRecord(String id, int isDetail);
+
+}

+ 0 - 11
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/SaveFileService.java

@@ -7,19 +7,8 @@ import org.springframework.web.multipart.MultipartFile;
 public interface SaveFileService {
     String saveShpFile(String shpPath, String zippath, String fromRoute) throws Exception;
 
-//    String saveShpFileNew(String shpPath, String zippath, String fromRoute) throws Exception;
-
     String saveDraw(String geom, String fromRoute);
 
     GeomRes getById(String id);
 
-    /**
-     * 将解析数据单独保存到表中
-     *
-     * @param geom
-     * @param fromRoute
-     * @return
-     * @throws Exception
-     */
-//    RequestResult uploadAddShpGeom(String geom, String fromRoute) throws Exception;
 }

+ 1 - 65
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/LocalSysFileServiceImpl.java

@@ -6,6 +6,7 @@ import com.onemap.common.core.domain.UploadZipDTO;
 import com.onemap.common.core.domain.WordToPdfDTO;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.file.domain.SpaceFileRecordDTO;
 import com.onemap.file.service.ISysFileService;
 import com.onemap.file.service.SaveFileService;
 import com.onemap.file.utils.*;
@@ -323,71 +324,6 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         return null;
     }
 
-    private void uploadDestMultipartFile(MultipartFile file, String destPath) throws IOException {
-        String fileName = file.getOriginalFilename();
-        // 获得文件后缀名
-        String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
-        // 判断上传的是否是压缩包
-        if (!type.equals("zip") && !type.equals("rar")) {
-            throw new FilerException("请上传压缩包");
-        }
-        //新文件
-        File newFile = new File(destPath + "/" + fileName);
-        //新文件的上级目录
-        File dir = newFile.getParentFile();
-        // 判断是否,并创建文件夹
-        if (!dir.exists()) {
-            dir.mkdirs();
-        }
-
-        //将文件复制到新文件
-//        file.transferTo(newFile);
-        Files.copy(file.getInputStream(), newFile.toPath());
-
-        // 解压zip格式
-        if (type.equals("zip")) {
-            new UnPackageUtils().unPackZip(newFile, destPath);
-        } else {
-            // 解压rar格式
-            new UnPackageUtils().unPackRar(newFile, destPath);
-        }
-    }
-
-    public RequestResult uploadAddShpFile(MultipartFile file, String fromRoute) throws Exception {
-        // 获取当前时间的时间戳
-        long timeMillis = System.currentTimeMillis();
-        //生成SHP解压文件路径
-        String shpPath = shpLocalFilePath + "/temp" + "/" + timeMillis;
-        //解压文件
-        uploadDestMultipartFile(file, shpPath);
-
-        String newShpPath = null;
-        File[] files = new File(shpPath).listFiles();
-        for (File file1 : files) {
-            List<File> shpFiles = new ArrayList<>();
-            FileUtils.findShpFiles(file1, shpFiles);
-            if (shpFiles.size() != 0) {
-                newShpPath = shpFiles.get(0).getPath();
-            }
-        }
-        if (StringUtils.isEmpty(newShpPath)) {
-            return RequestResult.error("未读取到SHP文件");
-        }
-        RequestResult res = spatialService.shpReadFile(shpPath);
-        if (!res.isSuccess()) {
-            return res;
-        }
-        String tableID = (String) res.get(RequestResult.DATA_TAG);
-        String id = saveFileService.saveShpFile(shpPath, tableID, fromRoute);
 
 
-//        if (!"".equals(shpPath)) {
-//            String id = saveFileService.saveShpFile(shpPath, dest.getPath(), fromRoute);
-//            return RequestResult.success("上传成功", saveFileService.getById(id));
-//        } else {
-//            return RequestResult.error("未检索到shp文件");
-//        }
-        return null;
-    }
-
 }

+ 1 - 19
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/impl/SaveFileImpl.java

@@ -37,25 +37,6 @@ public class SaveFileImpl implements SaveFileService {
         zhxzFileMapper.saveGeom(geomResourceDTO);
         return uuid;
     }
-//
-//    @Override
-//    @Master
-//    public String saveShpFile(String shpPath, String zippath, String fromRoute) throws Exception {
-//        String ewkt = WktUtils.getShpWkt(shpPath);
-//
-//        GeomResourceDTO geomResourceDTO = new GeomResourceDTO();
-//
-//        String uuid = StringUtils.getUUID();
-//        geomResourceDTO.setId(uuid);
-//        geomResourceDTO.setZippath(zippath);
-//        geomResourceDTO.setFilepath(shpPath);
-//        geomResourceDTO.setGeom(ewkt);
-//        geomResourceDTO.setFromType(2);
-//        geomResourceDTO.setFromRoute(fromRoute);
-//
-//        zhxzFileMapper.saveGeom(geomResourceDTO);
-//        return uuid;
-//    }
 
     @Override
     @Master
@@ -74,6 +55,7 @@ public class SaveFileImpl implements SaveFileService {
         zhxzFileMapper.saveGeom(geomResourceDTO);
         return uuid;
     }
+
     @Override
     @Master
     public GeomRes getById(String id) {

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

@@ -0,0 +1,234 @@
+package com.onemap.file.service.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.common.core.utils.StringUtils;
+import com.onemap.common.core.web.domain.AjaxResult;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.file.domain.SpaceFileRecordDTO;
+import com.onemap.file.mapper.SpaceFileRecordMapper;
+import com.onemap.file.service.ISpaceFileRecordService;
+import com.onemap.file.service.SaveFileService;
+import com.onemap.file.utils.FileUtils;
+import com.onemap.file.utils.UnPackageUtils;
+import com.onemap.system.api.AnalyseService;
+import com.onemap.system.api.SpatialService;
+import com.onemap.system.api.TableFiledRelationService;
+import com.onemap.system.api.domain.GeomGroupSummaryVo;
+import com.onemap.system.api.domain.RawTableVo;
+import com.onemap.file.domain.res.ApiTTable;
+import com.onemap.file.domain.res.ApiTTableFiled;
+import com.onemap.file.domain.res.TableDataVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.annotation.processing.FilerException;
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class SpaceFileRecordServiceImpl implements ISpaceFileRecordService {
+
+    @Autowired
+    private SaveFileService saveFileService;
+    @Autowired
+    private SpatialService spatialService;
+    @Value("${businessType.shp}")
+    private String shpLocalFilePath;
+    @Resource
+    private SpaceFileRecordMapper spaceFileRecordMapper;
+    @Resource
+    private TableFiledRelationService tableFiledRelationService;
+    @Resource
+    private AnalyseService analyseService;
+
+    @Override
+    public String saveSpaceFileRecord(SpaceFileRecordDTO spaceFileRecordDTO) throws Exception {
+        if (StringUtils.isEmpty(spaceFileRecordDTO.getId())) {
+            spaceFileRecordDTO.setId(StringUtils.getUUID());
+        }
+        spaceFileRecordMapper.saveSpaceFileRecord(spaceFileRecordDTO);
+        return spaceFileRecordDTO.getId();
+    }
+
+    @Override
+    public SpaceFileRecordDTO querySpaceFileRecord(String id, int isDetail) {
+        SpaceFileRecordDTO dto = spaceFileRecordMapper.querySpaceFileRecordById(id);
+        if (dto == null) {
+            return null;
+        }
+
+        //查询tableid
+        String tableId = dto.getFilepath();
+        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);
+
+        if (StringUtils.isEmpty(dto.getGeom())) {
+            //分组查询
+            GeomGroupSummaryVo geomGroupSummaryVo = new GeomGroupSummaryVo();
+            geomGroupSummaryVo.setSiweiArea(true);
+            geomGroupSummaryVo.setSrid(4525);
+            geomGroupSummaryVo.setIsGeography(false);
+            geomGroupSummaryVo.setTableName(tTable.getTableName());
+            RequestResult rawTableSumData = analyseService.getGeomGroupSummary(geomGroupSummaryVo);
+            if (!rawTableSumData.isSuccess()) {
+                return null;
+            }
+
+            List<Map<String, Object>> d_list_0 = (List<Map<String, Object>>) rawTableSumData.get(RequestResult.DATA_TAG);
+            Map<String, Object> d_map_0 = d_list_0.get(0);
+            int siweicount = (int) d_map_0.get("siweicount");
+            Double siweiarea = (Double) d_map_0.get("siweiarea");
+            String sumgeom = (String) d_map_0.get("geom");
+
+            dto.setArea(siweiarea);
+            dto.setNumber(siweicount);
+            dto.setGeom(sumgeom);
+            spaceFileRecordMapper.updateSpaceFileRecord(dto);
+        }
+
+        if (isDetail == 1) {
+            List<String> columns = new ArrayList<>();
+            for (ApiTTableFiled filed : tTable.getTableFiledlist()) {
+                columns.add(filed.getFiledName());
+            }
+            RawTableVo rawTableVo = new RawTableVo();
+            rawTableVo.setRawTableName(tTable.getTableName());
+            rawTableVo.setColumns(columns);
+            rawTableVo.setSrid(4525);
+            rawTableVo.setIsGeography(false);
+            rawTableVo.setSiweiArea(true);
+            RequestResult rawTableData = analyseService.rawTable(rawTableVo);
+            if (!rawTableData.isSuccess()) {
+                return null;
+            }
+            List<Map<String, Object>> retData = (List<Map<String, Object>>) rawTableData.get(RequestResult.DATA_TAG);
+            List<List<TableDataVo>> dataList_0 = dataMapTransFormZh(retData, tTable.getTableFiledlist());
+            dto.setDataList(dataList_0);
+        }
+        return dto;
+    }
+
+
+    public RequestResult uploadAddShpFile(MultipartFile file, String fromRoute) throws Exception {
+        // 获取当前时间的时间戳
+        long timeMillis = System.currentTimeMillis();
+        //生成SHP解压文件路径
+        String shpPath = shpLocalFilePath + "/temp" + "/" + timeMillis;
+        //解压文件
+        uploadDestMultipartFile(file, shpPath);
+
+        String newShpPath = null;
+        File[] files = new File(shpPath).listFiles();
+        for (File file1 : files) {
+            List<File> shpFiles = new ArrayList<>();
+            FileUtils.findShpFiles(file1, shpFiles);
+            if (shpFiles.size() != 0) {
+                newShpPath = shpFiles.get(0).getPath();
+            }
+        }
+        if (StringUtils.isEmpty(newShpPath)) {
+            return RequestResult.error("未读取到SHP文件");
+        }
+        RequestResult res = spatialService.shpReadFile(newShpPath);
+        if (!res.isSuccess()) {
+            return res;
+        }
+        String tableID = (String) res.get(RequestResult.MSG_TAG);
+        SpaceFileRecordDTO spaceFileRecordDTO = new SpaceFileRecordDTO();
+        spaceFileRecordDTO.setFromType(2);
+        spaceFileRecordDTO.setFilepath(tableID);
+        spaceFileRecordDTO.setFilepath(tableID);
+        spaceFileRecordDTO.setFromRoute(fromRoute);
+        String id = saveSpaceFileRecord(spaceFileRecordDTO);
+        return RequestResult.success("上传成功", querySpaceFileRecord(id, 0));
+    }
+
+    public RequestResult uploadAddShpDraw(String geom, String fromRoute) throws Exception {
+        RequestResult res = spatialService.shpReadEwkt(geom);
+        if (!res.isSuccess()) {
+            return res;
+        }
+        String tableID = (String) res.get(RequestResult.MSG_TAG);
+        SpaceFileRecordDTO spaceFileRecordDTO = new SpaceFileRecordDTO();
+        spaceFileRecordDTO.setFromType(2);
+        spaceFileRecordDTO.setFilepath(tableID);
+        spaceFileRecordDTO.setFilepath(tableID);
+        spaceFileRecordDTO.setFromRoute(fromRoute);
+        String id = saveSpaceFileRecord(spaceFileRecordDTO);
+        return RequestResult.success("上传成功", querySpaceFileRecord(id, 0));
+    }
+
+
+    private void uploadDestMultipartFile(MultipartFile file, String destPath) throws IOException {
+        String fileName = file.getOriginalFilename();
+        // 获得文件后缀名
+        String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+        // 判断上传的是否是压缩包
+        if (!type.equals("zip")) {
+            throw new FilerException("请上传压缩包,暂支持ZIP");
+        }
+        //新文件
+        File newFile = new File(destPath + "/" + fileName);
+        //新文件的上级目录
+        File dir = newFile.getParentFile();
+        // 判断是否,并创建文件夹
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        //将文件复制到新文件
+        Files.copy(file.getInputStream(), newFile.toPath());
+        // 解压zip格式
+        new UnPackageUtils().unPackZip(newFile, destPath);
+    }
+
+    private List<List<TableDataVo>> dataMapTransFormZh(List<Map<String, Object>> from_jg, List<ApiTTableFiled> filedList) {
+        List<List<TableDataVo>> retList = new ArrayList<>();
+        if (from_jg == null || from_jg.size() == 0) {
+            return retList;
+        }
+        if (filedList == null || filedList.size() == 0) {
+            return retList;
+        }
+        //循环结果
+        for (Map v_data : from_jg) {
+            //循环字段
+            List<TableDataVo> v_dataList = new ArrayList<>();
+            for (ApiTTableFiled v_filed_data : filedList) {
+                String v_filedName = v_filed_data.getFiledName();
+                String v_filedZh = v_filed_data.getFiledZh();
+                Object v_filedData = v_data.get(v_filedName);
+                TableDataVo tableDataVo = new TableDataVo();
+                tableDataVo.setData(v_filedData);
+                tableDataVo.setFiledZH(v_filedZh);
+                tableDataVo.setFiled(v_filedName);
+                v_dataList.add(tableDataVo);
+            }
+            Object siweiarea = v_data.get("siweiarea");
+            if (StringUtils.isNotNull(siweiarea)) {
+                // 面积
+                TableDataVo tableDataVo = new TableDataVo();
+                tableDataVo.setData(new BigDecimal(String.valueOf(siweiarea)).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                tableDataVo.setFiledZH("面积(平方米)");
+                tableDataVo.setFiled("siweiarea");
+                v_dataList.add(tableDataVo);
+            }
+            retList.add(v_dataList);
+        }
+        return retList;
+    }
+}

+ 46 - 0
onemap-modules/onemap-file/src/main/resources/mapper/postgresql/SpaceFileRecordMapper.xml

@@ -0,0 +1,46 @@
+<?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.file.mapper.SpaceFileRecordMapper">
+
+    <!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.onemap.file.domain.SpaceFileRecordDTO" id="spaceFileRecordResult">
+
+    </resultMap>
+
+    <insert id="saveSpaceFileRecord">
+        INSERT INTO t_space_file_record (id, filepath, zippath, from_type, create_time, from_route)
+        VALUES (#{id},
+                #{filepath},
+                #{zippath},
+                #{fromType}, now(),
+                #{fromRoute})
+    </insert>
+
+    <select id="querySpaceFileRecordById" parameterType="String" resultMap="spaceFileRecordResult">
+        select zippath,
+               "number",
+               id,
+               public.st_asewkt(geom) AS geom,
+               from_type,
+               from_route,
+               filepath,
+               create_time,
+               area
+        from t_space_file_record
+        where id = #{id}
+    </select>
+
+    <update id="updateSpaceFileRecord">
+        update t_space_file_record
+        <set>
+            <if test="geom != null and geom != ''">geom =
+                public.st_transform(public.st_geomfromewkt(#{geom,jdbcType=OTHER}), 4326),
+            </if>
+            <if test="area != null and area != ''">area = #{area},</if>
+            <if test="number != null and number != ''">"number" = #{number},</if>
+            id = #{id}
+        </set>
+        where id = #{id}
+    </update>
+</mapper>

+ 8 - 1
onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/controller/ShpController.java

@@ -39,7 +39,7 @@ public class ShpController {
         return RequestResult.success(map);
     }
 
-    @GetMapping("/read/file")
+    @PostMapping("/read/file")
     public RequestResult readFile(@RequestParam("filepath") String filepath) {
         if (StringUtils.isEmpty(filepath)) {
             return RequestResult.error("filepath is null");
@@ -47,5 +47,12 @@ public class ShpController {
         return RequestResult.success(shpFileSaveService.readFile(filepath));
     }
 
+    @PostMapping("/read/ewkt")
+    public RequestResult readEwkt(@RequestParam("ewkt") String ewkt) throws Exception {
+        if (StringUtils.isEmpty(ewkt)) {
+            return RequestResult.error("ewkt is null");
+        }
+        return RequestResult.success(shpFileSaveService.readEwkt(ewkt));
+    }
 
 }

+ 1 - 0
onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/IShpFileSaveService.java

@@ -2,4 +2,5 @@ package com.onemap.spatial.service;
 
 public interface IShpFileSaveService {
     public String readFile(String filepath);
+    public String readEwkt(String ewkt) throws Exception;
 }

+ 45 - 2
onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/impl/ShpFileSaveServiceImpl.java

@@ -35,10 +35,55 @@ public class ShpFileSaveServiceImpl implements IShpFileSaveService {
 
     @Override
     public String readFile(String filepath) {
+        System.out.println("filepath:" + filepath);
         return readShapeFile(new File(filepath));
 //        readShapeFile(new File("D:\\02DATA\\三亚\\甲方数据\\权属\\SHP\\国有使用权去掉.shp"));
     }
 
+    @Override
+    public String readEwkt(String ewkt) throws Exception {
+        int len = ewkt.indexOf(";");
+        if (len < 0) {
+            ewkt = "SRID=" + 4326 + ";" + ewkt;
+        }
+        //获取字段列表
+        List<Map<String, String>> tableCommsList = new ArrayList<>();
+        //添加ID
+        Map<String, String> attributesMapId = new LinkedHashMap<>();
+        attributesMapId.put("key", "id");
+        attributesMapId.put("value", "varchar");
+        tableCommsList.add(attributesMapId);
+
+        //添加ID
+        Map<String, String> attributesMapGeom = new LinkedHashMap<>();
+        attributesMapGeom.put("key", "geom");
+        attributesMapGeom.put("value", "public.geometry");
+        tableCommsList.add(attributesMapGeom);
+
+        String tableName = "z_shp" + "_" + System.currentTimeMillis() + "_" + StringUtils.getUUID();
+        shpFileMapper.createTable(tableCommsList, tableName);
+
+        Map<String, Object> table_data_0 = new HashMap<>();
+        table_data_0.put("tableName", tableName);
+        table_data_0.put("tableDescribe", "WKT解析表" + tableName);
+        table_data_0.put("tableColumns", tableCommsList);
+        AjaxResult Ajax = tableFiledRelationService.AddTableFiledRelation(table_data_0);
+        String tableId = null;
+        if (Ajax.isSuccess()) {
+            Object t_data = Ajax.get(AjaxResult.DATA_TAG);
+            if (StringUtils.isNull(t_data)) {
+                throw new Exception("SHP文件入库失败");
+            }
+            tableId = (String) t_data;
+        }
+        List<Object> pg_rk_list = new ArrayList<>();
+        pg_rk_list.add(StringUtils.getUUID());
+        ewkt = "public.st_transform(public.st_geomfromewkt('" + ewkt + "'), 4326)";
+        shpFileMapper.insertTableData(pg_rk_list, tableName, ewkt);
+        return tableId;
+    }
+
+
     public String convertShpFieldType2H2GISOrPG(Class value) throws Exception {
         if (value == String.class) {//文本
             return "varchar";
@@ -127,8 +172,6 @@ public class ShpFileSaveServiceImpl implements IShpFileSaveService {
             attributesMap2.put("value", "public.geometry");
             tableCommsList.add(attributesMap2);
 
-            System.out.println(tableCommsList.toString());
-
             String tableName = "z_shp" + "_" + System.currentTimeMillis() + "_" + StringUtils.getUUID();
             shpFileMapper.createTable(tableCommsList, tableName);
             Map<String, Object> table_data_0 = new HashMap<>();

+ 2 - 8
onemap-modules/onemap-system/src/main/java/com/onemap/system/controller/TTableController.java

@@ -13,14 +13,7 @@ import com.onemap.common.security.annotation.RequiresPermissions;
 import com.onemap.system.domain.TTable;
 import com.onemap.system.service.ITTableService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 【请填写功能名称】Controller
@@ -95,4 +88,5 @@ public class TTableController extends BaseController {
     public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(tTableService.deleteTTableByIds(ids));
     }
+
 }

+ 10 - 9
onemap-modules/onemap-system/src/main/java/com/onemap/system/controller/TTableFiledRelationController.java

@@ -11,17 +11,11 @@ import com.onemap.common.core.web.page.TableDataInfo;
 import com.onemap.common.log.annotation.Log;
 import com.onemap.common.log.enums.BusinessType;
 import com.onemap.common.security.annotation.RequiresPermissions;
+import com.onemap.system.domain.TTable;
 import com.onemap.system.domain.TTableFiledRelation;
 import com.onemap.system.service.ITTableFiledRelationService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 【请填写功能名称】Controller
@@ -105,10 +99,17 @@ public class TTableFiledRelationController extends BaseController {
      * tableDescribe string
      * tableColumns  List<Map<String, String>> (key 字段名 ,value 字段类型)
      */
-    @Log(title = "添加表和字段", businessType = BusinessType.UPDATE)
+    @Log(title = "添加表和字段", businessType = BusinessType.OTHER)
     @PostMapping("/add")
     public AjaxResult AddTableFiledRelation(@RequestBody Map<String, Object> tTableFiledRelation) {
         String id = tTableFiledRelationService.addTableFiledRelation(tTableFiledRelation);
         return AjaxResult.success("操作成功", id);
     }
+
+    @Log(title = "查询表和字段", businessType = BusinessType.OTHER)
+    @GetMapping("/query/table")
+    public AjaxResult QueryTableFiledRelation(@RequestParam("tableid") String tableid) {
+        return AjaxResult.success("操作成功", tTableFiledRelationService.QueryTableFiledRelation(tableid));
+    }
+
 }

+ 79 - 60
onemap-modules/onemap-system/src/main/java/com/onemap/system/domain/TTable.java

@@ -1,6 +1,7 @@
 package com.onemap.system.domain;
 
 import java.util.Date;
+import java.util.List;
 
 import com.onemap.common.core.annotation.Excel;
 import com.onemap.common.core.web.domain.BaseEntity;
@@ -9,144 +10,162 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 【请填写功能名称】对象 t_table
- * 
+ *
  * @author ruoyi
  * @date 2024-08-06
  */
-public class TTable extends BaseEntity
-{
+public class TTable extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     private String id;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String tableName;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String tableDescribe;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Integer tableType;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Integer isExist;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Date deleteTime;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String createUserId;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String deleteUserId;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String version;
 
-    public void setId(String id) 
-    {
+    //table的字段集合
+    private List<TTableFiled> tableFiledlist;
+
+    public void setId(String id) {
         this.id = id;
     }
 
-    public String getId() 
-    {
+    public String getId() {
         return id;
     }
-    public void setTableName(String tableName) 
-    {
+
+    public void setTableName(String tableName) {
         this.tableName = tableName;
     }
 
-    public String getTableName() 
-    {
+    public String getTableName() {
         return tableName;
     }
-    public void setTableDescribe(String tableDescribe) 
-    {
+
+    public void setTableDescribe(String tableDescribe) {
         this.tableDescribe = tableDescribe;
     }
 
-    public String getTableDescribe() 
-    {
+    public String getTableDescribe() {
         return tableDescribe;
     }
-    public void setTableType(Integer tableType) 
-    {
+
+    public void setTableType(Integer tableType) {
         this.tableType = tableType;
     }
 
-    public Integer getTableType() 
-    {
+    public Integer getTableType() {
         return tableType;
     }
-    public void setIsExist(Integer isExist) 
-    {
+
+    public void setIsExist(Integer isExist) {
         this.isExist = isExist;
     }
 
-    public Integer getIsExist() 
-    {
+    public Integer getIsExist() {
         return isExist;
     }
-    public void setDeleteTime(Date deleteTime) 
-    {
+
+    public void setDeleteTime(Date deleteTime) {
         this.deleteTime = deleteTime;
     }
 
-    public Date getDeleteTime() 
-    {
+    public Date getDeleteTime() {
         return deleteTime;
     }
-    public void setCreateUserId(String createUserId) 
-    {
+
+    public void setCreateUserId(String createUserId) {
         this.createUserId = createUserId;
     }
 
-    public String getCreateUserId() 
-    {
+    public String getCreateUserId() {
         return createUserId;
     }
-    public void setDeleteUserId(String deleteUserId) 
-    {
+
+    public void setDeleteUserId(String deleteUserId) {
         this.deleteUserId = deleteUserId;
     }
 
-    public String getDeleteUserId() 
-    {
+    public String getDeleteUserId() {
         return deleteUserId;
     }
-    public void setVersion(String version) 
-    {
+
+    public void setVersion(String version) {
         this.version = version;
     }
 
-    public String getVersion() 
-    {
+    public String getVersion() {
         return version;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("tableName", getTableName())
-            .append("tableDescribe", getTableDescribe())
-            .append("tableType", getTableType())
-            .append("isExist", getIsExist())
-            .append("createTime", getCreateTime())
-            .append("deleteTime", getDeleteTime())
-            .append("createUserId", getCreateUserId())
-            .append("deleteUserId", getDeleteUserId())
-            .append("version", getVersion())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("tableName", getTableName())
+                .append("tableDescribe", getTableDescribe())
+                .append("tableType", getTableType())
+                .append("isExist", getIsExist())
+                .append("createTime", getCreateTime())
+                .append("deleteTime", getDeleteTime())
+                .append("createUserId", getCreateUserId())
+                .append("deleteUserId", getDeleteUserId())
+                .append("version", getVersion())
+                .toString();
+    }
+
+    public List<TTableFiled> getTableFiledlist() {
+        return tableFiledlist;
+    }
+
+    public void setTableFiledlist(List<TTableFiled> tableFiledlist) {
+        this.tableFiledlist = tableFiledlist;
     }
 }

+ 3 - 0
onemap-modules/onemap-system/src/main/java/com/onemap/system/service/ITTableFiledRelationService.java

@@ -1,5 +1,6 @@
 package com.onemap.system.service;
 
+import com.onemap.system.domain.TTable;
 import com.onemap.system.domain.TTableFiledRelation;
 
 import java.util.List;
@@ -62,4 +63,6 @@ public interface ITTableFiledRelationService
     public int deleteTTableFiledRelationById(String id);
 
     public String addTableFiledRelation(Map<String, Object> tTableFiledRelation);
+
+    public TTable QueryTableFiledRelation(String id );
 }

+ 19 - 0
onemap-modules/onemap-system/src/main/java/com/onemap/system/service/impl/TTableFiledRelationServiceImpl.java

@@ -1,5 +1,6 @@
 package com.onemap.system.service.impl;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -147,4 +148,22 @@ public class TTableFiledRelationServiceImpl implements ITTableFiledRelationServi
 
         return tableId;
     }
+
+    @Override
+    public TTable QueryTableFiledRelation(String tableId) {
+        TTable table = tTableMapper.selectTTableById(tableId);
+        if (table == null) {
+            return null;
+        }
+        TTableFiledRelation tTableFiledRelation = new TTableFiledRelation();
+        tTableFiledRelation.setTableId(tableId);
+        List<TTableFiledRelation> list = tTableFiledRelationMapper.selectTTableFiledRelationList(tTableFiledRelation);
+
+        List<TTableFiled> tableFiledlist = new ArrayList<>();
+        for (TTableFiledRelation tTableFiledRelation1 : list) {
+            tableFiledlist.add(tTableFiledMapper.selectTTableFiledById(tTableFiledRelation1.getFiledId()));
+        }
+        table.setTableFiledlist(tableFiledlist);
+        return table;
+    }
 }