EquipmentCenterController.java 9.5 KB
package com.skua.modules.equipment.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.equipment.dto.ReportStatisticsDTO;
import com.skua.modules.equipment.service.IProductionEquipmentService;
import com.skua.modules.equipment.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@Api(tags = "设备中心")
@RestController
@RequestMapping("/web/equipment/equipmentCenter")
public class EquipmentCenterController {
    @Autowired
    private IProductionEquipmentService iProductionEquipmentService;

    @AutoLog(value = "设备中心-顶部总览")
    @ApiOperation(value = "设备中心-顶部总览", notes = "设备中心-顶部总览")
    @GetMapping(value = "/topOverview")
    public Result<ProductionEquipmentVO> topOverview(ReportStatisticsDTO reportStatisticsDTO) {
        Result<ProductionEquipmentVO> result = new Result<ProductionEquipmentVO>();
        ProductionEquipmentVO productionEquipmentVO = iProductionEquipmentService.getProductionEquipmentVO(reportStatisticsDTO);
        result.setResult(productionEquipmentVO);
        return result;
    }

    @AutoLog(value = "设备中心-设备统计")
    @ApiOperation(value = "设备中心-设备统计", notes = "设备中心-设备统计")
    @GetMapping(value = "/equipmentStatistics")
    public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
        Result<FaultStatisticsVO> result = new Result<>();
        FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO);
        result.setResult(equipmentStatistics);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-设备统计详情")
    @ApiOperation(value = "设备中心-设备统计详情", notes = "设备中心-设备统计详情")
    @GetMapping(value = "/equipmentStatisticsDetails")
    public Result<IPage<EquipmentNewMaintenancePlanVO>> equipmentStatisticsDetails(ReportStatisticsDTO reportStatisticsDTO,
                                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
        Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
        pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }

    @AutoLog(value = "设备中心-设备状态")
    @ApiOperation(value = "设备中心-设备状态", notes = "设备中心-设备状态")
    @GetMapping(value = "/equipmentState")
    public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<TOPTenVO>> result = new Result<>();
        List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO);
        result.setSuccess(true);
        result.setResult(equipmentState);
        return result;
    }

    @AutoLog(value = "设备中心-设备状态详情")
    @ApiOperation(value = "设备中心-设备状态详情", notes = "设备中心-设备状态详情")
    @GetMapping(value = "/equipmentStateDetails")
    public Result<IPage<EquipmentNewMaintenancePlanVO>> equipmentStateDetails(ReportStatisticsDTO reportStatisticsDTO,
                                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
        Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
        pageList = iProductionEquipmentService.getEquipmentStateDetails(pageList, reportStatisticsDTO);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }

    @AutoLog(value = "设备中心-设备完好率")
    @ApiOperation(value = "设备中心-设备完好率", notes = "设备中心-设备完好率")
    @GetMapping(value = "/equipmentIntactRate")
    public Result<List<ContrastVO>> equipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
        List<ContrastVO> equipmentIntactRate = iProductionEquipmentService.getEquipmentIntactRate(reportStatisticsDTO);
        result.setSuccess(true);
        result.setResult(equipmentIntactRate);
        return result;
    }

    @AutoLog(value = "设备中心-设备完好率详情")
    @ApiOperation(value = "设备中心-设备完好率详情", notes = "设备中心-设备完好率详情")
    @GetMapping(value = "/equipmentIntactRateDetails")
    public Result<List<Map>> equipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<Map>> result = new Result<List<Map>>();
        List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetails(reportStatisticsDTO);
        result.setResult(equipmentIntactRateDetails);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-MTTR&MTBF")
    @ApiOperation(value = "设备中心-MTTR&MTBF", notes = "设备中心-MTTR&MTBF")
    @GetMapping(value = "/equipmentMF")
    public Result<List<ContrastVO>> equipmentMF(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
        List<ContrastVO> equipmentMF = iProductionEquipmentService.getEquipmentMF(reportStatisticsDTO);
        result.setResult(equipmentMF);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-MTTR&MTBF详情")
    @ApiOperation(value = "设备中心-MTTR&MTBF详情", notes = "设备中心-MTTR&MTBF详情")
    @GetMapping(value = "/equipmentMFDetails")
    public Result<List<Map>> equipmentMFDetails(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<Map>> result = new Result<List<Map>>();
        List<Map> equipmentMFDetails = iProductionEquipmentService.getEquipmentMFDetails(reportStatisticsDTO);
        result.setResult(equipmentMFDetails);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-维护完成率趋势")
    @ApiOperation(value = "设备中心-维护完成率趋势", notes = "设备中心-维护完成率趋势")
    @GetMapping(value = "/maintainCompleteRate")
    public Result<List<ContrastVO>> maintainCompleteRate(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
        List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getMaintainCompleteRate(reportStatisticsDTO);
        result.setResult(maintainCompleteRate);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-维护完成率趋势详情")
    @ApiOperation(value = "设备中心-维护完成率趋势详情", notes = "设备中心-维护完成率趋势详情")
    @GetMapping(value = "/maintainCompleteRateDetails")
    public Result<List<Map>> maintainCompleteRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<Map>> result = new Result<>();
        List<Map> maintainCompleteRateDetails = iProductionEquipmentService.getMaintainCompleteRateDetails(reportStatisticsDTO);
        result.setResult(maintainCompleteRateDetails);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-维护维修费用")
    @ApiOperation(value = "设备中心-维护维修费用", notes = "设备中心-维护维修费用")
    @GetMapping(value = "/maintainRepairCost")
    public Result<List<ContrastVO>> maintainRepairCost(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
        List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getContrastCost(reportStatisticsDTO);
        result.setResult(maintainCompleteRate);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "设备中心-维护维修费用详情")
    @ApiOperation(value = "设备中心-维护维修费用详情", notes = "设备中心-维护维修费用详情")
    @GetMapping(value = "/maintainRepairCostDetails")
    public Result<List<Map>> maintainRepairCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
        Result<List<Map>> result = new Result<>();
        List<Map> contrastCostDetails = iProductionEquipmentService.getContrastCostDetails(reportStatisticsDTO);
        result.setResult(contrastCostDetails);
        result.setSuccess(true);
        return result;
    }
}