AqaraDeviceController.java 1.74 KB
package cn.com.glsx.modules.controller;

import cn.com.glsx.modules.service.AqaraDeviceService;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhouhaibao
 * @date 2021/4/20 16:25
 */
@Controller
@RequestMapping("/device")
@Api(value = "aqara设备管理", tags = {"aqara设备管理"})
public class AqaraDeviceController {

    @Autowired
    private AqaraDeviceService aqaraDeviceService;

    @RequestMapping(value = "/bindKeyGet", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取bindKey")
    public R bindKeyGet(@RequestParam(required = false) String username){
        return aqaraDeviceService.bindKeyGet(username);
    }

    @RequestMapping(value = "/instructionIssue", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "下发指令")
    public R instructionIssue(@RequestBody String data,@RequestParam(required = false) String username){
        return aqaraDeviceService.instructionIssue(data,username);
    }

    @RequestMapping(value = "/subscriber", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "订阅资源")
    public R subscriber(@RequestBody String data,@RequestParam(required = false) String username){
        return aqaraDeviceService.subscriber(data,username);
    }
}