package com.bonus.canteen.core.report.controller;

import com.bonus.canteen.core.order.domain.OrderDetail;
import com.bonus.canteen.core.order.service.IOrderDetailService;
import com.bonus.canteen.core.report.domain.*;
import com.bonus.canteen.core.report.service.TradeReportService;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 交易报表
 * 
 * @author ruoyi
 * @date 2025-04-14
 */
@Controller
@RequestMapping("/report/trade")
public class TradeReportController extends BaseController
{
    @Autowired
    private TradeReportService tradeReportService;
    @ApiOperation("交易流水")
    @PostMapping("/flow")
    @ResponseBody
    public TableDataInfo tradeFlowList(@RequestBody TradeFlowParam param)
    {
        startPage();
        List<TradeFlowVO> list = tradeReportService.selectTradeFlow(param);
        return getDataTable(list);
    }
    @ApiOperation("营业汇总")
    @PostMapping("/revenue/operating")
    @ResponseBody
    public TableDataInfo selectOperatingRevenue(@RequestBody OperatingRevenueParam param)
    {
        startPage();
        List<OperatingRevenueVO> list = tradeReportService.selectOperatingRevenue(param);
        return getDataTable(list);
    }
    @ApiOperation("食堂档口汇总")
    @PostMapping("/revenue/canteen")
    @ResponseBody
    public TableDataInfo selectCanteenStallRevenue(@RequestBody CanteenStallRevenueParam param)
    {
        startPage();
        List<CanteenStallRevenueVO> list = tradeReportService.selectCanteenStallRevenue(param);
        return getDataTable(list);
    }
    @ApiOperation("设备汇总")
    @PostMapping("/revenue/device")
    @ResponseBody
    public TableDataInfo selectDeviceRevenue(@RequestBody DeviceRevenueParam param)
    {
        startPage();
        List<DeviceRevenueVO> list = tradeReportService.selectDeviceRevenue(param);
        return getDataTable(list);
    }
    @ApiOperation("个人消费汇总")
    @PostMapping("/revenue/user")
    @ResponseBody
    public TableDataInfo selectUserRevenue(@RequestBody UserRevenueParam param)
    {
        startPage();
        List<UserRevenueVO> list = tradeReportService.selectUserRevenue(param);
        return getDataTable(list);
    }
    @ApiOperation("菜品销售汇总")
    @PostMapping("/revenue/goods")
    @ResponseBody
    public TableDataInfo selectGoodsRevenue(@RequestBody GoodsRevenueParam param)
    {
        startPage();
        List<GoodsRevenueVO> list = tradeReportService.selectGoodsRevenue(param);
        return getDataTable(list);
    }
}
