package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.common.controller.IController;
import com.kym.entity.queryParams.StatQueryParam;
import com.kym.service.StatService;
import org.springframework.web.bind.annotation.*;


/**
 * 统计数据
 *
 * @author skyline
 */
@RestController
@RequestMapping("/stat")
public class StatController extends IController {

    private final StatService statService;

    public StatController(StatService statService) {
        this.statService = statService;
    }

    /**
     * 站点今日概要
     *
     * @param stationId
     * @return
     */
    @GetMapping("/dashboard")
    public R<?> dashboard(@RequestParam String stationId) {
        return R.success(statService.dashboard(stationId));
    }


    /**
     * 站点设备状态
     *
     * @param stationId
     * @return
     */
    @GetMapping("/washDeviceStatus")
    public R<?> washDeviceStatus(@RequestParam String stationId) {
        return R.success(statService.washDeviceStatus(stationId));
    }

    /**
     * 站点趋势数据
     *
     * @param params
     * @return
     */
    @PostMapping("/trend")
    public R<?> trend(@ModelAttribute StatQueryParam params) {
        return R.success(statService.trend(params));
    }

}
