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

import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
import com.bonus.canteen.core.report.domain.*;
import com.bonus.canteen.core.report.service.AccReportService;
import com.bonus.canteen.core.report.service.TradeReportService;
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 io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 交易报表
 * 
 * @author ruoyi
 * @date 2025-04-14
 */
@Controller
@RequestMapping("/report/acc")
public class AccReportController extends BaseController
{
    @Autowired
    private AccReportService accReportService;

    @ApiOperation("查询交易流水")
    @PostMapping("/balance")
    @ResponseBody
    public TableDataInfo balanceList(@RequestBody AccountInfoQueryParam accountInfoQueryParam)
    {
        startPage();
        List<AccInfoDetailsVO> list = accReportService.balanceList(accountInfoQueryParam);
        return getDataTable(list);
    }

//    @ApiOperation("账户余额汇总")
//    @PostMapping({"/balance/sum"})
//    public AjaxResult queryAccInfoBalanceSum(@RequestBody AccountInfoQueryParam accountInfoQueryParam) {
//        return AjaxResult.success(this.accReportService.balanceListSum(accountInfoQueryParam));
//    }
    @ApiOperation("充值方式汇总")
    @PostMapping("/recharge")
    @ResponseBody
    public TableDataInfo rechargeCount(@RequestBody RechargeRecordParam param)
    {
        startPage();
        List<RechargeRecordVO> list = accReportService.rechargeCount(param);
        return getDataTable(list);
    }

    @ApiOperation("取款汇总")
    @PostMapping("/withdraw")
    @ResponseBody
    public TableDataInfo withdrawCount(@RequestBody WithdrawRecordParam param)
    {
        startPage();
        List<WithdrawRecordVO> list = accReportService.selectWithdrawRecord(param);
        return getDataTable(list);
    }

    @ApiOperation("组织收支汇总")
    @PostMapping("/dept/income-outcome")
    @ResponseBody
    public TableDataInfo deptIncomeOutcome(@RequestBody DeptIncomeOutcomeParam param)
    {
        startPage();
        List<DeptIncomeOutcomeVO> list = accReportService.selectDeptIncomeOutcome(param);
        return getDataTable(list);
    }

    @ApiOperation("个人收支汇总")
    @PostMapping("/user/income-outcome")
    @ResponseBody
    public TableDataInfo userIncomeOutcome(@RequestBody UserIncomeOutcomeParam param)
    {
        startPage();
        List<UserIncomeOutcomeVO> list = accReportService.selectUserIncomeOutcome(param);
        return getDataTable(list);
    }
}
