feiyu02
2025-09-04 707b00a0ca6604c249a110b376ac1e44e408e624
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)
    }
}