suerprisePlus
2024-09-23 e7c3276f2f5091fe8626af61ba5d7b41b2a1f2df
src/main/java/com/yb/service/IntentionService.java
@@ -3,6 +3,7 @@
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;
@@ -147,15 +148,27 @@
        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);
@@ -163,6 +176,12 @@
        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);
    }
@@ -174,10 +193,13 @@
        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);