package com.jeethink.manage.controller;

import java.util.List;

import com.jeethink.bean.domain.ArchivesMaster;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.jeethink.common.annotation.Log;
import com.jeethink.common.core.controller.BaseController;
import com.jeethink.common.core.domain.AjaxResult;
import com.jeethink.common.enums.BusinessType;
import com.jeethink.manage.service.IAuthenticateService;
import com.jeethink.common.utils.poi.ExcelUtil;
import com.jeethink.common.core.page.TableDataInfo;

/**
 * 价值鉴定Controller
 * 
 * @author zjt
 * @date 2022-11-10
 */
@RestController
@RequestMapping("/manage/authenticate")
public class AuthenticateController extends BaseController
{
    @Autowired
    private IAuthenticateService service;
    /**
     * 查询价值鉴定列表
     */
    @PreAuthorize("@ss.hasPermi('manage:authenticate:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchivesMaster archives)
    {
        startPage();
        List<ArchivesMaster> list = service.selectAuthenticateList(archives);
        return getDataTable(list);
    }

    /**
     * 导出价值鉴定列表
     */
    @PreAuthorize("@ss.hasPermi('manage:authenticate:export')")
    @Log(title = "价值鉴定", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ArchivesMaster archives)
    {
        List<ArchivesMaster> list = service.selectAuthenticateList(archives);
        ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
        return util.exportExcel(list, "authenticate");
    }

    @PreAuthorize(("@ss.hasPermi('manage:authenticate:postpone')"))
    @Log(title = "档案延期", businessType = BusinessType.UPDATE)
    @PostMapping("/postpone")
    public AjaxResult postpone(@RequestBody ArchivesMaster archives) {

        service.postponeArchives(archives);
        return AjaxResult.success();
    }
}
