Browse Source

准备打包

ximinghao 3 weeks ago
parent
commit
2f7f72ef33

+ 6 - 1
pom.xml

@@ -13,7 +13,7 @@
     <version>0.0.1-SNAPSHOT</version>
     <name>poiaddr</name>
     <description>poiaddr</description>
-    <packaging>jar</packaging>
+    <packaging>war</packaging>
     <url/>
     <licenses>
         <license/>
@@ -32,6 +32,11 @@
         <java.version>8</java.version>
     </properties>
     <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-tomcat</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <!-- Spring Data JPA 依赖,用于简化数据库操作 -->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 8 - 1
src/main/java/com/skyversation/poiaddr/PoiAddrApplication.java

@@ -2,14 +2,21 @@ package com.skyversation.poiaddr;
 
 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.data.web.config.EnableSpringDataWebSupport;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @EnableSpringDataWebSupport // 以自动处理分页参数和 Page 的序列化:
 @EnableScheduling // 定时任务支持
-public class PoiAddrApplication {
+public class PoiAddrApplication extends SpringBootServletInitializer {
     public static void main(String[] args) {
         SpringApplication.run(PoiAddrApplication.class, args);
     }
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+        return builder.sources(PoiAddrApplication.class);
+    }
 }

+ 1 - 1
src/main/java/com/skyversation/poiaddr/addquery/Constant.java

@@ -56,7 +56,7 @@ public class Constant {
             "|100000|110000|120000|130000|140000|150000|160000|170000|180000|190000|200000|220000|970000|980000|990000";
 
     @Value("${amap_key}")
-    public static String AMAP_KEY = "161e0c673807a9586ba5a115da2a0112";
+    public static String AMAP_KEY = "93a315e8c7b82f2796563753140e7e70";
 
     //    oauth和dms搭建服务器地址
     public static String ServerBaseUrl = "http://121.43.55.7:";

+ 10 - 0
src/main/java/com/skyversation/poiaddr/controller/PoiAddressController.java

@@ -5,6 +5,7 @@ import com.skyversation.poiaddr.bean.AddressResult;
 import com.skyversation.poiaddr.entity.FileDataDto;
 import com.skyversation.poiaddr.service.impl.TestDataServiceImpl;
 import com.skyversation.poiaddr.util.ExcelReaderUtils;
+import com.skyversation.poiaddr.util.MessageManage;
 import com.skyversation.poiaddr.util.RequestUtils;
 import com.skyversation.poiaddr.util.SerializationUtils;
 import com.skyversation.poiaddr.util.dms.DmsTools;
@@ -48,6 +49,15 @@ public class PoiAddressController {
     }
 
 
+    @RequestMapping("/selectPoi/{address}")
+    public Object selectPoi(@PathVariable("address") String address){
+        AddressResult addressResult = addressQueryEngine.commonSearchByName(address,AddressLevel.LEVEL_1);
+        if (addressResult.getMessage().equals("失败")){
+            return MessageManage.getInstance().getResultContent(200,addressResult,"未找到");
+        }else {
+            return MessageManage.getInstance().getResultContent(200,addressResult,"成功");
+        }
+    }
     //  根据街镇名称和村居名称返回符合条件的geojson集合文件
     @PostMapping(value = "/selectGeojsonByNames", produces = MediaType.MULTIPART_FORM_DATA_VALUE)
     public Object selectGeojsonByNames(HttpServletResponse response, @RequestParam("jdNameStr") String jdNameStr, @RequestParam(name = "czNameStr", required = false) String czNameStr) throws Exception {

+ 23 - 0
src/main/java/com/skyversation/poiaddr/util/ExcelReaderUtils.java

@@ -1,6 +1,7 @@
 package com.skyversation.poiaddr.util;
 
 import com.skyversation.poiaddr.addquery.Constant;
+import com.skyversation.poiaddr.ignore.YyszAddressV3;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 
@@ -62,6 +63,28 @@ public class ExcelReaderUtils {
         }
     }
 
+    public static void writeYToExcel(List<YyszAddressV3> target,String filePath) throws IOException {
+
+        List<Map<String, Object>> excel = new ArrayList<>();
+        for (YyszAddressV3 address : target) {
+            Map<String, Object> row = new HashMap<>();
+            row.put("oid", address.getId() == null ? "" : address.getId().toString());
+            row.put("sourceaddress", address.getSourceaddress() == null ? "" : address.getSourceaddress());
+            row.put("city", address.getCity() == null ? "" : address.getCity());
+            row.put("county", address.getCounty() == null ? "" : address.getCounty());
+            row.put("Createtime", address.getCreatetime() == null ? "" : address.getCreatetime().toString());
+            row.put("no1", address.getNo1() == null ? "" : address.getNo1());
+            row.put("lon", address.getLon() == null ? "" : address.getLon().toString());
+            row.put("lat", address.getLat() == null ? "" : address.getLat().toString());
+            row.put("x", address.getX() == null ? "" : address.getX());
+            row.put("y", address.getY() == null ? "" : address.getY());
+            row.put("town", address.getTown() == null ? "" : address.getTown());
+            row.put("community", address.getCommunity() == null ? "" : address.getCommunity());
+            excel.add(row);
+        }
+        writeToExcel(excel,filePath);
+    }
+
     public static List<Map<String, Object>> readExcel(String filePath) throws IOException {
         List<Map<String, Object>> resultList = new ArrayList<>();
         FileInputStream fis = new FileInputStream(filePath);

+ 1 - 1
src/main/resources/application.properties

@@ -31,7 +31,7 @@ app.area=\u9752\u6D66
 app.town=\u6731\u5BB6\u89D2\u9547\u3001\u8D75\u5DF7\u9547\u3001\u5F90\u6CFE\u9547\u3001\u534E\u65B0\u9547\u3001\u91CD\u56FA\u9547\u3001\u767D\u9E64\u9547\u3001\u7EC3\u5858\u9547\u3001\u91D1\u6CFD\u9547\u3001\u590F\u9633\u8857\u9053\u3001\u76C8\u6D66\u8857\u9053\u3001\u9999\u82B1\u6865\u8857\u9053
 
 app.net-type=${NET_TYPE:internet}
-app.yysz-address-service=http://localhost:10012/poi
+app.yysz-address-service=${YYSZ_POI_SERVICE:http://127.0.0.1:10012/poi}
 #
 #logging.level.org.hibernate=DEBUG
 #logging.level.org.springframework=DEBUG

File diff suppressed because it is too large
+ 0 - 0
src/main/resources/geojson/青浦区综合网格.geojson


Some files were not shown because too many files changed in this diff