using SafeCampus.Application.Services.Business.CameraInfoService;
using System.Collections.Generic;
namespace SafeCampus.Web.Core.Controllers.Application.Business;
///
/// 摄像头管理接口
///
[ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 91, Tag = "摄像头管理")]
[Route("/business/cameraInfo")]
[RolePermission]
public class CameraInfoController
{
private readonly ICameraInfoService _cameraInfoService;
public CameraInfoController(ICameraInfoService cameraInfoService)
{
_cameraInfoService = cameraInfoService;
}
///
/// 数据同步
///
///
public async Task DataSync()
{
return await _cameraInfoService.DataSync();
}
///
/// 获取摄像头列表
///
///
///
public async Task> GetPageList(CameraSearch search)
{
return await _cameraInfoService.GetPageList(search);
}
///
/// 批量给摄像头设置分组
///
///
///
public async Task BatchSetGroup(SetGroupInput input)
{
return await _cameraInfoService.BatchSetGroup(input);
}
///
/// 根据分组批量设置推送人
///
///
///
public async Task BatchSetPushPersonByGroup(SetPushPersonGroupInput input)
{
return await _cameraInfoService.BatchSetPushPersonByGroup(input);
}
///
/// 对摄像头批量设置推送人
///
///
///
public async Task BatchSetPushPerson(SetPushPersonInput input)
{
return await _cameraInfoService.BatchSetPushPerson(input);
}
///
/// 根据预警分组设置推送人
///
///
///
public async Task BatchSetPushPersonByWarn(SetPushPersonWarnInput input)
{
return await _cameraInfoService.BatchSetPushPersonByWarn(input);
}
///
/// 设备状态统计API
///
///
public async Task GetCameraStatistic()
{
var list = await _cameraInfoService.GetPageList(new CameraSearch{PageNum = 1,PageSize = 1000});
var numbers = new Dictionary { {true, "在线" }, { false, "离线" } };
var statistics = numbers.Select(x => new
{
Name = x.Value,
Count = list.List.Count(xx => xx.DeviceStatus)
}).ToList();
return statistics;
}
}