package com.zksy.web.controller.base.pressure;

import com.zksy.base.pressure.service.FirefightingPressureService;
import com.zksy.common.annotation.Anonymous;
import com.zksy.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@Api(tags = "消防压力设备数据")
@RestController
@RequestMapping("/api/pressure")
@Anonymous
public class FirefightingPressureController {

    @Autowired
    private FirefightingPressureService firefightingPressureService;

    /**
     * 获取某时间段的平均压力
     */
    @GetMapping("/visualization/average")
    @ApiOperation(value = "获取某时间段的平均压力")
    public AjaxResult getAveragePressure(@RequestParam String startTime, @RequestParam String endTime) {
        return AjaxResult.success(firefightingPressureService.getAveragePressure(startTime, endTime));
    }

    /**
     * 按天统计最大、最小、平均值
     */
    @GetMapping("/visualization/daily-stats")
    @ApiOperation(value = "按天统计最大、最小、平均值")
    public AjaxResult getDailyStats(@RequestParam String startTime,@RequestParam String endTime) {
        return AjaxResult.success(firefightingPressureService.getDailyStats(startTime, endTime));
    }

    /**
     * 统计各类报警次数
     */
    @GetMapping("/visualization/alarm-counts")
    @ApiOperation(value = "统计各类报警次数")
    public AjaxResult getAlarmCounts(@RequestParam String startTime, @RequestParam String endTime) {
        return AjaxResult.success(firefightingPressureService.getAlarmCounts(startTime, endTime));
    }

    /**
     * 压力地理分布
     */
    @GetMapping("/visualization/distribution")
    @ApiOperation(value = "压力地理分布")
    public AjaxResult getPressureDistribution(@RequestParam String startTime, @RequestParam String endTime) {
        return AjaxResult.success(firefightingPressureService.getPressureDistribution(startTime, endTime));
    }

    /**
     * GPRS信号与压力稳定性分析
     */
    @GetMapping("/visualization/signal-vs-pressure")
    @ApiOperation(value = "GPRS信号 pressuresability")
    public AjaxResult getSignalVsPressure(@RequestParam String startTime, @RequestParam String endTime) {
        return AjaxResult.success(firefightingPressureService.getSignalVsPressure(startTime, endTime));
    }
    //根据设备分组查询
    @GetMapping("/visualization/device-group")
    @ApiOperation(value = "根据设备分组查询")
    public AjaxResult getDeviceGroup() {
        return AjaxResult.success(firefightingPressureService.getDeviceGroup());
    }
}
