Преглед изворни кода

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test
合并冲突

guqiang пре 1 дан
родитељ
комит
196241d4fa

+ 5 - 1
src/Hotline.Application/StatisticalReport/CallReport/CallReportApplicationBase.cs

@@ -20,6 +20,7 @@ using JiebaNet.Segmenter.Common;
 using XingTang.Sdk;
 using Mapster;
 using NPOI.SS.Formula.Functions;
+using System.Linq;
 
 namespace Hotline.Application.StatisticalReport.CallReport;
 
@@ -175,11 +176,14 @@ public abstract class CallReportApplicationBase : ICallReportApplication
         int effectiveTimes = _systemSettingCacheManager.EffectiveTimes;
         //接通秒挂时间
         int connectByeTimes = _systemSettingCacheManager.ConnectByeTimes;
+        var setting = _systemSettingCacheManager.GetSetting(SettingConstants.RoleZuoXi).SettingValue;
 
         var recordPrefix = _systemSettingCacheManager.RecordPrefix;
         var query = _callNativeRepository.Queryable(includeDeleted: true)
                 .LeftJoin<Order>((p, o) => p.Id == o.CallId)
+                .RightJoin<User>((p, o, u) => p.UserId == u.Id && !u.IsDeleted)
                 .Where((p, o) => p.BeginIvrTime >= dto.StartTime && p.BeginIvrTime <= dto.EndTime && p.CallState != ECallState.Invalid)
+                .Where((p, o, u) => u.Roles.Any(x => setting.Contains(x.Name)))
                 .WhereIF(!string.IsNullOrEmpty(dto.UserId), (p, o) => p.UserId == dto.UserId)
                 .WhereIF(!string.IsNullOrEmpty(dto.UserName), (p, o) => p.UserName == dto.UserName)
                 .WhereIF(dto.FieldName == "inTotal", (p, o) => p.Direction == ECallDirection.In)                                                                                   //呼入总量
@@ -191,7 +195,7 @@ public abstract class CallReportApplicationBase : ICallReportApplication
                 .WhereIF(dto.FieldName == "outTotal", (p, o) => p.Direction == ECallDirection.Out)                                                                                 //呼出总量
                 .WhereIF(dto.FieldName == "outAnswered", (p, o) => p.Direction == ECallDirection.Out && p.AnsweredTime != null)                                                    //呼出接通量
                 .OrderByDescending((p, o) => p.BeginIvrTime)
