package com.casic.missiles.controller.equipment;


import com.casic.missiles.dto.ReturnDTO;
import com.casic.missiles.dto.equipment.EquipmentWorkbenchResponse;
import com.casic.missiles.model.equipment.EquipmentFixedAssets;
import com.casic.missiles.service.equipment.IEquipmentWorkbenchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 ** <p>
 *  * 工作台相关接口
 *  * </p>
 *
 * @author xiezhuangz
 * @version 1.0
 * @date 2023/2/6
 */

@Api(tags = "测量设备工作台相关接口")
@Slf4j
@RestController
@RequestMapping("equipment/workbench")
public class EquipmentWorkbenchController {


    @Resource
    private IEquipmentWorkbenchService iEquipmentWorkbenchService;

    /**
     * 本月统计数据
     * 测量设备:(闲置设备,封存设备)/标准装置:(暂停装置,撤销装置)/设备借用/设备领用 通过审批通过的时间查询当月的设备状态数量
     * 测量设备:(在用设备)/标准装置:(在用装置) 查询设备中管理状态为在用的设备数量
     * @return
     */
    @ApiOperation("本月统计数据")
    @PostMapping("/dataStatistics")
    @ResponseBody
    public ReturnDTO<EquipmentWorkbenchResponse> dataStatistics() {
        return iEquipmentWorkbenchService.dataStatistics();
    }

    /**
     * 设备台账检定提醒
     * 查询管理状态不是报废，上次检定日期距离和当前时间相差的月份>=检定周期-1(提前30天)
     * @return
     */
    @ApiOperation("设备台账检定提醒")
    @PostMapping("/remindListPage")
    @ResponseBody
    public ReturnDTO<EquipmentFixedAssets> remindListPage() {
        return iEquipmentWorkbenchService.remindListPage();
    }

    /**
     * 设备检定趋势
     * 未来一年内每月需要鉴定的设备
     * @return
     */
    @ApiOperation("设备检定趋势")
    @PostMapping("/measureTrend")
    @ResponseBody
    public ReturnDTO<EquipmentWorkbenchResponse> measureTrend() {
        return iEquipmentWorkbenchService.measureTrend();
    }

    /**
     * 装置检定趋势
     * @return
     */
    @ApiOperation("装置检定趋势")
    @PostMapping("/standardTrend")
    @ResponseBody
    public ReturnDTO<EquipmentWorkbenchResponse> standardTrend() {
        return iEquipmentWorkbenchService.standardTrend();
    }

    /**
     * 我的设备
     * @return
     */
    @ApiOperation("我的设备")
    @PostMapping("/myselfEquipment")
    @ResponseBody
    public ReturnDTO<EquipmentWorkbenchResponse> myselfEquipment() {
        return iEquipmentWorkbenchService.myselfEquipment();
    }

}
