feiyu02
2025-05-08 9a9a27f185bc0cf9dc0001cfc6839e6d13dbccd9
src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt
@@ -6,6 +6,8 @@
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
@Api(tags = ["走航监测数据API接口"])
@RestController
@@ -14,30 +16,43 @@
    @GetMapping("/sec")
    fun getSecondData(
        @RequestParam(value = "deviceType", required = false) deviceType: String?,
        @RequestParam(value = "deviceCode", required = false) deviceCode: String?,
        @RequestParam(value = "startTime", required = false) startTime: String?,
        @RequestParam(value = "endTime", required = false) endTime: String?,
        @ApiParam(value = "0: 秒级值; 1:分钟值", defaultValue = "0") @RequestParam(value = "type", required = false) type: Int?,
        @ApiParam(value = "0: 秒级值; 1:分钟值", defaultValue = "0") @RequestParam(value = "type",
            required = false) type: Int?,
        @RequestParam(value = "page", required = false) page: Int?,
        @RequestParam(value = "perPage", required = false) perPage: Int?
    ) = realTimeDataService.getSecondData(deviceCode, startTime, endTime, type, page, perPage)
        @RequestParam(value = "perPage", required = false) perPage: Int?,
    ) = realTimeDataService.getSecondData(deviceType, deviceCode, startTime, endTime, type, page, perPage)
    @GetMapping("/sec/next")
    fun getNextData(
        @RequestParam(value = "deviceCode") deviceCode: String,
        @RequestParam(value = "updateTime") updateTime: String,
        @RequestParam(value = "page", required = false) page: Int?,
        @RequestParam(value = "perPage", required = false) perPage: Int?
        @RequestParam(value = "perPage", required = false) perPage: Int?,
    ) = realTimeDataService.getNextData(deviceCode, updateTime, page, perPage)
    @PostMapping("/import")
    fun importData(
        @RequestPart("excel") file: MultipartFile
        @RequestPart("excel") file: MultipartFile,
    ) = realTimeDataService.importData(file)
    @ApiOperation(value = "导入静安区生态环境监测站的走行数据")
    @ApiOperation(value = "导入静安区生态环境监测站的走航数据")
    @PostMapping("/import/jinan")
    fun importJinanData(
        @RequestPart("excel") file: MultipartFile
    ) = realTimeDataService.importJinanData(file)
        @ApiParam("设备id") @RequestParam("code") code: String,
        @RequestPart("excel") file: MultipartFile,
    ) = resPack { realTimeDataService.importJinanData(code, file) }
    @ApiOperation(value = "下载静安区生态环境监测站走行数据导入模板")
    @PostMapping("/import/jinan/download/template")
    fun downloadTemplate(@ApiIgnore response: HttpServletResponse) = realTimeDataService.downloadTemplate(response)
    @ApiOperation(value = "获取按照路段分割的走航数据")
    @GetMapping("/sec/segment")
    fun getSegmentData(
        @ApiParam("任务id") @RequestParam("missionCode") missionCode: String,
    ) = resPack { realTimeDataService.getSegmentData(missionCode) }
}