package com.ruoyi.web.controller.common;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ss.order.service.IOrderService;
import com.ruoyi.system.domain.query.IndexChartQuery;
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;

/**
 * pc后台仪表盘
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/system/admin")
public class DashboardController extends BaseController {

    @Resource
    private IOrderService orderService;

    /**
     * 后台首页统计
     */
    @GetMapping(value = {  "/dashboard" })
    public AjaxResult adminIndex()
    {
        logger.info("【后台首页统计/dashboard】参数");
        return success(orderService.adminIndexStatistics());
    }

    /**
     * 后台首页图表数据
     */
    @GetMapping(value = {  "/dashboard/chart" })
    public AjaxResult dashboardChart(IndexChartQuery query)
    {
        logger.info("【后台首页图表数据/dashboard/chart】参数:{}", JSON.toJSONString(query));
        return success(orderService.adminIndexChartData(query));
    }



}
