package com.ruoyi.web.controller.risk;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.IRiskWorkbenchService;

/**
 * 评估师工作台控制器
 */
@Controller
@RequestMapping("/risk/workbench")
public class RiskWorkbenchController extends BaseController
{
    private String prefix = "risk/workbench";

    @Autowired
    private IRiskWorkbenchService riskWorkbenchService;

    @RequiresPermissions("risk:workbench:view")
    @GetMapping()
    public String workbench(ModelMap mmap)
    {
        mmap.put("summary", riskWorkbenchService.selectSummary());
        mmap.put("dueProjects", riskWorkbenchService.selectDueSoonProjects());
        mmap.put("pendingReports", riskWorkbenchService.selectPendingReports());
        mmap.put("pendingMaterials", riskWorkbenchService.selectPendingMaterials());
        return prefix + "/workbench";
    }

    @RequiresPermissions("risk:workbench:view")
    @GetMapping("/overview")
    @ResponseBody
    public AjaxResult overview()
    {
        return AjaxResult.success()
                .put("summary", riskWorkbenchService.selectSummary())
                .put("dueProjects", riskWorkbenchService.selectDueSoonProjects())
                .put("pendingReports", riskWorkbenchService.selectPendingReports())
                .put("pendingMaterials", riskWorkbenchService.selectPendingMaterials());
    }
}
