package com.ruoyi.device.uav.controller; import com.dtflys.forest.exceptions.ForestNetworkException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.pagehelper.util.StringUtil; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.device.uav.service.UavService; import com.ruoyi.utils.forest.UavClient; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.StringUtils; import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; import org.springframework.web.bind.annotation.*; import javax.annotation.PostConstruct; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; import org.apache.commons.codec.binary.Base64; 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, @RequestParam String data) { return this.uavService.doUavRequest(GET, url, data); } @PostMapping("/") @ApiOperation("无人机post接口") public Object post(@RequestParam String url, @RequestParam String data) { return this.uavService.doUavRequest(POST, url, data); } @DeleteMapping("/") @ApiOperation("无人机delete接口") public Object delete(@RequestParam String url, @RequestParam String data) { return this.uavService.doUavRequest(DELETE, url, data); } }