package com.zd.laboratory.mqtt;

import com.zd.laboratory.mqtt.enums.BigViewDataType;
import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
import io.swagger.annotations.Api;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zpp
 * @date 2019/8/26 18:19
 */
@RestController
@ResponseBody
@Api(tags = "mqtt测试")
@RequestMapping("/mqtt")
public class TestController {

    @Autowired
    private SubMessageSendManager messageSendService;

    @GetMapping("/send")
    public String send(){
        messageSendService.SendBigViewUpdate(BigViewDataType.SUB_ONLINE);
        return "success";
    }

//    @GetMapping("/sendry/{msg}")
//    public String sends(@PathVariable String msg){
//        String topic="reming/heartssss";
//        JSONObject jsonObject=new JSONObject();
//        jsonObject.put("name","张三");
//        jsonObject.put("sex","男");
//        jsonObject.put("phone","13324654152");
//        mqttProducer.send(topic,0,jsonObject.toJSONString());
//        return "success";
//    }



    //Integer trackX,Integer trackY,String macNo

//    @GetMapping("/pay")
//    public String pay(@RequestParam (value = "orderNo") String orderNo,
//                      @RequestParam (value = "trackX") Integer trackX,
//                      @RequestParam (value = "trackY") Integer trackY,
//                      @RequestParam (value = "macNo") String macNo,
//                      @RequestParam (value = "type") Integer type,
//                       @RequestParam (value = "number") Integer number
//    ){
//        messageSendService.SendPaySuccess(orderNo,trackX,trackY,macNo,type,number);
//        return "success";
//    }
}
