81 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
using LY.App.Model;
 | 
						|
using LY.App.Service;
 | 
						|
using Mapster;
 | 
						|
using Microsoft.AspNetCore.Http;
 | 
						|
using Microsoft.AspNetCore.Mvc;
 | 
						|
 | 
						|
namespace LY.App.Controllers
 | 
						|
{
 | 
						|
    [Route("api/[controller]")]
 | 
						|
    [ApiController]
 | 
						|
    public class AlarmController : ControllerBase
 | 
						|
    {
 | 
						|
 | 
						|
        private readonly AlarmService _alarmService;
 | 
						|
 | 
						|
        public AlarmController(AlarmService alarmService)
 | 
						|
        {
 | 
						|
            _alarmService = alarmService;
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        ///列表
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="input"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpGet("list")]
 | 
						|
        public async Task<IActionResult> List([FromQuery] AlarmReq input)
 | 
						|
        {
 | 
						|
            var result = await _alarmService.GetPage(input);
 | 
						|
            return Ok(result);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        ///列表
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="input"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpGet("list1")]
 | 
						|
        public async Task<IActionResult> List1([FromQuery] AlarmReq input)
 | 
						|
        {
 | 
						|
            var result = await _alarmService.CreateHistoryPage(input);
 | 
						|
            return Ok(result);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 新增告警
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="input"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost("add")]
 | 
						|
        public async Task<IActionResult> AddAlarm(RevData input)
 | 
						|
        {
 | 
						|
            var result = await _alarmService.AddAlarm(input);
 | 
						|
            return Ok(result);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 获取指定批次的告警详情
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="batchid"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpGet("detail")]
 | 
						|
        public async Task<IActionResult> detail(long batchid)
 | 
						|
        {
 | 
						|
            var result = await _alarmService.GetByBatchId(batchid);
 | 
						|
            return Ok(result);
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 统计报表
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="start"></param>
 | 
						|
        /// <param name="end"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpGet("report")]
 | 
						|
        public async Task<IActionResult> report(DateTime? start, DateTime? end)
 | 
						|
        {
 | 
						|
            var result=await _alarmService.GetReport(start, end);
 | 
						|
        return Ok(result);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |