package com.ruoyi.oa.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.oa.domain.vo.SalaryDashboardVo;
import com.ruoyi.oa.domain.vo.dashboard.NewSalaryDashboardVo;
import com.ruoyi.oa.service.ISalaryDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * 工资数据看板控制器
 */
@RestController
@RequestMapping("/oa/salary/dashboard")
public class SalaryDashboardController extends BaseController {

    @Autowired
    private ISalaryDashboardService salaryDashboardService;

    /**
     * 获取原有工资数据看板数据
     */
    @GetMapping
    public R<SalaryDashboardVo> getDashboardData(
            @RequestParam(required = true) Long payYear,
            @RequestParam(required = true) Long payMonth
           ) {
        return R.ok(
                salaryDashboardService.getDashboardData(payYear, payMonth)
        );
    }
    
    /**
     * 获取新工资数据看板数据（基于新的工资表结构）
     */
    @GetMapping("/new")
    public R<NewSalaryDashboardVo> getNewDashboardData(
            @RequestParam(required = true) String salaryPeriod
           ) {
        return R.ok(
                salaryDashboardService.getNewDashboardData(salaryPeriod)
        );
    }

}
