feiyu02
2024-02-02 83455446544f89b0663a3f520744331ad8259289
src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt
@@ -2,8 +2,12 @@
import com.flightfeather.uav.lightshare.service.RealTimeDataService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
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
@@ -15,20 +19,33 @@
        @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?,
        @RequestParam(value = "page", required = false) page: Int?,
        @RequestParam(value = "perPage", required = false) perPage: Int?
    ) = realTimeDataService.getSecondData(deviceCode, startTime, endTime, page, perPage)
        @RequestParam(value = "perPage", required = false) perPage: Int?,
    ) = realTimeDataService.getSecondData(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 = "导入静安区生态环境监测站的走行数据")
    @PostMapping("/import/jinan")
    fun importJinanData(
        @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)
}