package com.ruoyi.web.controller.tool;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.utils.R;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.dto.SiteRealTimeDTO;
import com.ruoyi.system.service.ReportDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * Create By Spring-2022/10/29
 */
@RestController
@RequestMapping(value = "/reportData")
@Api(tags = {"数据查询"})
@Slf4j
@Anonymous
public class ReportDataController {

    @Resource
    ReportDataService reportDataService;

    //小车位置
    @GetMapping(value = "/carLocation")
    @ApiOperation("获取小车实时位置")
    public R<List<CarPosition>> carLocation(Long siteId , String startTime, String endTime)  {
        return R.ok(reportDataService.carLocation(siteId, startTime, endTime ));
    }

    //小车信息
    @GetMapping(value = "/carInfo")
    @ApiOperation("获取小车实时信息")
    public R<List<HeartBeat>> carInfo(Long siteId, String startTime, String endTime)  {
        return R.ok(reportDataService.carInfo(siteId, startTime, endTime));
    }

    //站点实时信息
    @GetMapping(value = "/siteRealTime")
    @ApiOperation("获取站点实时信息")
    public R<SiteRealTimeDTO> siteRealTime(Long siteId)  {
        return R.ok(reportDataService.siteRealTime(siteId));
    }
    //即时信息
    @GetMapping(value = "/taskNotice")
    @ApiOperation("获取任务通知（及时消息）")
    public R<Page<TaskNotice>> taskNotice(Long siteId,String taskId, Long page, Long size)  {
        return R.ok(reportDataService.taskNotice(siteId,taskId,page,size));
    }
    //当前水位
    @GetMapping(value = "/getWaterLevel")
    @ApiOperation("获取实时水位")
    public R<WaterLevel> getWaterLevel(Long siteId)  {
        return R.ok(reportDataService.getWaterLevel(siteId));
    }

    //垂线点对应流量图
    @GetMapping(value = "/getMeasureLine")
    @ApiOperation("获取垂线点对应流量图")
    public R<List<MeasureUpload>> getMeasureLine(Long siteId, String taskId)  {
        return R.ok(reportDataService.getMeasureLine(siteId,taskId));
    }

    //垂线点对应流量图
    @GetMapping(value = "/getPointConfig")
    @ApiOperation("获取最后一次任务的停泊点信息")
    public R<BerthingPointConfig> getPointConfig(Long siteId)  {
        return R.ok(reportDataService.getPointConfig(siteId));
    }

    //获取最后一次任务详情
    @GetMapping(value = "/getLatestTask")
    @ApiOperation("获取最后一次任务详情")
    public R<TaskResult> getLatestTask(Long siteId)  {
        return R.ok(reportDataService.getLatestTask(siteId));
    }

    //垂线点对应流量图
    @GetMapping(value = "/getPointConfigByPlanid")
    @ApiOperation("通过策略编号获取停泊点信息")
    public R<BerthingPointConfig> getPointConfig(Long siteId, Long planid)  {
        return R.ok(reportDataService.getPointConfig(siteId, planid));
    }

}
