package com.ruoyi.api;

import com.ruoyi.ai.domain.AiRecharge;
import com.ruoyi.ai.service.IAiRechargeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 充值管理Controller
 * 
 * @author shi
 * @date 2025-11-13
 */
@Api(tags = "ai-充值管理")
@RestController
@RequestMapping("/api/recharge")
public class AiRechargeApiController extends BaseController
{
    @Autowired
    private IAiRechargeService aiRechargeService;



    /**
     * 查询充值管理列表
     */
    @ApiOperation("充值记录")
    @GetMapping("/getAiRechargeList")
    public TableDataInfo getAiRechargeList(AiRecharge aiRecharge)
    {
        aiRecharge.setUserId(SecurityUtils.getAiUserId());
        startPage();
        List<AiRecharge> list = aiRechargeService.getAiRechargeList(aiRecharge);
        BigDecimal totalAmount = aiRechargeService.getTotalAmount(aiRecharge);
        TableDataInfo dataTable = getDataTable(list);
        Map<String, Object> map = new HashMap<>();
        map.put("totalAmount", totalAmount);
        dataTable.setParam(map);
        return dataTable;
    }


}
