Răsfoiți Sursa

添加容错

zhanghan 6 zile în urmă
părinte
comite
de3291e8ee

BIN
out/artifacts/poiAddr/poiAddr.war


+ 7 - 3
src/main/java/com/skyversation/poiaddr/util/MessageManage.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONException;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.skyversation.poiaddr.bean.GeoJsonBean;
 import com.skyversation.poiaddr.entity.AddressV4Result;
 import com.skyversation.poiaddr.service.AreaService;
 import lombok.extern.slf4j.Slf4j;
@@ -110,11 +111,14 @@ public class MessageManage {
                     double y = poi.getDouble("lat");
                     AreaService areaService = AreaService.getInstance();
                     //TODO 网格信息
-                    poi.put("网格信息",areaService.isInGridPolygon(x,y).getProperties());
+                    GeoJsonBean gridGeo = areaService.isInGridPolygon(x,y);
+                    poi.put("网格信息",gridGeo == null ? new JSONObject() : gridGeo.getProperties());
                     //TODO 村居信息
-                    poi.put("村居信息",areaService.isInCJPolygon(x,y).getProperties());
+                    GeoJsonBean cjGeo = areaService.isInCJPolygon(x,y);
+                    poi.put("村居信息",cjGeo == null ? new JSONObject() : cjGeo.getProperties());
                     //TODO 微网格信息
-                    poi.put("微网格信息",areaService.isInWGridPolygon(x,y).getProperties());
+                    GeoJsonBean wgridGeo = areaService.isInWGridPolygon(x,y);
+                    poi.put("微网格信息", wgridGeo == null ? new JSONObject() : wgridGeo.getProperties());
 
                 }