| | |
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONArray;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.github.houbb.opencc4j.core.impl.ZhConvertBootstrap;
|
| | | import com.yb.config.XzConfig;
|
| | | import com.yb.helper.RsaHelper;
|
| | | import com.yb.util.EntityHttpUtil;
|
| | |
| | | String type = argsObject.getString("attris");
|
| | | String dis = argsObject.getString("redius");
|
| | | int radius = 5000;
|
| | | if (dis != null) {
|
| | | if (dis != null && dis.contains("km")) {
|
| | | dis = dis.replace("km", "");
|
| | | radius = Integer.parseInt(dis) * 1000;
|
| | | }
|
| | | if (dis != null && dis.contains("m")) {
|
| | | dis = dis.replace("m", "");
|
| | | radius = Integer.parseInt(dis);
|
| | | }
|
| | | if (dis != null && dis.contains("米")) {
|
| | | dis = dis.replace("米", "");
|
| | | radius = Integer.parseInt(dis);
|
| | | }
|
| | | String aroundPoi = agentService.getAgentAroundPoi(place, type, radius, xzConfig.queryFiled, xzConfig.typeFiled);
|
| | | if (aroundPoi == "" || aroundPoi.isEmpty()) {
|
| | | aroundPoi = agentService.getAgentAroundPoi(getTraditional(place), type, radius, xzConfig.queryFiled, xzConfig.typeFiled);
|
| | | if (aroundPoi == "" || aroundPoi.isEmpty()) {
|
| | | String msg = "未查询到" + place + "相关数据。请提供更加详细数据。";
|
| | | hashMap.put("msg", msg);
|
| | | return hashMap;
|
| | | }
|
| | |
|
| | | }
|
| | | JSONArray dataArray = JSONArray.parseArray(aroundPoi);
|
| | | System.out.println("aroundPoi: " + dataArray);
|
| | |
| | | String msg = "已查询到" + place + "内的" + type + "相关数据。共查询到" + dataArray.size() + "条数据。";
|
| | | hashMap.put("msg", msg);
|
| | | return hashMap;
|
| | |
|
| | | }
|
| | |
|
| | | public String getTraditional(String place) {
|
| | | ZhConvertBootstrap zhConvertBootstrap = ZhConvertBootstrap.newInstance();
|
| | | return zhConvertBootstrap.toTraditional(place);
|
| | |
|
| | | }
|
| | |
|
| | |
| | | String poiMap = agentService.getAgentPoiMap(place, xzConfig.queryFiled);
|
| | | JSONObject poiObj = JSONObject.parseObject(poiMap);
|
| | | if (poiMap == "" || poiMap.isEmpty()) {
|
| | | poiMap = agentService.getAgentPoiMap(getTraditional(place), xzConfig.queryFiled);
|
| | | if (poiMap == "" || poiMap.isEmpty()) {
|
| | | String msg = "未查询到" + place + "相关数据。请提供更加详细数据。";
|
| | | hashMap.put("msg", msg);
|
| | | return hashMap;
|
| | | }
|
| | | }
|
| | | System.out.println("poiMap: " + poiObj);
|
| | | hashMap.put("func", func);
|
| | | hashMap.put("data", poiObj);
|