|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONException;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.skyversation.poiaddr.entity.AddressV4Result;
|
|
|
+import com.skyversation.poiaddr.service.AreaService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -65,14 +66,75 @@ public class MessageManage {
|
|
|
return JSON.toJSONString(json, SerializerFeature.DisableCircularReferenceDetect);
|
|
|
}
|
|
|
|
|
|
- public String getResultContent(int code, Object bean, String message){
|
|
|
+ public String getAddressResultContent(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));
|
|
|
+ JSONObject content = JSON.parseObject(JSON.toJSONString(bean));
|
|
|
+ JSONArray pois = content.getJSONArray("data");
|
|
|
+ for(int i = 0; i < pois.size(); i++){
|
|
|
+ JSONObject poi = pois.getJSONObject(i);
|
|
|
+ poi.put("parent",new JSONArray());
|
|
|
+ poi.put("address",poi.getString("address")==null?"":poi.getString("address"));
|
|
|
+ poi.put("distance",new JSONArray());
|
|
|
+ poi.put("pname",poi.getString("pname")==null?"":poi.getString("pname"));
|
|
|
+ poi.put("importance",new JSONArray());
|
|
|
+ JSONObject biz_ext = new JSONObject();
|
|
|
+ biz_ext.put("cost",new JSONArray());
|
|
|
+ biz_ext.put("rating",new JSONArray());
|
|
|
+ poi.put("biz_ext",biz_ext);
|
|
|
+ poi.put("biz_type",new JSONArray());
|
|
|
+ String oCityname = poi.getString("cityname");
|
|
|
+ String oAdname = poi.getString("adname");
|
|
|
+ poi.put("cityname",poi.get("pname"));
|
|
|
+ //网格信息太复杂放最后
|
|
|
+ poi.put("type",poi.getString("type")==null?"":poi.getString("type"));
|
|
|
+ poi.put("parking_type","");
|
|
|
+ poi.put("photos",new JSONArray());
|
|
|
+ poi.put("typecode","");
|
|
|
+ poi.put("shopinfo","");
|
|
|
+ poi.put("poiweight",new JSONArray());
|
|
|
+ poi.put("childtype",new JSONArray());
|
|
|
+ poi.put("adname",oCityname);
|
|
|
+ poi.put("name",poi.getString("name")==null?"":poi.getString("name"));
|
|
|
+ //村居信息太复杂放最后
|
|
|
+ //微网格信息太复杂放最后
|
|
|
+ poi.put("location",poi.getString("location")==null?"":poi.getString("location"));
|
|
|
+ poi.put("tel",new JSONArray());
|
|
|
+ poi.put("shopid",new JSONArray());
|
|
|
+ poi.put("id","");
|
|
|
+ double x = poi.getDouble("lon");
|
|
|
+ double y = poi.getDouble("lat");
|
|
|
+ AreaService areaService = AreaService.getInstance();
|
|
|
+ //TODO 网格信息
|
|
|
+ poi.put("网格信息",areaService.isInGridPolygon(x,y).getProperties());
|
|
|
+ //TODO 村居信息
|
|
|
+ poi.put("村居信息",areaService.isInCJPolygon(x,y).getProperties());
|
|
|
+ //TODO 微网格信息
|
|
|
+ poi.put("微网格信息",areaService.isInWGridPolygon(x,y).getProperties());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ content.put("pois", pois);
|
|
|
+ content.remove("data");
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject suggestion = new JSONObject();
|
|
|
+ suggestion.put("keywords",new JSONArray());
|
|
|
+ suggestion.put("cities",new JSONArray());
|
|
|
+ content.put("suggestion",suggestion);
|
|
|
+ content.put("count","");
|
|
|
+ content.put("infocode","");
|
|
|
+ content.put("status","");
|
|
|
+ content.put("info","");
|
|
|
+
|
|
|
+
|
|
|
+ json.put("content", JSON.toJSON(content));
|
|
|
+
|
|
|
}
|
|
|
json.put("message", message);
|
|
|
} catch (JSONException e) {
|