package com.ruoyi.device.uav.controller; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.device.uav.service.UavService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.PostConstruct; import java.util.*; import static org.springframework.http.HttpMethod.*; /** * 相机设备Controller * * @author ruoyi * @date 2023-01-31 */ @Slf4j(topic = "uav") @RestController @RequestMapping("/device/uav") @Api(tags = "无人机外部接口") public class ArdUavController extends BaseController { @Autowired private UavService uavService; @PostConstruct public void created() { this.uavService.login(); } @GetMapping("/") @ApiOperation("无人机get接口") public Object get(@RequestParam String url) { return this.uavService.doUavRequest(GET, url, "{}"); } @PostMapping("/") @ApiOperation("无人机post接口") public Object post(@RequestBody Map param) { String url = param.get("url"); String data = param.get("data"); return this.uavService.doUavRequest(POST, url, data); } @DeleteMapping("/") @ApiOperation("无人机delete接口") public Object delete(@RequestBody Map param) { String url = param.get("url"); String data = param.get("data"); return this.uavService.doUavRequest(DELETE, url, data); } @GetMapping("/getToken") @ApiOperation("无人机delete接口") public Object getToken() { return this.uavService.getToken(); } }