diff --git a/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java b/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java index d20a70a..0012e86 100644 --- a/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java +++ b/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java @@ -34,7 +34,7 @@ class SmartCityUsercenterApplicationTests { } } - public static void main(String[] args) throws IOException { + public static void gridPoint() throws IOException { String baseDir = "/Users/wanggeng/Desktop/"; BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/gridPoint.json"))); StringBuilder sourceJsonArraySB = new StringBuilder(); @@ -76,4 +76,39 @@ class SmartCityUsercenterApplicationTests { System.out.println(sb); } + public static void gridMember() throws IOException { + String baseDir = "/Users/wanggeng/Desktop/乌兰察布市域社会治理/数字冰雹"; + BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/网格员.json"))); + StringBuilder sourceJsonArraySB = new StringBuilder(); + for (String line; (line = bufferedReader.readLine()) != null; ) { + sourceJsonArraySB.append(line); + } + JSONArray sourceJsonArray = JSONArray.parseArray(sourceJsonArraySB.toString()); + JSONArray map84GridJsonArray = new JSONArray(); + for (int i = 0; i < sourceJsonArray.size(); i++) { + JSONObject gridJSONObject = sourceJsonArray.getJSONObject(i); + JSONObject map84GridJSONObject = new JSONObject(); + map84GridJSONObject.put("userName", gridJSONObject.getString("userName")); + + JSONObject pointJSONObject = gridJSONObject.getJSONObject("point"); + double lat = pointJSONObject.getDoubleValue("lat"); + double lng = pointJSONObject.getDoubleValue("lng"); + double[] latLng = LatLngTransformUtil.bd09_To_gps84(lat, lng); + + JSONObject map84Point = new JSONObject(); + map84Point.put("lat", String.valueOf(latLng[0])); + map84Point.put("lng", String.valueOf(latLng[1])); + map84GridJSONObject.put("point", map84Point); + + map84GridJsonArray.add(map84GridJSONObject); + } + System.out.println(map84GridJsonArray); + } + + public static void main(String[] args) throws IOException { + gridMember(); + } + + + }