package com.ruoyi.system.forward.mq;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("test")
public class Controller {
    @Resource
    private MqttProducerService producerService;

    @GetMapping
    public int test() {
        String str = "{\"headers\":{\"deviceName\":\"水肥001\",\"productId\":\"SF\",\"async\":true,\"traceparent\":\"00-f701c1e675e132da7be37cbd933ea31b-b0f1f01ffa000ce5-01\"},\"messageId\":\"1693516298552786945\",\"deviceId\":\"SF001\",\"timestamp\":1692600724243,\"functionId\":\"paramconf\",\"inputs\":[{\"name\":\"st_kg_1\",\"value\":\"1\"},{\"name\":\"st_kg_2\",\"value\":\"1\"},{\"name\":\"st_kg_3\",\"value\":\"1\"},{\"name\":\"st_kg_4\",\"value\":\"1\"},{\"name\":\"st_ig\",\"value\":\"1\"},{\"name\":\"ps_ig\",\"value\":\"0\"}],\"messageType\":\"INVOKE_FUNCTION\"}\n";

        producerService.send("/SF/SF001/properties/write/reply", str);
        return 1;
    }
}
