소스 검색

init project

ximinghao 6 달 전
커밋
6fa136126b
25개의 변경된 파일2433개의 추가작업 그리고 0개의 파일을 삭제
  1. 38 0
      .gitignore
  2. 10 0
      .idea/.gitignore
  3. 8 0
      .idea/dictionaries/project.xml
  4. 7 0
      .idea/encodings.xml
  5. 14 0
      .idea/misc.xml
  6. 6 0
      .idea/vcs.xml
  7. 241 0
      pom.xml
  8. 20 0
      src/main/java/com/skyversation/xjcy/XjcyApplication.java
  9. 16 0
      src/main/java/com/skyversation/xjcy/bean/Enterprise.java
  10. 17 0
      src/main/java/com/skyversation/xjcy/bean/EnterpriseEconomic.java
  11. 3 0
      src/main/java/com/skyversation/xjcy/bean/FromJSON.java
  12. 19 0
      src/main/java/com/skyversation/xjcy/bean/IndustrialPark.java
  13. 11 0
      src/main/java/com/skyversation/xjcy/bean/Order.java
  14. 35 0
      src/main/java/com/skyversation/xjcy/config/CorsConfig.java
  15. 56 0
      src/main/java/com/skyversation/xjcy/config/ResponseHeadFilter.java
  16. 83 0
      src/main/java/com/skyversation/xjcy/controller/XjcyController.java
  17. 19 0
      src/main/java/com/skyversation/xjcy/query/DMSQuery.java
  18. 203 0
      src/main/java/com/skyversation/xjcy/service/DMSService.java
  19. 436 0
      src/main/java/com/skyversation/xjcy/service/DataCountService.java
  20. 94 0
      src/main/java/com/skyversation/xjcy/service/OWSService.java
  21. 742 0
      src/main/java/com/skyversation/xjcy/util/CoordTransform2.java
  22. 137 0
      src/main/java/com/skyversation/xjcy/util/HttpUtil.java
  23. 112 0
      src/main/java/com/skyversation/xjcy/util/MessageManage.java
  24. 77 0
      src/main/java/com/skyversation/xjcy/util/SpecialisationStringCollector.java
  25. 29 0
      src/main/resources/application.yml

+ 38 - 0
.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 10 - 0
.idea/.gitignore

@@ -0,0 +1,10 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# 依赖于环境的 Maven 主目录路径
+/mavenHomeManager.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 8 - 0
.idea/dictionaries/project.xml

@@ -0,0 +1,8 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="project">
+    <words>
+      <w>dwithin</w>
+      <w>gsqy</w>
+    </words>
+  </dictionary>
+</component>

+ 7 - 0
.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 14 - 0
.idea/misc.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 241 - 0
pom.xml

@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.skyversation</groupId>
+    <artifactId>xujing_cyszpt</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>war</packaging>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.7.2</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <java.version>1.8</java.version>
+        <geotools.version>26.0</geotools.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents.client5</groupId>
+            <artifactId>httpclient5</artifactId>
+            <version>5.3.1</version>
+        </dependency>
+        <!--            打包专用,平时注释掉-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>4.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-tomcat</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.62</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.htmlparser</groupId>
+            <artifactId>htmlparser</artifactId>
+            <version>2.1</version>
+        </dependency>
+
+        <!--        空间地理信息工具类-->
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-geojson</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-main</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-opengis</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-shapefile</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-metadata</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.locationtech.jts</groupId>
+            <artifactId>jts-core</artifactId>
+            <version>1.18.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.desoss</groupId>
+            <artifactId>jackson-datatype-jts</artifactId>
+            <version>2.5.1.2</version>
+        </dependency>
+        <!--        阿里云地名地址规范化-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-address-purification</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.5.9</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/org.osgeo/proj4j -->
+        <dependency>
+            <groupId>org.osgeo</groupId>
+            <artifactId>proj4j</artifactId>
+            <version>0.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>4.5.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>3.14.9</version>
+        </dependency>
+
+        <!--        excel 解析库-->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>8</source>
+                    <target>8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>jitpack.io</id>
+            <url>https://jitpack.io</url>
+        </repository>
+        <repository>
+            <id>osgeo</id>
+            <name>OSGeo Release Repository</name>
+            <url>https://repo.osgeo.org/repository/release/</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+                <!--不加如下updatePolicy会报错:resolution will not be reattempted until the update interval of XXX has elapsed or updates are force-->
+                <updatePolicy>always</updatePolicy>
+            </releases>
+        </repository>
+        <repository>
+            <id>osgeo-snapshot</id>
+            <name>OSGeo Snapshot Repository</name>
+            <url>https://repo.osgeo.org/repository/snapshot/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </repository>
+        <repository>
+            <id>maven2-repository.dev.java.net</id>
+            <name>Java.net repository</name>
+            <url>http://download.java.net/maven/2</url>
+        </repository>
+        <repository>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <id>boundless</id>
+            <name>Boundless Maven Repository</name>
+            <url>http://repo.boundlessgeo.com/main</url>
+        </repository>
+    </repositories>
+</project>

+ 20 - 0
src/main/java/com/skyversation/xjcy/XjcyApplication.java

@@ -0,0 +1,20 @@
+package com.skyversation.xjcy;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableScheduling
+public class XjcyApplication extends SpringBootServletInitializer {
+    public static void main(String[] args) {
+        SpringApplication.run(XjcyApplication.class, args);
+    }
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+        return application.sources(XjcyApplication.class);
+    }
+}

+ 16 - 0
src/main/java/com/skyversation/xjcy/bean/Enterprise.java

@@ -0,0 +1,16 @@
+package com.skyversation.xjcy.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+
+@Data
+public class Enterprise implements FromJSON {
+
+    private String cUnifiedSocialCreditCode;
+    private String cEnterpriseName;
+    private String regType;
+    private String isGsqy;
+    private String operationStatus;
+    private String industry;
+
+}

+ 17 - 0
src/main/java/com/skyversation/xjcy/bean/EnterpriseEconomic.java

@@ -0,0 +1,17 @@
+package com.skyversation.xjcy.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import java.math.BigDecimal;
+
+@Data
+public class EnterpriseEconomic implements FromJSON {
+
+    private String cEnterpriseId;
+    private String cYearMonth;
+    private String cDataStatus;
+    private BigDecimal cApprovedTax;
+    private BigDecimal cApprovedOutputValue;
+    private BigDecimal cApprovedRevenue;
+
+}

+ 3 - 0
src/main/java/com/skyversation/xjcy/bean/FromJSON.java

@@ -0,0 +1,3 @@
+package com.skyversation.xjcy.bean;
+
+public interface FromJSON {}

+ 19 - 0
src/main/java/com/skyversation/xjcy/bean/IndustrialPark.java

@@ -0,0 +1,19 @@
+package com.skyversation.xjcy.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import java.math.BigDecimal;
+
+@Data
+public class IndustrialPark implements FromJSON {
+
+    private String cParkCode;
+    private String cParentCode;
+    private String cResourceName;
+    private String cResourceType;
+    private String cZlqydm;
+    private BigDecimal cFloorArea;
+    private BigDecimal cBuildingArea;
+    private BigDecimal cVacantArea;
+
+}

+ 11 - 0
src/main/java/com/skyversation/xjcy/bean/Order.java

@@ -0,0 +1,11 @@
+package com.skyversation.xjcy.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+
+@Data
+public class Order implements FromJSON {
+
+    private String id;
+    private String status;
+}

+ 35 - 0
src/main/java/com/skyversation/xjcy/config/CorsConfig.java

@@ -0,0 +1,35 @@
+package com.skyversation.xjcy.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+import java.util.Collections;
+
+@Configuration
+public class CorsConfig {
+
+    @Bean
+    public CorsFilter corsFilter() {
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
+        // 设置允许跨域请求的域名
+        corsConfiguration.addAllowedOriginPattern("*");
+        // 设置允许跨域请求头
+        corsConfiguration.addAllowedHeader("*");
+        // 设置允许的方法
+        corsConfiguration.addAllowedMethod("*");
+        // 是否允许证书
+        corsConfiguration.setAllowCredentials(true);
+        // 跨域允许时间
+        corsConfiguration.setMaxAge(3600L);
+        // 允许标头跨域
+//        corsConfiguration.setAllowedOrigins(Collections.singletonList("*"));
+
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        source.registerCorsConfiguration("/**", corsConfiguration);
+        return new CorsFilter(source);
+    }
+
+}

+ 56 - 0
src/main/java/com/skyversation/xjcy/config/ResponseHeadFilter.java

@@ -0,0 +1,56 @@
+package com.skyversation.xjcy.config;
+
+
+import org.springframework.stereotype.Component;
+
+import javax.servlet.*;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebFilter(urlPatterns = "/*", filterName = "responseHeadFilter")
+@Component
+public class ResponseHeadFilter implements Filter {
+
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+        //增加响应头缺失代码
+        HttpServletRequest req=(HttpServletRequest)servletRequest;
+        HttpServletResponse res=(HttpServletResponse)servletResponse;
+        res.addHeader("X-Frame-Options","SAMEORIGIN");
+        res.addHeader("Referrer-Policy","origin");
+        res.addHeader("Content-Security-Policy","object-src 'self'");
+        res.addHeader("X-Permitted-Cross-Domain-Policies","master-only");
+        res.addHeader("X-Content-Type-Options","nosniff");
+        res.addHeader("X-XSS-Protection","1; mode=block");
+        res.addHeader("X-Download-Options","noopen");
+        res.addHeader("Strict-Transport-Security","max-age=63072000; includeSubdomains; preload");
+        //处理cookie问题
+        Cookie[] cookies = req.getCookies();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                String value = cookie.getValue();
+                String builder = cookie.getName() + "=" + value + ";" +
+                        "Secure;" +//Cookie设置Secure标识
+                        "HttpOnly;";//Cookie设置HttpOnly
+                res.addHeader("Set-Cookie", builder);
+            }
+        }
+        filterChain.doFilter(servletRequest, servletResponse);
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+
+
+}

+ 83 - 0
src/main/java/com/skyversation/xjcy/controller/XjcyController.java

