package com.njzscloud.supervisory.bs.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.supervisory.bs.service.StatisticsService;
import com.njzscloud.supervisory.bs.service.SupervisionStatisticsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 大屏
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/statistics")
@RequiredArgsConstructor
public class StatisticsController {
    private final StatisticsService statisticsService;
    private final SupervisionStatisticsService supervisionStatisticsService;


    @GetMapping("/obtain_data")
    public R<?> obtainData() throws Exception {
        Map<String, Object> data = statisticsService.obtainData();
        return R.success(data);
    }

    @GetMapping("/obtain_order")
    public R<?> obtainOrder(Long userId) {
        return R.success(statisticsService.obtainOrder(userId));
    }


    /**
     * 业务统计大屏
     */
    @GetMapping("/biz")
    public R<?> biz() {
        return R.success(statisticsService.biz());
    }

    /**
     * 车辆监管
     */
    @GetMapping("/supervision/obtain_data")
    public R<?> obtainData1() {
        Map<String, Object> data = supervisionStatisticsService.obtainData();
        return R.success(data);
    }

    /**
     * 首页
     */
    @GetMapping("/first_page")
    public R<Map<String, Object>> firstPage(@RequestParam(value = "trendStatisticsType", required = false, defaultValue = "1") Integer trendStatisticsType) {
        return R.success(supervisionStatisticsService.firstPage(trendStatisticsType));
    }

}
