package com.cico.nest.lcdp.boot.core.qxsd.adapter.web;

import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.ReportCarTypeFlowVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.TableStatsReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.StatisticalReportsService;
import com.cico.nest.lcdp.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 统计报表
 * @author zws
 * @date 2024/10/28
 */

@Tag(name = "管理后台 - 数据统计")
@RestController
@RequestMapping("/qxsd/report")
public class StatisticalReportsController {

    @Resource
    private StatisticalReportsService statisticalReportsService;

    /**
     * 通行车次统计
     * @param tableStatsReqVO
     * @return
     */
    @PostMapping("/carTypeFlow")
    @Operation(summary = "通行车次统计")
    CommonResult<List<ReportCarTypeFlowVO>> carTypeFlow(@RequestBody TableStatsReqVO tableStatsReqVO){
        return CommonResult.success(statisticalReportsService.carTypeFlow(tableStatsReqVO));
    }

    /**
     * 通行流量趋势
     * @param tableStatsReqVO
     * @return
     */
    @PostMapping("/carTypeFlowDay")
    @Operation(summary = "通行流量趋势")
    CommonResult<List<Map<String,Object>>> carTypeFlowDay(@RequestBody TableStatsReqVO tableStatsReqVO){
        return CommonResult.success(statisticalReportsService.carTypeFlowDay(tableStatsReqVO));
    }

    /**
     * 24小时流量趋势
     * @param tableStatsReqVO
     * @return
     */
    @PostMapping("/carTypeFlowHour")
    @Operation(summary = "24小时流量趋势")
    CommonResult<List<Map<String,Object>>> carTypeFlowHour(@RequestBody TableStatsReqVO tableStatsReqVO){
        return CommonResult.success(statisticalReportsService.carTypeFlowHour(tableStatsReqVO));
    }

    /**
     * 24小时时速趋势
     * @param tableStatsReqVO
     * @return
     */
    @PostMapping("/carTypeSpeedTrend")
    @Operation(summary = "24小时时速趋势")
    CommonResult<List<Map<String,Object>>> carTypeSpeedTrend(@RequestBody TableStatsReqVO tableStatsReqVO){
        return CommonResult.success(statisticalReportsService.carTypeSpeedTrend(tableStatsReqVO));
    }

}