-                .Select((p, o) => new CallRecordOutDto
+                .Select((p, o, u) => new CallRecordOutDto
                 {
                     OtherAccept = p.Id,
                     OrderId = o.Id,

+ 22 - 20
src/Hotline.Application/StatisticalReport/CallReport/YiBinCallReportApplication.cs

@@ -153,27 +153,29 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         var recordPrefix = _systemSettingCacheManager.RecordPrefix;
         var query = _trCallRecordRepository.Queryable()
                  .Includes(p => p.Order)
-                 .Where(p => p.CreatedTime >= dto.StartTime && p.CreatedTime <= dto.EndTime)
-                 .WhereIF(!string.IsNullOrEmpty(dto.UserId), p => p.UserId == dto.UserId)
-                 .WhereIF(!string.IsNullOrEmpty(dto.UserName), p => p.UserName == dto.UserName)
-                 .WhereIF(dto.FieldName == "inTotal", p => p.CallDirection == ECallDirection.In)                                                                                   //呼入总量
-                 .WhereIF(dto.FieldName == "inAnswered", p => p.CallDirection == ECallDirection.In && p.AnsweredTime != null)                                                      //接通总量
-                 .WhereIF(dto.FieldName == "inHangupImmediate", p => p.CallDirection == ECallDirection.In && p.AnsweredTime == null && p.RingTimes < noConnectByeTimes)            //呼入秒挂
-                 .WhereIF(dto.FieldName == "inHanguped", p => p.CallDirection == ECallDirection.In && p.AnsweredTime == null && p.RingTimes > ringTims)                            //呼入超时未接
-                 .WhereIF(dto.FieldName == "inAvailableAnswer", p => p.CallDirection == ECallDirection.In && p.AnsweredTime != null && p.Duration >= effectiveTimes)               //有效接通量
-                 .WhereIF(dto.FieldName == "inHangupImmediateWhenAnswered", p => p.CallDirection == ECallDirection.In && p.AnsweredTime != null && p.Duration < connectByeTimes)   //接通秒挂
-                 .WhereIF(dto.FieldName == "outTotal", p => p.CallDirection == ECallDirection.Out)                                                                                 //呼出总量
-                 .WhereIF(dto.FieldName == "outAnswered", p => p.CallDirection == ECallDirection.Out && p.AnsweredTime != null)                                                    //呼出接通量
-                 .OrderByDescending(p => p.BeginIvrTime)
-                 .Select(m => new CallRecordOutDto()
+                 .LeftJoin<User>((p, u) => p.UserId == u.Id && !u.IsDeleted)
+                 .Where((p, u) => p.CreatedTime >= dto.StartTime && p.CreatedTime <= dto.EndTime)
+                 .Where((p, u) => u.Roles.Any(x => setting.Contains(x.Name)))
+                 .WhereIF(!string.IsNullOrEmpty(dto.UserId), (p, u) => p.UserId == dto.UserId)
+                 .WhereIF(!string.IsNullOrEmpty(dto.UserName), (p, u) => p.UserName == dto.UserName)
+                 .WhereIF(dto.FieldName == "inTotal", (p, u) => p.CallDirection == ECallDirection.In)                                                                                   //呼入总量
+                 .WhereIF(dto.FieldName == "inAnswered", (p, u) => p.CallDirection == ECallDirection.In && p.AnsweredTime != null)                                                      //接通总量
+                 .WhereIF(dto.FieldName == "inHangupImmediate", (p, u) => p.CallDirection == ECallDirection.In && p.AnsweredTime == null && p.RingTimes < noConnectByeTimes)            //呼入秒挂
+                 .WhereIF(dto.FieldName == "inHanguped", (p, u) => p.CallDirection == ECallDirection.In && p.AnsweredTime == null && p.RingTimes > ringTims)                            //呼入超时未接
+                 .WhereIF(dto.FieldName == "inAvailableAnswer", (p, u) => p.CallDirection == ECallDirection.In && p.AnsweredTime != null && p.Duration >= effectiveTimes)               //有效接通量
+                 .WhereIF(dto.FieldName == "inHangupImmediateWhenAnswered", (p, u) => p.CallDirection == ECallDirection.In && p.AnsweredTime != null && p.Duration < connectByeTimes)   //接通秒挂
+                 .WhereIF(dto.FieldName == "outTotal", (p, u) => p.CallDirection == ECallDirection.Out)                                                                                 //呼出总量
+                 .WhereIF(dto.FieldName == "outAnswered", (p, u) => p.CallDirection == ECallDirection.Out && p.AnsweredTime != null)                                                    //呼出接通量
+                 .OrderByDescending((p, u) => p.BeginIvrTime)
+                 .Select(p => new CallRecordOutDto()
                  {
-                     FromNo = m.CPN,
-                     ToNo = m.CDPN,
-                     Direction = m.CallDirection,
-                     EndTime = m.OverTime,
-                     OrderId = m.Order.Id,
-                     OrderTitle = m.Order.Title,
-                     OrderNo = m.Order.No
+                     FromNo = p.CPN,
+                     ToNo = p.CDPN,
+                     Direction = p.CallDirection,
+                     EndTime = p.OverTime,
+                     OrderId = p.Order.Id,
+                     OrderTitle = p.Order.Title,
+                     OrderNo = p.Order.No
                  }, true);
 
         if (isAll)