feat: 增加下达mqtt命令功能接口
parent
ff765f4bf4
commit
db48dee2c3
@ -0,0 +1,34 @@
|
|||||||
|
package com.shxy.xymanager_admin.controller;
|
||||||
|
|
||||||
|
import com.shxy.xymanager_common.annotation.Log;
|
||||||
|
import com.shxy.xymanager_common.base.BaseController;
|
||||||
|
import com.shxy.xymanager_common.base.ResponseReult;
|
||||||
|
import com.shxy.xymanager_common.model.mqtt.MessageSend;
|
||||||
|
import com.shxy.xymanager_framework.mqtt.MqttPublisherService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Api(tags = {"mqtt相关接口"})
|
||||||
|
@RequestMapping("mqtt")
|
||||||
|
@Slf4j
|
||||||
|
public class MqttController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
MqttPublisherService mqttPublisherService;
|
||||||
|
|
||||||
|
@PostMapping("send")
|
||||||
|
@ApiOperation("下达命令")
|
||||||
|
@Log(title = "下达命令", type = "下达")
|
||||||
|
public ResponseReult<String> send(@RequestBody MessageSend msg) throws Exception {
|
||||||
|
mqttPublisherService.publish(msg);
|
||||||
|
return ResponseReult.success("OK");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue