package com.ruoyi.web.controller.statistics;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.loan.LoanApplication;
import com.ruoyi.system.domain.review.ReviewComments;
import com.ruoyi.system.service.statistics.IStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 首页统计
 * @Author: tjf
 * @Date: 2024/5/7 14:27
 * @Describe:
 */
@RestController
@RequestMapping("/statistics")
public class StatisticsController extends BaseController {
    @Autowired
    private IStatisticsService statisticsService;

    /**
     * 后台首页统计
     */
    @PreAuthorize("@ss.hasPermi('system:statistics:loan')")
    @PostMapping("/loan")
    public AjaxResult loan(@RequestBody LoanApplication loanApplication) {
        AjaxResult loan = statisticsService.loan(loanApplication);
        return loan;
    }

    /**
     * 后台首页统计本月数据
     */
    @PreAuthorize("@ss.hasPermi('system:statistics:loanMonth')")
    @PostMapping("/loanMonth")
    public AjaxResult loanMonth(@RequestBody LoanApplication loanApplication) {
        AjaxResult loanMonth = statisticsService.loanMonth(loanApplication);
        return loanMonth;
    }

    /**
     * 后台首页统计季度数据
     */
    @PreAuthorize("@ss.hasPermi('system:statistics:loanQuarter')")
    @PostMapping("/loanQuarter")
    public AjaxResult loanQuarter(@RequestBody LoanApplication loanApplication) {
        AjaxResult loanMonth = statisticsService.loanQuarter(loanApplication);
        return loanMonth;
    }
}
