EquipmentSingleStatisticsController.java 8.2 KB
package com.skua.modules.equipment.controller;

import com.skua.core.api.vo.Result;
import com.skua.modules.equipment.service.IEquipmentSingleStatisticsService;
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.RestController;

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

/**
 * <pre>
 *	 单台设备统计分析
 * </pre>
 * @author Li Yuanyuan
 * @version V0.1, 2024年1月24日 下午2:21:28
 */
@Slf4j
@Api(tags = "/设备管理/设备台账/单台设备统计分析")
@RestController
@RequestMapping("/equipment/statistics/single")
public class EquipmentSingleStatisticsController {
	@Autowired
    private IEquipmentSingleStatisticsService equipmentSingleStatisticsService;
	/**
	 * <pre>
	 * 	设备看板-设备故障分析
	 * </pre>
	 * @param equipmentId
	 * @param startTime
	 * @param endTime
	 * @return
	 * @author Li Yuanyuan, 2024年2月4日 下午2:40:30
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@ApiOperation(value = "设备看板-设备故障分析", notes = "设备看板-设备故障分析,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentOverview")
	public Result<Map<String,Object>> getAlarmOverview(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<Map<String,Object>> result = new Result<>();
		try {
			Map<String,Object> map = equipmentSingleStatisticsService.getAlarmOverview(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(map);
		} catch (Exception e) {
			log.error("设备故障分析统计失败", e.getMessage());
			result.error500("设备故障分析统计失败");
		}
		return result;
	}
	/**
	 * <pre>
	 * 	设备看板-故障类型分布
	 * </pre>
	 * @param equipmentId
	 * @param timePeriod
	 * @param startTime
	 * @param endTime
	 * @return
	 * @author Li Yuanyuan, 2024年1月30日 上午9:30:49
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@ApiOperation(value = "设备看板-故障类型分布", notes = "设备看板-故障类型分布,故障信号产生次数从getEquipmentOverview接口中获取alarmFaultCount属性")
	@GetMapping(value = "/getEquipmentFaultTypeDistribution")
	public Result<List<Map<String,Object>>> getEquipmentFaultTypeDistribution(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<List<Map<String,Object>>> result = new Result<>();
		try {
			List<Map<String,Object>> list = equipmentSingleStatisticsService.getEquipmentFaultTypeDistribution(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(list);
		} catch (Exception e) {
			log.error("故障类型分布统计失败", e.getMessage());
			result.error500("故障类型分布统计失败");
		}
		return result;
	}

	/**
	 * <pre>
	 * 	设备看板-故障程度分布
	 * </pre>
	 * @param equipmentId
	 * @param timePeriod
	 * @param startTime
	 * @param endTime
	 * @return
	 * @author Li Yuanyuan, 2024年1月30日 上午9:30:49
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@ApiOperation(value = "设备看板-故障程度分布", notes = "设备看板-故障程度分布")
	@GetMapping(value = "/getEquipmentFaultLevelDistribution")
	public Result<List<Map<String,Object>>> getEquipmentFaultLevelDistribution(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<List<Map<String,Object>>> result = new Result<>();
		try {
			List<Map<String,Object>> list = equipmentSingleStatisticsService.getEquipmentFaultLevelDistribution(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(list);
		} catch (Exception e) {
			log.error("故障类型分布统计失败", e.getMessage());
			result.error500("故障类型分布统计失败");
		}
		return result;
	}

	/**
	 * <pre>
	 * 	设备看板-维修工单情况
	 * </pre>
	 * @param equipmentId
	 * @param timePeriod
	 * @param startTime
	 * @param endTime
	 * @return
	 * @author Li Yuanyuan, 2024年1月30日 上午9:30:49
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@ApiOperation(value = "设备看板-维修工单情况", notes = "设备看板-维修工单情况,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentWorkOrderInfo")
	public Result<List<Map<String,Object>>> getEquipmentWorkOrderInfo(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<List<Map<String,Object>>> result = new Result<>();
		try {
			List<Map<String,Object>> list = equipmentSingleStatisticsService.getEquipmentWorkOrderInfo(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(list);
		} catch (Exception e) {
			log.error("故障类型分布统计失败", e.getMessage());
			result.error500("故障类型分布统计失败");
		}
		return result;
	}

	/**
	 * <pre>
	 * 	设备看板-设备报警类型
	 * </pre>
	 * @param equipmentId
	 * @param timePeriod
	 * @param startTime
	 * @param endTime
	 * @return
	 * @author Li Yuanyuan, 2024年1月30日 上午9:30:49
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@ApiOperation(value = "设备看板-设备报警类型", notes = "设备看板-设备报警类型,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentAlarmInfo")
	public Result<Map<String,Object>> getEquipmentAlarmInfo(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<Map<String,Object>> result = new Result<>();
		try {
			Map<String,Object> map = equipmentSingleStatisticsService.getEquipmentAlarmInfo(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(map);
		} catch (Exception e) {
			log.error("设备报警类型统计失败", e.getMessage());
			result.error500("设备报警类型统计失败");
		}
		return result;
	}

	@ApiOperation(value = "设备看板-设备维护情况", notes = "设备看板-设备维护情况,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentMaintainInfo")
	public Result<Map<String,Object>> getEquipmentMaintainInfo(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<Map<String,Object>> result = new Result<>();
		try {
			Map<String,Object> map = equipmentSingleStatisticsService.getEquipmentMaintainInfo(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(map);
		} catch (Exception e) {
			log.error("设备维护情况统计失败", e.getMessage());
			result.error500("设备维护情况统计失败");
		}
		return result;
	}

	@ApiOperation(value = "设备看板-巡检情况", notes = "设备看板-设备巡检情况,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentInspectionInfo")
	public Result<Map<String,Object>> getEquipmentInspectionInfo(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<Map<String,Object>> result = new Result<>();
		try {
			Map<String,Object> map = equipmentSingleStatisticsService.getEquipmentInspectionInfo(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(map);
		} catch (Exception e) {
			log.error("设备维护情况统计失败", e.getMessage());
			result.error500("设备维护情况统计失败");
		}
		return result;
	}

	@ApiOperation(value = "设备看板-设备备件更换情况", notes = "设备看板-设备备件更换情况,timePeriod【month/quarter/year】")
	@GetMapping(value = "/getEquipmentSparepartInfo")
	public Result<List<Map<String,Object>>> getEquipmentSparepartInfo(String equipmentId,String timePeriod,String startTime,String endTime) {
		Result<List<Map<String,Object>>> result = new Result<>();
		try {
			List<Map<String,Object>> list = equipmentSingleStatisticsService.getEquipmentSparepartInfo(equipmentId,timePeriod,startTime,endTime);
			result.setSuccess(true);
			result.setResult(list);
		} catch (Exception e) {
			log.error("设备备件更换情况统计失败", e.getMessage());
			result.error500("设备备件更换情况统计失败");
		}
		return result;
	}

}