package com.zd.laboratory.controller;

import com.zd.common.core.domain.per.PerFun;
import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.web.domain.ResultData;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.common.log.annotation.Log;
import com.zd.common.log.enums.BusinessType;
import com.zd.common.security.annotation.PreAuthorize;
import com.zd.laboratory.service.ILabGradeManageRecordService;
import com.zd.system.api.laboratory.domain.LabGradeManageRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 管控执行记录Controller
 *
 * @author liubo
 * @date 2022-02-10
 */
@RestController
@Api(tags = "【管控执行记录】")
@RequestMapping("/gradeManageRecord")
public class LabGradeManageRecordController extends BaseController {
    @Autowired
    private ILabGradeManageRecordService labGradeManageRecordService;

    /**
     * 查询管控执行记录列表
     */
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_GRADEMANAGERECORD + PerFun.LIST)
    @GetMapping("/list")
    @ApiOperation(value = "查询管控执行记录列表")
    public TableDataInfo<LabGradeManageRecord> list(LabGradeManageRecord labGradeManageRecord) {
        startPage();
        List<LabGradeManageRecord> list = labGradeManageRecordService.selectLabGradeManageRecordList(labGradeManageRecord);
        return getDataTable(list);
    }

    /**
     * 获取管控执行记录详细信息
     */
    @ApiOperation(value = "获取管控执行记录详细信息")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_GRADEMANAGERECORD + PerFun.QUERY)
    @GetMapping(value = "/{id}")
    public ResultData<LabGradeManageRecord> getInfo(@PathVariable("id") Long id) {
        return ResultData.success(labGradeManageRecordService.selectLabGradeManageRecordById(id));
    }

    /**
     * 定时任务分级管控工作过期记录 - 并排列下次工作计划
     */
    @ApiOperation(value = "定时任务分级管控工作过期记录 - 并排列下次工作计划")
    @Log(title = "定时任务分级管控工作过期记录 - 并排列下次工作计划", businessType = BusinessType.INSERT)
    @GetMapping(value = "/workArrange")
    public void workArrange() {
        labGradeManageRecordService.workArrange();
    }

    /**
     * 定时任务 早8点 管控工作逾期通知
     */
    @ApiOperation(value = "定时任务 早8点管控工作逾期通知")
    @GetMapping(value = "/workOverdue")
    public void workOverdue() {
        labGradeManageRecordService.workOverdue();
    }

    /**
     * 定时任务 下午7点 天管控工作执行通知
     */
    @ApiOperation(value = "定时任务 下午7点 管控工作执行通知")
    @GetMapping(value = "/workExecuteByDay")
    public void workExecuteByDay() {
        labGradeManageRecordService.workExecuteByDay("一天");
    }

    /**
     * 定时任务 早8点 其他管控工作执行通知
     */
    @ApiOperation(value = "定时任务 早8点 管控工作执行通知")
    @GetMapping(value = "/workExecute")
    public void workExecute() {
        labGradeManageRecordService.workExecute();
    }
}
