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;
@@ -33,16 +34,16 @@
        String history = orderObject.getString("history");
        if (func.equals(xzConfig.funcName[0])) {
            mapObj = getPoiMap(orderObject,func);
            mapObj = getPoiMap(orderObject, func);
        } else if (func.equals(xzConfig.funcName[1])) {
            mapObj = getAroundPoi(orderObject, func);
        } else if (func.equals(xzConfig.funcName[2])) {
            mapObj = getQueryMeta(orderObject, func);
        } else if (func.equals(xzConfig.funcName[3])) {
            mapObj = getQueryRelationship(orderObject, func);
        }else if (func.equals(xzConfig.funcName[4])) {
        } else if (func.equals(xzConfig.funcName[4])) {
            mapObj = getCombatSimulate(orderObject, func);
        }else if (func.equals(xzConfig.funcName[5])) {
        } else if (func.equals(xzConfig.funcName[5])) {
            mapObj = getBatEnv(orderObject, func, allParams);
        }
        return mapObj;
@@ -52,7 +53,7 @@
    private HashMap<String, Object> getCombatSimulate(JSONObject orderObject, String func) {
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("func", func);
        return  hashMap;
        return hashMap;
    }
    private HashMap<String, Object> getBatEnv(JSONObject orderObject, String func, Map<String, String> allParams) throws Exception {
@@ -64,7 +65,7 @@
        System.out.println("rec history1:" + history);
        String val = entityHttpUtil.postAgentMessage(xzConfig.battleReport, allParams);
        JSONObject js = JSONObject.parseObject(val);
        if(js == null){
        if (js == null) {
            hashMap.put("msg", "报告生成失败");
            return hashMap;
        }
@@ -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()) {
            String msg = "未查询到" + place + "相关数据。请提供更加详细数据。";
            hashMap.put("msg", msg);
            return hashMap;
            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,9 +193,12 @@
        String poiMap = agentService.getAgentPoiMap(place, xzConfig.queryFiled);
        JSONObject poiObj = JSONObject.parseObject(poiMap);
        if (poiMap == "" || poiMap.isEmpty()) {
            String msg = "未查询到" + place + "相关数据。请提供更加详细数据。";
            hashMap.put("msg", msg);
            return hashMap;
            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);