package com.casic.missiles.controller.business;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.casic.missiles.core.base.controller.ExportController;
import com.casic.missiles.core.page.PageFactory;
import com.casic.missiles.core.page.PageInfoBT;
import com.casic.missiles.dto.ReturnDTO;
import com.casic.missiles.dto.ReturnUtil;
import com.casic.missiles.dto.business.workbench.SampleMeasureChartResponse;
import com.casic.missiles.dto.business.workbench.SampleMeasureResponse;
import com.casic.missiles.dto.business.workbench.SampleMonitorResponse;
import com.casic.missiles.dto.business.workbench.SampleStatusMonthResponse;
import com.casic.missiles.service.business.BusinessWorkbenchService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 业务管理-工作台
 * @Author: wangpeng
 * @Date: 2023/4/19 13:28
 */
@Api(tags = "工作台相关接口")
@RestController
@RequestMapping("/workbench")
public class BusinessWorkbenchController extends ExportController {
    @Autowired
    private BusinessWorkbenchService workbenchService;

    /**
     * 样品监控
     * 分页展示全部检测中样品（对应实验室待分配、待检测、检测中），按实验室记录时间排序
     */
    @ApiOperation("样品监控")
    @GetMapping("/sample/monitor/listPage")
    public ReturnDTO<PageInfoBT<SampleMonitorResponse>> sampleMonitorListPage() {
        Page<SampleMonitorResponse> page = PageFactory.defaultPage();
        return ReturnUtil.success(super.packForBT(workbenchService.sampleMonitorListPage(page)));
    }

    /**
     * 样品检测
     * 列表：根据权限不同展示不同的当月检测样品列表
     * 占比图：不分权限展示所有的当月检测样品列表
     */
    @ApiOperation("样品检测列表")
    @GetMapping("/sample/measure/listPage")
    public ReturnDTO<PageInfoBT<SampleMeasureResponse>> sampleMeasureListPage() throws Exception {
        Page<SampleMeasureResponse> page = PageFactory.defaultPage();
        return ReturnUtil.success(super.packForBT(workbenchService.sampleMeasureListPage(page)));
    }

    @ApiOperation("样品检测占比图")
    @GetMapping("/sample/measure/chart")
    public ReturnDTO<List<SampleMeasureChartResponse>> sampleMeasureChart() throws Exception {
        return ReturnUtil.success(workbenchService.sampleMeasureChart());
    }

    /**
     * 证书报告，调用证书报告中列表接口
     */

    /**
     * 实时工作统计，调用业务看板中实时工作统计接口
     */

    /**
     * 本月样品状态
     */
    @ApiOperation("本月样品状态")
    @GetMapping("/sample/status/month")
    public ReturnDTO<List<SampleStatusMonthResponse>> sampleStatusMonth() throws Exception {
        return ReturnUtil.success(workbenchService.sampleStatusMonth());
    }

}
