package com.hz.pm.api.dashboard.controller;

import com.hz.pm.api.dashboard.manage.*;
import com.hz.pm.api.dashboard.model.vo.*;
import com.ningdatech.log.annotation.DataScopeQueryCheck;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZPF
 * @date 2023/11/25 上午10:36
 */
@RestController
@RequestMapping("/api/v1/statistics")
@Validated
@RequiredArgsConstructor
@Api(value = "StatisticsController", tags = "统计")
public class StatisticsController {

    private final FundStatisticsManage fundStatisticsManage;

    private final ExpertStatisticsManage expertStatisticsManage;

    private final MeetingStatisticsManage meetingStatisticsManage;

    private final ProjectCostStatisticsManage costStatisticsManage;

    private final EarlyWarningStatisticsManage earlyWarningStatisticsManage;

    private final PerformanceStatisticsManage performanceStatisticsManage;

    private final ProjectStatisticsManage projectStatisticsManage;

    @DataScopeQueryCheck
    @GetMapping("/fund")
    @ApiOperation("项目资金统计")
    public FundStatisticsVO fund(@RequestParam(required = false) Integer year) {
        return fundStatisticsManage.statistics(year);
    }

    @DataScopeQueryCheck
    @GetMapping("/expert")
    @ApiOperation("专家统计")
    public ExpertStatisticsVO expert(@RequestParam(required = false) Integer year) {
        return expertStatisticsManage.statistics(year);
    }

    @DataScopeQueryCheck
    @GetMapping("/meeting")
    @ApiOperation("评审会议统计")
    public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) {
        return meetingStatisticsManage.statistics(year);
    }

    @DataScopeQueryCheck
    @GetMapping("/project-cost")
    @ApiOperation("项目成本统计")
    public CostStatisticsVO projectCost() {
        return costStatisticsManage.statistics();
    }

    @DataScopeQueryCheck
    @GetMapping("/early-warning")
    @ApiOperation("预警统计")
    public EarlyWarningStatisticsVO earlyWarning(@RequestParam(required = false) Integer year) {
        return earlyWarningStatisticsManage.statistics(year);
    }

    @DataScopeQueryCheck
    @GetMapping("/performance")
    @ApiOperation("绩效统计")
    public PerformanceStatisticsVO performance(@RequestParam(required = false) Integer year) {
        return performanceStatisticsManage.statistics(year);
    }

    @DataScopeQueryCheck
    @GetMapping("/project")
    @ApiOperation("项目统计")
    public ProjectStatisticsVO project(@RequestParam(required = false) Integer year) {
        return projectStatisticsManage.statistics(year);
    }
}
