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

import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.workbench.manage.WorkbenchManage;
import com.hz.pm.api.workbench.model.vo.WorkbenchVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

/**
 * 工作台前端控制器
 * @author ZPF
 * @since 2023/03/17 15:35
 */
@RestController
@AllArgsConstructor
@Api(tags = "工作台控制器")
@RequestMapping("/api/v1/workbench")
public class WorkbenchController {

    private WorkbenchManage workbenchManage;

    /**
     * @param year \
     * @return \
     */
    @GetMapping
    public WorkbenchVO workbench(@RequestParam(required = false) Integer year){
        if (year == null) {
            year = LocalDate.now().getYear();
        }
        return workbenchManage.getWorkbenchData(year);
    }

    @ApiOperation(value = "催办", notes = "催办")
    @PostMapping("/urging/{recordId}")
    @WebLog("催办")
    public String urging(@PathVariable Long recordId){
        return workbenchManage.urging(recordId);
    }
}
