package com.fjhx.account.controller.account;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.account.entity.account.po.AccountRunningWater;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
import com.fjhx.account.entity.account.dto.AccountRunningWaterSelectDto;
import com.fjhx.account.entity.account.dto.AccountRunningWaterDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.account.service.account.AccountRunningWaterService;
import org.springframework.beans.factory.annotation.Autowired;

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


/**
 * <p>
 * 账户资金流水表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-06
 */
@DS(SourceConstant.ACCOUNT)
@RestController
@RequestMapping("/accountRunningWater")
public class AccountRunningWaterController {

    @Autowired
    private AccountRunningWaterService accountRunningWaterService;

    /**
     * 账户资金流水表分页
     */
    @PostMapping("/page")
    public Page<AccountRunningWaterVo> page(@RequestBody AccountRunningWaterSelectDto dto) {
        return accountRunningWaterService.getPage(dto);
    }

    /**
     * 账户资金流水表明细
     */
    @PostMapping("/detail")
    public AccountRunningWaterVo detail(@RequestBody BaseSelectDto dto) {
        return accountRunningWaterService.detail(dto.getId());
    }

    /**
     * 账户资金流水表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody AccountRunningWaterDto accountRunningWaterDto) {
        accountRunningWaterService.add(accountRunningWaterDto);
    }

    /**
     * 账户资金流水表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AccountRunningWater accountRunningWaterDto) {
        accountRunningWaterService.edit(accountRunningWaterDto);
    }

    /**
     * 账户资金流水表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        accountRunningWaterService.delete(dto.getId());
    }

    /**
     * 到账认领统计
     */
    @PostMapping("/claimStatistics")
    public List<AccountRunningWater> claimStatistics(@RequestBody BaseSelectDto dto) {
        return accountRunningWaterService.claimStatistics(dto);
    }

    /**
     * 账户资金流水表导出excel
     */
    @PostMapping("/exportExcel")
    public void exportExcel(@RequestBody AccountRunningWaterSelectDto dto,HttpServletResponse httpServletResponse) {
        accountRunningWaterService.exportExcel(dto,httpServletResponse);
    }

}
