package com.hxhq.business.controller;

import com.hxhq.business.domain.MjyJcgj;
import com.hxhq.business.domain.MjyTz;
import com.hxhq.business.dto.mjy.ListDto;
import com.hxhq.business.form.mjy.*;
import com.hxhq.business.service.IMjyJcgjService;
import com.hxhq.business.service.IMjyService;
import com.hxhq.business.service.IMjyTzService;
import com.hxhq.business.utils.pdf.PdfExportUtil;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;
import com.hxhq.common.security.annotation.Logical;
import com.hxhq.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 麻精药档案Controller
 *
 * @author hxhq
 * @date 2025-12-18
 */
@RestController
@RequestMapping("/business/mjyArchive")
public class MjyArchiveController extends BaseController
{
    @Autowired
    private IMjyService mjyService;

    /**
     * 列表
     */
    @RequiresPermissions("business:archive:mjy:list")
    @GetMapping("/list")
    public TableDataInfo list(SearchForm form)
    {
        startPage();
        List<ListDto> list = mjyService.queryArchiveList(form);
        return getDataTable(list);
    }

    /**
     * 同意归档
     */
    @PostMapping("/tygd")
    @RequiresPermissions("business:archive:mjy:tygd")
    public AjaxResult tygd(@RequestBody ArchiveForm form)
    {
        mjyService.tygd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝归档
     */
    @PostMapping("/jjgd")
    @RequiresPermissions("business:archive:mjy:jjgd")
    public AjaxResult jjgd(@RequestBody ArchiveForm form)
    {
        mjyService.jjgd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意解档
     */
    @PostMapping("/tyjd")
    @RequiresPermissions("business:archive:mjy:tyjd")
    public AjaxResult tyjd(@RequestBody ArchiveForm form)
    {
        mjyService.tyjd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝解档
     */
    @PostMapping("/jjjd")
    @RequiresPermissions("business:archive:mjy:jjjd")
    public AjaxResult jjjd(@RequestBody ArchiveForm form)
    {
        mjyService.jjjd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意借阅
     */
    @PostMapping("/tyjy")
    @RequiresPermissions("business:archive:mjy:tyjy")
    public AjaxResult tyjy(@RequestBody ArchiveForm form)
    {
        mjyService.tyjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝借阅
     */
    @PostMapping("/jjjy")
    @RequiresPermissions("business:archive:mjy:jjjy")
    public AjaxResult jjjy(@RequestBody ArchiveForm form)
    {
        mjyService.jjjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 确认归还
     */
    @PostMapping("/qrgh")
    @RequiresPermissions("business:archive:mjy:qrgh")
    public AjaxResult qrgh(@RequestBody ArchiveForm form)
    {
        mjyService.qrgh(form);
        return AjaxResult.success("操作成功");
    }

}
