Эх сурвалжийг харах

Merge branch 'master' of http://git.12345lm.cn/Fengwo/hotline

TANG JIANG 1 жил өмнө
parent
commit
3399844a83

+ 12 - 5
src/Hotline.Api/Controllers/OrderController.cs

@@ -28,6 +28,7 @@ using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Push;
 using Hotline.Share.Dtos.Push;
 using Hotline.Share.Dtos.Settings;
 using Hotline.Share.Dtos.Settings;
+using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Push;
 using Hotline.Share.Enums.Push;
@@ -3454,11 +3455,17 @@ public class OrderController : BaseController
             .Where(x => x.OrderVisit.Order.Contact == phone && (SqlFunc.JsonField(x.OrgProcessingResults, "Value") == "不满意" ||
             .Where(x => x.OrderVisit.Order.Contact == phone && (SqlFunc.JsonField(x.OrgProcessingResults, "Value") == "不满意" ||
                                                                 SqlFunc.JsonField(x.OrgProcessingResults, "Value") == "非常不满意"))
                                                                 SqlFunc.JsonField(x.OrgProcessingResults, "Value") == "非常不满意"))
             .Distinct().Select(x => new { x.OrderVisit.OrderId }).CountAsync();
             .Distinct().Select(x => new { x.OrderVisit.OrderId }).CountAsync();
-		//来电历史
-		var allCallNum = await _trCallRecordRepository.Queryable().Where(x => x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.CPN == phone).CountAsync();
-		var connectNum = await _trCallRecordRepository.Queryable().Where(x => x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.CPN == phone && x.Duration > 0).CountAsync();
-		var callBackNum = await _trCallRecordRepository.Queryable().Where(x => x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out && x.CPN == phone).CountAsync();
-
+        //来电历史
+        var callsHistory = await _trCallRecordRepository.Queryable().Where(x => x.CPN == phone).ToListAsync();
+        var allCallNum = 0;
+        var connectNum = 0;
+        var callBackNum = 0;
+        if (callsHistory != null && callsHistory.Any())
+        {
+			 allCallNum = callsHistory.Count(x => x.CallDirection == ECallDirection.In);
+			 connectNum = callsHistory.Count(x => x.CallDirection == ECallDirection.In && x.Duration > 0);
+			 callBackNum = callsHistory.Count(x => x.CallDirection == ECallDirection.Out);
+		}
 		//关注诉求
 		//关注诉求
 		var hotspotNames = string.Join(",", oders.Select(x => x.HotspotName).Distinct().Take(5).ToList());
 		var hotspotNames = string.Join(",", oders.Select(x => x.HotspotName).Distinct().Take(5).ToList());
         var rsp = new
         var rsp = new