Преглед изворни кода

文件上传程序跑起来了

gushoubang пре 10 месеци
родитељ
комит
9e204b4727
47 измењених фајлова са 2669 додато и 28 уклоњено
  1. 2 2
      onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/GhdkaMapper.xml
  2. 2 2
      onemap-modules/onemap-apply/src/main/resources/bootstrap.yml
  3. BIN
      onemap-modules/onemap-file - 副本/lib/ejml-core-0.39.jar
  4. BIN
      onemap-modules/onemap-file - 副本/lib/ejml-ddense-0.32.jar
  5. BIN
      onemap-modules/onemap-file - 副本/lib/gt-api-19.2.jar
  6. BIN
      onemap-modules/onemap-file - 副本/lib/gt-data-19.2.jar
  7. BIN
      onemap-modules/onemap-file - 副本/lib/gt-geojson-19.2.jar
  8. BIN
      onemap-modules/onemap-file - 副本/lib/gt-main-19.2.jar
  9. BIN
      onemap-modules/onemap-file - 副本/lib/gt-metadata-19.2.jar
  10. BIN
      onemap-modules/onemap-file - 副本/lib/gt-opengis-19.2.jar
  11. BIN
      onemap-modules/onemap-file - 副本/lib/gt-referencing-19.2.jar
  12. BIN
      onemap-modules/onemap-file - 副本/lib/gt-render-19.2.jar
  13. BIN
      onemap-modules/onemap-file - 副本/lib/gt-shapefile-19.2.jar
  14. BIN
      onemap-modules/onemap-file - 副本/lib/json-simple-1.1.jar
  15. BIN
      onemap-modules/onemap-file - 副本/lib/jsr-275-1.0-beta-2.jar
  16. BIN
      onemap-modules/onemap-file - 副本/lib/jts-1.13.jar
  17. BIN
      onemap-modules/onemap-file - 副本/lib/spire.doc.free-5.2.0.jar
  18. 272 0
      onemap-modules/onemap-file - 副本/pom.xml
  19. 44 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/OneMapFileApplication.java
  20. 82 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/MinioConfig.java
  21. 50 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/ResourcesConfig.java
  22. 20 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/UtfConfig.java
  23. 186 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/controller/SysFileController.java
  24. 31 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/domain/ShpFileDTO.java
  25. 34 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/domain/ZhxzFileDTO.java
  26. 20 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/mapper/ZhxzFileMapper.java
  27. 0 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/FastDfsSysFileServiceImpl.java
  28. 48 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/ISysFileService.java
  29. 408 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/LocalSysFileServiceImpl.java
  30. 0 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/MinioSysFileServiceImpl.java
  31. 285 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/EsriGeoJsonJsUtils.java
  32. 23 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileToTextUtils.java
  33. 180 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileUploadUtils.java
  34. 174 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileUtils.java
  35. 42 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/GeojsonToImageUtils.java
  36. 159 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/JSON2Shape.java
  37. 114 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/JsonFormatTool.java
  38. 229 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/ParsingShpFileUtils.java
  39. 27 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/PdfUtils.java
  40. 13 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/PublicTools.java
  41. 80 0
      onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/UnPackageUtils.java
  42. 8 0
      onemap-modules/onemap-file - 副本/src/main/resources/banner.txt
  43. 46 0
      onemap-modules/onemap-file - 副本/src/main/resources/bootstrap.yml
  44. 74 0
      onemap-modules/onemap-file - 副本/src/main/resources/logback.xml
  45. 5 5
      onemap-modules/onemap-file/pom.xml
  46. 4 13
      onemap-modules/onemap-file/src/main/java/com/onemap/file/OneMapFileApplication.java
  47. 7 6
      onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/EsriGeoJsonJsUtils.java

+ 2 - 2
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/GhdkaMapper.xml

@@ -12,8 +12,8 @@
     <select id="getIdByFilter" parameterType="com.onemap.analyse.domain.query.GhdkaFilter"
             resultType="java.lang.Integer">
         SELECT id
-        FROM "GHDKA" as dk,#{fzxzXzyzDTO.yzbsm} as tbName
-        WHEREh
+        FROM "GHDKA" as dk,"#{fzxzXzyzDTO.yzbsm}" as tbName
+        where
         id in
         <foreach collection="idList" item="id" open="(" separator="," close=")">
             #{id}

+ 2 - 2
onemap-modules/onemap-apply/src/main/resources/bootstrap.yml

@@ -30,11 +30,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 127.0.0.1:8848
+        server-addr: 192.168.100.30:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 127.0.0.1:8848
+        server-addr: 192.168.100.30:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

BIN
onemap-modules/onemap-file - 副本/lib/ejml-core-0.39.jar


BIN
onemap-modules/onemap-file - 副本/lib/ejml-ddense-0.32.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-api-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-data-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-geojson-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-main-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-metadata-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-opengis-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-referencing-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-render-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/gt-shapefile-19.2.jar


BIN
onemap-modules/onemap-file - 副本/lib/json-simple-1.1.jar


BIN
onemap-modules/onemap-file - 副本/lib/jsr-275-1.0-beta-2.jar


BIN
onemap-modules/onemap-file - 副本/lib/jts-1.13.jar


BIN
onemap-modules/onemap-file - 副本/lib/spire.doc.free-5.2.0.jar


+ 272 - 0
onemap-modules/onemap-file - 副本/pom.xml

@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>com.onemap</groupId>
+        <artifactId>onemap-modules</artifactId>
+        <version>3.6.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>onemap-modules-file</artifactId>
+
+    <description>
+        onemap-modules-file文件服务
+    </description>
+
+    <dependencies>
+        <!-- RuoYi Common DataSource -->
+        <dependency>
+            <groupId>com.onemap</groupId>
+            <artifactId>onemap-common-datasource</artifactId>
+        </dependency>
+
+        <!-- RuoYi Common DataScope -->
+        <dependency>
+            <groupId>com.onemap</groupId>
+            <artifactId>onemap-common-datascope</artifactId>
+        </dependency>
+        <!-- SpringCloud Alibaba Nacos -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Nacos Config -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Sentinel -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+
+        <!-- SpringBoot Actuator -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <!-- FastDFS -->
+        <dependency>
+            <groupId>com.github.tobato</groupId>
+            <artifactId>fastdfs-client</artifactId>
+        </dependency>
+
+        <!-- Minio -->
+        <dependency>
+            <groupId>io.minio</groupId>
+            <artifactId>minio</artifactId>
+            <version>${minio.version}</version>
+        </dependency>
+
+        <!-- 解压rar -->
+        <dependency>
+            <groupId>com.github.junrar</groupId>
+            <artifactId>junrar</artifactId>
+            <version>0.7</version>
+        </dependency>
+
+        <!-- 远程调用 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+        <!--zip4j依赖,解压zip压缩-->
+        <dependency>
+            <groupId>net.lingala.zip4j</groupId>
+            <artifactId>zip4j</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant</artifactId>
+            <version>1.9.4</version>
+            <scope>compile</scope>
+        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.gdal</groupId>-->
+<!--            <artifactId>gdal</artifactId>-->
+<!--            <version>3.3.0</version>-->
+<!--        </dependency>-->
+        <!--   ejml     -->
+        <dependency>
+            <groupId>ejml-core</groupId>
+            <artifactId>core</artifactId>
+            <scope>system</scope>
+            <version>0.39</version>
+            <systemPath>${project.basedir}/lib/ejml-core-0.39.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>ejml-ddense</groupId>
+            <artifactId>core</artifactId>
+            <scope>system</scope>
+            <version>0.32</version>
+            <systemPath>${project.basedir}/lib/ejml-ddense-0.32.jar</systemPath>
+        </dependency>
+        <!--   geotools     -->
+        <dependency>
+            <groupId>gt-api</groupId>
+            <artifactId>gt-api</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-api-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-data</groupId>
+            <artifactId>gt-data</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-data-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-geotools</groupId>
+            <artifactId>geojson</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-geojson-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-main</groupId>
+            <artifactId>gt-main</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-main-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-metadata</groupId>
+            <artifactId>gt-metadata</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-metadata-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-opengis</groupId>
+            <artifactId>gt-opengis</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-opengis-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-referencing</groupId>
+            <artifactId>gt-referencing</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-referencing-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-render</groupId>
+            <artifactId>gt-render</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-render-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-shapefile</groupId>
+            <artifactId>gt-shapefile</artifactId>
+            <scope>system</scope>
+            <version>19.2</version>
+            <systemPath>${project.basedir}/lib/gt-shapefile-19.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-jts</groupId>
+            <artifactId>gt-jts</artifactId>
+            <scope>system</scope>
+            <version>1.13</version>
+            <systemPath>${project.basedir}/lib/jts-1.13.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>gt-jsr</groupId>
+            <artifactId>gt-jsr</artifactId>
+            <scope>system</scope>
+            <version>1.0</version>
+            <systemPath>${project.basedir}/lib/jsr-275-1.0-beta-2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>json</groupId>
+            <artifactId>json</artifactId>
+            <scope>system</scope>
+            <version>1.1</version>
+            <systemPath>${project.basedir}/lib/json-simple-1.1.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+        <!--    解析shp    -->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.5</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>9.0.56</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.reflections</groupId>
+            <artifactId>reflections</artifactId>
+            <version>0.9.10</version>
+        </dependency>
+
+        <!-- RuoYi Api System -->
+        <dependency>
+            <groupId>com.onemap</groupId>
+            <artifactId>onemap-api-system</artifactId>
+        </dependency>
+
+        <!-- RuoYi Common Swagger -->
+        <dependency>
+            <groupId>com.onemap</groupId>
+            <artifactId>onemap-common-swagger</artifactId>
+        </dependency>
+        <!--word转pdf-->
+        <dependency>
+            <groupId>e-iceblue</groupId>
+            <artifactId>spire.doc.free</artifactId>
+            <scope>system</scope>
+            <version>5.2.0</version>
+            <systemPath>${project.basedir}/lib/spire.doc.free-5.2.0.jar</systemPath>
+        </dependency>
+    </dependencies>
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                    <fork>true</fork> <!--重要-->
+                </configuration>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.7.1</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 44 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/OneMapFileApplication.java

