package com.yuchen.saas.park.service.fault.controller;

import com.yuchen.saas.park.service.fault.service.EquipmentBreakdownCountService;
import io.swagger.annotations.Api;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/10/20 18:12
 * @Description: 设备故障统计
 * @Version: 1.0
 */
@RestController
@RequestMapping("/equipment_breakdown/count")
@Api(tags = "设备故障统计", value = "设备故障统计")
public class EquipmentBreakdownCountController {


    @Resource
    private EquipmentBreakdownCountService countStatusService;

    /**
     * 设备故障统计:设备总数
     *
     * @return
     */
    @RequestMapping("/total")
    public R total(Long parkId) {
        R result = countStatusService.total(parkId);
        return result;
    }

    /**
     * 异常趋势图和排名
     *
     * @param parkId   园区id
     * @param dateType 时间类型
     * @return
     */
    @RequestMapping("/trent_rank")
    public R trentAndRank(Long parkId, String dateType) {
        //
        R result = countStatusService.trentAndRank(parkId, dateType);
        return result;
    }

    /**
     * 设备画像占比
     *
     * @param parkId
     * @return
     */
    @RequestMapping("/picture_rate")
    public R pictureRate(Long parkId) {
        //
        R result = countStatusService.pictureRate(parkId);
        return result;
    }

    /**
     * 频繁故障设备统计
     * @param parkId
     * @param pictureCode
     * @return
     */
    @RequestMapping("/picture_code")
    public R pictureCode(Long parkId, String pictureCode) {
        //
        R result = countStatusService.pictureCode(parkId,pictureCode);
        return result;
    }


}