|
@@ -66,10 +66,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
private readonly IRepository<SystemArea> _systemAreaRepository;
|
|
|
private readonly IRepository<Hotspot> _hotspotRepository;
|
|
|
private readonly IRepository<WorkflowStep> _workflowStepRepository;
|
|
|
-
|
|
|
|
|
|
|
|
|
- public OrderApplication(
|
|
|
+
|
|
|
+ public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowDomainService workflowDomainService,
|
|
@@ -90,7 +90,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<SystemArea> systemAreaRepository,
|
|
|
IRepository<Hotspot> hotspotRepository,
|
|
|
IRepository<WorkflowStep> workflowStepRepository
|
|
|
- )
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_workflowDomainService = workflowDomainService;
|
|
@@ -106,20 +106,20 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderVisitDetailRepository = orderVisitDetailRepository;
|
|
|
_qualityApplication = qualityApplication;
|
|
|
_capPublisher = capPublisher;
|
|
|
- _systemOrganizeRepository = systemOrganizeRepository;
|
|
|
- _workflowCountersignRepository = workflowCountersignRepository;
|
|
|
+ _systemOrganizeRepository = systemOrganizeRepository;
|
|
|
+ _workflowCountersignRepository = workflowCountersignRepository;
|
|
|
_orderSpecialDetailRepository = orderSpecialDetailRepository;
|
|
|
_systemAreaRepository = systemAreaRepository;
|
|
|
_hotspotRepository = hotspotRepository;
|
|
|
_workflowStepRepository = workflowStepRepository;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新工单办理期满时间(延期调用,其他不调用)
|
|
|
/// 1.更新工单 2.更新流程 3.推送省平台
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public async Task DelayOrderExpiredTimeAsync(string orderId, int timeCount, ETimeType timeType,bool IsProDelay, CancellationToken cancellationToken)
|
|
|
+ public async Task DelayOrderExpiredTimeAsync(string orderId, int timeCount, ETimeType timeType, bool IsProDelay, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var order = await _orderDomainService.GetOrderAsync(orderId, cancellationToken: cancellationToken);
|
|
|
var expiredTimeConfig =
|
|
@@ -213,25 +213,25 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> GetAboutToExpireAsync(AboutToExpireListDto dto)
|
|
|
{
|
|
|
- //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.OrderAboutToExpire);
|
|
|
- //var value = setting?.SettingValue[0];
|
|
|
- //value = string.IsNullOrEmpty(value) ? "0" : value;
|
|
|
- //DateTime stTime = DateTime.Now.AddDays(int.Parse(value));
|
|
|
- //stTime = _timeLimitDomainService.WorkDay(stTime);
|
|
|
- //DateTime stTime2 = _timeLimitDomainService.WorkDay(DateTime.Now);
|
|
|
- DateTime? dateTime = DateTime.Now;
|
|
|
- var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
-
|
|
|
- return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
+ //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.OrderAboutToExpire);
|
|
|
+ //var value = setting?.SettingValue[0];
|
|
|
+ //value = string.IsNullOrEmpty(value) ? "0" : value;
|
|
|
+ //DateTime stTime = DateTime.Now.AddDays(int.Parse(value));
|
|
|
+ //stTime = _timeLimitDomainService.WorkDay(stTime);
|
|
|
+ //DateTime stTime2 = _timeLimitDomainService.WorkDay(DateTime.Now);
|
|
|
+ DateTime? dateTime = DateTime.Now;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+
|
|
|
+ return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
.WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No.Contains(dto.No!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), d => d.Title.Contains(dto.Title!))
|
|
|
.WhereIF(dto.Delay.HasValue && dto.Delay == 1, d => d.OrderDelays.Any() == true)
|
|
|
.WhereIF(dto.Delay.HasValue && dto.Delay == 2, d => d.OrderDelays.Any() == false)
|
|
|
- //&& stTime >= d.ExpiredTime.Value && stTime2 <= d.ExpiredTime.Value
|
|
|
- //.Where(d => d.ExpiredTime != null &&
|
|
|
- // d.Status != EOrderStatus.Filed && d.Status != EOrderStatus.Published && d.Status != EOrderStatus.Visited && stTime >= d.ExpiredTime.Value && stTime2 <= d.ExpiredTime.Value)
|
|
|
- .Where(d=>d.Status < EOrderStatus.Filed && (dateTime > d.NearlyExpiredTimeOne || dateTime > d.NearlyExpiredTime) && dateTime < d.ExpiredTime)
|
|
|
+ //&& stTime >= d.ExpiredTime.Value && stTime2 <= d.ExpiredTime.Value
|
|
|
+ //.Where(d => d.ExpiredTime != null &&
|
|
|
+ // d.Status != EOrderStatus.Filed && d.Status != EOrderStatus.Published && d.Status != EOrderStatus.Visited && stTime >= d.ExpiredTime.Value && stTime2 <= d.ExpiredTime.Value)
|
|
|
+ .Where(d => d.Status < EOrderStatus.Filed && (dateTime > d.NearlyExpiredTimeOne || dateTime > d.NearlyExpiredTime) && dateTime < d.ExpiredTime)
|
|
|
.OrderByDescending(d => d.CreationTime);
|
|
|
}
|
|
|
|
|
@@ -273,7 +273,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
DateTime stTime = _timeLimitDomainService.WorkDay(DateTime.Now);
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
- return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
+ return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
.WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
//.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.No.Contains(dto.No))
|
|
@@ -313,23 +313,23 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// </summary>
|
|
|
/// <param name="inputStr"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task OrderParticiple(string inputStr, string orderId,DateTime time, CancellationToken cancellationToken)
|
|
|
+ public async Task OrderParticiple(string inputStr, string orderId, DateTime time, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var seg = new Segment();
|
|
|
- ICollection<WordInfo> splitWords = seg.DoSegment(inputStr);
|
|
|
+ ICollection<WordInfo> splitWords = seg.DoSegment(inputStr);
|
|
|
var words = new List<string>();
|
|
|
for (int i = 0; i < splitWords.Count; i++)
|
|
|
{
|
|
|
var word = splitWords.ElementAt(i);
|
|
|
- if (word is { WordType: WordType.SimplifiedChinese, Word.Length: > 1 } )
|
|
|
- words.Add(splitWords.ElementAt(i).Word);
|
|
|
- }
|
|
|
+ if (word is { WordType: WordType.SimplifiedChinese, Word.Length: > 1 })
|
|
|
+ words.Add(splitWords.ElementAt(i).Word);
|
|
|
+ }
|
|
|
if (words.Any())
|
|
|
{
|
|
|
- var vector = await _repositoryts.SearchAsync(orderId, cancellationToken);
|
|
|
- if (vector != null && vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
|
|
|
- else await _repositoryts.AddVectorAsync(orderId, time, words, cancellationToken);
|
|
|
- }
|
|
|
+ var vector = await _repositoryts.SearchAsync(orderId, cancellationToken);
|
|
|
+ if (vector != null && vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
|
|
|
+ else await _repositoryts.AddVectorAsync(orderId, time, words, cancellationToken);
|
|
|
+ }
|
|
|
//var words = await _orderWrodRepository.Queryable().Where(x => x.IsEnable == 1 && x.Classify.Contains("普通标签")).Select(x => x.Tag).ToListAsync(cancellationToken);
|
|
|
//var res = new List<string>();
|
|
|
//if (words.Any()) res = ParticipleTool.SegMMDouble(inputStr, ref words);
|
|
@@ -523,11 +523,17 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.IdentityType != null, d => d.IdentityType == dto.IdentityType) //来电主体
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.FromName), d => d.FromName == dto.FromName) //来电人姓名
|
|
|
.WhereIF(dto.AreaCodes.Any(), d => dto.AreaCodes.Contains(d.AreaCode)) //区域
|
|
|
- .WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == true, d => d.IsProvince == true)
|
|
|
- .WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == false, d => d.IsProvince == false)
|
|
|
+ .WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == true, d => d.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == false, d => d.Source != ESource.ProvinceStraight)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.SensitiveWord), d => SqlFunc.JsonArrayAny(d.Sensitive, dto.SensitiveWord))
|
|
|
.WhereIF(dto.IsSensitiveWord.HasValue && dto.IsSensitiveWord == true, d => d.Sensitive != null && SqlFunc.JsonArrayLength(d.Sensitive) > 0)
|
|
|
- .WhereIF(dto.IsUrgent.HasValue , d=>d.IsUrgent == dto.IsUrgent.Value)
|
|
|
+ .WhereIF(dto.IsUrgent.HasValue, d => d.IsUrgent == dto.IsUrgent.Value)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ProvinceChannel) && dto.ProvinceChannel == "1", d => d.Source == ESource.ProvinceStraight &&
|
|
|
+ d.SourceChannelCode == "SZMHD" && d.IsProvince == false)//政民互动直派
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ProvinceChannel) && dto.ProvinceChannel == "2", d => d.Source == ESource.ProvinceStraight &&
|
|
|
+ d.SourceChannelCode == "SZMHD" && d.IsProvince == true)//政民互动
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ProvinceChannel) && dto.ProvinceChannel == "3", d => d.Source == ESource.ProvinceStraight &&
|
|
|
+ d.SourceChannelCode == "S12345" && d.IsProvince == true)//省12345
|
|
|
.OrderByDescending(d => d.CreationTime);
|
|
|
}
|
|
|
|
|
@@ -570,12 +576,12 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(d => d.SourceChannel != null && d.SourceChannel != "");
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 信件来源统计明细
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<Order> QueryOrderSourceDetail(QueryOrderSourceDetailRequest dto)
|
|
|
+ /// <summary>
|
|
|
+ /// 信件来源统计明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<Order> QueryOrderSourceDetail(QueryOrderSourceDetailRequest dto)
|
|
|
{
|
|
|
|
|
|
return _orderRepository.Queryable()
|
|
@@ -585,78 +591,78 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(d => d.SourceChannel != null && d.SourceChannel != "");
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 部门超期统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderBiOrgDataListVo> QueryOrgDataList(ReportPagedRequest dto)
|
|
|
+ /// <summary>
|
|
|
+ /// 部门超期统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderBiOrgDataListVo> QueryOrgDataList(ReportPagedRequest dto)
|
|
|
{
|
|
|
- if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
+ if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+
|
|
|
+
|
|
|
+ var queryOrder = _systemOrganizeRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((x, o) => x.Id == o.ActualHandleOrgCode)
|
|
|
+ .WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
+ .GroupBy((x, o) => new { x.Id, x.Name })
|
|
|
+ .Select((x, o) => new OrderBiOrgDataListVo
|
|
|
+ {
|
|
|
+ OrgName = x.Name,
|
|
|
+ OrgId = x.Id,
|
|
|
+ HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status >= EOrderStatus.Filed && o.ExpiredTime < o.FiledTime, 1, 0)),
|
|
|
+ NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status < EOrderStatus.Filed && o.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
+ }).MergeTable();
|
|
|
+
|
|
|
+ var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
+ .Where(x => x.CountersignPosition != ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .GroupBy(x => x.HandlerOrgId)
|
|
|
+ .Select(x => new OrderBiOrgDataListVo
|
|
|
+ {
|
|
|
+ OrgId = x.HandlerOrgId,
|
|
|
+ CounterHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime, 1, 0)),
|
|
|
+ CounterNoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
+ }).MergeTable();
|
|
|
+
|
|
|
+ var query = queryOrder.LeftJoin(queryCountersign, (or, co) => or.OrgId == co.OrgId)
|
|
|
+ //.LeftJoin<SystemOrganize>((or, co, so) => or.OrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) == so.Id)
|
|
|
+ .LeftJoin<SystemOrganize>((or, co, so) => or.OrgId == so.Id && so.Level == 1)
|
|
|
+ .GroupBy((or, co, so) => new { so.Id, so.Name })
|
|
|
+ .Select((or, co, so) => new OrderBiOrgDataListVo
|
|
|
+ {
|
|
|
+ OrgName = so.Name,
|
|
|
+ OrgId = so.Id,
|
|
|
+ HandlerExtendedNum = SqlFunc.AggregateSum(or.HandlerExtendedNum),
|
|
|
+ NoHandlerExtendedNum = SqlFunc.AggregateSum(or.NoHandlerExtendedNum),
|
|
|
+ CounterHandlerExtendedNum = SqlFunc.AggregateSum(co.CounterHandlerExtendedNum),
|
|
|
+ CounterNoHandlerExtendedNum = SqlFunc.AggregateSum(co.CounterNoHandlerExtendedNum)
|
|
|
+ }).MergeTable();
|
|
|
|
|
|
- var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
-
|
|
|
-
|
|
|
- var queryOrder = _systemOrganizeRepository.Queryable()
|
|
|
- .LeftJoin<Order>((x, o) => x.Id == o.ActualHandleOrgCode)
|
|
|
- .WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
- .GroupBy((x, o) => new { x.Id, x.Name })
|
|
|
- .Select((x, o) => new OrderBiOrgDataListVo
|
|
|
- {
|
|
|
- OrgName = x.Name,
|
|
|
- OrgId = x.Id,
|
|
|
- HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status >= EOrderStatus.Filed && o.ExpiredTime < o.FiledTime, 1, 0)),
|
|
|
- NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status < EOrderStatus.Filed && o.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
- }).MergeTable();
|
|
|
-
|
|
|
- var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
- .Where(x=>x.CountersignPosition != ECountersignPosition.None)
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- .GroupBy(x => x.HandlerOrgId)
|
|
|
- .Select(x => new OrderBiOrgDataListVo
|
|
|
- {
|
|
|
- OrgId = x.HandlerOrgId,
|
|
|
- CounterHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime, 1, 0)),
|
|
|
- CounterNoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
- }).MergeTable();
|
|
|
-
|
|
|
- var query = queryOrder.LeftJoin(queryCountersign, (or, co) => or.OrgId == co.OrgId)
|
|
|
- //.LeftJoin<SystemOrganize>((or, co, so) => or.OrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) == so.Id)
|
|
|
- .LeftJoin<SystemOrganize>((or, co, so) => or.OrgId == so.Id && so.Level == 1)
|
|
|
- .GroupBy((or, co, so) => new { so.Id, so.Name })
|
|
|
- .Select((or, co, so) => new OrderBiOrgDataListVo
|
|
|
- {
|
|
|
- OrgName = so.Name,
|
|
|
- OrgId = so.Id,
|
|
|
- HandlerExtendedNum = SqlFunc.AggregateSum(or.HandlerExtendedNum),
|
|
|
- NoHandlerExtendedNum = SqlFunc.AggregateSum(or.NoHandlerExtendedNum),
|
|
|
- CounterHandlerExtendedNum = SqlFunc.AggregateSum(co.CounterHandlerExtendedNum),
|
|
|
- CounterNoHandlerExtendedNum = SqlFunc.AggregateSum(co.CounterNoHandlerExtendedNum)
|
|
|
- }).MergeTable();
|
|
|
-
|
|
|
- query = query.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.OrgName.Contains(dto.Keyword!)).Where(x => x.HandlerExtendedNum > 0 || x.NoHandlerExtendedNum > 0 || x.CounterHandlerExtendedNum > 0 || x.CounterNoHandlerExtendedNum > 0);
|
|
|
- switch (dto.SortField)
|
|
|
- {
|
|
|
- case "handlerExtendedNum":
|
|
|
- query = dto.SortRule is 0 ? query.OrderBy(x => x.HandlerExtendedNum) : query.OrderByDescending(x => x.HandlerExtendedNum);
|
|
|
- break;
|
|
|
- case "counterHandlerExtendedNum":
|
|
|
- query = dto.SortRule is 0 ? query.OrderBy(x => x.CounterHandlerExtendedNum) : query.OrderByDescending(x => x.CounterHandlerExtendedNum);
|
|
|
- break;
|
|
|
- case "noHandlerExtendedNum":
|
|
|
- query = dto.SortRule is 0 ? query.OrderBy(x => x.NoHandlerExtendedNum) : query.OrderByDescending(x => x.NoHandlerExtendedNum);
|
|
|
- break;
|
|
|
- case "counterNoHandlerExtendedNum":
|
|
|
- query = dto.SortRule is 0 ? query.OrderBy(x => x.CounterNoHandlerExtendedNum) : query.OrderByDescending(x => x.CounterNoHandlerExtendedNum);
|
|
|
- break;
|
|
|
- }
|
|
|
+ query = query.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.OrgName.Contains(dto.Keyword!)).Where(x => x.HandlerExtendedNum > 0 || x.NoHandlerExtendedNum > 0 || x.CounterHandlerExtendedNum > 0 || x.CounterNoHandlerExtendedNum > 0);
|
|
|
+ switch (dto.SortField)
|
|
|
+ {
|
|
|
+ case "handlerExtendedNum":
|
|
|
+ query = dto.SortRule is 0 ? query.OrderBy(x => x.HandlerExtendedNum) : query.OrderByDescending(x => x.HandlerExtendedNum);
|
|
|
+ break;
|
|
|
+ case "counterHandlerExtendedNum":
|
|
|
+ query = dto.SortRule is 0 ? query.OrderBy(x => x.CounterHandlerExtendedNum) : query.OrderByDescending(x => x.CounterHandlerExtendedNum);
|
|
|
+ break;
|
|
|
+ case "noHandlerExtendedNum":
|
|
|
+ query = dto.SortRule is 0 ? query.OrderBy(x => x.NoHandlerExtendedNum) : query.OrderByDescending(x => x.NoHandlerExtendedNum);
|
|
|
+ break;
|
|
|
+ case "counterNoHandlerExtendedNum":
|
|
|
+ query = dto.SortRule is 0 ? query.OrderBy(x => x.CounterNoHandlerExtendedNum) : query.OrderByDescending(x => x.CounterNoHandlerExtendedNum);
|
|
|
+ break;
|
|
|
+ }
|
|
|
return query;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 部门超期统计明细
|
|
@@ -664,100 +670,100 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListDetailRequest dto)
|
|
|
- {
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
var quer = _orderRepository.Queryable()
|
|
|
- .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
- .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
//.WhereIF(dto.Statuses.Any(), x => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
.WhereIF(dto.QueryType == 1, (x, so) => x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) //业务已办超期
|
|
|
.WhereIF(dto.QueryType == 3, (x, so) => x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()) //业务待办超期
|
|
|
.WhereIF(dto.QueryType == 5, (x, so) =>
|
|
|
(x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) , (x, so) => x.ActualHandleOrgCode == dto.OrgCode)
|
|
|
- .Select(x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
- if (dto.QueryType is 2 or 4 )
|
|
|
- {
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode), (x, so) => x.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .Select(x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
+ if (dto.QueryType is 2 or 4)
|
|
|
+ {
|
|
|
var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
.Includes(x => x.Workflow)
|
|
|
.InnerJoin<SystemOrganize>((x, so) => x.HandlerOrgId == so.Id && so.Level == 1)
|
|
|
- .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
+ .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
.Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
.WhereIF(dto.QueryType == 2, (x, so) => x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime) //会签已办超期
|
|
|
.WhereIF(dto.QueryType == 4, (x, so) => x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate())//会签待办超期
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) , (x, so) => x.HandlerOrgId == dto.OrgCode)
|
|
|
- .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode), (x, so) => x.HandlerOrgId == dto.OrgCode)
|
|
|
+ .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
.Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
|
|
|
|
- quer = _orderRepository.Queryable().InnerJoin(queryCountersign, (o, w) => o.Id == w.Id)
|
|
|
- .Select((o, w) => new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
- //quer = _orderRepository.UnionAll(quer, queryCountersignOrder);
|
|
|
- }
|
|
|
+ quer = _orderRepository.Queryable().InnerJoin(queryCountersign, (o, w) => o.Id == w.Id)
|
|
|
+ .Select((o, w) => new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
+ //quer = _orderRepository.UnionAll(quer, queryCountersignOrder);
|
|
|
+ }
|
|
|
return quer;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 部门超期统计明细
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListAllDetailRequest dto)
|
|
|
- {
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
- bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ /// <summary>
|
|
|
+ /// 部门超期统计明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListAllDetailRequest dto)
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
- var quer = _orderRepository.Queryable()
|
|
|
- .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
- .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ var quer = _orderRepository.Queryable()
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
.WhereIF(dto.Statuses.Any(), (x, so) => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
- .WhereIF( dto.ExpiredType is 2, (x, so) => x.OrderDelays.Any(x=> x.DelayState == EDelayState.Pass))
|
|
|
+ .WhereIF(dto.ExpiredType is 2, (x, so) => x.OrderDelays.Any(x => x.DelayState == EDelayState.Pass))
|
|
|
.Where((x, so) =>
|
|
|
- (x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
+ (x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
.WhereIF(IsCenter == false, (x, so) => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName) , (x, so) => x.AcceptorOrgName == dto.OrgName)
|
|
|
- .Select( x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), (x, so) => x.AcceptorOrgName == dto.OrgName)
|
|
|
+ .Select(x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
|
|
|
var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
- .Includes(x => x.Workflow)
|
|
|
+ .Includes(x => x.Workflow)
|
|
|
.InnerJoin<SystemOrganize>((x, so) => x.HandlerOrgId == so.Id && so.Level == 1)
|
|
|
- .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
- .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
- .Where((x, so) => (x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime)||(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(IsCenter == false, (x, so) => x.HandlerOrgId == _sessionContext.RequiredOrgId)
|
|
|
- .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
- .Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
|
+ .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ .Where((x, so) => (x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime) || (x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate()))
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => x.HandlerOrgId == _sessionContext.RequiredOrgId)
|
|
|
+ .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
+ .Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
|
|
|
|
var queryCountersignOrder = _orderRepository.Queryable().InnerJoin(queryCountersign, (o, w) => o.Id == w.Id)
|
|
|
- .Select((o,w)=> new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
- quer = _orderRepository.UnionAll(quer, queryCountersignOrder).MergeTable().InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id);
|
|
|
- return quer;
|
|
|
- }
|
|
|
+ .Select((o, w) => new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
+ quer = _orderRepository.UnionAll(quer, queryCountersignOrder).MergeTable().InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id);
|
|
|
+ return quer;
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 回退错件统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderReTransactVo> OrderReTransact(QueryOrderReTransactRequest dto)
|
|
|
+ /// <summary>
|
|
|
+ /// 回退错件统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderReTransactVo> OrderReTransact(QueryOrderReTransactRequest dto)
|
|
|
{
|
|
|
|
|
|
- return _orderSpecialDetailRepository.Queryable()
|
|
|
- .Includes(x => x.OrderSpecial)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
- .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
- .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
- .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime)
|
|
|
- .GroupBy(x => new { Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"), x.OrgId, x.OrgName })
|
|
|
- .Select(x => new OrderReTransactVo
|
|
|
- {
|
|
|
- Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"),
|
|
|
- OrgId = x.OrgId,
|
|
|
- OrgName = x.OrgName,
|
|
|
- Num = SqlFunc.AggregateCount(1)
|
|
|
- }).MergeTable()
|
|
|
- .OrderByIF(dto.SortRule is 0, x => x.Num, OrderByType.Asc)
|
|
|
- .OrderByIF(dto.SortRule is 1, x => x.Num, OrderByType.Desc); ;
|
|
|
+ return _orderSpecialDetailRepository.Queryable()
|
|
|
+ .Includes(x => x.OrderSpecial)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
+ .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime)
|
|
|
+ .GroupBy(x => new { Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"), x.OrgId, x.OrgName })
|
|
|
+ .Select(x => new OrderReTransactVo
|
|
|
+ {
|
|
|
+ Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"),
|
|
|
+ OrgId = x.OrgId,
|
|
|
+ OrgName = x.OrgName,
|
|
|
+ Num = SqlFunc.AggregateCount(1)
|
|
|
+ }).MergeTable()
|
|
|
+ .OrderByIF(dto.SortRule is 0, x => x.Num, OrderByType.Asc)
|
|
|
+ .OrderByIF(dto.SortRule is 1, x => x.Num, OrderByType.Desc); ;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 回退错件明细统计
|
|
@@ -767,169 +773,170 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
public ISugarQueryable<OrderSpecialDetail> QueryOrderSourceDetail(QueryOrderReTransactDetailRequest dto)
|
|
|
{
|
|
|
|
|
|
- return _orderSpecialDetailRepository.Queryable()
|
|
|
- .Includes(x => x.OrderSpecial, s => s.Order)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.ErrorName), x => x.ErrorName.Contains(dto.ErrorName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderSpecial!.Order!.No!.Contains(dto.No!))
|
|
|
- .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
- .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
- .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime);
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 部门满意度统计
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgSatisfactionStatistics(PagedKeywordSonRequest dto) {
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ return _orderSpecialDetailRepository.Queryable()
|
|
|
+ .Includes(x => x.OrderSpecial, s => s.Order)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ErrorName), x => x.ErrorName.Contains(dto.ErrorName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderSpecial!.Order!.No!.Contains(dto.No!))
|
|
|
+ .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 部门满意度统计
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgSatisfactionStatistics(PagedKeywordSonRequest dto)
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
- bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
- var list = _orderVisitDetailRepository.Queryable()
|
|
|
- .Where(x => x.OrderVisit.VisitTime >= dto.StartTime.Value && x.OrderVisit.VisitTime <= dto.EndTime.Value && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
- .WhereIF(string.IsNullOrEmpty(dto.OrgName) == false, x => x.VisitOrgName.Contains(dto.OrgName))
|
|
|
- .WhereIF(string.IsNullOrEmpty(dto.LineNum) == false, x => x.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
- .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId));
|
|
|
+ var list = _orderVisitDetailRepository.Queryable()
|
|
|
+ .Where(x => x.OrderVisit.VisitTime >= dto.StartTime.Value && x.OrderVisit.VisitTime <= dto.EndTime.Value && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
+ .WhereIF(string.IsNullOrEmpty(dto.OrgName) == false, x => x.VisitOrgName.Contains(dto.OrgName))
|
|
|
+ .WhereIF(string.IsNullOrEmpty(dto.LineNum) == false, x => x.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
+ .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId));
|
|
|
|
|
|
- var data = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
+ var data = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
|
|
|
- if (IsCenter && list != null)
|
|
|
- {
|
|
|
- data = await list.GroupBy(x => new
|
|
|
- {
|
|
|
- VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
|
- })
|
|
|
- .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
- TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
- VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
- SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
- RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
- DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
- NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
- NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
- NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
- })
|
|
|
- .MergeTable()
|
|
|
- .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
- .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgName = o.Name,
|
|
|
- OrgCode = it.OrgCode,
|
|
|
- OrgType = o.OrgType,
|
|
|
- TotalSumCount = it.TotalSumCount,
|
|
|
- VerySatisfiedCount = it.VerySatisfiedCount,//非常满意数
|
|
|
- SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
- RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount,//视为满意
|
|
|
- DefaultSatisfiedCount = it.DefaultSatisfiedCount,//默认满意
|
|
|
- NoSatisfiedCount = it.NoSatisfiedCount,//不满意
|
|
|
- NoEvaluateCount = it.NoEvaluateCount,//未做评价
|
|
|
- NoPutThroughCount = it.NoPutThroughCount,//未接通
|
|
|
- })
|
|
|
- .ToListAsync();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- data = await list.GroupBy(x => new
|
|
|
- {
|
|
|
- x.VisitOrgCode
|
|
|
- })
|
|
|
- .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = x.VisitOrgCode,
|
|
|
- TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
- VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
- SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
- RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
- DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
- NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
- NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
- NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
- })
|
|
|
- .MergeTable()
|
|
|
- .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
- .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgName = o.Name,
|
|
|
- OrgCode = it.OrgCode,
|
|
|
- OrgType = o.OrgType,
|
|
|
- TotalSumCount = it.TotalSumCount,
|
|
|
- VerySatisfiedCount = it.VerySatisfiedCount,//非常满意数
|
|
|
- SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
- RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount,//视为满意
|
|
|
- DefaultSatisfiedCount = it.DefaultSatisfiedCount,//默认满意
|
|
|
- NoSatisfiedCount = it.NoSatisfiedCount,//不满意
|
|
|
- NoEvaluateCount = it.NoEvaluateCount,//未做评价
|
|
|
- NoPutThroughCount = it.NoPutThroughCount,//未接通
|
|
|
- })
|
|
|
- .ToListAsync();
|
|
|
- }
|
|
|
+ if (IsCenter && list != null)
|
|
|
+ {
|
|
|
+ data = await list.GroupBy(x => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
|
+ })
|
|
|
+ .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
+ VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
+ NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
+ .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = it.TotalSumCount,
|
|
|
+ VerySatisfiedCount = it.VerySatisfiedCount,//非常满意数
|
|
|
+ SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount,//视为满意
|
|
|
+ DefaultSatisfiedCount = it.DefaultSatisfiedCount,//默认满意
|
|
|
+ NoSatisfiedCount = it.NoSatisfiedCount,//不满意
|
|
|
+ NoEvaluateCount = it.NoEvaluateCount,//未做评价
|
|
|
+ NoPutThroughCount = it.NoPutThroughCount,//未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ data = await list.GroupBy(x => new
|
|
|
+ {
|
|
|
+ x.VisitOrgCode
|
|
|
+ })
|
|
|
+ .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = x.VisitOrgCode,
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
+ VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
+ NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
+ .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = it.TotalSumCount,
|
|
|
+ VerySatisfiedCount = it.VerySatisfiedCount,//非常满意数
|
|
|
+ SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount,//视为满意
|
|
|
+ DefaultSatisfiedCount = it.DefaultSatisfiedCount,//默认满意
|
|
|
+ NoSatisfiedCount = it.NoSatisfiedCount,//不满意
|
|
|
+ NoEvaluateCount = it.NoEvaluateCount,//未做评价
|
|
|
+ NoPutThroughCount = it.NoPutThroughCount,//未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
return data;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 子部门满意度
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgStatisfactionOrgDetail(PagedKeywordSonRequest dto)
|
|
|
- {
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
- bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ }
|
|
|
|
|
|
- var list = await _systemOrganizeRepository.Queryable().Where(x => x.Id.StartsWith(dto.OrgCode))
|
|
|
- .LeftJoin<OrderVisitDetail>((x, it) => x.Id == it.VisitOrgCode)
|
|
|
- .Where((x, it) => it.OrderVisit.VisitTime >= dto.StartTime.Value && it.OrderVisit.VisitTime <= dto.EndTime.Value && it.VisitTarget == EVisitTarget.Org && it.OrderVisit.VisitState == EVisitState.Visited)
|
|
|
- .WhereIF(dto.OrgCode == "001", (x, it) => it.VisitOrgCode == dto.OrgCode)
|
|
|
- .WhereIF(dto.OrgCode != "001", (x, it) => it.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.LineNum), (x, it) => it.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
- .WhereIF(IsCenter == false, (x, it) => it.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
- .GroupBy((x, it) => new
|
|
|
- {
|
|
|
- VisitOrgCode = it.VisitOrgCode
|
|
|
- })
|
|
|
- .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = it.VisitOrgCode,
|
|
|
- TotalSumCount = SqlFunc.AggregateCount(it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("9"))),
|
|
|
- VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
- SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
- RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
- DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
- NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
- NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
- NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "6", 1, 0)))//未接通
|
|
|
- })
|
|
|
- .MergeTable()
|
|
|
- .LeftJoin<SystemOrganize>((x, it) => x.OrgCode == it.Id)
|
|
|
- .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgName = it.Name,
|
|
|
- OrgCode = x.OrgCode,
|
|
|
- OrgType = it.OrgType,
|
|
|
- TotalSumCount = x.TotalSumCount,
|
|
|
- VerySatisfiedCount = x.VerySatisfiedCount,//非常满意数
|
|
|
- SatisfiedCount = x.SatisfiedCount, //满意数
|
|
|
- RegardedAsSatisfiedCount = x.RegardedAsSatisfiedCount,//视为满意
|
|
|
- DefaultSatisfiedCount = x.DefaultSatisfiedCount,//默认满意
|
|
|
- NoSatisfiedCount = x.NoSatisfiedCount,//不满意
|
|
|
- NoEvaluateCount = x.NoEvaluateCount,//未做评价
|
|
|
- NoPutThroughCount = x.NoPutThroughCount,//未接通
|
|
|
- })
|
|
|
- .ToListAsync();
|
|
|
+ /// <summary>
|
|
|
+ /// 子部门满意度
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgStatisfactionOrgDetail(PagedKeywordSonRequest dto)
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+
|
|
|
+ var list = await _systemOrganizeRepository.Queryable().Where(x => x.Id.StartsWith(dto.OrgCode))
|
|
|
+ .LeftJoin<OrderVisitDetail>((x, it) => x.Id == it.VisitOrgCode)
|
|
|
+ .Where((x, it) => it.OrderVisit.VisitTime >= dto.StartTime.Value && it.OrderVisit.VisitTime <= dto.EndTime.Value && it.VisitTarget == EVisitTarget.Org && it.OrderVisit.VisitState == EVisitState.Visited)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, it) => it.VisitOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, it) => it.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.LineNum), (x, it) => it.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
+ .WhereIF(IsCenter == false, (x, it) => it.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
+ .GroupBy((x, it) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = it.VisitOrgCode
|
|
|
+ })
|
|
|
+ .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = it.VisitOrgCode,
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("9"))),
|
|
|
+ VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
+ NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "6", 1, 0)))//未接通
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((x, it) => x.OrgCode == it.Id)
|
|
|
+ .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = it.Name,
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
+ OrgType = it.OrgType,
|
|
|
+ TotalSumCount = x.TotalSumCount,
|
|
|
+ VerySatisfiedCount = x.VerySatisfiedCount,//非常满意数
|
|
|
+ SatisfiedCount = x.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = x.RegardedAsSatisfiedCount,//视为满意
|
|
|
+ DefaultSatisfiedCount = x.DefaultSatisfiedCount,//默认满意
|
|
|
+ NoSatisfiedCount = x.NoSatisfiedCount,//不满意
|
|
|
+ NoEvaluateCount = x.NoEvaluateCount,//未做评价
|
|
|
+ NoPutThroughCount = x.NoPutThroughCount,//未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
return list;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 部门满意度明细统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderVisitDetail> VisitAndOrgSatisfactionDetail(VisitAndOrgSatisfactionDetailDto dto)
|
|
|
- {
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
- bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ /// <summary>
|
|
|
+ /// 部门满意度明细统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderVisitDetail> VisitAndOrgSatisfactionDetail(VisitAndOrgSatisfactionDetailDto dto)
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
return _orderVisitDetailRepository.Queryable()
|
|
|
.Includes(x => x.OrderVisit, o => o.Order, d => d.CallRecord)
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime && x.OrderVisit.VisitTime <= dto.EndTime && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited)
|
|
@@ -942,21 +949,22 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.TypeId is 1, x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.DateValue)
|
|
|
.WhereIF(dto.TypeId is 2, x => SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == dto.DateValue)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.LineNum), x => x.OrderVisit.Order.CallRecord.Gateway == dto.LineNum);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 热点区域统计
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<(List<SystemArea> area,object items)> HotspotAndAreaStatistics(HotspotAndAreaStatisticsReq dto)
|
|
|
+ public async Task<(List<SystemArea> area, object items)> HotspotAndAreaStatistics(HotspotAndAreaStatisticsReq dto)
|
|
|
{
|
|
|
dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var areaList = _systemAreaRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 6 && x.Id != "510000").OrderBy(x => x.Id).MergeTable();
|
|
|
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
|
var hotspotList = _hotspotRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == int.Parse(endIndex))
|
|
|
- .Select(x => new {
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
HotspotId = x.Id,
|
|
|
HotspotName = x.HotSpotFullName,
|
|
|
}).MergeTable();
|
|
@@ -965,7 +973,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var orderList = _orderRepository.Queryable().Where(x => x.CreationTime >= dto.StartTime && x.CreationTime < dto.EndTime)
|
|
|
.Select(x => new
|
|
|
{
|
|
|
- HotspotId= x.HotspotId.Substring(0,int.Parse(endIndex)),
|
|
|
+ HotspotId = x.HotspotId.Substring(0, int.Parse(endIndex)),
|
|
|
AreaCode = x.AreaCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
}).MergeTable();
|
|
|
|
|
@@ -1003,13 +1011,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
AreaCode = pp.Id,
|
|
|
AreaName = pp.AreaName,
|
|
|
Count = SqlFunc.AggregateSum(dd.Count)
|
|
|
- }).Where(q => q.HotspotName != "").ToPivotListAsync(q=> q.AreaCode, q=> new { q.HotspotName,q.HotspotId},q=> q.Sum(x=>x.Count));
|
|
|
+ }).Where(q => q.HotspotName != "").ToPivotListAsync(q => q.AreaCode, q => new { q.HotspotName, q.HotspotId }, q => q.Sum(x => x.Count));
|
|
|
|
|
|
var areaTitleList = await _systemAreaRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 6 && x.Id != "510000").OrderBy(x => x.Id).ToListAsync();
|
|
|
return (areaTitleList, returnList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
@@ -1024,7 +1032,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
|
var hotspotList = _hotspotRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == int.Parse(endIndex))
|
|
|
- .Select(x => new {
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
HotspotId = x.Id,
|
|
|
HotspotName = x.HotSpotFullName,
|
|
|
}).MergeTable();
|
|
@@ -1055,7 +1064,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
}).MergeTable();
|
|
|
|
|
|
|
|
|
- var returnList = await areaList.LeftJoin(hotListAndOrder, (pp, dd) => pp.Id == dd.AreaCode )
|
|
|
+ var returnList = await areaList.LeftJoin(hotListAndOrder, (pp, dd) => pp.Id == dd.AreaCode)
|
|
|
.GroupBy((pp, dd) => new
|
|
|
{
|
|
|
HotspotId = dd.HotspotId,
|
|
@@ -1072,10 +1081,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
AreaName = pp.AreaName,
|
|
|
Count = SqlFunc.AggregateSum(dd.Count)
|
|
|
}).Where(q => q.HotspotName != "").ToPivotTableAsync(q => q.AreaName, q => new { q.HotspotName }, q => q.Sum(x => x.Count));
|
|
|
- return returnList;
|
|
|
+ return returnList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1345,7 +1354,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
if (files != null && files.Any())
|
|
|
order.FileJson = await _fileRepository.AddFileAsync(files, order.Id, "", cancellationToken);
|
|
|
order.ReTransactNum++;
|
|
|
- await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+ await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
|
|
|
if (orderExtension is not null)
|
|
|
{
|