package com.bonus.material.work.controller;

import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.ma.domain.DirectApplyInfo;
import com.bonus.material.work.domain.DirectAudit;
import com.bonus.material.work.service.IDirectAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author hay
 * @description 业务办理--直转审核
 * @date 2025/2/17 13:13
 */
@Api(tags = "直转审核任务接口")
@RestController
@RequestMapping("/directAudit")
public class DirectAuditController extends BaseController {

    @Resource
    private IDirectAuditService service;


    /**
     * 直转记录查询列表
     */
    @ApiOperation(value = "直转记录查询列表")
    @GetMapping("/list")
    public TableDataInfo list(DirectApplyInfo directApplyInfo) {
        startPage();
        try {
            directApplyInfo.setAuditor(SecurityUtils.getLoginUser().getUserid()+"");
            List<DirectApplyInfo> directApplyInfos = service.getList(directApplyInfo);
            return getDataTable(directApplyInfos);
        } catch (Exception e) {
            System.err.println("查询列表失败：异常信息：" + e.getMessage());
            logger.error("查询列表失败：异常信息：{}", e.getMessage(), e);
            return getDataTable(new ArrayList<>());
        }
    }




/*    @ApiOperation(value = "查看审批详情")
    @GetMapping("/getAuditInfo")
    public AjaxResult getAuditInfo(DirectAudit du) {
        try {
            return AjaxResult.success(service.getAuditInfo(du));
        } catch (Exception e) {
            return AjaxResult.success(new DirectApplyInfo());
        }
    }*/

    /**
     * 审核直转申请
     */
  /*  @ApiOperation(value = "审核直转申请")
    @PostMapping("/auditDir")
    public AjaxResult auditDir(@RequestBody DirectAudit audit) {
        try {
            return service.auditDir(audit);
        } catch (Exception e) {
            return AjaxResult.error("保存失败");
        }
    }
*/
}
