package com.inspect.metadata.mqutil;

import com.inspect.metadata.websocketutil.WebsocketSend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/testMq"})
public class testMq {
    private final Sender sender;
    final
    WebsocketSend websocketSend;

    public testMq(Sender sender, WebsocketSend websocketSend) {
        this.sender = sender;
        this.websocketSend = websocketSend;
    }

    @GetMapping({"/test"})
    public void test() {
        try {
            String str = "{\n    \"SendCode\": \"机器人及无人机巡视系统唯一标识\",\n    \"ReceiveCode\": \"巡视主机唯一标识\",\n    \"Type\": \"5\",\n    \"Command\": \"\",\n    \"Code\": \"\",\n    \"Items\": [\n        {\n            \"patroldevice_name\": \"巡视设备名称\",\n            \"patroldevice_code\": \"巡视设备编码\",\n            \"content\": \"告警描述\"\n        }\n    ]\n}";
            this.websocketSend.parseMessage(str);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