@@ -0,0 +1,44 @@
+package com.onemap.file;
+
+import com.onemap.common.security.annotation.EnableCustomConfig;
+import com.onemap.common.security.annotation.EnableRyFeignClients;
+import com.onemap.common.swagger.annotation.EnableCustomSwagger2;
+// import org.gdal.gdal.gdal;
+// import org.gdal.ogr.ogr;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+/**
+ * 文件服务
+ * 
+ * @author onemap
+ */
+@EnableScheduling
+@EnableCustomConfig
+@EnableCustomSwagger2
+@EnableRyFeignClients
+@SpringBootApplication
+@EnableFeignClients(basePackages = "com.onemap.file.controller")
+@MapperScan("com.onemap.file.mapper")
+public class OneMapFileApplication
+{
+    public static void main(String[] args)
+    {
+        // gdal.AllRegister();
+        // ogr.RegisterAll();
+        SpringApplication.run(OneMapFileApplication.class, args);
+        System.out.println("(♥◠‿◠)ノ゙  文件服务模块启动成功   ლ(´ڡ`ლ)゙  \n" +
+                " .-------.       ____     __        \n" +
+                " |  _ _   \\      \\   \\   /  /    \n" +
+                " | ( ' )  |       \\  _. /  '       \n" +
+                " |(_ o _) /        _( )_ .'         \n" +
+                " | (_,_).' __  ___(_ o _)'          \n" +
+                " |  |\\ \\  |  ||   |(_,_)'         \n" +
+                " |  | \\ `'   /|   `-'  /           \n" +
+                " |  |  \\    /  \\      /           \n" +
+                " ''-'   `'-'    `-..-'              ");
+    }
+}

+ 82 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/MinioConfig.java

@@ -0,0 +1,82 @@
+package com.onemap.file.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import io.minio.MinioClient;
+
+/**
+ * Minio 配置信息
+ *
+ * @author onemap
+ */
+@Configuration
+@ConfigurationProperties(prefix = "minio")
+public class MinioConfig
+{
+    /**
+     * 服务地址
+     */
+    private String url;
+
+    /**
+     * 用户名
+     */
+    private String accessKey;
+
+    /**
+     * 密码
+     */
+    private String secretKey;
+
+    /**
+     * 存储桶名称
+     */
+    private String bucketName;
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl(String url)
+    {
+        this.url = url;
+    }
+
+    public String getAccessKey()
+    {
+        return accessKey;
+    }
+
+    public void setAccessKey(String accessKey)
+    {
+        this.accessKey = accessKey;
+    }
+
+    public String getSecretKey()
+    {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey)
+    {
+        this.secretKey = secretKey;
+    }
+
+    public String getBucketName()
+    {
+        return bucketName;
+    }
+
+    public void setBucketName(String bucketName)
+    {
+        this.bucketName = bucketName;
+    }
+
+    @Bean
+    public MinioClient getMinioClient()
+    {
+        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
+    }
+}

+ 50 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/ResourcesConfig.java

@@ -0,0 +1,50 @@
+package com.onemap.file.config;
+
+import java.io.File;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 通用映射配置
+ * 
+ * @author onemap
+ */
+@Configuration
+public class ResourcesConfig implements WebMvcConfigurer
+{
+    /**
+     * 上传文件存储在本地的根路径
+     */
+    @Value("${file.path}")
+    private String localFilePath;
+
+    /**
+     * 资源映射路径 前缀
+     */
+    @Value("${file.prefix}")
+    public String localFilePrefix;
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry)
+    {
+        /** 本地文件上传路径 */
+        registry.addResourceHandler(localFilePrefix + "/**")
+                .addResourceLocations("file:" + localFilePath + File.separator);
+    }
+    
+    /**
+     * 开启跨域
+     */
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        // 设置允许跨域的路由
+        registry.addMapping(localFilePrefix  + "/**")
+                // 设置允许跨域请求的域名
+                .allowedOrigins("*")
+                // 设置允许的方法
+                .allowedMethods("GET");
+    }
+}

+ 20 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/config/UtfConfig.java

@@ -0,0 +1,20 @@
+package com.onemap.file.config;
+
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.filter.CharacterEncodingFilter;
+
+@Configuration
+public class UtfConfig {
+
+    @Bean
+    public FilterRegistrationBean filterRegistrationBean() {
+        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
+        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
+        characterEncodingFilter.setForceEncoding(true);
+        characterEncodingFilter.setEncoding("utf-8");
+        registrationBean.setFilter(characterEncodingFilter);
+        return registrationBean;
+    }
+}

+ 186 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/controller/SysFileController.java

