2 次代码提交 e7de08ac75 ... ca0f3437a5

作者 SHA1 备注 提交日期
  田爽 ca0f3437a5 Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test 4 天之前
  田爽 4e79d10aab 重构回访统计逻辑,优化查询性能 4 天之前

+ 11 - 3
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -3267,11 +3267,19 @@ namespace Hotline.Api.Controllers.Bi
                   CallVisitd = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState == EVisitState.Visited && x.VisitType == EVisitType.CallVisit, 1, 0)),// 已回访--电话
                   SmsVisitd = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState == EVisitState.Visited && x.VisitType == EVisitType.SmsVisit, 1, 0)),//已回访--短信
                   OtherVisitd = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState == EVisitState.Visited && x.VisitType != EVisitType.CallVisit && x.VisitType != EVisitType.SmsVisit, 1, 0)),//其他回访
-                  WaitVisitd = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState != EVisitState.None && x.VisitState != EVisitState.Visited, 1, 0)),//待回访
+                  //WaitVisitd = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState != EVisitState.None && x.VisitState != EVisitState.Visited, 1, 0)),//待回访
               }).FirstAsync();
 
-            //部门
-            var listOrg = await _orderVisitDetailRepository.Queryable()
+            var WaitVisitd = await _orderVisitRepository.Queryable()
+			  .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
+			  .WhereIF(IdentityType.HasValue, (x, o) => o.IdentityType == IdentityType)
+			  .Where((x, o) => x.CreationTime >= StartTime && x.CreationTime <= EndTime).Select((x, o) => 
+                    SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitState != EVisitState.None && x.VisitState != EVisitState.Visited, 1, 0)) //待回访
+               ).FirstAsync();
+            centerReportVisitd.WaitVisitd = WaitVisitd;
+
+			//部门
+			var listOrg = await _orderVisitDetailRepository.Queryable()
                 .LeftJoin<OrderVisit>((x, ov) => x.VisitId == ov.Id)
                 .LeftJoin<Order>((x, ov, o) => ov.OrderId == o.Id)
                 .WhereIF(IdentityType.HasValue, (x, ov, o) => o.IdentityType == IdentityType)

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -1,7 +1,7 @@
 {
   "AllowedHosts": "*",
   "AppConfiguration": {
-    "AppScope": "YiBin",
+    "AppScope": "LuZhou",
     "YiBin": {
       "AreaCode": "511500",
       "CallCenterType": "TianRun", //XunShi、WeiErXin、TianRun、XingTang