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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.flightfeather.uav.lightshare.web
 
import com.fasterxml.jackson.annotation.JsonFormat
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import java.time.LocalDateTime
import javax.servlet.http.HttpServletResponse
 
/**
 * 卫星遥测
 * @date 2024/12/5
 * @author feiyu02
 */
@Api(tags = ["卫星遥测API接口"])
@RestController
@RequestMapping("air/satellite")
class SatelliteTelemetryController(private val satelliteTelemetryService: SatelliteTelemetryService) {
 
    @ApiOperation(value = "获取网格组信息")
    @PostMapping("/grid/group")
    fun fetchGridGroup(
        @RequestBody areaVo: AreaVo,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, page, perPage) }
 
    @ApiOperation(value = "获取网格组内具体网格信息")
    @GetMapping("/grid/cell")
    fun fetchGridCell(
        @ApiParam("网格组id") @RequestParam groupId: Int,
    ) = resPack { satelliteTelemetryService.fetchGridCell(groupId) }
 
    @ApiOperation(value = "获取网格组下的卫星遥测数据")
    @GetMapping("/grid/data")
    fun fetchGridData(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
        @ApiParam("遥测数据类型", allowableValues = "0:原始卫星遥测数据;1:融合数据") @RequestParam(required = false) type: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridData(groupId, dataTime, type) }
 
    @ApiOperation(value = "获取网格组下的卫星遥测具体数据")
    @GetMapping("/grid/data/detail")
    fun fetchGridDataDetail(
        @ApiParam("遥测数据id") @RequestParam dataId: Int,
        @ApiParam("网格组id") @RequestParam(required = false) groupId: Int?,
        @ApiParam("网格单元格id") @RequestParam(required = false) cellId: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) }
 
 
    @ApiOperation(value = "导入卫星遥测PM2.5结果数据")
    @PostMapping("/import/grid/data")
    fun importGridData(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
        @ApiParam("是否覆盖旧数据") @RequestParam update: Boolean,
        @RequestParam("excel") file: MultipartFile,
    ) = resPack {
        satelliteTelemetryService.importGridData(groupId, dateTime, update, file)
    }
 
    @ApiOperation(value = "下载卫星遥测PM2.5结果数据导入模板")
    @GetMapping("/import/grid/data/download/template")
    fun downloadTemplate(@ApiIgnore response: HttpServletResponse) = satelliteTelemetryService.downloadTemplate(response)
 
    @ApiOperation(value = "获取网格组下的卫星遥测aod数据")
    @GetMapping("/grid/aod")
    fun fetchGridAod(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
    ) = resPack { satelliteTelemetryService.fetchGridAod(groupId, dataTime) }
 
    @ApiOperation(value = "导入卫星遥测Aod结果数据")
    @PostMapping("/import/grid/aod")
    fun importGridAOD(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
        @ApiParam("是否覆盖旧数据") @RequestParam update: Boolean,
        @RequestParam("excel") file: MultipartFile,
    ) = resPack {
        satelliteTelemetryService.importGridAOD(groupId, dateTime, update, file)
    }
 
    @ApiOperation(value = "下载卫星遥测Aod结果数据导入模板")
    @GetMapping("/import/grid/aod/download/template")
    fun downloadAODTemplate(@ApiIgnore response: HttpServletResponse) = satelliteTelemetryService.downloadAODTemplate(response)
}