package com.flightfeather.uav.lightshare.web
|
|
import com.fasterxml.jackson.annotation.JsonFormat
|
import com.flightfeather.uav.common.exception.BizException
|
import com.flightfeather.uav.lightshare.service.ThirdPartyService
|
import com.flightfeather.uav.socket.eunm.UWDeviceType
|
import io.swagger.annotations.Api
|
import io.swagger.annotations.ApiOperation
|
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestParam
|
import org.springframework.web.bind.annotation.RestController
|
import java.time.LocalDateTime
|
|
/**
|
* 第三方对接相关接口,包含
|
* 1. 申欣环保走航数据相关接口
|
* @date 2024/8/26
|
* @author feiyu02
|
*/
|
@Api(tags = ["第三方对接相关API接口"])
|
@RestController
|
@RequestMapping("air/thirdParty")
|
class ThirdPartyController(private val thirdPartyService: ThirdPartyService) {
|
|
@ApiOperation(value = "根据任务信息获取对应范围内的第三方走航数据")
|
@GetMapping("/data/fetch/mission")
|
fun fetchMissionData(
|
@RequestParam label: String,
|
@RequestParam missionCode: String,
|
) = resPack { thirdPartyService.fetchMissionData(label, missionCode) }
|
|
@ApiOperation(value = "获取实时最新的第三方走航数据")
|
@GetMapping("/data/fetch/latest")
|
fun fetchLatestData(
|
@RequestParam label: String,
|
@RequestParam deviceType: String,
|
@RequestParam deviceCode: String,
|
@RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") startTime: LocalDateTime?,
|
@RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") endTime: LocalDateTime?,
|
) = resPack {
|
val type = UWDeviceType.fromValue(deviceType) ?: throw BizException("设备类型不存在")
|
thirdPartyService.fetchLatestData(label, type, deviceCode, startTime, endTime)
|
}
|
}
|