private E1Sound GetPhoneCode(List <FeiKunData> feiKuns, E1Sound e1) { if (feiKuns.Count > 0) { FeiKunData fei = feiKuns.FirstOrDefault <FeiKunData>(); e1.PhoneCode1 = fei.PhoneCode1; e1.PhoneCode2 = fei.PhoneCode2; return(e1); } else { return(null); } }
private int DataSpanAnalyze(FeiKunData item1, E1Sound e1) { DateTime dt1 = Convert.ToDateTime(item1.DtHolding); DateTime dt2 = Convert.ToDateTime(e1.DateSpan); int dt = TimeSpan.Compare(dt1.TimeOfDay, dt2.TimeOfDay); if (dt1 == dt2)//两个时间段相等,或者相差小于5s { return(1); } else if (dt1 != dt2 && dt > 0 && dt <= DistanceTime) { return(2); //dt1>dt2 } else if (dt1 != dt2 && dt < 0 && dt >= DistanceTime * -1) { return(3); //dt1<dt2 } else { return(0); } }
private List <FeiKunData> DataCompareFeiKun(List <FeiKunData> feiKuns, E1Sound e1) { List <FeiKunData> list = new List <FeiKunData>(); List <FeiKunData> list1 = new List <FeiKunData>(); List <FeiKunData> list2 = new List <FeiKunData>(); //先通过通道号筛选通话记录合集 foreach (var item in feiKuns) { if ((item.Chnl1 == e1.Chnl1 && item.Chnl2 == e1.Chnl2) || (item.Chnl1 == e1.Chnl2 && item.Chnl2 == e1.Chnl1)) { list.Add(item); } } if (list.Count <= 0) { return(null); } //再根据通话时长筛选通话记录集合 foreach (var item1 in list) { if (DataSpanAnalyze(item1, e1) > 0) { list1.Add(item1); } } if (list1.Count <= 0) { return(null); } //最后根据开始时间结束时间模糊定位通话记录集合 foreach (var item2 in list1) { int Das = DataSpanAnalyze(item2, e1); TimeSpan stimefeikun = Convert.ToDateTime(item2.DtStart).TimeOfDay; TimeSpan stimee1 = Convert.ToDateTime(e1.DateStart).TimeOfDay; TimeSpan etimefeikun = Convert.ToDateTime(item2.DtEnd).TimeOfDay; TimeSpan etimee1 = Convert.ToDateTime(e1.DateEnd).TimeOfDay; switch (Das) { case 1: //时长一样 if (stimefeikun == stimee1 && etimefeikun == etimee1) { item2.Matching = 100; list2.Add(item2); } else if (stimefeikun < stimee1 && etimefeikun < etimee1 && etimefeikun > stimee1) { list2.Add(item2); } else if (stimefeikun > stimee1 && etimefeikun > etimee1 && stimefeikun < etimee1) { list2.Add(item2); } else { } break; case 2: //FeiKun记录时长 大于 E1记录时长 if (stimefeikun < stimee1 && System.Math.Abs(TimeSpan.Compare(etimefeikun, etimee1)) <= DistanceTime) { list2.Add(item2); } else if (System.Math.Abs(TimeSpan.Compare(stimefeikun, stimee1)) <= DistanceTime && etimefeikun > etimee1) { list2.Add(item2); } else if (stimefeikun > stimee1 && etimefeikun < etimee1) { list2.Add(item2); } else { } break; case 3: //FeiKun记录时长 小于 E1记录时长 if (stimefeikun < stimee1 && etimefeikun < etimee1 && etimefeikun > stimee1) { list2.Add(item2); } else if (stimefeikun > stimee1 && stimefeikun < etimee1 && etimefeikun > etimee1) { list2.Add(item2); } else if (stimefeikun < stimee1 && etimefeikun > etimee1) { list2.Add(item2); } else { } break; default: break; } } return(null); }