|
@@ -1,6 +1,7 @@
|
|
package com.skyversation.poiaddr.util;
|
|
package com.skyversation.poiaddr.util;
|
|
|
|
|
|
import com.skyversation.poiaddr.addquery.Constant;
|
|
import com.skyversation.poiaddr.addquery.Constant;
|
|
|
|
+import com.skyversation.poiaddr.ignore.YyszAddressV3;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
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 {
|
|
public static List<Map<String, Object>> readExcel(String filePath) throws IOException {
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
FileInputStream fis = new FileInputStream(filePath);
|
|
FileInputStream fis = new FileInputStream(filePath);
|