package com.aucma.report.controller;

import com.aucma.common.annotation.Anonymous;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.report.service.IBoard5Service;
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;

/**
 * Board5看板数据Controller
 * 设备保养与故障分析看板
 *
 * @author YinQ
 */
@RestController
@RequestMapping("/board5")
public class Board5Controller extends BaseController {

    @Autowired
    private IBoard5Service board5Service;

    /**
     * 获取工单统计（总数、已完成、完成率、停机）
     */
    @Anonymous
    @GetMapping("/orderWorkStatistics")
    public AjaxResult getOrderWorkStatistics() {
        return success(board5Service.getOrderWorkStatistics());
    }

    /**
     * 获取维修时间统计（平均响应时间、平均维修时间）
     */
    @Anonymous
    @GetMapping("/repairTimeStatistics")
    public AjaxResult getRepairTimeStatistics() {
        return success(board5Service.getRepairTimeStatistics());
    }

    /**
     * 获取保养执行情况统计
     */
    @Anonymous
    @GetMapping("/maintStatistics")
    public AjaxResult getMaintStatistics() {
        return success(board5Service.getMaintStatistics());
    }

    /**
     * 获取巡检执行情况统计
     */
    @Anonymous
    @GetMapping("/inspectStatistics")
    public AjaxResult getInspectStatistics() {
        return success(board5Service.getInspectStatistics());
    }

    /**
     * 获取设备状态分布
     */
    @Anonymous
    @GetMapping("/deviceStatusDistribution")
    public AjaxResult getDeviceStatusDistribution() {
        return success(board5Service.getDeviceStatusDistribution());
    }

    /**
     * 获取故障来源分布
     */
    @Anonymous
    @GetMapping("/faultSourceDistribution")
    public AjaxResult getFaultSourceDistribution() {
        return success(board5Service.getFaultSourceDistribution());
    }

    /**
     * 获取故障数量曲线
     */
    @Anonymous
    @GetMapping("/faultTrendList")
    public AjaxResult getFaultTrendList() {
        return success(board5Service.getFaultTrendList());
    }

    /**
     * 获取产量机台TOP5
     */
    @Anonymous
    @GetMapping("/productionTop5")
    public AjaxResult getProductionTop5() {
        return success(board5Service.getProductionTop5());
    }
}
