package com.ruoyi.web.controller.mch;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dashboard.domain.dto.BusinessStatisticsQuery;
import com.ruoyi.dashboard.service.DashboardService;
import io.swagger.annotations.ApiOperation;
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.RestController;

/**
 * @author wjh
 * 2024/10/8
 */
@RestController
@RequestMapping("/mch/dashboard")
public class MchDashboardController extends BaseController {

    @Autowired
    private DashboardService dashboardService;

    @ApiOperation("商户获取店铺维度的订单统计")
    @GetMapping("/businessStatisticsByStore")
    public AjaxResult businessStatisticsByStore(BusinessStatisticsQuery query) {
        query.setMchId(getUserId());
        return success(dashboardService.businessStatisticsByStore(query));
    }

    @ApiOperation("商户获取指定店铺的订单统计")
    @GetMapping("/businessStatisticsByDevice")
    public AjaxResult businessStatisticsByDevice(BusinessStatisticsQuery query) {
        query.setMchId(getUserId());
        return success(dashboardService.businessStatisticsByDevice(query));
    }

}
