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;
        }
@@ -84,7 +85,11 @@
        String key = "msg";
        String msg = (String) poiMap.get(key);
        hashMap.put("msg", msg);
        hashMap.put("data", poiMap);
        String center = (String) poiMap.get("center");
        if(center != null){
            hashMap.put("data", poiMap);
        }
        return hashMap;
    }
@@ -95,6 +100,7 @@
        String filedString = xzService.getQueryMeta(xzConfig.layerId, xzConfig.dbid, xzConfig.typeFiled, xzConfig.queryEntity);
        JSONObject metaObject = JSON.parseObject(filedString);
        JSONArray dataArray = metaObject.getJSONArray("data");
        String markDown = "| 数据类型 | 数据量 |\n|------|------|\n";
        ArrayList<HashMap<String, Object>> list = new ArrayList<>();
        for (int i = 0; i < dataArray.size(); i++) {
@@ -115,6 +121,7 @@
    }
    //    关键字查询分类查询数据量
    private ArrayList getQueryByFiledList(String name) throws Exception {
        String obj = xzConfig.typeFiled + " = '" + name + "'" + "";
@@ -126,8 +133,6 @@
        System.out.println("rec queryMeta:" + fObj);
        if (fObj != null) {
            JSONArray fArray = JSONArray.parseArray(JSONObject.parseObject(fObj).getString("items"));
            System.out.println("rec queryMeta:" + fArray);
            System.out.println("rec queryMeta:" + fArray.size());
            if (fArray.size() > 0) {
                for (int i = 0; i < fArray.size(); i++) {
                    String sid = JSONObject.parseObject(fArray.get(i).toString()).getString("seid");
@@ -147,22 +152,106 @@
        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) * 1000;
        }
        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);
        hashMap.put("data", dataArray);
        if (type.contains("全部目标")) {
            if (dataArray.size() == 0) {
                hashMap.put("data", dataArray);
                String msg = "已查询到" + place + "内的" + type + "相关数据。共查询到" + dataArray.size() + "条数据。";
                hashMap.put("msg", msg);
                return hashMap;
            }
            ArrayList<HashMap<String, Object>> listArray = new ArrayList<>();
            String markDown = "| 数据类型 | 数据量 |\n|------|------|\n";
            ArrayList<HashMap<String, Object>> list = new ArrayList<>();
            List<String> cName = new ArrayList<>();
            List<Integer> cNum = new ArrayList<>();
            for (int i = 0; i < dataArray.size(); i++) {
                JSONObject dataObj = dataArray.getJSONObject(i);
                String fclass1 = dataObj.getString("fclass_1");
                String ids = dataObj.getString("seid");
                if (cName.contains(fclass1)) {
                    for (int j = 0; j < cName.size(); j++) {
                        String name = cName.get(j);
                        if (name.equals(fclass1)) {
                            System.out.println("目标统计 = " + cName.get(j) + fclass1);
                            int num = cNum.get(j) + 1;
                            cNum.set(j, num);
                            HashMap<String, Object> itemObj = list.get(j);
                            for (String key : itemObj.keySet()) {
                                if (key.contains("ids")) {
                                    ArrayList list_ids = (ArrayList) itemObj.get(key);
                                    list_ids.add(ids);
                                    itemObj.put(key,list_ids);
                                }
                            }
                        }
                    }
                } else {
                    cName.add(fclass1);
                    cNum.add(1);
                    HashMap<String, Object> listhash = new HashMap<>();
                    ArrayList listId = new ArrayList();
                    listId.add(ids);
                    listhash.put("name", fclass1);
                    listhash.put("ids", listId);
                    list.add(listhash);
                }
            }
            for (int i = 0; i < cName.size(); i++) {
                markDown += "| " + cName.get(i) + " | " + cNum.get(i) + " |\n";
            }
            hashMap.put("ids", list);
            hashMap.put("data", markDown);
            hashMap.put("func", "queryMeta");
            return hashMap;
        }
        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 +263,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);