@@ -0,0 +1,186 @@
+package com.onemap.file.controller;
+
+import com.onemap.common.core.domain.UploadZipDTO;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.file.domain.ShpFileDTO;
+import com.onemap.system.api.domain.GhtgCl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import com.onemap.common.core.domain.R;
+import com.onemap.common.core.utils.file.FileUtils;
+import com.onemap.file.service.ISysFileService;
+import com.onemap.system.api.domain.SysFile;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文件请求处理
+ *
+ * @author onemap
+ */
+@RestController
+public class SysFileController {
+    private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
+
+    @Autowired
+    private ISysFileService sysFileService;
+
+    /**
+     * 文件上传
+     *
+     * @param file         文件
+     * @param businessType 业务类型
+     */
+    @PostMapping("/upload")
+    public R<SysFile> upload(MultipartFile file, String businessType) {
+        try {
+            // 上传并返回访问地址
+            String url = sysFileService.uploadFile(file, businessType);
+            SysFile sysFile = new SysFile();
+            sysFile.setName(FileUtils.getName(url));
+            sysFile.setUrl(url);
+            return R.ok(sysFile);
+        } catch (Exception e) {
+            log.error("上传文件失败", e);
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * 文件上传(大文件分片上传)
+     *
+     * @param file
+     * @param chunk
+     * @param chunks
+     * @param name
+     * @param md5
+     * @return
+     */
+    @PostMapping("/splitFileUpload")
+    public R<SysFile> splitFileUpload(@RequestParam("file") MultipartFile file,
+                                      @RequestParam("chunk") int chunk,
+                                      @RequestParam("chunks") int chunks,
+                                      @RequestParam("name") String name,
+                                      @RequestParam("md5") String md5) {
+        try {
+            // 上传并返回访问地址
+            String url = sysFileService.splitFileUpload(file, chunk, chunks, name, md5);
+            SysFile sysFile = new SysFile();
+            sysFile.setName(FileUtils.getName(url));
+            sysFile.setUrl(url);
+            return R.ok(sysFile);
+        } catch (Exception e) {
+            log.error("上传文件失败", e);
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * 上传附件,图片
+     *
+     * @param files 文件列表
+     * @return 文件地址集合
+     */
+    @PostMapping("/uploadAppendix")
+    public R<List<SysFile>> uploadAppendix(MultipartFile[] files) {
+        try {
+            List<SysFile> sysFileList = new ArrayList<>();
+            // 上传并返回访问地址
+            for (MultipartFile file : files) {
+                String url = sysFileService.uploadAppendix(file);
+                SysFile sysFile = new SysFile();
+                sysFile.setName(FileUtils.getName(url));
+                sysFile.setUrl(url);
+                sysFileList.add(sysFile);
+            }
+
+            return R.ok(sysFileList);
+        } catch (Exception e) {
+            log.error("上传文件失败", e);
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * shp压缩包文件上传
+     *
+     * @param file 文件
+     */
+    @PostMapping("/uploadShpZip")
+    public RequestResult uploadShpZip(MultipartFile file) {
+        try {
+            RequestResult res = sysFileService.uploadShpZip(file);
+            return res;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("上传失败!", null);
+        }
+    }
+
+    /**
+     * shp压缩包文件上传****智慧选址
+     *
+     * @param file 文件
+     */
+    @PostMapping("/uploadZhxzZip")
+    public RequestResult uploadZhxzZip(MultipartFile file) {
+        try {
+            RequestResult res = sysFileService.uploadZhxzZip(file);
+            return res;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("上传失败!", null);
+        }
+    }
+
+    /**
+     * 压缩包文件上传
+     *
+     * @param file 文件
+     */
+    @PostMapping("/uploadZip")
+    public UploadZipDTO uploadZip(MultipartFile file) {
+        try {
+            UploadZipDTO res = sysFileService.uploadZip(file);
+            return res;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new UploadZipDTO();
+        }
+    }
+
+    /**
+     * shp压缩包文件上传
+     *
+     * @param file 文件
+     */
+    @PostMapping("/uploadTgcl")
+    public GhtgCl uploadTgcl(MultipartFile file, Integer type) {
+        try {
+            GhtgCl res = sysFileService.uploadTgcl(file, type);
+            return res;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 获取shp文件相应的geojson
+     */
+    @GetMapping("/getShpGeoJson")
+    public String getShpGeoJson(String shpfile) {
+        try {
+            String res = sysFileService.getShpGeoJson(shpfile);
+            return res;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 31 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/domain/ShpFileDTO.java

@@ -0,0 +1,31 @@
+package com.onemap.file.domain;
+
+public class ShpFileDTO {
+    private String filepath ;
+    private String zippath ;
+    private String geojson;
+
+    public String getFilepath() {
+        return filepath;
+    }
+
+    public void setFilepath(String filepath) {
+        this.filepath = filepath;
+    }
+
+    public String getGeojson() {
+        return geojson;
+    }
+
+    public void setGeojson(String geojson) {
+        this.geojson = geojson;
+    }
+
+    public String getZippath() {
+        return zippath;
+    }
+
+    public void setZippath(String zippath) {
+        this.zippath = zippath;
+    }
+}

+ 34 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/domain/ZhxzFileDTO.java

@@ -0,0 +1,34 @@
+package com.onemap.file.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("t_fzss_zhxz_file")
+public class ZhxzFileDTO {
+    private String bsm ;
+    private String wj ;
+    private String yswj ;
+
+    public String getBsm() {
+        return bsm;
+    }
+
+    public void setBsm(String bsm) {
+        this.bsm = bsm;
+    }
+
+    public String getWj() {
+        return wj;
+    }
+
+    public void setWj(String wj) {
+        this.wj = wj;
+    }
+
+    public String getYswj() {
+        return yswj;
+    }
+
+    public void setYswj(String yswj) {
+        this.yswj = yswj;
+    }
+}

+ 20 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/mapper/ZhxzFileMapper.java

@@ -0,0 +1,20 @@
+package com.onemap.file.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.file.domain.ZhxzFileDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 数据层
+ *
+ * @author onemap
+ */
+@Mapper
+public interface ZhxzFileMapper extends BaseMapper<ZhxzFileDTO>
+{
+
+}

+ 0 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/FastDfsSysFileServiceImpl.java → onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/FastDfsSysFileServiceImpl.java


+ 48 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/ISysFileService.java

@@ -0,0 +1,48 @@
+package com.onemap.file.service;
+
+import com.onemap.common.core.domain.UploadZipDTO;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.system.api.domain.GhtgCl;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 文件上传接口
+ *
+ * @author onemap
+ */
+public interface ISysFileService {
+    /**
+     * 文件上传接口
+     *
+     * @param file 上传的文件
+     * @return 访问地址
+     * @throws Exception
+     */
+    String uploadFile(MultipartFile file, String businessType) throws Exception;
+
+    /**
+     * 上传附件类型文件(pdf, word, excel, jpeg, jpg, png...)
+     *
+     * @param file 文件
+     * @return 文件访问地址
+     * @throws Exception 抛出错误
+     */
+    String uploadAppendix(MultipartFile file) throws Exception;
+
+    RequestResult uploadShpZip(MultipartFile file);
+
+    GhtgCl uploadTgcl(MultipartFile file, Integer type) throws Exception;
+
+    String getShpGeoJson(String shppath);
+
+    UploadZipDTO uploadZip(MultipartFile file);
+
+    RequestResult uploadZhxzZip(MultipartFile file);
+
+    String splitFileUpload(@RequestParam("file") MultipartFile file,
+                           @RequestParam("chunk") int chunk,
+                           @RequestParam("chunks") int chunks,
+                           @RequestParam("name") String name,
+                           @RequestParam("md5") String md5);
+}

+ 408 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/LocalSysFileServiceImpl.java

@@ -0,0 +1,408 @@
+package com.onemap.file.service;
+
+import com.google.common.collect.ImmutableMap;
+import com.onemap.common.core.domain.TgclTypeDTO;
+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.ShpFileDTO;
+import com.onemap.file.domain.ZhxzFileDTO;
+import com.onemap.file.mapper.ZhxzFileMapper;
+import com.onemap.file.utils.*;
+import com.onemap.system.api.domain.GhtgCl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Primary;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * 本地文件存储
+ *
+ * @author onemap
+ */
+@Primary
+@Service
+public class LocalSysFileServiceImpl implements ISysFileService {
+    /**
+     * 资源映射路径 前缀
+     */
+    @Value("${file.prefix}")
+    public String localFilePrefix;
+    private TgclTypeDTO tgclTypeDTO = new TgclTypeDTO();
+    /**
+     * 智慧选址压缩包
+     */
+    @Resource
+    private ZhxzFileMapper zhxzFileMapper;
+    /**
+     * 域名或本机访问地址
+     */
+    @Value("${file.domain}")
+    public String domain;
+
+    /**
+     * 上传文件存储在本地的根路径
+     */
+    @Value("${file.path}")
+    private String localFilePath;
+    /**
+     * 专题图上传路径
+     */
+    @Value("${businessType.ztt}")
+    private String zttLocalFilePath;
+    /**
+     * 调规材料上传路径
+     */
+    @Value("${businessType.tgcl}")
+    private String tgclLocalFilePath;
+
+    /**
+     * shp上传路径
+     */
+    @Value("${businessType.shp}")
+    private String shpLocalFilePath;
+    //文件上传后的转发路径配置
+    private Map<String, String> businessFilter = ImmutableMap.of("tgcl", "调规");
+
+    /**
+     * 本地文件上传接口
+     *
+     * @param file 上传的文件
+     * @return 访问地址
+     * @throws Exception
+     */
+    @Override
+    public String uploadFile(MultipartFile file, String businessType) throws Exception {
+        String filepath = localFilePath;
+        if ("ztt".equals(businessType)) {
+            filepath = zttLocalFilePath;
+        } else if ("tgcl".equals(businessType)) {
+            filepath = tgclLocalFilePath;
+        }
+        String name = FileUploadUtils.upload(filepath, file);
+        String url = domain + localFilePrefix + name;
+        if (businessFilter.get(businessType) != null) {
+            url = domain + localFilePrefix + "/" + businessFilter.get(businessType) + "/" + name;
+        }
+        return url;
+    }
+
+    /**
+     * 分片上传
+     *
+     * @param file   文件
+     * @param chunk  块
+     * @param chunks 块
+     * @param md5    名字
+     * @return {@link ResponseEntity}<{@link String}>
+     * @throws IOException ioexception
+     */
+    @Override
+    public String splitFileUpload(@RequestParam("file") MultipartFile file,
+                                  @RequestParam("chunk") int chunk,
+                                  @RequestParam("chunks") int chunks,
+                                  @RequestParam("name") String name,
+                                  @RequestParam("md5") String md5) {
+        String folder = localFilePath + "\\" + md5 + "\\";
+        File dir = new File(folder);
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        String path = folder + md5 + " _" + chunk + ".part";
+        try {
+            file.transferTo(new File(path));
+        } catch (IOException e) {
+            e.printStackTrace();
+            return "文件保存失败!";
+        }
+        if (chunk == chunks - 1) {
+            String filepath = folder + name + "";
+            try {
+                FileUtils.mergeFile(folder, filepath);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return "文件保存失败!";
+            }
+            // 删除分片文件
+            for (int i = 0; i < chunks; i++) {
+                try {
+                    new File(folder + md5 + " _" + i + ".part").delete();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            return filepath;
+        }
+        return "上传成功";
+    }
+
+    /**
+     * 上传附件类型文件(pdf, word, excel, jpeg, jpg, png...)
+     *
+     * @param file 文件
+     * @return 文件访问地址
+     * @throws Exception 抛出错误
+     */
+    @Override
+    public String uploadAppendix(MultipartFile file) throws Exception {
+        String filepath = localFilePath + File.separator + "att";
+        String name = FileUploadUtils.upload(filepath, file);
+        String url = domain + localFilePrefix + "/att" + name;
+
+        return url;
+    }
+
+    /**
+     * 本地word并转换pdf
+     *
+     * @param file 上传的文件
+     * @return 访问地址
+     * @throws Exception
+     */
+    public WordToPdfDTO uploadWordFileToPdf(MultipartFile file, String businessType) throws Exception {
+        WordToPdfDTO pdf = new WordToPdfDTO();
+        String filepath = localFilePath;//9082打开
+        if ("tgcl".equals(businessType)) {
+            filepath = tgclLocalFilePath;
+        }
+        String filename = file.getOriginalFilename();
+        String name = FileUploadUtils.upload(filepath, file);
+        String kzmc = PublicTools.getFileKzmx(filename);
+        String pdfpath = "";
+        if (!kzmc.contains("pdf")) {
+            pdfpath = PdfUtils.file2pdf(filepath + name, name, kzmc);
+        } else {
+            pdfpath = name;
+        }
+        String url = domain + localFilePrefix + name;
+        if (businessFilter.get(businessType) != null) {
+            url = domain + localFilePrefix + "/" + businessFilter.get(businessType) + "/" + pdfpath;
+        }
+        pdf.setFilepath(filename);
+        pdf.setPdfpath(url);
+        pdf.setKzmc(kzmc);
+        return pdf;
+    }
+
+    @Override
+    public RequestResult uploadShpZip(MultipartFile file) {
+        //获得文件名称
+        String fileName = file.getOriginalFilename();
+        //获得文件后缀名
+        String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+        //判断上传的是否是压缩包
+        if (!type.equals("zip") && !type.equals("rar")) {
+            return RequestResult.error("请上传压缩包", null);
+        }
+        File dest = new File(shpLocalFilePath + "/" + fileName);
+        //获得上级目录
+        File dir = dest.getParentFile();
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        //获取当前时间的时间戳
+        long timeMillis = System.currentTimeMillis();
+        String shpPath = "";
+        try {
+            //上传文件
+            file.transferTo(dest);
+            //解压zip格式
+            if (type.equals("zip")) {
+                new UnPackageUtils().unPackZip(dest, shpLocalFilePath + "/" + timeMillis);
+            } else {
+                //解压rar格式
+                new UnPackageUtils().unPackRar(dest, shpLocalFilePath + "/" + timeMillis);
+            }
+            File[] files = new File(shpLocalFilePath + "/" + timeMillis).listFiles();
+            for (File file1 : files) {
+                if (file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(".") + 1).equals("shp")) {
+                    shpPath = file1.getAbsolutePath();
+                    break;
+                }
+            }
+            if (!"".equals(shpPath)) {
+                ShpFileDTO res = new ShpFileDTO();
+                res.setFilepath(shpPath);
+                res.setGeojson(getShpGeoJson(shpPath));
+                res.setZippath(dest.getAbsolutePath());
+                return RequestResult.success("上传成功", res);
+            } else {
+                return RequestResult.error("未检索到shp文件");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return RequestResult.error("上传失败");
+        }
+    }
+
+    @Override
+    public RequestResult uploadZhxzZip(MultipartFile file) {
+        //获得文件名称
+        String fileName = file.getOriginalFilename();
+        //获得文件后缀名
+        String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+        //判断上传的是否是压缩包
+        if (!type.equals("zip") && !type.equals("rar")) {
+            return RequestResult.error("请上传压缩包", null);
+        }
+        File dest = new File(shpLocalFilePath + "/" + fileName);
+        //获得上级目录
+        File dir = dest.getParentFile();
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        //获取当前时间的时间戳
+        long timeMillis = System.currentTimeMillis();
+        String shpPath = "";
+        try {
+            //上传文件
+            file.transferTo(dest);
+            //解压zip格式
+            if (type.equals("zip")) {
+                new UnPackageUtils().unPackZip(dest, shpLocalFilePath + "/" + timeMillis);
+            } else {
+                //解压rar格式
+                new UnPackageUtils().unPackRar(dest, shpLocalFilePath + "/" + timeMillis);
+            }
+            File[] files = new File(shpLocalFilePath + "/" + timeMillis).listFiles();
+            for (File file1 : files) {
+                if (file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(".") + 1).equals("shp")) {
+                    shpPath = file1.getAbsolutePath();
+                    break;
+                }
+            }
+            if (!"".equals(shpPath)) {
+                String uuid = StringUtils.getUUID();
+                ZhxzFileDTO insertDto = new ZhxzFileDTO();
+                insertDto.setBsm(uuid);
+                insertDto.setWj(shpPath);
+                insertDto.setYswj(dest.getAbsolutePath());
+                zhxzFileMapper.insert(insertDto);
+                return RequestResult.success("上传成功", uuid);
+            } else {
+                return RequestResult.error("未检索到shp文件");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return RequestResult.error("上传失败");
+        }
+    }
+
+    @Override
+    public GhtgCl uploadTgcl(MultipartFile file, Integer type) throws Exception {
+        GhtgCl cl = new GhtgCl();
+        cl.setBsm(StringUtils.getUUID());
+        cl.setWjdx((double) file.getSize());
+        String filename = file.getOriginalFilename();
+        cl.setFjmc(filename);
+        String kzmc = PublicTools.getFileKzmx(filename);
+        cl.setFjlx(type);
+        if (type == tgclTypeDTO.getShp()) {
+            RequestResult shpzip = uploadShpZip(file);
+            ShpFileDTO shpzipinfo = (ShpFileDTO) shpzip.get("data");
+            cl.setWjlj(shpzipinfo.getZippath());
+            cl.setYshp(shpzipinfo.getFilepath());
+            cl.setGeojson(shpzipinfo.getGeojson());
+            cl.setKzmc(kzmc);
+            cl.setYwj(shpzipinfo.getZippath());
+            return cl;
+        } else if (type == tgclTypeDTO.getTgcl()) {
+            WordToPdfDTO pdf = uploadWordFileToPdf(file, "tgcl");
+            cl.setWjlj(pdf.getPdfpath());
+            cl.setKzmc(pdf.getKzmc());
+            cl.setYwj(pdf.getFilepath());
+            return cl;
+        }
+        return null;
+    }
+
+    /**
+     * 通过shp路径转换esrijson并返回相应json文件路径
+     *
+     * @param path
+     * @return
+     */
+    private String getShpEsriJsonPath(String path) {
+        String uuid = StringUtils.getUUID();
+        String publicpath = path.substring(0, path.indexOf("."));
+        String shppath = path;
+        String esrijsonpath = publicpath + "_" + uuid + "_" + "json.json";
+        String geojsonPath = publicpath + "_" + uuid + "_" + "geojson.json";
+        String geojson = ParsingShpFileUtils.shape2Geojson(shppath, geojsonPath);
+        String esrijson = EsriGeoJsonJsUtils.geo2ersi(geojson, "", shppath);
+        //写入文件
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(esrijsonpath, false);
+            //true表示在文件末尾追加
+            fos.write(esrijson.toString().getBytes());
+            fos.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return esrijsonpath;
+    }
+
+    /**
+     * 通过shp路径转换geojson
+     *
+     * @param path
+     * @return
+     */
+    @Override
+    public String getShpGeoJson(String path) {
+        String uuid = StringUtils.getUUID();
+        String publicpath = path.substring(0, path.indexOf("."));
+        String shppath = path;
+        String geojsonPath = publicpath + "_" + uuid + "_" + "geojson.json";
+        String geojson = new ParsingShpFileUtils().shape2Geojson(shppath, geojsonPath);
+        return geojson;
+    }
+
+    @Override
+    public UploadZipDTO uploadZip(MultipartFile file) {
+        //获得文件名称
+        String fileName = file.getOriginalFilename();
+        //获得文件后缀名
+        String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+        String path = shpLocalFilePath + "/" + fileName;
+        File dest = new File(path);
+        //获得上级目录
+        File dir = dest.getParentFile();
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        //获取当前时间的时间戳
+        long timeMillis = System.currentTimeMillis();
+        String unzippath = shpLocalFilePath + "/" + timeMillis;
+        try {
+            //上传文件
+            file.transferTo(dest);
+            if (type.equals("zip")) {
+                new UnPackageUtils().unPackZip(dest, unzippath);
+            } else if (type.equals("rar")) {
+                //解压rar格式
+                new UnPackageUtils().unPackRar(dest, unzippath);
+            }
+            UploadZipDTO dto = new UploadZipDTO();
+            dto.setPath(path);
+            dto.setUnzippath(unzippath);
+            dto.setUuid(StringUtils.getUUID());
+            return dto;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 0 - 0
onemap-modules/onemap-file/src/main/java/com/onemap/file/service/MinioSysFileServiceImpl.java → onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/service/MinioSysFileServiceImpl.java


+ 285 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/EsriGeoJsonJsUtils.java

@@ -0,0 +1,285 @@
+package com.onemap.file.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+// import org.gdal.ogr.DataSource;
+// import org.gdal.ogr.ogr;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 将shp文件转为esrijson文件  逻辑是先将shp转为GeoJSON  然后再将GeoJSON转为esrijson
+ */
+public class EsriGeoJsonJsUtils {
+    //EsriJson转geoJson
+    public static String esri2geo(String ersiJson) {
+        Map geoMap = new HashMap();
+        try {
+            List geoFs = new ArrayList();
+            geoMap.put("type", "FeatureCollection");
+            Map esriMap = (Map) JSON.parse(ersiJson);
+            Object esriFs = esriMap.get("features");
+            if (esriFs instanceof List) {
+                esriFs = (List<Map<String, Object>>) esriFs;
+                for (int i = 0; i < ((List) esriFs).size(); i++) {
+                    Map esriF = (Map) ((List) esriFs).get(i);
+                    Map geoF = new HashMap();
+                    geoF.put("type", "Feature");
+                    geoF.put("properties", esriF.get("attributes"));
+                    Map<String, Object> geometry = (Map<String, Object>) esriF.get("geometry");
+                    if (null != geometry.get("x")) {
+                        geoF.put("geometry", geoPoint(geometry));
+                    } else if (null != geometry.get("points")) {
+                        geoF.put("geometry", geoPoints(geometry));
+                    } else if (null != geometry.get("paths")) {
+                        geoF.put("geometry", geoLine(geometry));
+                    } else if (null != geometry.get("rings")) {
+                        geoF.put("geometry", geoPoly(geometry));
+                    }
+                    geoFs.add(geoF);
+                }
+                geoMap.put("features", geoFs);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new JSONObject(geoMap).toString();
+    }
+
+    //geoJosn转EsriJson
+    public static String geo2ersi(String geoJson, String idAttribute, String shppath) {
+        Map esriMap = new HashMap();
+        try {
+            int wkid = 4326;
+            if (!"".equals(shppath)) {
+                wkid = getWKID(shppath);
+//                wkid = ParsingShpFileUtils.getShpWkt(shppath);
+            }
+            Map geoMap = JSON.parseObject(geoJson);
+            esriMap = getEsriGeo(geoMap, idAttribute);
+            Map spatialReference = new HashMap();
+            spatialReference.put("wkid", wkid);
+            spatialReference.put("latestWkid", wkid);
+            esriMap.put("spatialReference", spatialReference);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new JSONObject(esriMap).toString();
+    }
+
+    private static Integer getWKID(String path) {
+        // DataSource ds = ogr.Open(path, 0);
+        // String proj = ds.GetLayer(0).GetSpatialRef().ExportToXML();
+        // String[] split = proj.split("<gml:name codeSpace=\"urn:ogc:def:crs:EPSG::\">");
+        // return Integer.valueOf(split[1].substring(0, 4));
+        return 4326;
+    }
+
+    public static Map getEsriGeo(Map geoMap, String idAttribute) {
+        Map esriMap = new HashMap();
+        if (idAttribute == null || "".equals(idAttribute)) {
+            idAttribute = "OBJECTID";
+        }
+        String type = geoMap.get("type").toString();
+        if ("Point".equals(type)) {
+            List<BigDecimal> coords = (List<BigDecimal>) geoMap.get("coordinates");
+            esriMap.put("x", coords.get(0));
+            esriMap.put("y", coords.get(1));
+        } else if ("MultiPoint".equals(type)) {
+            esriMap.put("points", geoMap.get("coordinates"));
+        } else if ("LineString".equals(type)) {
+            List<Object> coordsList = new ArrayList<Object>();
+            coordsList.add(geoMap.get("coordinates"));
+            esriMap.put("paths", coordsList);
+        } else if ("MultiLineString".equals(type)) {
+            esriMap.put("paths", geoMap.get("coordinates"));
+        } else if ("Polygon".equals(type)) {
+            List<List<List<BigDecimal>>> coordinates = (List<List<List<BigDecimal>>>) geoMap.get("coordinates");
+            List<List<List<BigDecimal>>> rings = orientRings(coordinates);
+            esriMap.put("rings", rings);
+        } else if ("MultiPolygon".equals(type)) {
+            List<List<List<List<BigDecimal>>>> mcoordinates = (List<List<List<List<BigDecimal>>>>) geoMap.get("coordinates");
+            List<List<List<BigDecimal>>> mrings = flattenMultiPolygonRings(mcoordinates);
+            esriMap.put("rings", mrings);
+        } else if ("Feature".equals(type)) {
+            if (null != geoMap.get("geometry")) {
+                Map geometry = getEsriGeo((Map) geoMap.get("geometry"), idAttribute);
+                esriMap.put("geometry", geometry);
+            }
+            if (null != geoMap.get("properties")) {
+                Map properties = (Map) geoMap.get("properties");
+                if (null != geoMap.get("id")) {
+                    properties.put(idAttribute, geoMap.get("id"));
+                }
+                esriMap.put("attributes", properties);
+            }
+        } else if ("FeatureCollection".equals(type)) {
+            List<Object> esriFs = new ArrayList<Object>();
+            List<Map> features = (List<Map>) geoMap.get("features");
+            for (int i = 0; i < features.size(); i++) {
+                esriFs.add(getEsriGeo(features.get(i), idAttribute));
+            }
+            esriMap.put("features", esriFs);
+            esriMap.put("geometryType", "esriGeometryPolygon");
+        } else if ("GeometryCollection".equals(type)) {
+            List<Object> esriFsc = new ArrayList<Object>();
+            List<Map> geometries = (List<Map>) geoMap.get("geometries");
+            for (int i = 0; i < geometries.size(); i++) {
+                esriFsc.add(getEsriGeo(geometries.get(i), idAttribute));
+            }
+            esriMap.put("geometries", esriFsc);
+            esriMap.put("geometryType", "esriGeometryPolygon");
+        }
+        return esriMap;
+    }
+
+
+    public static Map geoPoint(Map<String, Object> geometry) {
+        Map geo = new HashMap();
+        geo.put("type", "point");
+        BigDecimal x = (BigDecimal) geometry.get("x");
+        BigDecimal y = (BigDecimal) geometry.get("y");
+        List<BigDecimal> coords = new ArrayList<BigDecimal>();
+        coords.add(x);
+        coords.add(y);
+        geo.put("coordinates", coords);
+        return geo;
+    }
+
+    public static Map geoPoints(Map<String, Object> geometry) {
+        Map geo = new HashMap();
+        List<Object> points = (List<Object>) geometry.get("points");
+        if (points.size() == 1) {
+            geo.put("type", "Point");
+            geo.put("coordinates", points.get(0));
+        } else {
+            geo.put("type", "MultiPoint");
+            geo.put("coordinates", points);
+        }
+        return geo;
+    }
+
+    public static Map geoLine(Map<String, Object> geometry) {
+        Map geo = new HashMap();
+        List<Object> paths = (List<Object>) geometry.get("paths");
+        if (paths.size() == 1) {
+            geo.put("type", "LineString");
+            geo.put("coordinates", paths.get(0));
+        } else {
+            geo.put("type", "MultiLineString");
+            geo.put("coordinates", paths);
+        }
+        return geo;
+    }
+
+    public static Map geoPoly(Map<String, Object> geometry) {
+        Map geo = new HashMap();
+        List<List<List<BigDecimal>>> rings = (List<List<List<BigDecimal>>>) geometry.get("rings");
+        if (rings.size() == 1) {
+            geo.put("type", "Polygon");
+            geo.put("coordinates", rings);
+        } else {
+            List<List<List<List<BigDecimal>>>> coords = new ArrayList();
+            String type = "";
+            int len = coords.size() - 1;
+            for (int i = 0; i < rings.size(); i++) {
+                if (ringIsClockwise(rings.get(i))) {
+                    List<List<List<BigDecimal>>> item = new ArrayList<List<List<BigDecimal>>>();
+                    item.add(rings.get(i));
+                    coords.add(item);
+                    len++;
+                } else {
+                    coords.get(len).add(rings.get(i));
+                }
+            }
+            if (coords.size() == 1) {
+                type = "Polygon";
+            } else {
+                type = "MultiPolygon";
+            }
+            geo.put("type", type);
+            geo.put("coordinates", coords.size() == 1 ? coords.get(0) : coords);
+        }
+        return geo;
+    }
+
+    public static boolean ringIsClockwise(List<List<BigDecimal>> rings) {
+        int total = 0;
+        List<BigDecimal> pt1 = null;
+        List<BigDecimal> pt2 = null;
+        for (int i = 0; i < rings.size() - 1; i++) {
+            pt1 = rings.get(i);
+            pt2 = rings.get(i + 1);
+            Object pt20 = pt2.get(0);
+            Object pt10 = pt1.get(0);
+            Object pt21 = pt2.get(1);
+            Object pt11 = pt1.get(1);
+            if (pt21 instanceof Integer) {
+                pt21 = new BigDecimal(pt21.toString());
+            }
+            if (pt20 instanceof Integer) {
+                pt20 = new BigDecimal(pt20.toString());
+            }
+            if (pt10 instanceof Integer) {
+                pt10 = new BigDecimal(pt10.toString());
+            }
+            if (pt11 instanceof Integer) {
+                pt11 = new BigDecimal(pt11.toString());
+            }
+            total += (((BigDecimal) pt20).doubleValue() - ((BigDecimal) pt10).doubleValue()) * (((BigDecimal) pt21).doubleValue() + ((BigDecimal) pt11).doubleValue());
+        }
+        return total >= 0;
+    }
+
+    public static List<List<List<BigDecimal>>> orientRings(List<List<List<BigDecimal>>> polygon) {
+        List<List<List<BigDecimal>>> ringsList = new ArrayList<List<List<BigDecimal>>>();
+        List<List<BigDecimal>> outerRing = closeRing(polygon.get(0));
+        if (outerRing.size() >= 4) {
+            if (!ringIsClockwise(outerRing)) {
+                Collections.reverse(outerRing);
+            }
+            ringsList.add(outerRing);
+            polygon.remove(0);
+            for (int i = 0; i < polygon.size(); i++) {
+                List<List<BigDecimal>> hole = closeRing(polygon.get(i));
+                if (hole.size() >= 4) {
+                    if (ringIsClockwise(hole)) {
+                        Collections.reverse(hole);
+                    }
+                    ringsList.add(hole);
+                }
+            }
+        }
+        return ringsList;
+    }
+
+    public static List<List<BigDecimal>> closeRing(List<List<BigDecimal>> coords) {
+        if (!pointsEqual(coords.get(0), coords.get(coords.size() - 1))) {
+            coords.add(coords.get(0));
+        }
+        return coords;
+    }
+
+    public static boolean pointsEqual(List<BigDecimal> a, List<BigDecimal> b) {
+        for (int i = 0; i < a.size(); i++) {
+            if (a.get(i).compareTo(b.get(i)) != 0) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static List<List<List<BigDecimal>>> flattenMultiPolygonRings(List<List<List<List<BigDecimal>>>> rings) {
+        List<List<List<BigDecimal>>> polygonList = new ArrayList<List<List<BigDecimal>>>();
+        for (int i = 0; i < rings.size(); i++) {
+            List<List<List<BigDecimal>>> polygons = orientRings(rings.get(i));
+            for (int x = polygons.size() - 1; x >= 0; x--) {
+                List<List<BigDecimal>> polygon = polygons.get(x);
+                polygonList.add(polygon);
+            }
+        }
+        return polygonList;
+    }
+
+}

+ 23 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileToTextUtils.java

@@ -0,0 +1,23 @@
+package com.onemap.file.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.charset.StandardCharsets;
+
+public class FileToTextUtils {
+
+    public static String getTemplateContent(String path) throws Exception {
+        File file = new File(path);
+        if (!file.exists()) {
+            return null;
+        }
+        FileInputStream inputStream = new FileInputStream(file);
+        int length = inputStream.available();
+        byte bytes[] = new byte[length];
+        inputStream.read(bytes);
+        inputStream.close();
+        String str = new String(bytes, StandardCharsets.UTF_8);
+        return str;
+
+    }
+}

+ 180 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileUploadUtils.java

@@ -0,0 +1,180 @@
+package com.onemap.file.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.Objects;
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.web.multipart.MultipartFile;
+import com.onemap.common.core.exception.file.FileNameLengthLimitExceededException;
+import com.onemap.common.core.exception.file.FileSizeLimitExceededException;
+import com.onemap.common.core.exception.file.InvalidExtensionException;
+import com.onemap.common.core.utils.DateUtils;
+import com.onemap.common.core.utils.StringUtils;
+import com.onemap.common.core.utils.file.FileTypeUtils;
+import com.onemap.common.core.utils.file.MimeTypeUtils;
+import com.onemap.common.core.utils.uuid.Seq;
+
+/**
+ * 文件上传工具类
+ * 
+ * @author onemap
+ */
+public class FileUploadUtils
+{
+    /**
+     * 默认大小 50M
+     */
+    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
+
+    /**
+     * 默认的文件名最大长度 100
+     */
+    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
+
+    /**
+     * 根据文件路径上传
+     *
+     * @param baseDir 相对应用的基目录
+     * @param file 上传的文件
+     * @return 文件名称
+     * @throws IOException
+     */
+    public static final String upload(String baseDir, MultipartFile file) throws IOException
+    {
+        try
+        {
+            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+        }
+        catch (Exception e)
+        {
+            throw new IOException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 文件上传
+     *
+     * @param baseDir 相对应用的基目录
+     * @param file 上传的文件
+     * @param allowedExtension 上传文件类型
+     * @return 返回上传成功的文件名
+     * @throws FileSizeLimitExceededException 如果超出最大大小
+     * @throws FileNameLengthLimitExceededException 文件名太长
+     * @throws IOException 比如读写文件出错时
+     * @throws InvalidExtensionException 文件校验异常
+     */
+    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
+            throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
+            InvalidExtensionException
+    {
+        int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
+        if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
+        {
+            throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
+        }
+
+        assertAllowed(file, allowedExtension);
+
+        String fileName = extractFilename(file);
+
+        String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
+        file.transferTo(Paths.get(absPath));
+        return getPathFileName(fileName);
+    }
+
+    /**
+     * 编码文件名
+     */
+    public static final String extractFilename(MultipartFile file)
+    {
+        return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
+                FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file));
+    }
+
+    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
+    {
+        File desc = new File(uploadDir + File.separator + fileName);
+
+        if (!desc.exists())
+        {
+            if (!desc.getParentFile().exists())
+            {
+                desc.getParentFile().mkdirs();
+            }
+        }
+        return desc.isAbsolute() ? desc : desc.getAbsoluteFile();
+    }
+
+    private static final String getPathFileName(String fileName) throws IOException
+    {
+        String pathFileName = "/" + fileName;
+        return pathFileName;
+    }
+
+    /**
+     * 文件大小校验
+     *
+     * @param file 上传的文件
+     * @throws FileSizeLimitExceededException 如果超出最大大小
+     * @throws InvalidExtensionException 文件校验异常
+     */
+    public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
+            throws FileSizeLimitExceededException, InvalidExtensionException
+    {
+        long size = file.getSize();
+        if (size > DEFAULT_MAX_SIZE)
+        {
+            throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
+        }
+
+        String fileName = file.getOriginalFilename();
+        String extension = FileTypeUtils.getExtension(file);
+        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
+        {
+            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else
+            {
+                throw new InvalidExtensionException(allowedExtension, extension, fileName);
+            }
+        }
+    }
+
+    /**
+     * 判断MIME类型是否是允许的MIME类型
+     *
+     * @param extension 上传文件类型
+     * @param allowedExtension 允许上传文件类型
+     * @return true/false
+     */
+    public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
+    {
+        for (String str : allowedExtension)
+        {
+            if (str.equalsIgnoreCase(extension))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+}

+ 174 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/FileUtils.java

@@ -0,0 +1,174 @@
+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 java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 文件工具
+ */
+
+@Data
+public class FileUtils {
+    private List<File> filelist;//文件列表
+    private String strPath;//路径
+
+    public FileUtils(List<File> filelist, String strPath) {
+        this.filelist = filelist;
+        this.strPath = strPath;
+        getFileList(this.strPath);
+    }
+
+    /**
+     * 获取文件列表
+     *
+     * @param strPath
+     * @return
+     */
+    public List<File> getFileList(String strPath) {
+        File dir = new File(strPath);
+        File[] files = dir.listFiles(); // 该文件目录下文件全部放入数组
+        if (files != null) {
+            for (int i = 0; i < files.length; i++) {
+                String fileName = files[i].getName();
+                if (files[i].isDirectory()) { // 判断是文件还是文件夹
+                    getFileList(files[i].getAbsolutePath()); // 获取文件绝对路径
+                } else { // 判断文件名
+                    String strFileName = files[i].getAbsolutePath();
+                    filelist.add(files[i]);
+                }
+            }
+        }
+        return filelist;
+    }
+
+    /**
+     * 合并文件
+     *
+     * @param from
+     * @param to
+     * @throws IOException
+     */
+    public static void mergeFile(String from, String to) throws IOException {
+        List<File> list = getAllFileAndSort(from);
+        File t = new File(to);
+        FileInputStream in = null;
+        FileChannel inChannel = null;
+        FileOutputStream out = new FileOutputStream(t, true);
+        FileChannel outChannel = out.getChannel();
+        File f = new File(from);
+        System.out.println("f " + f.isDirectory());
+        // 获取目录下的每一个文件名,再将每个文件一次写入目标文件
+        if (f.isDirectory()) {
+            // 记录新文件最后一个数据的位置
+            long start = 0;
+            for (File file : list) {
+                in = new FileInputStream(file);
+                inChannel = in.getChannel();
+                // 从inChannel中读取file.length()长度的数据,写入outChannel的start处
+                outChannel.transferFrom(inChannel, start, file.length());
+                start += file.length();
+                in.close();
+                inChannel.close();
+            }
+        }
+        out.close();
+        outChannel.close();
+    }
+
+    /**
+     * 所有文件排序
+     *
+     * @param dirPath 文件根目录路径
+     * @return
+     */
+    public static List<File> getAllFileAndSort(String dirPath) {
+        File dirFile = new File(dirPath);
+        File[] listFiles = dirFile.listFiles();
+        List<File> list = Arrays.asList(listFiles);
+        Collections.sort(list, (o1, o2) -> {
+            String _str = o1.getName().split("\\.")[0];
+            String _num = _str.split("_")[1];
+            String _str2 = o2.getName().split("\\.")[0];
+            String _num2 = _str2.split("_")[1];
+            return Integer.parseInt(_num) - Integer.parseInt(_num2);
+        });
+        return list;
+    }
+
+    /**
+     * 删除文件夹
+     * 删除文件夹需要把包含的文件及文件夹先删除,才能成功
+     * https://blog.csdn.net/m0_57640408/article/details/120774050
+     *
+     * @param directory 文件夹名
+     * @return 删除成功返回true, 失败返回false
+     */
+    public static boolean deleteDirectory(String directory) {
+        // directory不以文件分隔符(/或\)结尾时,自动添加文件分隔符,不同系统下File.separator方法会自动添加相应的分隔符
+        if (!directory.endsWith(File.separator)) {
+            directory = directory + File.separator;
+        }
+        File directoryFile = new File(directory);
+        // 判断directory对应的文件是否存在,或者是否是一个文件夹
+        if (!directoryFile.exists() || !directoryFile.isDirectory()) {
+            System.out.println("文件夹删除失败,文件夹不存在" + directory);
+            return false;
+        }
+        boolean flag = true;
+        // 删除文件夹下的所有文件和文件夹
+        File[] files = directoryFile.listFiles();
+        for (int i = 0; i < files.length; i++) {  // 循环删除所有的子文件及子文件夹
+            // 删除子文件
+            if (files[i].isFile()) {
+                flag = deleteFile(files[i].getAbsolutePath());
+                if (!flag) {
+                    break;
+                }
+            } else {  // 删除子文件夹
+                flag = deleteDirectory(files[i].getAbsolutePath());
+                if (!flag) {
+                    break;
+                }
+            }
+        }
+        if (!flag) {
+            System.out.println("删除失败");
+            return false;
+        }
+        // 最后删除当前文件夹
+        if (directoryFile.delete()) {
+            System.out.println("删除成功:" + directory);
+            return true;
+        } else {
+            System.out.println("删除失败:" + directory);
+            return false;
+        }
+    }
+
+    /**
+     * 删除文件
+     *
+     * @param fileName 文件名
+     * @return 删除成功返回true, 失败返回false
+     */
+    public static boolean deleteFile(String fileName) {
+        File file = new File(fileName);
+        if (file.isFile() && file.exists()) {
+            file.delete();
+            System.out.println("删除文件成功:" + fileName);
+            return true;
+        } else {
+            System.out.println("删除文件失败:" + fileName);
+            return false;
+        }
+    }
+}

Разлика између датотеке није приказан због своје велике величине
+ 42 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/GeojsonToImageUtils.java


+ 159 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/JSON2Shape.java

@@ -0,0 +1,159 @@
+package com.onemap.file.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.vividsolutions.jts.geom.*;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.shapefile.ShapefileDataStoreFactory;
+import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
+import org.geotools.geojson.geom.GeometryJSON;
+import org.geotools.referencing.crs.DefaultGeographicCRS;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class JSON2Shape {
+
+    public static void main(String[] args) {
+        geojson2Shape("C:\\TEMP\\India.geojson", "C:\\TEMP\\college.shp");
+    }
+
+    public static void geojson2Shape(String jsonPath, String shpPath) {
+        GeometryJSON geojson = new GeometryJSON();
+        try {
+            String geojsonStr = readJson(jsonPath);
+            Map<String, Object> geojsonMap = JSONObject.parseObject(geojsonStr, Map.class);
+            List<Map> features = (List<Map>) geojsonMap.get("features");
+            Map geojsonExemple = features.get(0);
+            String geojsonType = ((Map) geojsonExemple.get("geometry")).get("type").toString();
+            Map<String, Class> mapFields = new HashMap();
+            for (int i = 0; i < features.size(); i++) {
+                Map<String, Object> attributes = (Map<String, Object>) features.get(i).get("properties");
+                for (String key : attributes.keySet()) {
+                    Class type = attributes.get(key).getClass();
+                    mapFields.put(key, type);
+                }
+            }
+
+            Class<?> geoType = null;
+            switch (geojsonType) {
+                case "Point":
+                    geoType = Point.class;
+                    break;
+                case "MultiPoint":
+                    geoType = MultiPoint.class;
+                    break;
+                case "LineString":
+                    geoType = LineString.class;
+                    break;
+                case "MultiLineString":
+                    geoType = MultiLineString.class;
+                    break;
+                case "Polygon":
+                    geoType = Polygon.class;
+                    break;
+                case "MultiPolygon":
+                    geoType = MultiPolygon.class;
+                    break;
+            }
+
+            //创建shape文件对象
+            File file = new File(shpPath);
+            Map<String, Serializable> params = new HashMap<String, Serializable>();
+            params.put(ShapefileDataStoreFactory.URLP.key, file.toURI().toURL());
+            ShapefileDataStore ds = (ShapefileDataStore) new ShapefileDataStoreFactory().createNewDataStore(params);
+            //定义图形信息和属性信息
+            SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
+            tb.setCRS(DefaultGeographicCRS.WGS84);
+            tb.setName("shapefile");
+            tb.add("the_geom", geoType);
+
+            for (String key : mapFields.keySet()) {
+                tb.add(key, mapFields.get(key));
+            }
+
+            ds.createSchema(tb.buildFeatureType());
+            //设置Writer
+            FeatureWriter<SimpleFeatureType, SimpleFeature> writer = ds.
+                    getFeatureWriter(ds.getTypeNames()[0], Transaction.AUTO_COMMIT);
+
+            for (int i = 0, len = features.size(); i < len; i++) {
+                Map oneGeojson = features.get(i);
+                Map<String, Object> attributes = (Map<String, Object>) oneGeojson.get("properties");
+                String strFeature = JSONObject.toJSONString(oneGeojson);
+                Reader reader = new StringReader(strFeature);
+                SimpleFeature feature = writer.next();
+
+                switch (geojsonType) {
+                    case "Point":
+                        feature.setAttribute("the_geom", geojson.readPoint(reader));
+                        break;
+                    case "MultiPoint":
+                        feature.setAttribute("the_geom", geojson.readMultiPoint(reader));
+                        break;
+                    case "LineString":
+                        feature.setAttribute("the_geom", geojson.readLine(reader));
+                        break;
+                    case "MultiLineString":
+                        feature.setAttribute("the_geom", geojson.readMultiLine(reader));
+                        break;
+                    case "Polygon":
+                        feature.setAttribute("the_geom", geojson.readPolygon(reader));
+                        break;
+                    case "MultiPolygon":
+                        feature.setAttribute("the_geom", geojson.readMultiPolygon(reader));
+                        break;
+                }
+
+                for (String key : attributes.keySet()) {
+                    feature.setAttribute(key, attributes.get(key));
+                }
+                writer.write();
+            }
+            writer.close();
+            ds.dispose();
+        } catch (Exception e) {
+            System.out.println("转换失败");
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 读取文件
+     *
+     * @param filepath 文件路径
+     * @throws IOException
+     */
+    public static String readJson(String filepath) {
+        FileReader re = null;
+        BufferedReader buff = null;
+        String line = "";
+        try {
+            File file = new File(filepath);
+            re = new FileReader(file);
+            buff = new BufferedReader(re);
+            String tempString = null;
+            while ((tempString = buff.readLine()) != null) {
+                line += tempString;
+            }
+            return line;
+        } catch (Exception e) {
+            System.out.println("失败了");
+        } finally {
+            try {
+                re.close();
+                buff.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return line;
+    }
+
+}

+ 114 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/JsonFormatTool.java

@@ -0,0 +1,114 @@
+package com.onemap.file.utils;
+
+public class JsonFormatTool {
+    /**
+     * 单位缩进字符串。
+     */
+    private static String SPACE = "  ";
+
+    /**
+     * 返回格式化JSON字符串。
+     *
+     * @param json 未格式化的JSON字符串。
+     * @return 格式化的JSON字符串。
+     */
+    public static String formatJson(String json) {
+        StringBuffer result = new StringBuffer();
+
+        int length = json.length();
+        int number = 0;
+        char key = 0;
+
+        // 遍历输入字符串。
+        for (int i = 0; i < length; i++) {
+            // 1、获取当前字符。
+            key = json.charAt(i);
+
+            // 2、如果当前字符是前方括号、前花括号做如下处理:
+            if ((key == '[') || (key == '{')) {
+                // (1)如果前面还有字符,并且字符为“:”,打印:换行和缩进字符字符串。
+                if ((i - 1 > 0) && (json.charAt(i - 1) == ':')) {
+                    result.append('\n');
+                    result.append("allow");
+                    result.append(":");
+                    //result.append(indent(number));
+                }
+
+                // (2)打印:当前字符。
+                result.append(key);
+
+                // (3)前方括号、前花括号,的后面必须换行。打印:换行。
+                result.append('\n');
+
+                // (4)每出现一次前方括号、前花括号;缩进次数增加一次。打印:新行缩进。
+                number++;
+                result.append(indent(number));
+
+                // (5)进行下一次循环。
+                continue;
+            }
+
+            // 3、如果当前字符是后方括号、后花括号做如下处理:
+            if ((key == ']') || (key == '}')) {
+                // (1)后方括号、后花括号,的前面必须换行。打印:换行。
+                result.append('\n');
+
+                // (2)每出现一次后方括号、后花括号;缩进次数减少一次。打印:缩进。
+                number--;
+                result.append(indent(number));
+
+                // (3)打印:当前字符。
+                result.append(key);
+
+                // (4)如果当前字符后面还有字符,并且字符不为“,”,打印:换行。
+                if (((i + 1) < length) && (json.charAt(i + 1) != ',')) {
+                    //result.append('\n');
+                }
+
+                // (5)继续下一次循环。
+                continue;
+            }
+            // 4、如果当前字符是逗号。逗号后面换行,并缩进,不改变缩进次数。
+            if ((key == ',')) {
+                result.append(key);
+                //result.append('\n');
+                result.append(indent(number));
+                continue;
+            }
+            // 5、打印:当前字符。
+            result.append(key);
+        }
+        return result.toString();
+    }
+
+    /**
+     * 返回指定次数的缩进字符串。每一次缩进三个空格,即SPACE。
+     *
+     * @param number 缩进次数。
+     * @return 指定缩进次数的字符串。
+     */
+    private static String indent(int number) {
+        StringBuffer result = new StringBuffer();
+        for (int i = 0; i < number; i++) {
+            result.append(SPACE);
+        }
+        return result.toString();
+    }
+
+    public static String formatJson2(String json) {
+        StringBuffer result = new StringBuffer();
+        result.append("{");
+        result.append("\n");
+        result.append(SPACE);
+        //添加json字符串
+        result.append('"');
+        result.append("allow");
+        result.append('"');
+        result.append(":");
+        result.append(json);
+        result.append("\n");
+        result.append("}");
+        return result.toString();
+    }
+
+}

+ 229 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/ParsingShpFileUtils.java

@@ -0,0 +1,229 @@
+package com.onemap.file.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.onemap.common.core.utils.StringUtils;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.Point;
+import org.geotools.data.FileDataStore;
+import org.geotools.data.FileDataStoreFinder;
+import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.data.simple.SimpleFeatureSource;
+import org.geotools.geojson.GeoJSONUtil;
+import org.geotools.geojson.feature.FeatureJSON;
+import org.geotools.geometry.jts.ReferencedEnvelope;
+import org.json.simple.JSONArray;
+import org.opengis.feature.Property;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.Name;
+import org.opengis.filter.Filter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.nio.charset.Charset;
+import java.util.*;
+
+/**
+ * @Author wanger
+ * @Date 2022/8/22 上午8:8
+ * @Version 1.0
+ */
+public class ParsingShpFileUtils {
+
+    /**
+     * 解析shp文件
+     *
+     * @param filePath
+     * @return
+     * @throws Exception
+     */
+    public static Map ParsingShpFile(String filePath) throws Exception {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new Exception("文件不存在!");
+        }
+        if (!filePath.endsWith("shp")) {
+            throw new Exception("只能指定后缀为shp的文件");
+        }
+        Map map = new HashMap();
+        List<Map> list = new ArrayList();
+        //读取shp
+        SimpleFeatureCollection colls1 = readShp(filePath);
+        SimpleFeatureType schema = colls1.getSchema();
+        Name name = schema.getGeometryDescriptor().getType().getName();
+        ReferencedEnvelope bounds = colls1.getBounds();
+        //拿到所有features
+        SimpleFeatureIterator iters = colls1.features();
+        String s = name.toString();
+        if ("Point".equals(s)) {
+            list = parsingPoint(iters);
+        } else if ("MultiLineString".equals(s) || "MultiPolygon".equals(s)) {
+            list = parsingLineOrPoly(iters);
+        }
+        map.put("data", list);
+        map.put("maxX", bounds.getMaxX());
+        map.put("minX", bounds.getMinX());
+        map.put("maxY", bounds.getMaxY());
+        map.put("minY", bounds.getMinY());
+        map.put("shapeFile", name.toString());
+        return map;
+    }
+
+    /**
+     * 解析点数据
+     *
+     * @param iters
+     * @return
+     */
+    public static List<Map> parsingPoint(SimpleFeatureIterator iters) {
+        List<Map> list = new ArrayList();
+        while (iters.hasNext()) {
+            SimpleFeature sf = iters.next();
+            Map map = new HashMap();
+            Iterator<? extends Property> iterator = sf.getValue().iterator();
+            while (iterator.hasNext()) {
+                Property property = iterator.next();
+                if (property.getValue() instanceof Point) {
+                    map.put("PointX", ((Point) (property.getValue())).getX());
+                    map.put("PointY", ((Point) (property.getValue())).getY());
+                } else {
+                    Name name = property.getName();//属性名称
+                    Object value = property.getValue();//属性值
+                    map.put(name, value);
+                }
+            }
+            list.add(map);
+        }
+        iters.close();
+        return list;
+    }
+
+    /**
+     * 解析线和面
+     *
+     * @param iters
+     * @return
+     */
+    public static List<Map> parsingLineOrPoly(SimpleFeatureIterator iters) {
+        List<Map> list = new ArrayList();
+        while (iters.hasNext()) {
+            SimpleFeature sf = iters.next();
+            Map map = new HashMap();
+            Iterator<? extends Property> iterator = sf.getValue().iterator();
+            while (iterator.hasNext()) {
+                Property property = iterator.next();
+                if (property.getValue() instanceof Geometry) {
+                    Geometry geometry = (Geometry) property.getValue();
+                    Coordinate[] coordinates = geometry.getCoordinates();
+                    List<Map> paths = new ArrayList<Map>();
+                    for (Coordinate coordinate : coordinates) {
+                        Map path = new HashMap();
+                        path.put("x", coordinate.x);
+                        path.put("y", coordinate.y);
+                        path.put("z", coordinate.z);
+                        paths.add(path);
+                    }
+                    map.put("path", paths);
+                } else {
+                    Name name = property.getName();//属性名称
+                    Object value = property.getValue();//属性值
+                    map.put(name, value);
+                }
+            }
+            list.add(map);
+        }
+        iters.close();
+        return list;
+    }
+
+    public static Integer getShpWkt(String path) {
+        File file = new File(path);
+        FileDataStore store;
+        try {
+            store = FileDataStoreFinder.getDataStore(file);
+            ((ShapefileDataStore) store).setCharset(Charset.forName("UTF-8"));
+            store.getFeatureSource().getBounds().getCoordinateReferenceSystem().getName().getCode();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return 4326;
+    }
+
+    public static SimpleFeatureCollection readShp(String path) {
+        return readShp(path, null);
+    }
+
+    public static SimpleFeatureCollection readShp(String path, Filter filter) {
+        SimpleFeatureSource featureSource = readStoreByShp(path);
+        if (featureSource == null) {
+            return null;
+        }
+        ;
+        try {
+            return filter != null ? featureSource.getFeatures(filter) : featureSource.getFeatures();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static SimpleFeatureSource readStoreByShp(String path) {
+        File file = new File(path);
+        FileDataStore store;
+        SimpleFeatureSource featureSource = null;
+        try {
+            store = FileDataStoreFinder.getDataStore(file);
+            ((ShapefileDataStore) store).setCharset(Charset.forName("UTF-8"));
+            featureSource = store.getFeatureSource();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return featureSource;
+    }
+
+    /**
+     * shp转换为Geojson
+     *
+     * @param shpPath  shp文件地址
+     * @param jsonPath 要写入的json文件地址
+     * @return
+     */
+    public static String shape2Geojson(String shpPath, String jsonPath) {
+        FeatureJSON fjson = new FeatureJSON();
+        StringBuffer sb = new StringBuffer();
+        try {
+            sb.append("{\"type\": \"FeatureCollection\",\"features\": ");
+            //读取shp
+            SimpleFeatureCollection colls = readShp(shpPath);
+            //拿到所有features
+            SimpleFeatureIterator itertor = colls.features();
+            JSONArray array = new JSONArray();
+            while (itertor.hasNext()) {
+                GeoJSONUtil e = new GeoJSONUtil();
+                SimpleFeature feature = itertor.next();
+                StringWriter writer = new StringWriter();
+                fjson.writeFeature(feature, writer);
+                JSONObject json = JSONObject.parseObject(writer.toString());
+                array.add(json);
+            }
+            itertor.close();
+            sb.append(array.toString());
+            sb.append("}");
+            if (!StringUtils.isEmpty(jsonPath)) {
+                //写入文件
+                FileOutputStream fos = new FileOutputStream(jsonPath, false);
+                //true表示在文件末尾追加
+                fos.write(sb.toString().getBytes());
+                fos.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return sb.toString();
+    }
+}

+ 27 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/PdfUtils.java

@@ -0,0 +1,27 @@
+package com.onemap.file.utils;
+
+
+import com.spire.doc.*;
+import java.io.*;
+
+public class PdfUtils {
+    /**
+     * @param toFilePath 文件夹路径
+     * @param fileName   文件名
+     * @param type       文件类型
+     * @return
+     * @throws Exception
+     */
+    public static String file2pdf(String toFilePath, String fileName, String type) throws Exception {
+        String infilepath = toFilePath;
+        String outfilepath = infilepath.replace(type,".pdf");
+        //实例化Document类的对象
+        Document doc = new Document();
+        //加载Word
+        doc.loadFromFile(infilepath);
+        //保存为PDF格式
+        doc.saveToFile(outfilepath,FileFormat.PDF);
+        return fileName.replace(type,".pdf");
+    }
+}
+

+ 13 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/PublicTools.java

@@ -0,0 +1,13 @@
+package com.onemap.file.utils;
+
+public class PublicTools {
+    /**
+     * 获取文件扩展名称
+     *
+     * @param filename
+     * @return
+     */
+    public static String getFileKzmx(String filename) {
+        return "." + filename.split("\\.")[filename.split("\\.").length - 1];
+    }
+}

+ 80 - 0
onemap-modules/onemap-file - 副本/src/main/java/com/onemap/file/utils/UnPackageUtils.java

@@ -0,0 +1,80 @@
+package com.onemap.file.utils;
+
+import com.github.junrar.Archive;
+import com.github.junrar.rarfile.FileHeader;
+import net.lingala.zip4j.core.ZipFile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * @author : wangping
+ * @createDate: 2021/7/12
+ * @description:解压缩工具
+ **/
+
+
+public class UnPackageUtils {
+
+    /**
+     * zip文件解压
+     *
+     * @param destPath 解压文件路径
+     * @param zipFile  压缩文件
+     *                 //* @param password 解压密码(如果有)
+     */
+    public static void unPackZip(File zipFile, String destPath) {
+
+        try {
+            ZipFile zip = new ZipFile(zipFile);
+            /*zip4j默认用GBK编码去解压,这里设置编码为GBK的*/
+            zip.setFileNameCharset("GBK");
+            zip.extractAll(destPath);
+
+            // 如果解压需要密码
+//            if (zip.isEncrypted()) {
+//                zip.setPassword(password);
+//            }
+        } catch (Exception e) {
+        }
+    }
+
+    /**
+     * rar文件解压(不支持有密码的压缩包)
+     *
+     * @param rarFile  rar压缩包
+     * @param destPath 解压保存路径
+     */
+    public static void unPackRar(File rarFile, String destPath) {
+        try (Archive archive = new Archive(rarFile)) {
+            if (null != archive) {
+                FileHeader fileHeader = archive.nextFileHeader();
+                File file = null;
+                while (null != fileHeader) {
+                    // 防止文件名中文乱码问题的处理
+                    String fileName = fileHeader.getFileNameW().isEmpty() ? fileHeader.getFileNameString() : fileHeader.getFileNameW();
+                    if (fileHeader.isDirectory()) {
+                        //是文件夹
+                        file = new File(destPath + File.separator + fileName);
+                        file.mkdirs();
+                    } else {
+                        //不是文件夹
+                        file = new File(destPath + File.separator + fileName.trim());
+                        if (!file.exists()) {
+                            if (!file.getParentFile().exists()) {
+                                // 相对路径可能多级,可能需要创建父目录.
+                                file.getParentFile().mkdirs();
+                            }
+                            file.createNewFile();
+                        }
+                        FileOutputStream os = new FileOutputStream(file);
+                        archive.extractFile(fileHeader, os);
+                        os.close();
+                    }
+                    fileHeader = archive.nextFileHeader();
+                }
+            }
+        } catch (Exception e) {
+        }
+    }
+}

+ 8 - 0
onemap-modules/onemap-file - 副本/src/main/resources/banner.txt

@@ -0,0 +1,8 @@
+Spring Boot Version: ${spring-boot.version}
+Spring Application Name: ${spring.application.name}
+  _____.__.__
+_/ ____\__|  |   ____
+\   __\|  |  | _/ __ \
+ |  |  |  |  |_\  ___/
+ |__|  |__|____/\___  >
+                    \/

+ 46 - 0
onemap-modules/onemap-file - 副本/src/main/resources/bootstrap.yml

@@ -0,0 +1,46 @@
+#Feign Client配置
+feign:
+  client:
+    config:
+      FooClient: #contextId
+        connectTimeout: 1000000
+        readTimeout: 2000000
+      default:
+        connectTimeout: 6000000
+        readTimeout: 1000000
+# Tomcat
+server:
+  port: 9201
+  #配置springboot的http字符编码支持
+  servlet:
+    encoding:
+      force: true
+
+# Spring
+spring:
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 10240MB
+      max-request-size: 10240MB
+  application:
+    # 应用名称
+    name: onemap-file
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        namespace: model
+        # 服务注册地址
+        server-addr: 127.0.0.1:8848
+      config:
+        namespace: model
+        # 配置中心地址
+        server-addr: 127.0.0.1:8848
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

+ 74 - 0
onemap-modules/onemap-file - 副本/src/main/resources/logback.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <!-- 日志存放路径 -->
+	<property name="log.path" value="logs/onemap-file" />
+   <!-- 日志输出格式 -->
+	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+
+    <!-- 控制台输出 -->
+	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+	</appender>
+
+    <!-- 系统日志输出 -->
+	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/info.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+			<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+		</rollingPolicy>
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>INFO</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+	</appender>
+
+    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/error.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>ERROR</level>
+			<!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+			<!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 系统模块日志级别控制  -->
+	<logger name="com.onemap" level="info" />
+	<!-- Spring日志级别控制  -->
+	<logger name="org.springframework" level="warn" />
+
+	<root level="info">
+		<appender-ref ref="console" />
+	</root>
+	
+	<!--系统操作日志-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+    </root>
+</configuration>

+ 5 - 5
onemap-modules/onemap-file/pom.xml

@@ -89,11 +89,11 @@
             <version>1.9.4</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.gdal</groupId>
-            <artifactId>gdal</artifactId>
-            <version>3.3.0</version>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.gdal</groupId>-->
+<!--            <artifactId>gdal</artifactId>-->
+<!--            <version>3.3.0</version>-->
+<!--        </dependency>-->
         <!--   ejml     -->
         <dependency>
             <groupId>ejml-core</groupId>

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

@@ -2,21 +2,16 @@ package com.onemap.file;
 
 import com.onemap.common.security.annotation.EnableCustomConfig;
 import com.onemap.common.security.annotation.EnableRyFeignClients;
-import org.gdal.gdal.gdal;
-import org.gdal.ogr.ogr;
+import com.onemap.common.swagger.annotation.EnableCustomSwagger2;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import com.onemap.common.swagger.annotation.EnableCustomSwagger2;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 /**
  * 文件服务
- * 
+ *
  * @author onemap
  */
 @EnableScheduling
@@ -26,12 +21,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @SpringBootApplication
 @EnableFeignClients(basePackages = "com.onemap.file.controller")
 @MapperScan("com.onemap.file.mapper")
-public class OneMapFileApplication
-{
-    public static void main(String[] args)
-    {
-        gdal.AllRegister();
-        ogr.RegisterAll();
+public class OneMapFileApplication {
+    public static void main(String[] args) {
         SpringApplication.run(OneMapFileApplication.class, args);
         System.out.println("(♥◠‿◠)ノ゙  文件服务模块启动成功   ლ(´ڡ`ლ)゙  \n" +
                 " .-------.       ____     __        \n" +

+ 7 - 6
onemap-modules/onemap-file/src/main/java/com/onemap/file/utils/EsriGeoJsonJsUtils.java

@@ -2,8 +2,8 @@ package com.onemap.file.utils;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import org.gdal.ogr.DataSource;
-import org.gdal.ogr.ogr;
+// import org.gdal.ogr.DataSource;
+// import org.gdal.ogr.ogr;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -69,10 +69,11 @@ public class EsriGeoJsonJsUtils {
     }
 
     private static Integer getWKID(String path) {
-        DataSource ds = ogr.Open(path, 0);
-        String proj = ds.GetLayer(0).GetSpatialRef().ExportToXML();
-        String[] split = proj.split("<gml:name codeSpace=\"urn:ogc:def:crs:EPSG::\">");
-        return Integer.valueOf(split[1].substring(0, 4));
+        // DataSource ds = ogr.Open(path, 0);
+        // String proj = ds.GetLayer(0).GetSpatialRef().ExportToXML();
+        // String[] split = proj.split("<gml:name codeSpace=\"urn:ogc:def:crs:EPSG::\">");
+        // return Integer.valueOf(split[1].substring(0, 4));
+        return 4326;
     }
 
     public static Map getEsriGeo(Map geoMap, String idAttribute) {

Неке датотеке нису приказане због велике количине промена