feiyu02
2025-07-04 9c797fa0d704ef8ffb65cd1716b8eb694b4c46c3
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
package com.flightfeather.uav.lightshare.web
 
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
@RequestMapping("air/realtime")
class RealTimeDataController(val realTimeDataService: RealTimeDataService) {
 
    @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?,
        @RequestParam(value = "page", required = false) page: Int?,
        @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?,
    ) = realTimeDataService.getNextData(deviceCode, updateTime, page, perPage)
 
    @PostMapping("/import")
    fun importData(
        @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)
 
    @ApiOperation(value = "获取按照路段分割的走航数据")
    @GetMapping("/sec/segment")
    fun getSegmentData(
        @ApiParam("任务id") @RequestParam("missionCode") missionCode: String,
    ) = resPack { realTimeDataService.getSegmentData(missionCode) }
}