suerprisePlus
2024-09-05 cc3a00f52f356c893d9f21798e9e941bb9533d10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.yb.service;
 
import com.alibaba.fastjson.JSONObject;
import com.yb.config.XzConfig;
import com.yb.entity.ReqEntity;
import com.yb.util.EntityHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service
public class AgentService {
    @Autowired
    private EntityHttpUtil entityHttpUtil;
    @Autowired
    private XzService xzService;
    @Autowired
    private XzConfig xzConfig;
 
    //   Agent_Rag服务调用
    public String getAgentRag(String url, String api, String sessionId, String libId, String msg) throws Exception {
        String http = url + api + "?session_id=" + sessionId + "&lib_id=" + libId + "&message=" + msg;
        System.out.println("rec getAgentRag:" + http);
        String obj = entityHttpUtil.getAgentMessage(http);
        System.out.println("rec getAgentRag:" + obj);
        return obj;
    }
 
    public String getAgentIntention(String url, String api, String msg) throws Exception {
        String http = url + api + "?message=" + msg;
        System.out.println("rec getMessage:" + http);
        String obj = entityHttpUtil.getAgentMessage(http);
        System.out.println("rec getMessage:" + obj);
        return obj;
    }
 
    //
    public String getAgentPoiMap(String func, String filed) throws Exception {
        String poiObj= xzService.getQueryFiled(func, filed, xzConfig.layerId, xzConfig.dbid, xzConfig.queryEntity);
        System.out.println("rec poiMap:" + poiObj);
        return poiObj;
    }
 
 
    public String getAgentAroundPoi(String place, String type, int dis, String filed, String typeFiled) throws Exception {
        String item = xzService.getQueryFiled(place, filed, xzConfig.layerId, xzConfig.dbid, xzConfig.queryEntity);
        JSONObject obj = JSONObject.parseObject(item);
        Double lon = Double.parseDouble(obj.getString("lon"));
        Double lat = Double.parseDouble(obj.getString("lat"));
        String wkt = xzService.getWKt(lon, lat, dis);
       return xzService.getQueryAround(type, wkt, typeFiled, xzConfig.layerId, xzConfig.dbid, xzConfig.queryEntity);
 
    }
}