feiyu02
13 小时以前 4a976d3763be8a7bed743faf24abf2718ae18e31
src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
@@ -1,8 +1,11 @@
package com.flightfeather.uav.lightshare.web
import com.fasterxml.jackson.annotation.JsonFormat
import com.flightfeather.uav.common.exception.BizException
import com.flightfeather.uav.lightshare.bean.AnalysisOption
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.DataAnalysisService
import com.flightfeather.uav.socket.eunm.FactorType
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
@@ -56,6 +59,12 @@
        )
    }
    @ApiOperation(value = "生成走航任务汇总统计")
    @GetMapping("/report/missionSummary/one")
    fun generateOneMissionSummary(
        @ApiParam("任务编号") @RequestParam missionCode: String,
    ) = resPack { dataAnalysisService.generateMissionSummary(missionCode) }
    @ApiOperation(value = "生成走航任务清单")
    @PostMapping("/report/missionList")
    fun generateMissionList(
@@ -87,18 +96,53 @@
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        endTime: LocalDateTime,
        @ApiParam("数据颗粒度", allowableValues = "SECOND, MINUTE, HOUR") @RequestParam(required = false)
        granularity: String?,
        @ApiParam("区域") @RequestBody areaVo: AreaVo,
    ) = resPack {
        dataAnalysisService.generateMissionDetail(
            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
            areaVo
            areaVo,granularity
        )
    }
    @ApiOperation(value = "生成走航任务详情")
    @GetMapping("/report/missionDetail/one")
    fun generateOneMissionDetail(
        @ApiParam("任务编号") @RequestParam missionCode: String,
        @ApiParam("数据颗粒度", allowableValues = "SECOND, MINUTE, HOUR") @RequestParam(required = false)
        granularity: String?,
    ) = resPack { dataAnalysisService.generateMissionDetail(missionCode, granularity) }
    @ApiOperation(value = "走航典型隐患区域统计")
    @PostMapping("/report/clueByRiskArea")
    fun generateClueByRiskArea(
        @ApiParam("区域") @RequestBody analysisOption: AnalysisOption,
    ) = resPack {
        if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null)
            throw BizException("参数错误, startTime, endTime, areaVo不能为空")
        val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
        val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
        val areaVo = analysisOption.area!!
        dataAnalysisService.generateClueByRiskArea(
            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
            areaVo,
            analysisOption.removeOtherDistrict,
            analysisOption.removeNoPollutedSource
        )
    }
    @ApiOperation(value = "走航典型隐患区域统计")
    @GetMapping("/report/clueByRiskArea/one")
    fun generateOneClueByRiskArea(
        @ApiParam("任务编号") @RequestParam missionCode: String,
    ) = resPack { dataAnalysisService.generateClueByRiskArea(missionCode) }
    @ApiOperation(value = "叠加融合分析")
    @PostMapping("/report/gridFusion")
    fun generateGridFusion(
        @ApiParam("开始时间") @RequestParam
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -107,9 +151,12 @@
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        endTime: LocalDateTime,
        @ApiParam("需要统计的监测因子", example = "NO2, CO") @RequestParam
        factorTypes: String,
        @ApiParam("区域") @RequestBody areaVo: AreaVo,
    ) = resPack {
        dataAnalysisService.generateClueByRiskArea(
        dataAnalysisService.generateGridFusion(
            factorTypes.split(",").map { FactorType.valueOf(it) },
            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
            areaVo