leutu
2024-08-27 55e607b91e8058a7fe713fa07cd4c829b5593aa5
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.yb.controller;
 
import com.alibaba.fastjson.JSON;
import com.yb.config.R;
import com.yb.entity.ReqEntity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
 
@Tag(name="新智接口")
@RestController
@RequestMapping("/api/v1")
public class XzController {
    @Autowired
    WebSocketController webSocketController;
 
    @GetMapping("/poiMap/{place}")
    @Operation(summary = "显示地点")
    public R poiMap(@PathVariable("place")String place){
        System.out.println("rec message:"+place);
        HashMap<String,Object> hash = new HashMap<>();
        hash.put("func","poiMap");
        ReqEntity reqEntity = new ReqEntity();
        reqEntity.setPlace(place);
        reqEntity.setX("120.9671");
        reqEntity.setY("13.5748");
        hash.put("poi",reqEntity);
 
        String message = JSON.toJSONString(hash);
        webSocketController.sendAllMessage(message);
 
        return R.ok(hash);
    }
 
    @PostMapping("/aroundPoi")
    @Operation(summary = "周边查询")
    public R aroundPoi(@RequestBody ReqEntity reqEntity){
        System.out.println("rec message:"+reqEntity);
        HashMap<String,Object> hash = new HashMap<>();
        hash.put("func","aroundPoi");
        List<ReqEntity> list = new ArrayList<>();
        reqEntity.setX("120.9671");
        reqEntity.setY("13.5748");
        list.add(reqEntity);
        list.add(reqEntity);
        hash.put("poi",list);
 
        String message = JSON.toJSONString(hash);
        webSocketController.sendAllMessage(message);
 
        return R.ok(hash);
    }
 
    @GetMapping("/queryPath/{start_point}/{end_point}")
    @Operation(summary = "路线查询")
    public R queryPath(@PathVariable("start_point")String start_point,@PathVariable("end_point")String end_point){
        System.out.println("rec start_point: "+start_point+"  end_point: "+end_point);
        HashMap<String,Object> hash = new HashMap<>();
        hash.put("func","searchPath");
        List<ReqEntity> list = new ArrayList<>();
 
        hash.put("path",list);
 
        String message = JSON.toJSONString(hash);
        webSocketController.sendAllMessage(message);
 
        return R.ok(hash);
    }
 
    @GetMapping("/queryMeta")
    @Operation(summary = "元信息查询")
    public R queryMeta(){
        System.out.println("queryMeta ");
        HashMap<String,Object> hash = new HashMap<>();
        hash.put("func","queryMeta");
        List<ReqEntity> list = new ArrayList<>();
 
        hash.put("meta",list);
 
        String message = JSON.toJSONString(hash);
        webSocketController.sendAllMessage(message);
 
        return R.ok(hash);
    }
}