feiyu02
2025-09-30 94fee0b511279679b43e210878d3d36e5a14384b
src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
@@ -1,7 +1,9 @@
package com.flightfeather.uav.lightshare.web
import com.fasterxml.jackson.annotation.JsonFormat
import com.flightfeather.uav.domain.entity.GridData
import com.flightfeather.uav.domain.entity.GridDataDetail
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService
import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
@@ -21,15 +23,19 @@
@Api(tags = ["卫星遥测API接口"])
@RestController
@RequestMapping("air/satellite")
class SatelliteTelemetryController(private val satelliteTelemetryService: SatelliteTelemetryService) {
class SatelliteTelemetryController(
    private val satelliteTelemetryService: SatelliteTelemetryService,
    private val satelliteDataCalculateService: SatelliteDataCalculateService,
) {
    @ApiOperation(value = "获取网格组信息")
    @PostMapping("/grid/group")
    fun fetchGridGroup(
        @RequestBody areaVo: AreaVo,
        @RequestParam(required = false) type: String?,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, page, perPage) }
        @RequestParam("per_page", required = false) perPage: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, type, page, perPage) }
    @ApiOperation(value = "获取网格组内具体网格信息")
    @GetMapping("/grid/cell")
@@ -43,8 +49,21 @@
        @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?,
        @ApiParam("遥测数据类型", allowableValues = "0:原始卫星遥测数据;1:融合数据")
        @RequestParam(required = false) type: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridData(groupId, dataTime, type) }
    @ApiOperation(value = "获取网格组下的卫星遥测数据")
    @PostMapping("/grid/data2")
    fun fetchGridData2(
        @ApiParam("网格数据") @RequestBody gridData: GridData,
    ) = resPack { satelliteTelemetryService.fetchGridData(gridData) }
    @ApiOperation(value = "删除网格数据")
    @DeleteMapping("/grid/data/delete")
    fun deleteGridData(
        @ApiParam("数据id") @RequestParam dataId: Int,
    ) = resPack { satelliteTelemetryService.deleteGridData(dataId) }
    @ApiOperation(value = "获取网格组下的卫星遥测具体数据")
    @GetMapping("/grid/data/detail")
@@ -54,11 +73,24 @@
        @ApiParam("网格单元格id") @RequestParam(required = false) cellId: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) }
    @ApiOperation(value = "保存拟合生成的卫星遥测PM2.5结果数据")
    @PostMapping("/grid/data/create")
    fun createGridDataAndDataDetail(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
        @RequestBody gridDataDetail: List<GridDataDetail>,
    ) = resPack {
        satelliteTelemetryService.createGridDataAndDataDetail(groupId, dateTime, gridDataDetail)
    }
    @ApiOperation(value = "多次走航数据进行融合计算")
    @PostMapping("/grid/data/mix")
    fun mixGridData(
        @ApiParam("原始数据id数组") @RequestBody dataIdList: List<Int>
        @ApiParam("原始数据id数组") @RequestBody dataIdList: List<Int>,
    ) = resPack { satelliteTelemetryService.mixGridData(dataIdList) }
    @ApiOperation(value = "导入卫星遥测PM2.5结果数据")
    @PostMapping("/import/grid/data")
@@ -74,15 +106,8 @@
    @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) }
    fun downloadTemplate(@ApiIgnore response: HttpServletResponse) =
        satelliteTelemetryService.downloadTemplate(response)
    @ApiOperation(value = "导入卫星遥测Aod结果数据")
    @PostMapping("/import/grid/aod")
@@ -98,5 +123,57 @@
    @ApiOperation(value = "下载卫星遥测Aod结果数据导入模板")
    @GetMapping("/import/grid/aod/download/template")
    fun downloadAODTemplate(@ApiIgnore response: HttpServletResponse) = satelliteTelemetryService.downloadAODTemplate(response)
    fun downloadAODTemplate(@ApiIgnore response: HttpServletResponse) =
        satelliteTelemetryService.downloadAODTemplate(response)
    /**AOD数据相关**************************************************************/
    @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数据")
//    @GetMapping("/aod/data")
//    fun fetchGridAOD(
//        @ApiParam("网格组id") @RequestParam groupId: Int,
//        @ApiParam("AOD数据时间")
//        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
//    ) = resPack { satelliteTelemetryService.fetchGridAOD(groupId, dataTime) }
    @ApiOperation(value = "获取网格组下的卫星遥测AOD具体数据")
    @GetMapping("/aod/data/detail")
    fun fetchGridAODDetail(
        @ApiParam("AOD数据id") @RequestParam aodId: Int,
        @ApiParam("网格组id") @RequestParam(required = false) groupId: Int?,
        @ApiParam("网格单元格id") @RequestParam(required = false) cellId: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridAODDetail(aodId, groupId, cellId) }
    /**遥测产品制作相关**************************************************************/
    @ApiOperation(value = "生成走航融合产品")
    @PostMapping("/product/underway/build")
    fun buildUnderwayProduct(
//        @ApiParam("走航任务编号") @RequestParam missionCode: String,
//        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("网格数据") @RequestBody gridData: GridData,
    ) = resPack { satelliteDataCalculateService.dataFusion(gridData) }
    @ApiOperation(value = "进行走航融合产品的融合分析")
    @PostMapping("/product/underway/mix")
    fun mixGridData(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("需要融合的数据id") @RequestBody dataIdList: List<Int>,
    ) = resPack { satelliteDataCalculateService.mixUnderwayGridData(groupId, dataIdList) }
    @ApiOperation(value = "生成走航热力图")
    @PostMapping("/product/underway/heatmap/build")
    fun buildUnderwayHeatmap(
        @ApiParam("使用的网格组id") @RequestParam groupId: Int,
        @ApiParam("搜索网格距离") @RequestParam searchLength: Int,
        @ApiParam("使用的走航网格数据") @RequestBody gridDataDetailList: List<GridDataDetail>,
    ) = resPack { satelliteDataCalculateService.buildHeatmap(groupId, gridDataDetailList, searchLength) }
}