Browse Source

feat: 完善服务调用计算流程

master
fajiao 2 years ago
parent
commit
9059935995
  1. 2
      Cis.Application/Core/Algo/MarkSearcherBase.cs
  2. 49
      Cis.Application/Core/Center/CameraDataCenter.cs
  3. 23
      Cis.Application/Core/Service/MarkSearchService.cs

2
Cis.Application/Core/Algo/MarkSearcherBase.cs

@ -16,7 +16,7 @@ public abstract class MarkSearcherBase
/// <summary>
/// _markLabelInfoList 锁对象,写锁
/// </summary>
private static readonly object mliListLock = new();
private static object mliListLock { get; } = new();
/// <summary>
/// 需要计算的 markLabelInfo 列表

49
Cis.Application/Core/Center/CameraDataCenter.cs

@ -35,7 +35,7 @@ public class CameraDataCenter
/// <summary>
/// _markSearcherDict 锁对象,写锁
/// </summary>
private static readonly ReaderWriterLockSlim msDictLock = new();
private static ReaderWriterLockSlim msDictLock { get; } = new();
/// <summary>
/// (cbCameraId, MarkSearcherBase)
@ -224,19 +224,58 @@ public class CameraDataCenter
return markSearcher.AddMarkLabelCalcInfo(markLabelCalcInfo);
}
public bool DeleteCameraMarkLabel(long cameraId, long marklabelId)
public bool DeleteCameraMarkLabel(long cameraId, long markLabelId)
{
if (!_markSearcherDict.ExistsKey(cameraId))
return false;
MarkSearcherBase markSearcher = _markSearcherDict[cameraId];
return markSearcher.DeleteMarkLabelCalcInfo(marklabelId);
return markSearcher.DeleteMarkLabelCalcInfo(markLabelId);
}
public List<MarkLabelCalcResult> GetMarkLabelCalcResults(long cameraId)
public List<MarkLabelCalcResult> GetMarkLabelCalcResultList(long cameraId)
{
return null;
}
public async Task<bool> ActiveCameraAsync(long cameraId)
{
return await Task.Run(() =>
{
return ActiveCamera(cameraId);
});
}
public async Task<bool> DeActiveCameraAsync(long cameraId)
{
return await Task.Run(() =>
{
return DeActiveCamera(cameraId);
});
}
public async Task<bool> AddCameraMarkLabelAsync(long cameraId, long markLabelId)
{
return await Task.Run(() =>
{
return AddCameraMarkLabel(cameraId, markLabelId);
});
}
public async Task<bool> DeleteCameraMarkLabelAsync(long cameraId, long markLabelId)
{
return await Task.Run(() =>
{
return DeleteCameraMarkLabel(cameraId, markLabelId);
});
}
public async Task<List<MarkLabelCalcResult>> GetMarkLabelCalcResultListAsync(long cameraId)
{
return await Task.Run(() =>
{
return GetMarkLabelCalcResultList(cameraId);
});
}
#endregion external call
}

23
Cis.Application/Core/Service/MarkSearchService.cs

@ -16,7 +16,28 @@ public class MarkSearchService : IDynamicApiController, ITransient
_cameraDataCenter = cameraDataCenter;
}
public void ActivateCamera()
public async Task<bool> ActivateCamera(long cameraId)
{
return await _cameraDataCenter.ActiveCameraAsync(cameraId);
}
public async Task<bool> DeActiveCamera(long cameraId)
{
return await _cameraDataCenter.DeActiveCameraAsync(cameraId);
}
public async Task<bool> AddCameraMarkLabel(long cameraId, long markLabelId)
{
return await _cameraDataCenter.AddCameraMarkLabelAsync(cameraId, markLabelId);
}
public async Task<bool> DeleteCameraMarkLabel(long cameraId, long markLabelId)
{
return await _cameraDataCenter.DeleteCameraMarkLabelAsync(cameraId, markLabelId);
}
public async Task<List<MarkLabelCalcResult>> GetMarkLabelCalcResultList(long cameraId)
{
return await _cameraDataCenter.GetMarkLabelCalcResultListAsync(cameraId);
}
}
Loading…
Cancel
Save