|
@@ -28,7 +28,10 @@ namespace CheckServer.Controllers
|
|
|
{
|
|
|
dto.file1 = GetLocalFile(dto.file1);
|
|
|
List<DetectResDto> list = new List<DetectResDto>();
|
|
|
+ List<DmcResult> listRes = new List<DmcResult>();
|
|
|
List<DmcResult> dmcResults = new List<DmcResult>();
|
|
|
+ List<DmcResult> ibsResults = new List<DmcResult>();
|
|
|
+ List<DmcResult> kyResults = new List<DmcResult>();
|
|
|
if (dto.dmcType.HasFlag(EnumSigCheckTypeDto.DAMA))
|
|
|
{
|
|
|
var dmcResult = await CheckHelper.DmcCheckAsync(dto.file1, dto.fsHz, EnumSigCheckTypeDto.DAMA, dto.band);
|
|
@@ -37,22 +40,54 @@ namespace CheckServer.Controllers
|
|
|
if (dto.dmcType.HasFlag(EnumSigCheckTypeDto.IBS))
|
|
|
{
|
|
|
var dmcResult = await CheckHelper.DmcCheckAsync(dto.file1, dto.fsHz, EnumSigCheckTypeDto.IBS, dto.band);
|
|
|
- dmcResults.AddRange(dmcResult);
|
|
|
+ ibsResults.AddRange(dmcResult);
|
|
|
}
|
|
|
if (dto.dmcType.HasFlag(EnumSigCheckTypeDto.Ky5758))
|
|
|
{
|
|
|
var dmcResult = await CheckHelper.DmcCheckAsync(dto.file1, dto.fsHz, EnumSigCheckTypeDto.Ky5758, dto.band);
|
|
|
- dmcResults.AddRange(dmcResult);
|
|
|
+ kyResults.AddRange(dmcResult);
|
|
|
}
|
|
|
-
|
|
|
- foreach (var dmcItem in dmcResults)
|
|
|
+ if (dto.mergeRes)
|
|
|
+ {
|
|
|
+ listRes.AddRange(dmcResults);
|
|
|
+ var ibsCopy = ibsResults.Skip(0).ToList();
|
|
|
+ foreach (var item in ibsResults)
|
|
|
+ {
|
|
|
+ if (listRes.Any(p => CalcIntersecLen(p, item) > 500))
|
|
|
+ ibsCopy.Remove(item);//IBS结果在DAMA中重叠超过500长度,忽略
|
|
|
+ }
|
|
|
+ listRes.AddRange(ibsCopy);
|
|
|
+ var kyCopy = kyResults.Skip(0).ToList();
|
|
|
+ foreach (var item in kyResults)
|
|
|
+ {
|
|
|
+ if (listRes.Any(p => CalcIntersecLen(p, item) > 500))
|
|
|
+ kyCopy.Remove(item);//KY结果在DAMA或IBS中重叠超过500长度,忽略
|
|
|
+ }
|
|
|
+ listRes.AddRange(kyCopy);
|
|
|
+ foreach (var dmcItem in listRes)
|
|
|
+ {
|
|
|
+ DetectResDto detectRes = new DetectResDto(dmcItem.Start, dmcItem.Length, dmcItem.UserName);
|
|
|
+ detectRes.ModType = dmcItem.ModType;
|
|
|
+ detectRes.DmcType = dmcItem.DmcType;
|
|
|
+ detectRes.File1 = dto.file1;
|
|
|
+ detectRes.TimeMs = dmcItem.Times;
|
|
|
+ list.Add(detectRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- DetectResDto detectRes = new DetectResDto(dmcItem.Start, dmcItem.Length, dmcItem.UserName);
|
|
|
- detectRes.ModType = dmcItem.ModType;
|
|
|
- detectRes.DmcType = dmcItem.DmcType;
|
|
|
- detectRes.File1 = dto.file1;
|
|
|
- detectRes.TimeMs = dmcItem.Times;
|
|
|
- list.Add(detectRes);
|
|
|
+ listRes.AddRange(dmcResults);
|
|
|
+ listRes.AddRange(ibsResults);
|
|
|
+ listRes.AddRange(kyResults);
|
|
|
+ foreach (var dmcItem in listRes)
|
|
|
+ {
|
|
|
+ DetectResDto detectRes = new DetectResDto(dmcItem.Start, dmcItem.Length, dmcItem.UserName);
|
|
|
+ detectRes.ModType = dmcItem.ModType;
|
|
|
+ detectRes.DmcType = dmcItem.DmcType;
|
|
|
+ detectRes.File1 = dto.file1;
|
|
|
+ detectRes.TimeMs = dmcItem.Times;
|
|
|
+ list.Add(detectRes);
|
|
|
+ }
|
|
|
}
|
|
|
return Success(list);
|
|
|
}
|
|
@@ -152,5 +187,15 @@ namespace CheckServer.Controllers
|
|
|
}
|
|
|
return M;
|
|
|
}
|
|
|
+
|
|
|
+ //计算两个时隙交集的长度,无交集返回0
|
|
|
+ private int CalcIntersecLen(DmcResult dto1, DmcResult dto2)
|
|
|
+ {
|
|
|
+ if (dto2.Start >= dto1.Start + dto1.Length) return 0;
|
|
|
+ if (dto1.Start >= dto2.Start + dto2.Length) return 0;
|
|
|
+ int maxStart = Math.Max(dto1.Start, dto2.Start);
|
|
|
+ int minEnd = Math.Min(dto1.Start + dto1.Length, dto2.Start + dto2.Length);
|
|
|
+ return minEnd - maxStart + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|