package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.entity.admin.queryParams.StatQueryParam;
import com.kym.service.miniapp.ChargeOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author skyline
 * @description 统计数据
 * @date 2023-09-02 09:44
 */
@RestController
@RequestMapping("/stat")
public class StatController {

    private final ChargeOrderService chargeOrderService;

    public StatController(ChargeOrderService chargeOrderService) {
        this.chargeOrderService = chargeOrderService;
    }

    /**
     * 站点充电数据-日/月
     *
     * @param params
     * @return
     */
    @GetMapping("/stationStat")
    R stationStat(@ModelAttribute StatQueryParam params) {
        var res = chargeOrderService.stationStat(params);
        return R.success(res);
    }

    /**
     * 站点实时数据
     *
     * @return
     */
    @GetMapping("/stationTodayStat")
    R stationTodayStat() {
        var res = chargeOrderService.stationTodayStat();
        return R.success(res);
    }
}