@@ -0,0 +1,83 @@
+package com.skyversation.xjcy.controller;
+
+import com.skyversation.xjcy.service.DataCountService;
+import com.skyversation.xjcy.service.OWSService;
+import com.skyversation.xjcy.util.MessageManage;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/count")
+public class XjcyController {
+    @Resource
+    DataCountService dataCountService;
+    @Resource
+    OWSService owsService;
+
+    @RequestMapping(value = "/town", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public String townCountData() {
+        try {
+            return MessageManage.getInstance().getResultContent(200,
+                    dataCountService.getTownData(), "成功查询结果");
+        } catch (Exception e) {
+            return MessageManage.getInstance().getResultContent(201, e.getMessage(), "出现异常");
+        }
+    }
+
+    @RequestMapping(value = "/park", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public String parkCountData(HttpServletRequest request) {
+        String code = request.getParameter("code");
+        try {
+            return MessageManage.getInstance().getResultContent(200,
+                    dataCountService.getParkData(code), "成功查询结果");
+        } catch (Exception e) {
+            return MessageManage.getInstance().getResultContent(201, e.getMessage(), "出现异常");
+        }
+    }
+
+    @RequestMapping(value = "/build", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public String buildCountData(HttpServletRequest request) {
+        String code = request.getParameter("code");
+        try {
+            return MessageManage.getInstance().getResultContent(200,
+                    dataCountService.getBuildData(code), "成功查询结果");
+        } catch (Exception e) {
+            return MessageManage.getInstance().getResultContent(201, e.getMessage(), "出现异常");
+        }
+    }
+
+    @RequestMapping(value = "/around_point", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public String aroundPoint(HttpServletRequest request) throws UnsupportedEncodingException {
+        String cqlFilter = java.net.URLDecoder.decode(request.getParameter("cql_filter"), StandardCharsets.UTF_8.name());
+        if (cqlFilter!=null){
+            return MessageManage.getInstance().getResultContent(200, owsService.
+                    countAll(cqlFilter), "已统计所有相关点位");
+        }
+        String longitude = request.getParameter("lon");
+        String latitude = request.getParameter("lat");
+        String distance = request.getParameter("distance");
+        if (longitude == null || latitude == null || distance == null) {
+            return MessageManage.getInstance().getResultContent(-1,"参数不足","参数不足");
+        }
+        return MessageManage.getInstance().getResultContent(200, owsService.
+                countAll(owsService.getArea(longitude, latitude, distance)), "已统计所有相关点位");
+    }
+
+    @RequestMapping(value = "/recount", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public String reCount() {
+        new Thread(() -> dataCountService.count());
+        return MessageManage.getInstance().getResultContent(200, "已开始重新统计", "已开始重新统计");
+    }
+
+}

+ 19 - 0
src/main/java/com/skyversation/xjcy/query/DMSQuery.java

@@ -0,0 +1,19 @@
+package com.skyversation.xjcy.query;
+
+import com.skyversation.xjcy.bean.*;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum DMSQuery {
+
+    INDUSTRIAL_PARK("1580", IndustrialPark.class),
+    ENTERPRISE      ("1593", Enterprise.class),
+    ECONOMIC_ALL_INDEED("1594", EnterpriseEconomic.class),
+    ORDER           ("1587", Order.class);
+
+    private final String columnId;
+    private final Class<? extends FromJSON> resultType;
+
+}

+ 203 - 0
src/main/java/com/skyversation/xjcy/service/DMSService.java

@@ -0,0 +1,203 @@
+package com.skyversation.xjcy.service;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.xjcy.bean.FromJSON;
+import com.skyversation.xjcy.query.DMSQuery;
+import com.skyversation.xjcy.util.HttpUtil;
+import com.skyversation.xjcy.util.SpecialisationStringCollector;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestClientException;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class DMSService {
+    @Value("${app.dms.path}")
+    private String path;
+    @Value("${app.oauth.login-name}")
+    private String loginName;
+    @Value("${app.oauth.password}")
+    private String password;
+    @Value("${app.oauth.path}")
+    private String oauthPath;
+
+//    private String cacheToken="";
+
+
+    private static class DMSRequest {
+        DMSRequestType type;
+        Map<String,String> params = new HashMap<>();
+        String token;
+        JSONArray where = new JSONArray();
+        JSONArray order = new JSONArray();
+    }
+    private enum DMSRequestType {
+        List,JOIN_LIST
+    }
+
+    public String loginForToken() throws Exception {
+        if (!StringUtils.hasText(loginName) || !StringUtils.hasText(password)) {
+            throw new Exception("请提供用于访问DMS的账号密码");
+        }
+        MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+        params.add("userName", loginName);
+        params.add("password", password);
+        params.add("clientId", "2");
+        String response = HttpUtil.requestPost(oauthPath, params, new HashMap<>());
+        JSONObject jsonObject = JSON.parseObject(response);
+        if ("密码错误".equals(jsonObject.getString("message"))) {
+            loginName = null;
+            password = null;
+            throw new Exception("请检查使用的账户和密码是否正确,已停止使用该账号密码以避免锁定账号");
+        }
+        if (!Objects.equals(jsonObject.getString("code"), "200")) {
+            throw new Exception(jsonObject.getString("message"));
+        }
+        return jsonObject.getString("message");
+    }
+
+    private JSONObject sendToDms(DMSRequest request,int depth){
+        JSONObject jsonObject;
+        MultiValueMap<String,String> params = new LinkedMultiValueMap<>();
+        request.params.forEach(params::add);
+        params.add("search", request.where.toJSONString());
+        try {
+            String response;
+            switch (request.type) {
+                case List:{
+                    response= HttpUtil.requestPost(path+"/content/selectContentListInfo",params,
+                            Collections.singletonMap("token",request.token));
+                    break;
+                }
+                case JOIN_LIST:{
+                    response = "";
+                    break;
+                }
+                default:{
+                    return null;
+                }
+            }
+          jsonObject = JSON.parseObject(response);
+        } catch (RestClientException e) {
+            if (depth<3){
+                return sendToDms(request,depth+1);
+            }
+            return null;
+        }catch (Exception e){
+            return null;
+        }
+        if (Objects.equals(jsonObject.getString("message"), "无效token")&&depth<3){
+            return null;
+        }
+        return jsonObject;
+    }
+    private JSONObject sendToDms(DMSRequest request){
+        return sendToDms(request,0);
+    }
+    private void addWhere(DMSRequest request,String field,String type , String content){
+        JSONObject where = new JSONObject();
+        where.put("field",field);
+        where.put("searchType",type);
+        JSONObject contents = new JSONObject();
+        contents.put("value",content);
+        where.put("content",contents);
+        request.where.add(where);
+    }
+    private void addWhere(DMSRequest request,String field,String type , Set<String> content) {
+        JSONObject where = new JSONObject();
+        where.put("field",field);
+        where.put("searchType",type);
+        JSONObject contents = new JSONObject();
+        contents.put("value",content);
+        where.put("content",contents);
+        request.where.add(where);
+    }
+    private void addWhere(DMSRequest request,String field,String type , String start,String end){
+        JSONObject where = new JSONObject();
+        where.put("field",field);
+        where.put("type",type);
+        JSONObject contents = new JSONObject();
+        contents.put("start",start);
+        contents.put("end",end);
+        where.put("content",contents);
+        request.where.add(where);
+    }
+    private void  addOrder(DMSRequest request){
+
+    }
+    private void setPage(DMSRequest request,String page,String pageSize){
+        request.params.put("page",page);
+        request.params.put("pageSize",pageSize);
+    }
+    private void setState(DMSRequest request){
+        request.params.put("states","0,1,2,3");
+    }
+    private void setColumnId(DMSRequest request,String columnId){
+        request.params.put("columnId",columnId);
+    }
+    private List<JSONObject> queryDmsList(DMSRequest request,String token,String columnId){
+        request.token=token;
+        request.type=DMSRequestType.List;
+        setColumnId(request,columnId);
+        setState(request);
+        int page = 0;
+        int pageSize = 2000;
+        List<JSONObject> list = new ArrayList<>();
+        int count;
+        do {
+            try {
+                setPage(request,page+"",pageSize+"");
+                JSONObject jsonObject = sendToDms(request);
+                if ("成功".equals(jsonObject.getString("message"))) {
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    count = content.getInteger("count");
+                    JSONArray data = content.getJSONArray("data");
+                    for (int i = 0; i < data.size(); i++) {
+                        list.add(data.getJSONObject(i));
+                    }
+                }else {
+                    break;
+                }
+            } catch (Exception e) {
+                break;
+            }
+        }while (++page*pageSize < count);
+
+        return list;
+    }
+    public List<JSONObject> simpleQuery(String token,String columId){
+        return queryDmsList(new DMSRequest(),token,columId);
+    }
+    public List<JSONObject> lastYearQuery(String token, String columId,String timeField){
+        DMSRequest request = new DMSRequest();
+        Set<String> monthInDeed = new HashSet<>();
+        monthInDeed.addAll(SpecialisationStringCollector.YearMonthByLast12Month());
+        monthInDeed.addAll(SpecialisationStringCollector.YearMonthByYtd());
+        monthInDeed.addAll(SpecialisationStringCollector.YearMonthByYtd(1));
+        addWhere(request,timeField,"5", monthInDeed );
+        return queryDmsList(request,token,columId);
+    }
+
+    public <T extends FromJSON> List<T> query(String token,DMSQuery query,Class<T> clazz){
+        if(query.getResultType()!=clazz){
+            throw new RuntimeException("类型与枚举提供的类型不符,请确认枚举中的类型");
+        }
+        List<JSONObject> dmsResult;
+        if (query == DMSQuery.ECONOMIC_ALL_INDEED){
+            dmsResult = lastYearQuery(token,query.getColumnId(),"c_year_month");
+        }else {
+            dmsResult = simpleQuery(token, query.getColumnId());
+        }
+        return dmsResult.stream().map(jsonObject -> JSON.toJavaObject(jsonObject,clazz)).collect(Collectors.toList());
+    }
+
+
+
+}

+ 436 - 0
src/main/java/com/skyversation/xjcy/service/DataCountService.java

@@ -0,0 +1,436 @@
+package com.skyversation.xjcy.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.xjcy.bean.Enterprise;
+import com.skyversation.xjcy.bean.EnterpriseEconomic;
+import com.skyversation.xjcy.bean.IndustrialPark;
+import com.skyversation.xjcy.bean.Order;
+import com.skyversation.xjcy.query.DMSQuery;
+import com.skyversation.xjcy.util.SpecialisationStringCollector;
+import lombok.NoArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class DataCountService {
+    @Resource
+    DMSService dmsService;
+
+    private boolean counted = false;
+    private JSONObject cacheTownData;
+    private Map<String, JSONObject> cacheParkData;
+    private Map<String, JSONObject> cacheBuildData;
+
+    private JSONObject tempCacheTownData;
+    private Map<String, JSONObject> tempCacheParkData;
+    private Map<String, JSONObject> tempCacheBuildData;
+
+    Map<String,EnterpriseEconomicCount> economicCountBy12Month = new HashMap<>();
+    Map<String,EnterpriseEconomicCount> economicCountByYtdThisYear = new HashMap<>();
+    Map<String,EnterpriseEconomicCount> economicCountByYtdLastYear = new HashMap<>();
+
+    Map<String, Enterprise> aliveEnterpriseMap = new HashMap<>();
+
+    MultiValueMap<String, IndustrialPark> roomMap = new LinkedMultiValueMap<>();
+    MultiValueMap<String, IndustrialPark> floorMap = new LinkedMultiValueMap<>();
+    MultiValueMap<String, IndustrialPark> buildMap = new LinkedMultiValueMap<>();
+    List<IndustrialPark> allPark = new ArrayList<>();
+
+    @NoArgsConstructor
+    private static class EnterpriseEconomicCount{
+        BigDecimal tax = BigDecimal.ZERO;
+        BigDecimal product = BigDecimal.ZERO;
+        BigDecimal revenue = BigDecimal.ZERO;
+        public EnterpriseEconomicCount(List<EnterpriseEconomic> enterpriseEconomicList) {
+            for (EnterpriseEconomic enterpriseEconomic : enterpriseEconomicList) {
+                tax = tax.add(Optional.ofNullable(enterpriseEconomic.getCApprovedOutputValue()).orElse(BigDecimal.ZERO));
+                product = product.add(Optional.ofNullable(enterpriseEconomic.getCApprovedOutputValue()).orElse(BigDecimal.ZERO));
+                revenue = revenue.add(Optional.ofNullable(enterpriseEconomic.getCApprovedRevenue()).orElse(BigDecimal.ZERO));
+            }
+        }
+    }
+
+    @PostConstruct
+    public void count() {
+        tempCacheTownData = new JSONObject();
+        tempCacheParkData = new HashMap<>();
+        tempCacheBuildData = new HashMap<>();
+        String token;
+        try {
+            token = dmsService.loginForToken();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        counted = true;
+        //统一查询所有需要的数据避免处理时间太长token过期,数据量大不了所以不做流式
+        List<IndustrialPark> allIndustrialPark = dmsService.query(token, DMSQuery.INDUSTRIAL_PARK, IndustrialPark.class);
+        List<Enterprise> allEnterprise = dmsService.query(token, DMSQuery.ENTERPRISE, Enterprise.class);
+        List<EnterpriseEconomic> inDateEnterpriseEconomic = dmsService.query(token, DMSQuery.ECONOMIC_ALL_INDEED, EnterpriseEconomic.class);
+        List<Order> allOrder = dmsService.query(token, DMSQuery.ORDER, Order.class);
+
+        //处理一下拿到的数据,建一建索引
+        Map<String, List<EnterpriseEconomic>> enterpriseEconomicMap = new HashMap<>();
+        inDateEnterpriseEconomic.forEach(e -> {
+            String id = e.getCEnterpriseId();
+            if (enterpriseEconomicMap.containsKey(id)) {
+                enterpriseEconomicMap.get(id).add(e);
+            } else {
+                List<EnterpriseEconomic> list = new ArrayList<>();
+                list.add(e);
+                enterpriseEconomicMap.put(id, list);
+            }
+        });
+
+        //楼宇/企业/企业经济数据遍历,全镇级/产业园级/楼栋级一并处理
+
+        //遍历并计算企业相关的结果
+        countEnterprise(allEnterprise, enterpriseEconomicMap);
+
+        //遍历计算产业园相关
+        countIndustrialPark(allIndustrialPark);
+
+        //企呼我应
+        countOrder(allOrder);
+
+        cacheTownData = tempCacheTownData;
+        cacheParkData = tempCacheParkData;
+        cacheBuildData = tempCacheBuildData;
+    }
+
+    private void countIndustrialPark(List<IndustrialPark> allIndustrialPark) {
+        //简单统计并按父级编码建映射
+        simpleCountPark(allIndustrialPark);
+        //按楼宇父子关系统计
+        for (IndustrialPark industrialPark : allPark) {
+            String parkCode = industrialPark.getCParkCode();
+            List<IndustrialPark> allBuild;
+            List<IndustrialPark> allRoom = new ArrayList<>();
+
+            BigDecimal allTaxByYtdThisYear = BigDecimal.ZERO;
+            BigDecimal allGsProductByYtdThisYear = BigDecimal.ZERO;
+            BigDecimal allTaxByYtdLastYear = BigDecimal.ZERO;
+            BigDecimal allGsProductByYtdLastYear = BigDecimal.ZERO;
+
+            int enterPriceCount = 0;
+            int enterPriceGsCount = 0;
+            Map<String, Integer> industryCount = new HashMap<>();
+            Set<String> inParkEnterpriseCode = new HashSet<>();
+            List<String> aliveEnterprise = new ArrayList<>();
+            int usedRoomCount = 0;
+
+            allBuild = buildMap.get(parkCode);
+            if (allBuild == null) {
+                allBuild = new ArrayList<>();
+            }
+            //楼栋
+            for (IndustrialPark build : allBuild) {
+                String buildCode = build.getCParkCode();
+
+                Set<String> buildEnterpriseCode = new HashSet<>();
+                JSONObject buildData = new JSONObject();
+                int buildEnterpriseCount = 0;
+                int buildGsEnterpriseCount = 0;
+                int buildRoomCount = 0;
+                int buildUsedRoomCount = 0;
+
+                JSONArray floors = new JSONArray();
+                List<IndustrialPark> partFloor = floorMap.get(buildCode);
+                if (partFloor == null) {
+                    partFloor = new ArrayList<>();
+                }
+                //楼层
+                for (IndustrialPark floor : partFloor) {
+                    String floorCode = floor.getCParkCode();
+
+                    JSONObject floorData = new JSONObject();
+                    int floorRoomCount = 0;
+                    int floorUsedRoomCount = 0;
+
+                    List<IndustrialPark> partRoom = roomMap.get(floorCode);
+                    if (partRoom == null) {
+                        partRoom = new ArrayList<>();
+                    }
+                    //房间
+                    allRoom.addAll(partRoom);
+                    for (IndustrialPark room : partRoom) {
+                        buildRoomCount++;
+                        floorRoomCount++;
+                        String enterpriseCode = room.getCZlqydm();
+
+                        if (enterpriseCode != null) {
+                            usedRoomCount++;
+                            buildUsedRoomCount++;
+                            floorUsedRoomCount++;
+                            inParkEnterpriseCode.add(enterpriseCode);
+                            buildEnterpriseCode.add(enterpriseCode);
+                        }
+                    }
+                    floorData.put("floorCode", floorCode);
+                    floorData.put("roomCount", floorRoomCount);
+                    floorData.put("usedRoomCount", floorUsedRoomCount);
+                    floorData.put("buildingAreaCount", floor.getCBuildingArea());
+                    floorData.put("vacantAreaCount", floor.getCVacantArea());
+                    floorData.put("floorName", floor.getCResourceName());
+                    floors.add(floorData);
+                }
+                for (String enterpriseCode : buildEnterpriseCode) {
+                    if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
+                        Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
+                        buildEnterpriseCount++;
+                        if ("2".equals(enterprise.getIsGsqy())) {
+                            buildGsEnterpriseCount++;
+                        }
+                    }
+                }
+                buildData.put("enterpriseCount", buildEnterpriseCount);
+                buildData.put("gsEnterpriseCount", buildGsEnterpriseCount);
+                buildData.put("floorCount", partFloor.size());
+                buildData.put("roomCount", buildRoomCount);
+                buildData.put("usedRoomCount", buildUsedRoomCount);
+                buildData.put("buildingAreaCount", buildData.getString("c_building_area"));
+                buildData.put("vacantAreaCount", buildData.getString("c_vacant_area"));
+                buildData.put("floors", floors);
+                tempCacheBuildData.put(buildCode, buildData);
+            }
+
+            for (String enterpriseCode : inParkEnterpriseCode) {
+                if (aliveEnterpriseMap.containsKey(enterpriseCode)) {
+                    Enterprise enterprise = aliveEnterpriseMap.get(enterpriseCode);
+                    EnterpriseEconomicCount ytdThisYear = economicCountByYtdThisYear.get(enterpriseCode);
+                    EnterpriseEconomicCount ytdLastYear = economicCountByYtdLastYear.get(enterpriseCode);
+                    allTaxByYtdThisYear = allTaxByYtdThisYear.add(ytdThisYear.tax);
+                    allTaxByYtdLastYear = allTaxByYtdLastYear.add(ytdLastYear.tax);
+                    if ("2".equals(enterprise.getIsGsqy())) {
+                        allGsProductByYtdThisYear = allGsProductByYtdThisYear.add(ytdThisYear.product);
+                        allGsProductByYtdLastYear = allGsProductByYtdLastYear.add(ytdLastYear.product);
+                        enterPriceGsCount++;
+                    }
+                    enterPriceCount++;
+                    aliveEnterprise.add(enterpriseCode);
+                    String industry = enterprise.getIndustry();
+                    if (industry != null) {
+                        if (industryCount.containsKey(industry)) {
+                            industryCount.put(industry, industryCount.get(industry) + 1);
+                        } else {
+                            industryCount.put(industry, 1);
+                        }
+                    }
+                }
+            }
+            List<String> sortedEnterprise = aliveEnterprise.stream().sorted((a, b) -> {
+                BigDecimal ar = economicCountBy12Month.get(a).revenue;
+                BigDecimal br = economicCountBy12Month.get(b).revenue;
+                return ar.compareTo(br) * -1;
+            }).limit(10).collect(Collectors.toList());
+
+            JSONObject parkDataCount = new JSONObject();
+            parkDataCount.put("totalTaxThisYear", allTaxByYtdThisYear);
+            parkDataCount.put("totalGsOutputThisYear", allGsProductByYtdThisYear);
+            parkDataCount.put("totalTaxLastYear", allTaxByYtdThisYear);
+            parkDataCount.put("totalGsOutputLastYear", allGsProductByYtdThisYear);
+            parkDataCount.put("buildCount", allBuild.size());
+            parkDataCount.put("officeCount", allRoom.size());
+            parkDataCount.put("usedRoomCount", usedRoomCount);
+            parkDataCount.put("enterpriseCount", enterPriceCount);
+            parkDataCount.put("enterpriseGsCount", enterPriceGsCount);
+            parkDataCount.put("parkVacantArea", industrialPark.getCVacantArea());
+            parkDataCount.put("enterPriseIndustry", industryCount);
+
+            JSONArray topRevenue = new JSONArray();
+            for (String enterPriseCode : sortedEnterprise) {
+                JSONObject outPut = new JSONObject();
+                Enterprise enterPrice = aliveEnterpriseMap.get(enterPriseCode);
+                outPut.put("enterPriceCode", enterPriseCode);
+                outPut.put("enterPriceName", enterPrice.getCEnterpriseName());
+                outPut.put("enterPriceRevenue", economicCountBy12Month.get(enterPriseCode).revenue);
+                topRevenue.add(outPut);
+            }
+
+            parkDataCount.put("topRevenue", topRevenue);
+
+            tempCacheParkData.put(parkCode, parkDataCount);
+        }
+
+
+    }
+
+    private void simpleCountPark(List<IndustrialPark> allIndustrialPark) {
+        int parkCount = 0;
+        BigDecimal totalFloorArea = BigDecimal.ZERO;
+        BigDecimal totalBuildArea = BigDecimal.ZERO;
+        BigDecimal totalVacantArea = BigDecimal.ZERO;
+        for (IndustrialPark industrialPark : allIndustrialPark) {
+            try {
+                int type = Integer.parseInt(industrialPark.getCResourceType());
+                switch (type) {
+                    case 1: {
+                        String parentCode = industrialPark.getCParentCode();
+                        roomMap.add(parentCode, industrialPark);
+                        break;
+                    }
+                    case 2: {
+                        String parentCode = industrialPark.getCParentCode();
+                        floorMap.add(parentCode, industrialPark);
+                        break;
+                    }
+                    case 3: {
+                        String parentCode = industrialPark.getCParentCode();
+                        buildMap.add(parentCode, industrialPark);
+                        break;
+                    }
+                    case 4: {
+                        parkCount++;
+                        allPark.add(industrialPark);
+                        try {
+                            totalFloorArea = totalFloorArea.add(industrialPark.getCFloorArea());
+                        } catch (NumberFormatException ignore) {
+                        }
+                        try {
+                            totalBuildArea = totalBuildArea.add(industrialPark.getCBuildingArea());
+                        } catch (NumberFormatException ignore) {
+                        }
+                        try {
+                            totalVacantArea = totalVacantArea.add(industrialPark.getCVacantArea());
+                        } catch (NumberFormatException ignore) {
+                        }
+                    }
+                    default: {
+                        //do nothing
+                    }
+                }
+            } catch (Exception e) {
+                //nothing
+            }
+        }
+
+        tempCacheTownData.put("parkCount", parkCount);
+        tempCacheTownData.put("areaBuild", totalBuildArea);
+        tempCacheTownData.put("areaFloor", totalFloorArea);
+        tempCacheTownData.put("areaVacant", totalVacantArea);
+        tempCacheTownData.put("areaUsed", totalBuildArea.subtract(totalVacantArea));
+    }
+
+    private void countEnterprise(List<Enterprise> allEnterprise, Map<String, List<EnterpriseEconomic>> enterpriseEconomicMap) {
+        int inTownCount = 0;
+        int gsqyCount = 0;
+        int aliveCount = 0;
+        Map<String, Integer> industryCount = new HashMap<>();
+
+        for (Enterprise enterPrise : allEnterprise) {
+            boolean isInTown = "1".equals(Optional.ofNullable(enterPrise.getRegType()).orElse("1"));
+            boolean isGsqy = "2".equals(Optional.ofNullable(enterPrise.getIsGsqy()).orElse("1"));
+            boolean isAlive = "存续".equals(Optional.ofNullable(enterPrise.getOperationStatus()).orElse("存续"));
+
+            if (isAlive) {
+                aliveCount++;
+                if (isInTown) {
+                    inTownCount++;
+                }
+                if (isGsqy) {
+                    gsqyCount++;
+                }
+
+                String industry = enterPrise.getIndustry();
+                if (industry != null) {
+                    if (industryCount.containsKey(industry)) {
+                        industryCount.put(industry, industryCount.get(industry) + 1);
+                    } else {
+                        industryCount.put(industry, 1);
+                    }
+                }
+
+                String enterPriceCode = enterPrise.getCUnifiedSocialCreditCode();
+                if (enterPriceCode != null) {
+                    aliveEnterpriseMap.put(enterPriceCode, enterPrise);
+                    List<EnterpriseEconomic> enterpriseEconomicList = enterpriseEconomicMap.get(enterPriceCode);
+                    List<EnterpriseEconomic> economicBy12Month = new ArrayList<>();
+                    List<EnterpriseEconomic> economicByYtdThisYear = new ArrayList<>();
+                    List<EnterpriseEconomic> economicByYtdLastYear = new ArrayList<>();
+                    List<String> Last12Month = SpecialisationStringCollector.YearMonthByLast12Month();
+                    List<String> ytdThisYear = SpecialisationStringCollector.YearMonthByYtd();
+                    List<String> ytdLastYear = SpecialisationStringCollector.YearMonthByYtd(1);
+                    Optional.ofNullable(enterpriseEconomicList).orElse(new ArrayList<>()).stream()
+                            .filter(e -> !"4".equals(e.getCDataStatus()))
+                            .forEach(e -> {
+                                String time = e.getCYearMonth();
+                                if (Last12Month.contains(time)) {
+                                    economicBy12Month.add(e);
+                                }
+                                if (ytdThisYear.contains(time)) {
+                                    economicByYtdThisYear.add(e);
+                                }
+                                if (ytdLastYear.contains(time)) {
+                                    economicByYtdLastYear.add(e);
+                                }
+                            });
+                    economicCountBy12Month.put(enterPriceCode,new EnterpriseEconomicCount(economicBy12Month));
+                    economicCountByYtdThisYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdThisYear));
+                    economicCountByYtdLastYear.put(enterPriceCode, new EnterpriseEconomicCount(economicByYtdLastYear));
+                }
+            }
+
+        }
+
+        tempCacheTownData.put("enterPriseCount", aliveCount);
+        tempCacheTownData.put("enterPriseSdCount", inTownCount);
+        tempCacheTownData.put("enterPriseGsCount", gsqyCount);
+
+        tempCacheTownData.put("enterPriseIndustry", industryCount);
+    }
+
+    public void countOrder(List<Order> allOrder) {
+        int orderComplete = 0;
+        int orderCount = 0;
+        for (Order order : allOrder) {
+            String status = order.getStatus();
+            switch (status) {
+                case "3": {
+                    orderComplete++;
+                    //就是没有break,需要它自然下落
+                }
+                case "1":
+                case "2": {
+                    orderCount++;
+                }
+                case "4":
+                default: {
+                    //doNothing
+                }
+            }
+        }
+        tempCacheTownData.put("completeOrder", orderComplete);
+        tempCacheTownData.put("orderCount", orderCount);
+    }
+
+
+    public void tryCount() {
+        if (!counted) {
+            count();
+        }
+    }
+
+    public JSONObject getTownData() {
+        tryCount();
+        return cacheTownData;
+    }
+
+    public JSONObject getParkData(String parkCode) {
+        tryCount();
+        return cacheParkData.get(parkCode);
+    }
+
+    public JSONObject getBuildData(String buildCode) {
+        tryCount();
+        return cacheBuildData.get(buildCode);
+    }
+
+
+}

+ 94 - 0
src/main/java/com/skyversation/xjcy/service/OWSService.java

@@ -0,0 +1,94 @@
+package com.skyversation.xjcy.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.xjcy.util.HttpUtil;
+import lombok.Getter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClientException;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class OWSService {
+    @Value("${app.ows.path}")
+    private String owsPath;
+
+    public enum TypeName {
+        SUBWAY_STATION("xjxm:shs_dtz","subwayStation"),
+        BUS_STATION("xjxm:shs_gjz","busStation"),
+        PARKING_LOT("xjxm:shs_tcc","parkingLot"),
+        GAS_STATION("xjxm:shs_jyz","gasStation"),
+        PARK("xjxm:shs_gygc_point","park"),
+        HOTEL("xjxm:shs_zsfu_point","hotel"),;
+
+        public final String value;
+        public final String name;
+
+        TypeName(String v, String n) {
+            value = v;
+            name = n;
+        }
+    }
+
+    private JSONArray sendToOWS(Map<String, String> params, int depth) {
+        MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
+        for (Map.Entry<String, String> entry : params.entrySet()) {
+            map.add(entry.getKey(), entry.getValue());
+        }
+        try {
+            ResponseEntity<String> result = HttpUtil.requestGet(owsPath, map, Collections.emptyMap());
+            JSONObject json = JSONObject.parseObject(result.getBody());
+            return json.getJSONArray("features");
+        } catch (RestClientException e) {
+            if (depth >= 3) {
+                System.out.println("无法访问OWS服务,相关参数如下");
+                System.out.println("path:"+owsPath);
+                params.forEach((k,v)-> System.out.println(k+":"+v));
+                return null;
+            }
+            return sendToOWS(params, depth + 1);
+        }
+    }
+
+    private JSONArray sendToOWS(Map<String, String> params) {
+        return sendToOWS(params, 0);
+    }
+
+    private Map<String, String> commonParams() {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("service", "WFS");
+        params.put("version", "1.0.0");
+        params.put("request", "GetFeature");
+        params.put("outputFormat", "application/json");
+        return params;
+    }
+
+    public JSONArray commonFind(String area, TypeName typeName) {
+        Map<String, String> params = commonParams();
+        params.put("typeName", typeName.value);
+        params.put("CQL_FILTER", area);
+        return sendToOWS(params);
+    }
+    public Map<String,Integer> countAll(String area) {
+        Map<String, Integer> result = new HashMap<>();
+        for (TypeName typeName : TypeName.values()) {
+            try {
+                result.put(typeName.name, commonFind(area,typeName).size());
+            } catch (Exception e) {
+                //do nothing
+            }
+        }
+        return result;
+    }
+    public String getArea(String lon , String lat ,String distance){
+        return "INTERSECTS(the_geom, BUFFER(POINT("+lon+" "+lat+"),"+distance+"))";
+    }
+}

+ 742 - 0
src/main/java/com/skyversation/xjcy/util/CoordTransform2.java

@@ -0,0 +1,742 @@
+package com.skyversation.xjcy.util;
+
+import org.opengis.referencing.operation.Projection;
+import org.osgeo.proj4j.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CoordTransform2 {
+
+    private final double x_PI = (Math.PI * 3000.0) / 180.0;
+    private final double ee = 0.00669342162296594323;
+    private final double a = 6378245.0;
+
+
+    private final double BD_FACTOR = (3.14159265358979324 * 3000.0) / 180.0;
+    private final double PI = Math.PI;
+    private final double RADIUS = 6378245.0;
+    private final double EE = 0.00669342162296594323;
+
+
+    // 定义常量
+    private final double A = 6378245.0;
+
+    public enum Projs {
+        WGS84, GCJ02, BD09, UTM4, SHCJ, METER, DEGREE
+    }
+
+    public enum EPSG {
+        WGS84("+proj=longlat +datum=WGS84 +no_defs"),
+        MERCATOR("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"),
+        GAUSS_KRUGER("+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
+
+        private final String projString;
+
+        EPSG(String projString) {
+            this.projString = projString;
+        }
+
+        public String getProjString() {
+            return projString;
+        }
+    }
+
+    public static boolean outOfSh(double lng, double lat){
+        lat += lat;
+        lng +=lng;
+        return !(lng > 115.487 && lng < 123.696 && lat > 28.260 && lat < 33.521);
+    }
+
+    private static CoordTransform2 instance = new CoordTransform2();
+    private CoordTransform2(){}
+    public static CoordTransform2 getInstance(){
+        if(instance == null) {
+            instance = new CoordTransform2();
+        }
+        return instance;
+    }
+
+
+    // 定义投影字典
+    private static final List<Projection> projs = new ArrayList<>();
+
+    // 定义坐标转换方法
+    public double[] wgs84ToShcj(double x, double y) {
+        if (outOfChina(x, y)) {
+            return new double[]{x, y};
+        } else {
+            double[] dlatLng = transformLatLng(x - 105.0, y - 35.0);
+            double radLat = (y / 180.0) * PI;
+            double magic = Math.sin(radLat);
+            magic = 1 - ee * magic * magic;
+            double sqrtMagic = Math.sqrt(magic);
+            dlatLng[0] = (dlatLng[0] * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * PI);
+            dlatLng[1] = (dlatLng[1] * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * PI);
+            double mglat = y + dlatLng[0];
+            double mglng = x + dlatLng[1];
+            return new double[]{mglng, mglat};
+        }
+    }
+
+    // 定义坐标转换方法
+    public double[] gcj02ToWgs84(double x, double y) {
+        if (outOfChina(x, y)) {
+            return new double[]{x, y};
+        } else {
+            double[] dlatLng = transformLatLng(x - 105.0, y - 35.0);
+            double radLat = (y / 180.0) * PI;
+            double magic = Math.sin(radLat);
+            magic = 1 - ee * magic * magic;
+            double sqrtMagic = Math.sqrt(magic);
+            dlatLng[0] = (dlatLng[0] * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * PI);
+            dlatLng[1] = (dlatLng[1] * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * PI);
+            double mglat = y + dlatLng[0];
+            double mglng = x + dlatLng[1];
+            return new double[]{x * 2 - mglng, y * 2 - mglat};
+        }
+    }
+
+    // 定义判断是否在中国境内的方法
+    public boolean outOfChina(double x, double y) {
+        // 纬度 3.86~53.55,经度 73.66~135.05
+        return!(x > 73.66 && x < 135.05 && y > 3.86 && y < 53.55);
+    }
+
+    // 定义坐标转换方法
+    public double[] transformLatLng(double x, double y) {
+        double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
+        ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(y * PI) + 40.0 * Math.sin((y / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((y / 12.0) * PI) + 320 * Math.sin((y * PI) / 30.0)) * 2.0) / 3.0;
+        return new double[]{ret, ret};
+    }
+
+    // 定义经纬度转米的方法
+    public double[] degreeToMeter(double x, double y) {
+        double lon = (x * 20037508.34) / 180;
+        double lat = Math.log(Math.tan(((90 + y) * PI) / 360)) / (PI / 180);
+        lat = (lat * 20037508.34) / 180;
+        return new double[]{lon, lat};
+    }
+
+    // 定义米转经纬度的方法
+    public double[] meterToDegree(double x, double y) {
+        double lon = (x / 20037508.34) * 180;
+        double lat = (y / 20037508.34) * 180;
+        lat = (180 / PI) * (2 * Math.atan(Math.exp((lat * PI) / 180)) - PI / 2);
+        return new double[]{lon, lat};
+    }
+
+    // 定义 WGS84 坐标转上海城建的方法
+    public double[] wgs84ToShcj2(double x, double y) {
+        double[] xy = shcjGetUTMFromWGS(x, y);
+        return utmToShcj4(xy[0], xy[1]);
+    }
+
+    // 定义 UTM 转上海城建的方法
+    public double[] utmToShcj4(double x, double y) {
+        double DX = -500199.29965;
+        double DY = -3457078.805985;
+        double T = 0.0000001755;
+        double K = 1.0004000106;
+        return covertByFourParm(x, y, DX, DY, T, K);
+    }
+
+    // 定义上海城建坐标转 UTM 的方法
+    public double[] shcjGetUTMFromWGS(double lon, double lat) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        double f = (a - b) / a;
+
+        double eSquare = 2 * f - f * f;
+        double k0 = 0.9996;
+        double lonOrigin = 121.46714714;
+        double FN = 0;
+        // # 确保 longtitude 位于-180.00----179.9 之间
+        double lonTemp = lon + 180 - Math.floor((lon + 180) / 360) * 360 - 180;
+        double latRad = (lat * PI) / 180;
+        double lonRad = (lonTemp * PI) / 180;
+        double lonOriginRad = (lonOrigin * PI) / 180;
+        double e2Square = eSquare / (1 - eSquare);
+
+        double V = a / Math.sqrt(1 - eSquare * Math.pow(Math.sin(latRad), 2));
+        double T = Math.pow(Math.tan(latRad), 2);
+        double C = e2Square * Math.pow(Math.cos(latRad), 2);
+        double A = Math.cos(latRad) * (lonRad - lonOriginRad);
+        double M = a * ((1 - eSquare / 4 - (3 * Math.pow(eSquare, 2)) / 64 - (5 * Math.pow(eSquare, 3)) / 256) * latRad - ((3 * eSquare) / 8 + (3 * Math.pow(eSquare, 2)) / 32 + (45 * Math.pow(eSquare, 3)) / 1024) * Math.sin(2 * latRad) + ((15 * Math.pow(eSquare, 2)) / 256 + (45 * Math.pow(eSquare, 3)) / 1024) * Math.sin(4 * latRad) - ((35 * Math.pow(eSquare, 3)) / 3072) * Math.sin(6 * latRad));
+
+        // # x
+        double UTMEasting = k0 * V * (A + ((1 - T + C) * Math.pow(A, 3)) / 6 + ((5 - 18 * T + Math.pow(T, 2) + 72 * C - 58 * e2Square) * Math.pow(A, 5)) / 120) + 500000.0;
+        //  # y
+        double UTMNorthing = k0 * (M + V * Math.tan(latRad) * (Math.pow(A, 2) / 2 + ((5 - T + 9 * C + 4 * Math.pow(C, 2)) * Math.pow(A, 4)) / 24 + ((61 - 58 * T + Math.pow(T, 2) + 600 * C - 330 * e2Square) * Math.pow(A, 6)) / 720));
+        //# 南半球纬度起点为 10000000.0m
+        UTMNorthing += FN;
+        double[] xy = new double[2];
+        xy[0] = UTMEasting;
+        xy[1] = UTMNorthing;
+        return xy;
+    }
+
+    // 定义上海城建坐标转 WGS84 的方法
+    public double[] shcjToWgs84(double x, double y) {
+        double[] xy = shcjToUtm4(x, y);
+        return shcjGetWGSFromUTM(xy[0], xy[1]);
+    }
+
+    // 定义上海城建坐标转 UTM 的方法
+    public double[] shcjToUtm4(double x, double y) {
+        double DX = 499999.90104;
+        double DY = 3455696.403019;
+        double T = -0.0000001755;
+        double K = 0.999600149344;
+        return covertByFourParm(x, y, DX, DY, T, K);
+    }
+
+    // 定义四参数公式
+    public double[] covertByFourParm(double x, double y, double dx, double dy, double a, double k) {
+        double px = 0;
+        double py = 0;
+        px = x * k * Math.cos(a) - y * k * Math.sin(a) + dx;
+        py = x * k * Math.sin(a) + y * k * Math.cos(a) + dy;
+        double[] xy = new double[2];
+        xy[0] = px;
+        xy[1] = py;
+        return xy;
+    }
+
+    // 定义上海城建坐标转 WGS84 的方法
+    public double[] shcjGetWGSFromUTM(double x, double y) {
+        // WGS84
+        double a = 6378137; // 椭球体长半轴
+        double b = 6356752.3142451; // 椭球体短半轴
+        x = 500000 - x;
+        double k0 = 0.9996;
+        double e = Math.sqrt(1 - Math.pow(b, 2) / Math.pow(a, 2));
+        // # calculate the meridional arc
+        double M = y / k0;
+        //# calculate footprint latitude
+        double mu = M / (a * (1 - Math.pow(e, 2) / 4 - (3 * Math.pow(e, 4)) / 64 - (5 * Math.pow(e, 6)) / 256));
+        double e1 = (1 - Math.pow(1 - Math.pow(e, 2), 1.0 / 2)) / (1 + Math.pow(1 - Math.pow(e, 2), 1.0 / 2));
+        double J1 = (3 * e1) / 2 - (27 * Math.pow(e1, 3)) / 32;
+        double J2 = (21 * Math.pow(e1, 2)) / 16 - (55 * Math.pow(e1, 4)) / 32;
+        double J3 = (151 * Math.pow(e1, 3)) / 96;
+        double J4 = (1097 * Math.pow(e1, 4)) / 512;
+        double fp = mu + J1 * Math.sin(2 * mu) + J2 * Math.sin(4 * mu) + J3 * Math.sin(6 * mu) + J4 * Math.sin(8 * mu);
+        // # Calculate Latitude and Longitude
+        double e2 = Math.pow(e, 2) / (1 - Math.pow(e, 2));
+        double C1 = e2 * Math.pow(Math.cos(fp), 2);
+        double T1 = Math.pow(Math.tan(fp), 2);
+        double R1 = (a * (1 - Math.pow(e, 2))) / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 3.0 / 2);
+        //# This is the same as rho in the forward conversion formulas above, but calculated for fp instead of lat.
+        double N1 = a / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 1.0 / 2);
+        //# This is the same as nu in the forward conversion formulas above, but calculated for fp instead of lat.
+        double D = x / (N1 * k0);
+        double Q1 = (N1 * Math.tan(fp)) / R1;
+        double Q2 = Math.pow(D, 2) / 2;
+        double Q3 = ((5 + 3 * T1 + 10 * C1 - 4 * Math.pow(C1, 2) - 9 * e2) * Math.pow(D, 4)) / 24;
+        double Q4 = ((61 + 90 * T1 + 298 * C1 + 45 * Math.pow(T1, 2) - 3 * Math.pow(C1, 2) - 252 * e2) * Math.pow(D, 6)) / 720;
+        double lat = ((fp - Q1 * (Q2 - Q3 + Q4)) * 180) / PI;
+        // System.out.println("lat===="+Math.toRadians(fp - Q1*(Q2 - Q3 + Q4)));
+        double Q5 = D;
+        double Q6 = ((1 + 2 * T1 + C1) * Math.pow(D, 3)) / 6;
+        double Q7 = ((5 - 2 * C1 + 28 * T1 - 3 * Math.pow(C1, 2) + 8 * e2 + 24 * Math.pow(T1, 2)) * Math.pow(D, 5)) / 120;
+        double lonMid = 121.46714714;
+        double lon = lonMid - (((Q5 - Q6 + Q7) / Math.cos(fp)) * 180) / PI;
+        double[] xy = new double[2];
+        xy[0] = lon;
+        xy[1] = lat;
+        return xy;
+    }
+
+    /***
+     *  计算两个经纬度之间的距离,返回单位米
+     * @param lat1
+     * @param lon1
+     * @param lat2
+     * @param lon2
+     * @return
+     */
+    public double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
+        // 将经纬度转换为弧度
+        double lat1Rad = Math.toRadians(lat1);
+        double lon1Rad = Math.toRadians(lon1);
+        double lat2Rad = Math.toRadians(lat2);
+        double lon2Rad = Math.toRadians(lon2);
+
+//        // 地球半径(单位:千米)
+//        double earthRadius = 6371.0;
+
+        // Haversine公式计算两点之间的距离
+        double dLat = lat2Rad - lat1Rad;
+        double dLon = lon2Rad - lon1Rad;
+        double a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1Rad) * Math.cos(lat2Rad) * Math.pow(Math.sin(dLon / 2), 2);
+        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+        double distance = RADIUS * c;
+
+        return distance;
+    }
+
+    public boolean checkLatlon(double lat, double lon){
+        if(lat >85 || lat < -85|| lon >180 || lon < -180){
+            return false;
+        }
+        return true;
+    }
+
+    public double[] bd09_to_gcj02(double bd_lon, double bd_lat) {
+        double x = bd_lon - 0.0065;
+        double y = bd_lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
+        double gg_lng = z * Math.cos(theta);
+        double gg_lat = z * Math.sin(theta);
+        return new double[]{gg_lng, gg_lat};
+    }
+
+    public double[] gcj02_to_bd09(double lng, double lat) {
+        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI);
+        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI);
+        double bd_lng = z * Math.cos(theta) + 0.0065;
+        double bd_lat = z * Math.sin(theta) + 0.006;
+        return new double[]{bd_lng, bd_lat};
+    }
+
+    public double[] wgs84_to_gcj02(double lng, double lat) {
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double dlat = transformlat(lng - 105.0, lat - 35.0);
+            double dlng = transformlng(lng - 105.0, lat - 35.0);
+            double radlat = (lat / 180.0) * PI;
+            double magic = Math.sin(radlat);
+            magic = 1 - ee * magic * magic;
+            double sqrtmagic = Math.sqrt(magic);
+            dlat = (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI);
+            dlng = (dlng * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
+            double mglat = lat + dlat;
+            double mglng = lng + dlng;
+            return new double[]{mglng, mglat};
+        }
+    }
+
+//    public double[] gcj02_to_wgs84(double lng, double lat) {
+//        if (out_of_china(lng, lat)) {
+//            return new double[]{lng, lat};
+//        } else {
+//            double dlat = transformlat(lng - 105.0, lat - 35.0);
+//            double dlng = transformlng(lng - 105.0, lat - 35.0);
+//            double radlat = (lat / 180.0) * PI;
+//            double magic = Math.sin(radlat);
+//            magic = 1 - ee * magic * magic;
+//            double sqrtmagic = Math.sqrt(magic);
+//            dlat = (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI);
+//            dlng = (dlng * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
+//            double mglat = lat + dlat;
+//            double mglng = lng + dlng;
+//            return new double[]{lng * 2 - mglng, lat * 2 - mglat};
+//        }
+//    }
+
+//    public boolean out_of_china(double lng, double lat) {
+//        return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
+//    }
+
+//    public double transformlat(double lng, double lat) {
+//        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+//        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+//        ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0;
+//        ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0;
+//        return ret;
+//    }
+//
+//    public double transformlng(double lng, double lat) {
+//        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+//        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+//        ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0;
+//        ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0;
+//        return ret;
+//    }
+
+    public double[] degree_to_meter(double lng, double lat) {
+        double x = (lng * 20037508.34) / 180;
+        double y = Math.log(Math.tan(((90 + lat) * PI) / 360)) / (PI / 180);
+        y = (y * 20037508.34) / 180;
+        return new double[]{x, y};
+    }
+
+    public double[] meter_to_degree(double x, double y) {
+        double lon = (x / 20037508.34) * 180;
+        double lat = (y / 20037508.34) * 180;
+        lat = (180 / PI) * (2 * Math.atan(Math.exp((lat * PI) / 180)) - PI / 2);
+        return new double[]{lon, lat};
+    }
+
+//    public double[] wgs84_to_shcj(double x, double y) {
+//        double[] xy = new double[2];
+//        xy = shcj_get_UTM_from_WGS(x, y);
+//        return utm_to_shcj4(xy[0], xy[1]);
+//    }
+
+    public double[] utm_to_shcj4(double x, double y) {
+        double DX = -500199.29965;
+        double DY = -3457078.805985;
+        double T = 0.0000001755;
+        double K = 1.0004000106;
+        return covert_by_four_parm(x, y, DX, DY, T, K);
+    }
+
+    public double[] shcj_get_UTM_from_WGS(double lon, double lat) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        double f = (a - b) / a;
+        double eSquare = 2 * f - f * f;
+        double k0 = 0.9996;
+        double lonOrigin = 121.46714714;
+        double FN = 0;
+        double lonTemp = lon + 180 - Math.floor((lon + 180) / 360) * 360 - 180;
+        double latRad = (lat * PI) / 180;
+        double lonRad = (lonTemp * PI) / 180;
+        double lonOriginRad = (lonOrigin * PI) / 180;
+        double e2Square = eSquare / (1 - eSquare);
+        double V = a / Math.sqrt(1 - eSquare * Math.pow(Math.sin(latRad), 2));
+        double T = Math.pow(Math.tan(latRad), 2);
+        double C = e2Square * Math.pow(Math.cos(latRad), 2);
+        double A = Math.cos(latRad) * (lonRad - lonOriginRad);
+        double M = a * ((1 - eSquare / 4 - (3 * Math.pow(eSquare, 2)) / 64 - (5 * Math.pow(eSquare, 3)) / 256) * latRad -
+                ((3 * eSquare) / 8 + (3 * Math.pow(eSquare, 2)) / 32 + (45 * Math.pow(eSquare, 3)) / 1024) *
+                        Math.sin(2 * latRad) +
+                ((15 * Math.pow(eSquare, 2)) / 256 + (45 * Math.pow(eSquare, 3)) / 1024) *
+                        Math.sin(4 * latRad) -
+                ((35 * Math.pow(eSquare, 3)) / 3072) * Math.sin(6 * latRad));
+        double UTMEasting = k0 * V * (A + ((1 - T + C) * Math.pow(A, 3)) / 6 +
+                ((5 - 18 * T + Math.pow(T, 2) + 72 * C - 58 * e2Square) * Math.pow(A, 5)) / 120) + 500000.0;
+        double UTMNorthing = k0 * (M + V * Math.tan(latRad) * (Math.pow(A, 2) / 2 +
+                ((5 - T + 9 * C + 4 * Math.pow(C, 2)) * Math.pow(A, 4)) / 24 +
+                ((61 - 58 * T + Math.pow(T, 2) + 600 * C - 330 * e2Square) * Math.pow(A, 6)) / 720));
+        UTMNorthing += FN;
+        return new double[]{UTMEasting, UTMNorthing};
+    }
+
+    public double[] shcj_to_wgs84(double x, double y) {
+        double[] xy = new double[2];
+        xy = shcj_to_utm4(x, y);
+        return shcj_get_WGS_from_UTM(xy[0], xy[1]);
+    }
+
+    public double[] shcj_to_utm4(double x, double y) {
+        double DX = 499999.90104;
+        double DY = 3455696.403019;
+        double T = -0.0000001755;
+        double K = 0.999600149344;
+        return covert_by_four_parm(x, y, DX, DY, T, K);
+    }
+
+    public double[] covert_by_four_parm(double x, double y, double dx, double dy, double a, double k) {
+        double px = x * k * Math.cos(a) - y * k * Math.sin(a) + dx;
+        double py = x * k * Math.sin(a) + y * k * Math.cos(a) + dy;
+        return new double[]{px, py};
+    }
+
+    public double[] shcj_get_WGS_from_UTM(double x, double y) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        x = 500000 - x;
+        double k0 = 0.9996;
+        double e = Math.sqrt(1 - Math.pow(b, 2) / Math.pow(a, 2));
+        double M = y / k0;
+        double mu = M / (a * (1 - Math.pow(e, 2) / 4 - (3 * Math.pow(e, 4)) / 64 - (5 * Math.pow(e, 6)) / 256));
+        double e1 = (1 - Math.pow(1 - Math.pow(e, 2), 1.0 / 2)) / (1 + Math.pow(1 - Math.pow(e, 2), 1.0 / 2));
+        double J1 = (3 * e1) / 2 - (27 * Math.pow(e1, 3)) / 32;
+        double J2 = (21 * Math.pow(e1, 2)) / 16 - (55 * Math.pow(e1, 4)) / 32;
+        double J3 = (151 * Math.pow(e1, 3)) / 96;
+        double J4 = (1097 * Math.pow(e1, 4)) / 512;
+        double fp = mu + J1 * Math.sin(2 * mu) + J2 * Math.sin(4 * mu) + J3 * Math.sin(6 * mu) + J4 * Math.sin(8 * mu);
+        double e2 = Math.pow(e, 2) / (1 - Math.pow(e, 2));
+        double C1 = e2 * Math.pow(Math.cos(fp), 2);
+        double T1 = Math.pow(Math.tan(fp), 2);
+        double R1 = (a * (1 - Math.pow(e, 2))) / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 3.0 / 2);
+        double N1 = a / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 1.0 / 2);
+        double D = x / (N1 * k0);
+        double Q1 = (N1 * Math.tan(fp)) / R1;
+        double Q2 = Math.pow(D, 2) / 2;
+        double Q3 = ((5 + 3 * T1 + 10 * C1 - 4 * Math.pow(C1, 2) - 9 * e2) * Math.pow(D, 4)) / 24;
+        double Q4 = ((61 + 90 * T1 + 298 * C1 + 45 * Math.pow(T1, 2) - 3 * Math.pow(C1, 2) - 252 * e2) * Math.pow(D, 6)) / 720;
+        double lat = ((fp - Q1 * (Q2 - Q3 + Q4)) * 180) / PI;
+        double Q5 = D;
+        double Q6 = ((1 + 2 * T1 + C1) * Math.pow(D, 3)) / 6;
+        double Q7 = ((5 - 2 * C1 + 28 * T1 - 3 * Math.pow(C1, 2) + 8 * e2 + 24 * Math.pow(T1, 2)) * Math.pow(D, 5)) / 120;
+        double lonmid = 121.46714714;
+        double lon = lonmid - (((Q5 - Q6 + Q7) / Math.cos(fp)) * 180) / PI;
+        return new double[]{lon, lat};
+    }
+
+    public double[] wgs84_to_bd09(double x, double y) {
+        double[] ll = wgs84_to_gcj02(x, y);
+        ll = gcj02_to_bd09(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] bd09_to_wgs84(double x, double y) {
+        double[] ll = bd09_to_gcj02(x, y);
+        ll = gcj02_to_wgs84(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] gcj02_to_shcj(double x, double y) {
+        double[] ll = gcj02_to_wgs84(x, y);
+        ll = wgs84_to_shcj(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] shcj_to_gcj02(double x, double y) {
+        double[] ll = shcj_to_wgs84(x, y);
+        ll = wgs84_to_gcj02(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] convert_proj_from_to(Projs from, Projs to, double[] xy) {
+        if (from == to) {
+            return xy;
+        } else {
+            String fromProj = from.toString().toLowerCase();
+            String toProj = to.toString().toLowerCase();
+            String targetMethod = fromProj + "_to_" + toProj;
+            try {
+                return (double[]) this.getClass().getMethod(targetMethod, double.class, double.class).invoke(this, xy[0], xy[1]);
+            } catch (IllegalAccessException e) {
+                throw new RuntimeException(e);
+            } catch (InvocationTargetException e) {
+                throw new RuntimeException(e);
+            } catch (NoSuchMethodException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public double[] WGS84ToSH2000(double lng, double lat) {
+        if (out_of_sh(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] templatlng = wgs84_to_shcj(lng, lat);
+            templatlng = meter_to_degree(templatlng[0], templatlng[1]);
+            return new double[]{templatlng[0], templatlng[1]};
+        }
+    }
+
+    public double[] SH2000ToWGS84(double x, double y) {
+        double[] templatlng = meter_to_degree(x, y);
+        if (out_of_sh2000(templatlng[0], templatlng[1])) {
+            return new double[]{x, y};
+        } else {
+            templatlng = shcj_to_wgs84(x, y);
+            return templatlng;
+        }
+    }
+
+    public double[] SH2000lnglatToWGS84(double lng, double lat) {
+        if (out_of_sh2000(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] templatlng = degree_to_meter(lng, lat);
+            templatlng = shcj_to_wgs84(templatlng[0], templatlng[1]);
+            return templatlng;
+        }
+    }
+
+    private boolean out_of_sh(double lng, double lat) {
+        // 实现out_of_sh方法
+        return false;
+    }
+
+    private boolean out_of_sh2000(double lng, double lat) {
+        // 实现out_of_sh2000方法
+        return false;
+    }
+
+    public double[] wgs84_to_shcj(double x, double y) {
+        double[] xy = new double[2];
+        xy = shcj_get_UTM_from_WGS(x, y);
+        return utm_to_shcj4(xy[0], xy[1]);
+    }
+
+
+    public double[] BD09ToGCJ02(double lng, double lat) {
+        double x = lng - 0.0065;
+        double y = lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * BD_FACTOR);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * BD_FACTOR);
+        double gg_lng = z * Math.cos(theta);
+        double gg_lat = z * Math.sin(theta);
+        return new double[]{gg_lng, gg_lat};
+    }
+
+    public double[] GCJ02ToBD09(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * BD_FACTOR);
+        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * BD_FACTOR);
+        double bd_lng = z * Math.cos(theta) + 0.0065;
+        double bd_lat = z * Math.sin(theta) + 0.006;
+        return new double[]{bd_lng, bd_lat};
+    }
+
+    public double[] WGS84ToBD09(double lng, double lat) {
+        double[] GCJ02latlng = WGS84ToGCJ02(lng, lat);
+        double[] BD09latlng = GCJ02ToBD09(GCJ02latlng[0], GCJ02latlng[1]);
+        return BD09latlng;
+    }
+
+    public double[] BD09ToWGS84(double lng, double lat) {
+        double[] GCJ02latlng = BD09ToGCJ02(lng, lat);
+        double[] wgslatlng = GCJ02ToWGS84(GCJ02latlng[0], GCJ02latlng[1]);
+        return wgslatlng;
+    }
+
+    public double[] WGS84ToGCJ02(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] d = delta(lng, lat);
+            return new double[]{lng + d[0], lat + d[1]};
+        }
+    }
+
+    public double[] GCJ02ToWGS84(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] d = delta(lng, lat);
+            double mgLng = lng + d[0];
+            double mgLat = lat + d[1];
+            return new double[]{lng * 2 - mgLng, lat * 2 - mgLat};
+        }
+    }
+
+    private double[] delta(double lng, double lat) {
+        double dLng = transformLng(lng - 105, lat - 35);
+        double dLat = transformLat(lng - 105, lat - 35);
+        double radLat = (lat / 180) * PI;
+        double magic = Math.sin(radLat);
+        magic = 1 - EE * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLng = (dLng * 180) / ((RADIUS / sqrtMagic) * Math.cos(radLat) * PI);
+        dLat = (dLat * 180) / (((RADIUS * (1 - EE)) / (magic * sqrtMagic)) * PI);
+        return new double[]{dLng, dLat};
+    }
+
+    private double transformLng(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    private double transformLat(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    private boolean out_of_china(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
+    }
+
+    private CRSFactory crsFactory = new CRSFactory();
+
+    // 定义84坐标系
+    private String wgs84Str = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
+//    private CoordinateReferenceSystem wgs84 = crsFactory.createFromParameters(
+//            "WGS84", wgs84Str);
+    private CoordinateReferenceSystem wgs84 =
+            crsFactory.createFromName("EPSG:4326");
+
+    // 定义CGCS2000坐标系
+    private String cgcs2000Str = "+proj=utm +zone=50 +ellps=GRS80 +units=m +no_defs";
+//    private CoordinateReferenceSystem cgcs2000 = crsFactory.createFromParameters(
+//            "CGCS2000", cgcs2000Str);
+    private CoordinateReferenceSystem cgcs2000 =
+            crsFactory.createFromName("EPSG:4490");
+
+    public double[] gcj02_to_wgs84(double lng, double lat) {
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double dlat = transformlat(lng - 105.0, lat - 35.0);
+            double dlng = transformlng(lng - 105.0, lat - 35.0);
+            double radlat = (lat / 180.0) * Math.PI;
+            double magic = Math.sin(radlat);
+            magic = 1 - EE * magic * magic;
+            double sqrtmagic = Math.sqrt(magic);
+            dlat = (dlat * 180.0) / (((A * (1 - EE)) / (magic * sqrtmagic)) * Math.PI);
+            dlng = (dlng * 180.0) / ((A / sqrtmagic) * Math.cos(radlat) * Math.PI);
+            double mglat = lat + dlat;
+            double mglng = lng + dlng;
+            return new double[]{lng * 2 - mglng, lat * 2 - mglat};
+        }
+    }
+
+    public double transformlng(double lng, double lat) {
+        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lng * Math.PI) + 40.0 * Math.sin((lng / 3.0) * Math.PI)) * 2.0) / 3.0;
+        ret += ((150.0 * Math.sin((lng / 12.0) * Math.PI) + 300.0 * Math.sin((lng / 30.0) * Math.PI)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    public double transformlat(double lng, double lat) {
+        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lat * Math.PI) + 40.0 * Math.sin((lat / 3.0) * Math.PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((lat / 12.0) * Math.PI) + 320 * Math.sin((lat * Math.PI) / 30.0)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    public double[] wgs84ToCGCS2000(double lng, double lat) {
+
+        // 定义WGS84坐标点
+        ProjCoordinate wgs84Point = new ProjCoordinate(lng, lat);
+
+        // 将WGS84坐标点转换为CGCS2000坐标点
+        ProjCoordinate cgcs2000Point = new ProjCoordinate();
+
+        // 创建坐标转换器
+        CoordinateTransformFactory ctf = new CoordinateTransformFactory();
+        CoordinateTransform transform = ctf.createTransform(wgs84, cgcs2000);
+
+        transform.transform(wgs84Point, cgcs2000Point);
+        System.out.println(cgcs2000Point.x + "," + cgcs2000Point.y);
+        return new double[]{cgcs2000Point.x, cgcs2000Point.y};
+    }
+
+    public double[] cgcs2000ToWGS84(double lng, double lat) {
+        // 定义CGCS2000坐标点
+        ProjCoordinate cgcs2000Point = new ProjCoordinate(lng, lat);
+
+        // 将CGCS2000坐标点转换为WGS84坐标点
+        ProjCoordinate wgs84Point = new ProjCoordinate();
+
+        // 创建坐标转换器
+        CoordinateTransformFactory ctf = new CoordinateTransformFactory();
+        CoordinateTransform transform = ctf.createTransform(cgcs2000, wgs84);
+
+        transform.transform(cgcs2000Point, wgs84Point);
+        System.out.println(wgs84Point.x + "," + wgs84Point.y);
+        return new double[]{wgs84Point.x, wgs84Point.y};
+    }
+
+}

+ 137 - 0
src/main/java/com/skyversation/xjcy/util/HttpUtil.java

@@ -0,0 +1,137 @@
+package com.skyversation.xjcy.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.http.*;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import javax.net.ssl.SSLContext;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.*;
+
+@Service
+public class HttpUtil {
+
+    public List<String> tempToken = new ArrayList<>();
+    public boolean isRun = false;
+
+    public static String requestPost(String url, MultiValueMap<String, String> params, Map<String, String> headerMap) {
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setConnectTimeout(10 * 1000);
+        requestFactory.setReadTimeout(10 * 1000);
+        RestTemplate client = new RestTemplate(requestFactory);
+        client.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+        HttpHeaders headers = new HttpHeaders();
+        //请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+        if (headerMap != null) {
+            Set<String> sets = headerMap.keySet();
+            for (String key : sets) {
+                headers.add(key, headerMap.get(key));
+            }
+        }
+
+        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);//执行HTTP请求
+        ResponseEntity<String> response = client.exchange(url, HttpMethod.POST, requestEntity, String.class);
+        return response.getBody();
+    }
+
+    public static ResponseEntity<String> requestGet(String url,
+                                                    MultiValueMap<String, String> params,
+                                                    Map<String, String> headerMap) {
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setConnectTimeout(10 * 1000);
+        requestFactory.setReadTimeout(10 * 1000);
+        RestTemplate client = new RestTemplate(requestFactory);
+        client.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+
+        // 构建带参数的完整 URL
+        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
+        if (params != null) {
+            builder.queryParams(params);
+        }
+
+        // 构建 headers
+        HttpHeaders headers = new HttpHeaders();
+        if (headerMap != null) {
+            headerMap.forEach(headers::add);
+        }
+
+        HttpEntity<?> entity = new HttpEntity<>(headers);
+        URI uri = URI.create(builder.toUriString());
+        return client.exchange(uri, HttpMethod.GET, entity, String.class);
+    }
+
+
+    public static ResponseEntity<String> requestGetHttps(String url, MultiValueMap<String, String> params, Map<String, String> headerMap) {
+        try {
+            // 创建忽略 SSL 验证的 HttpClient
+            TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
+            SSLContext sslContext = SSLContextBuilder.create()
+                    .loadTrustMaterial(null, acceptingTrustStrategy)
+                    .build();
+
+            CloseableHttpClient httpClient = HttpClients.custom()
+                    .setSSLContext(sslContext)
+                    .setSSLHostnameVerifier(new NoopHostnameVerifier())
+                    .build();
+
+            // 创建使用自定义 HttpClient 的 RequestFactory
+            HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
+            requestFactory.setHttpClient(httpClient);
+            requestFactory.setConnectTimeout(10 * 1000);
+            requestFactory.setReadTimeout(10 * 1000);
+
+            RestTemplate client = new RestTemplate(requestFactory);
+            client.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+
+            HttpHeaders headers = new HttpHeaders();
+            // 请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            if (headerMap != null) {
+                Set<String> sets = headerMap.keySet();
+                for (String key : sets) {
+                    headers.add(key, headerMap.get(key));
+                }
+            }
+
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
+            // 执行 HTTP 请求
+            return client.exchange(url, HttpMethod.GET, requestEntity, String.class);
+        } catch (KeyStoreException | NoSuchAlgorithmException | KeyManagementException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+
+
+    public static String sendGetRequest(String urlString) throws Exception {
+        HttpClient httpClient = HttpClients.createDefault();
+        HttpGet httpGet = new HttpGet(urlString);
+        HttpResponse response = httpClient.execute(httpGet);
+        HttpEntity entity = (HttpEntity) response.getEntity();
+        return EntityUtils.toString((org.apache.http.HttpEntity) entity);
+    }
+}

+ 112 - 0
src/main/java/com/skyversation/xjcy/util/MessageManage.java

@@ -0,0 +1,112 @@
+package com.skyversation.xjcy.util;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONException;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+
+/***
+ * 接口返回消息封装管理工具
+ */
+
+@Slf4j
+public class MessageManage {
+
+    private static MessageManage messageManage = new MessageManage();
+    private MessageManage(){}
+    public static MessageManage getInstance(){
+        if(messageManage == null) {
+            messageManage = new MessageManage();
+        }
+        return messageManage;
+    }
+
+    public String getResultContent(int code, String content, String message){
+        JSONObject json = new JSONObject();
+        try {
+            json.put("code", code);
+            if(content == null || content.equals("")){
+                json.put("content", null);
+            } else {
+                json.put("content", content);
+            }
+            json.put("message", message);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        log.info(json.toString());
+        return json.toString();
+    }
+
+    public String getResultContent(int code, Object bean, String message){
+        JSONObject json = new JSONObject();
+        try {
+            json.put("code", code);
+            if(bean == null){
+                json.put("content", null);
+            } else {
+                json.put("content", JSON.toJSON(bean));
+            }
+            json.put("message", message);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        log.info(json.toString());
+        return JSON.toJSONString(json, SerializerFeature.DisableCircularReferenceDetect);
+    }
+
+    public String getResultContent(int code, List lis, String message){
+        JSONObject json = new JSONObject();
+        try {
+            json.put("code", code);
+            json.put("message", message);
+            if(lis != null && lis.size() > 0){
+                JSONArray data = new JSONArray();
+                for(Object obj : lis){
+                    data.add(JSON.toJSON(obj));
+                }
+                json.put("content", data);
+            } else {
+                json.put("content", null);
+            }
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        log.info(json.toString());
+        return json.toString();
+    }
+    public String getResultContent(int code, List lis, String message, Long total){
+        JSONObject json = new JSONObject();
+        try {
+            json.put("code", code);
+            json.put("message", message);
+            if(total == null || total < 0){
+                json.put("total", 0);
+            } else {
+                json.put("total", total);
+            }
+            if(lis != null && lis.size() > 0){
+                JSONArray data = new JSONArray();
+                for(Object obj : lis){
+                    data.add(JSON.toJSON(obj));
+                }
+                json.put("content", data);
+            } else {
+                json.put("content", "");
+            }
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        log.info(json.toString());
+        return json.toString();
+    }
+
+
+}

+ 77 - 0
src/main/java/com/skyversation/xjcy/util/SpecialisationStringCollector.java

@@ -0,0 +1,77 @@
+package com.skyversation.xjcy.util;
+
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SpecialisationStringCollector {
+    public static List<String> YearMonthByLast12Month() {
+        List<String> list = new ArrayList<>();
+
+        //先拿时间
+        LocalDate localDate = LocalDate.now();
+        int dayForMonth = localDate.getDayOfMonth();
+        // 计算“起始年月”
+        YearMonth startYm = YearMonth.from(localDate).minusMonths(dayForMonth < 15 ? 2 : 1);
+
+        // 往前推 12 个月
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMM");
+        for (int i = 0; i < 12; i++) {
+            list.add(startYm.minusMonths(i).format(fmt));
+        }
+
+        return list;
+    }
+
+    public static List<String> YearMonthByYtd(int offsetYear) {
+        List<String> list = new ArrayList<>();
+
+        //先拿时间
+        LocalDate localDate = LocalDate.now();
+        localDate = localDate.minusYears(offsetYear);
+        int dayForMonth = localDate.getDayOfMonth();
+        // 计算“起始年月”
+        YearMonth startYm = YearMonth.from(localDate).minusMonths(dayForMonth < 15 ? 2 : 1);
+
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMM");
+
+        // 当年 1 月
+        YearMonth january = YearMonth.of(localDate.getYear(), 1);
+
+        // 从起始月往前遍历,直到当年 1 月为止
+        YearMonth cursor = startYm;
+        while (!cursor.isBefore(january)) {          // 当 cursor >= 当年 1 月
+            list.add(cursor.format(fmt));
+            cursor = cursor.minusMonths(1);
+        }
+
+        return list;
+    }
+
+    public static List<String> YearMonthByYtd() {
+        return YearMonthByYtd(0);
+    }
+
+    private static List<String> summonLastYearStringBySeason() {
+        List<String> list = new ArrayList<>();
+
+        // 当前季度
+        LocalDate now = LocalDate.now();
+        int quarter = (now.getMonthValue() - 1) / 3 + 1;
+
+        // 起始季度:如果当前是 1 月 1-15 号,则往前多推一个季度
+        YearMonth startQuarterFirstMonth = YearMonth.of(now.getYear(), 1)
+                .plusMonths((quarter - 1) * 3)
+                .minusMonths(now.getDayOfMonth() < 15 ? 6 : 3);
+
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy'Q'Q");
+        for (int i = 0; i < 4; i++) {
+            list.add(startQuarterFirstMonth.minusMonths(i * 3).format(fmt));
+        }
+
+        // 按时间从新到旧排序
+        return list;
+    }
+}

+ 29 - 0
src/main/resources/application.yml

@@ -0,0 +1,29 @@
+server:
+  port: 10020
+  servlet.context-path: /xjcy/
+spring:
+  application:
+    name: xjcy
+  mvc:
+    async:
+      request-timeout: 60000
+  servlet:
+    multipart:
+      max-file-size: 3000MB
+      max-request-size: 3000MB
+logging:
+  level:
+    org:
+      springframework:
+        boot:
+          web:
+            servlet: DEBUG
+app:
+  dms:
+    path: ${DMS_PATH:http://121.43.55.7:10081/dms}
+  oauth:
+    login-name: ${DMS_LOGIN_NAME:user002}
+    password: ${DMS_PASSWORD:1234567890}
+    path: ${OAUTH_LOGIN_PATH:http://121.43.55.7:10086/oauth/api/user/login}
+  ows:
+    path: ${OWS_PATH:http://121.43.55.7:8889/geoserver/xjxm/ows}