package com.ruoyi.web.modules.trading.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.modules.trading.service.IAppSupplierHomeService;

/**
 * 供应商小程序首页统计。
 */
@RestController
@RequestMapping("/app/supplier/home")
public class BizAppSupplierHomeController extends BaseController
{
    @Autowired
    private IAppSupplierHomeService appSupplierHomeService;

    /**
     * 首页看板：交易/结算汇总、交易金额趋势、实时牦牛状态。
     *
     * @param range TODAY | YESTERDAY | DAYS_7 | DAYS_30，默认 TODAY（对应界面「实时/今日」）
     */
    @GetMapping("/dashboard")
    public AjaxResult dashboard(@RequestParam(value = "range", defaultValue = "TODAY") String range)
    {
        return success(appSupplierHomeService.loadDashboard(range));
    }
}
