|
@@ -1781,7 +1781,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
string orgLevelStr = (_sessionContextProvider.SessionContext.RequiredOrgId.Length + 3).ToString();
|
|
|
|
|
|
- var list = _orderVisitDetailRepository.Queryable()
|
|
|
+ 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))
|
|
@@ -1794,111 +1794,111 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var data = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
var oldData = 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
|
|
|
- {
|
|
|
- VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"),SqlFunc.MappingColumn<int>(orgLevelStr))
|
|
|
- })
|
|
|
- .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
- TotalSumCount =
|
|
|
- SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))),
|
|
|
- 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 && (o.Level == orgLevel || o.Level == (orgLevel + 1)))
|
|
|
- .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();
|
|
|
- }
|
|
|
-
|
|
|
- #region 老系统数据
|
|
|
- if (await _statisticsDepartSatisfiedRepository.Queryable().Where(x => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
+ 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
|
|
|
+ {
|
|
|
+ VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))
|
|
|
+ })
|
|
|
+ .Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
+ TotalSumCount =
|
|
|
+ SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))),
|
|
|
+ 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 && (o.Level == orgLevel || o.Level == (orgLevel + 1)))
|
|
|
+ .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();
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 老系统数据
|
|
|
+ if (await _statisticsDepartSatisfiedRepository.Queryable().Where(x => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
{
|
|
|
var query = _statisticsDepartSatisfiedRepository.Queryable()
|
|
|
.LeftJoin<SystemOrganize>((x, so) => x.DepartmentId == so.oldBmid)
|
|
@@ -2006,141 +2006,141 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
var org = await _systemOrganizeRepository.Queryable().FirstAsync(x => x.Id == dto.OrgCode);
|
|
|
|
|
|
- string orgLevelStr = (dto.OrgCode.Length + 3 ).ToString();
|
|
|
- var oldData = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
-
|
|
|
- var quer = _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(dto.TypeCode != null && dto.TypeCode == 1,
|
|
|
- (x, it) => it.OrderVisit.Order.IdentityType == EIdentityType.Citizen)
|
|
|
- .WhereIF(dto.TypeCode != null && dto.TypeCode == 2,
|
|
|
- (x, it) => it.OrderVisit.Order.IdentityType == EIdentityType.Enterprise)
|
|
|
- .WhereIF(IsCenter == false,
|
|
|
- (x, it) => it.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
- .WhereIF(dto.VisitType != null, (x, it) => it.OrderVisit.VisitType == dto.VisitType)
|
|
|
- .GroupBy((x, it) => new
|
|
|
- {
|
|
|
- VisitOrgCode = it.VisitOrgCode
|
|
|
- })
|
|
|
- .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = it.VisitOrgCode,
|
|
|
- TotalSumCount = SqlFunc.AggregateCount(it.VisitOrgCode),
|
|
|
- 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 && (it.Level == org.Level || it.Level == (org.Level + 1)))
|
|
|
- .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, //未接通
|
|
|
- });
|
|
|
- var list = await quer.ToListAsync();
|
|
|
-
|
|
|
- #region 老系统数据
|
|
|
- if (await _statisticsDepartSatisfiedRepository.Queryable().Where(x => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
- {
|
|
|
- var query = _statisticsDepartSatisfiedRepository.Queryable()
|
|
|
- .LeftJoin<SystemOrganize>((x, so) => x.DepartmentId == so.oldBmid)
|
|
|
- .WhereIF(dto.OrgCode == "001", (x, so) => so.Id == dto.OrgCode)
|
|
|
- .WhereIF(dto.OrgCode != "001", (x, so) => so.Id.StartsWith(dto.OrgCode))
|
|
|
- .Where((x, so) => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value);
|
|
|
-
|
|
|
- oldData = await query.GroupBy((x, so) => new
|
|
|
- {
|
|
|
- VisitOrgCode = so.Id
|
|
|
- }).Select((x, so) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgCode = so.Id,//.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
- TotalSumCount = SqlFunc.AggregateSum(x.Total),
|
|
|
- VerySatisfiedCount = SqlFunc.AggregateSum(x.VerySatisfaction), //非常满意数
|
|
|
- SatisfiedCount = SqlFunc.AggregateSum(x.Satisfaction), //满意数
|
|
|
- RegardedAsSatisfiedCount = SqlFunc.AggregateSum(x.TreatSatisfaction), //视为满意
|
|
|
- DefaultSatisfiedCount = SqlFunc.AggregateSum(x.DefaultSatisfaction), //默认满意
|
|
|
- NoSatisfiedCount = SqlFunc.AggregateSum(x.Dissatisfaction), //不满意
|
|
|
- NoEvaluateCount = SqlFunc.AggregateSum(x.NotEvaluated), //未做评价
|
|
|
- NoPutThroughCount = SqlFunc.AggregateSum(x.BlockCall), //未接通
|
|
|
- })
|
|
|
- .MergeTable().LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id && (o.Level == org.Level || o.Level == (org.Level + 1)))
|
|
|
- .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();
|
|
|
- list = (from t1 in list
|
|
|
+ string orgLevelStr = (dto.OrgCode.Length + 3).ToString();
|
|
|
+ var oldData = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
+
|
|
|
+ var mainList = 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)
|
|
|
+ .Where((x, it) => it.VisitOrgCode.StartsWith(dto.OrgCode) )
|
|
|
+ //&& it.VisitOrgCode != dto.OrgCode
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.LineNum),
|
|
|
+ (x, it) => it.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
+ .WhereIF(dto.TypeCode != null && dto.TypeCode == 1,
|
|
|
+ (x, it) => it.OrderVisit.Order.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(dto.TypeCode != null && dto.TypeCode == 2,
|
|
|
+ (x, it) => it.OrderVisit.Order.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .WhereIF(IsCenter == false,
|
|
|
+ (x, it) => it.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(dto.VisitType != null, (x, it) => it.OrderVisit.VisitType == dto.VisitType)
|
|
|
+ .GroupBy((x, it) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))
|
|
|
+ })
|
|
|
+ .Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))),
|
|
|
+ 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 && (it.Level == org.Level || it.Level == (org.Level + 1)))
|
|
|
+ .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();
|
|
|
+
|
|
|
+
|
|
|
+ #region 老系统数据
|
|
|
+ if (await _statisticsDepartSatisfiedRepository.Queryable().Where(x => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
+ {
|
|
|
+ var query = _statisticsDepartSatisfiedRepository.Queryable()
|
|
|
+ .LeftJoin<SystemOrganize>((x, so) => x.DepartmentId == so.oldBmid)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, so) => so.Id == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, so) => so.Id.StartsWith(dto.OrgCode))
|
|
|
+ .Where((x, so) => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value);
|
|
|
+
|
|
|
+ oldData = await query.GroupBy((x, so) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = so.Id
|
|
|
+ }).Select((x, so) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = so.Id,//.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
+ TotalSumCount = SqlFunc.AggregateSum(x.Total),
|
|
|
+ VerySatisfiedCount = SqlFunc.AggregateSum(x.VerySatisfaction), //非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.AggregateSum(x.Satisfaction), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.AggregateSum(x.TreatSatisfaction), //视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.AggregateSum(x.DefaultSatisfaction), //默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.AggregateSum(x.Dissatisfaction), //不满意
|
|
|
+ NoEvaluateCount = SqlFunc.AggregateSum(x.NotEvaluated), //未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.AggregateSum(x.BlockCall), //未接通
|
|
|
+ })
|
|
|
+ .MergeTable().LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id && (o.Level == org.Level || o.Level == (org.Level + 1)))
|
|
|
+ .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();
|
|
|
+ mainList = (from t1 in mainList
|
|
|
join t2 in oldData on t1.OrgCode equals t2.OrgCode into t1_t2
|
|
|
- from item in t1_t2.DefaultIfEmpty()
|
|
|
- select new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
- {
|
|
|
- OrgName = t1.OrgName,
|
|
|
- OrgCode = t1.OrgCode,
|
|
|
- OrgType = t1.OrgType,
|
|
|
- TotalSumCount = t1.TotalSumCount + t1_t2.Select(x => x.TotalSumCount).FirstOrDefault(),
|
|
|
- VerySatisfiedCount = t1.VerySatisfiedCount + t1_t2.Select(x => x.VerySatisfiedCount).FirstOrDefault(),//非常满意数
|
|
|
- SatisfiedCount = t1.SatisfiedCount + t1_t2.Select(x => x.SatisfiedCount).FirstOrDefault(), //满意数
|
|
|
- RegardedAsSatisfiedCount = t1.RegardedAsSatisfiedCount + t1_t2.Select(x => x.RegardedAsSatisfiedCount).FirstOrDefault(), //视为满意
|
|
|
- DefaultSatisfiedCount = t1.DefaultSatisfiedCount + t1_t2.Select(x => x.DefaultSatisfiedCount).FirstOrDefault(), //默认满意
|
|
|
- NoSatisfiedCount = t1.NoSatisfiedCount + t1_t2.Select(x => x.NoSatisfiedCount).FirstOrDefault(), //不满意
|
|
|
- NoEvaluateCount = t1.NoEvaluateCount + t1_t2.Select(x => x.NoEvaluateCount).FirstOrDefault(), //未做评价
|
|
|
- NoPutThroughCount = t1.NoPutThroughCount + t1_t2.Select(x => x.NoPutThroughCount).FirstOrDefault(), //未接通
|
|
|
- }).ToList();
|
|
|
- }
|
|
|
- #endregion
|
|
|
- return list;
|
|
|
+ from item in t1_t2.DefaultIfEmpty()
|
|
|
+ select new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = t1.OrgName,
|
|
|
+ OrgCode = t1.OrgCode,
|
|
|
+ OrgType = t1.OrgType,
|
|
|
+ TotalSumCount = t1.TotalSumCount + t1_t2.Select(x => x.TotalSumCount).FirstOrDefault(),
|
|
|
+ VerySatisfiedCount = t1.VerySatisfiedCount + t1_t2.Select(x => x.VerySatisfiedCount).FirstOrDefault(),//非常满意数
|
|
|
+ SatisfiedCount = t1.SatisfiedCount + t1_t2.Select(x => x.SatisfiedCount).FirstOrDefault(), //满意数
|
|
|
+ RegardedAsSatisfiedCount = t1.RegardedAsSatisfiedCount + t1_t2.Select(x => x.RegardedAsSatisfiedCount).FirstOrDefault(), //视为满意
|
|
|
+ DefaultSatisfiedCount = t1.DefaultSatisfiedCount + t1_t2.Select(x => x.DefaultSatisfiedCount).FirstOrDefault(), //默认满意
|
|
|
+ NoSatisfiedCount = t1.NoSatisfiedCount + t1_t2.Select(x => x.NoSatisfiedCount).FirstOrDefault(), //不满意
|
|
|
+ NoEvaluateCount = t1.NoEvaluateCount + t1_t2.Select(x => x.NoEvaluateCount).FirstOrDefault(), //未做评价
|
|
|
+ NoPutThroughCount = t1.NoPutThroughCount + t1_t2.Select(x => x.NoPutThroughCount).FirstOrDefault(), //未接通
|
|
|
+ }).ToList();
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ return mainList;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3737,13 +3737,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
public ISugarQueryable<Order> QueryWaitedForSeat(QueryOrderWaitedDto dto)
|
|
|
{
|
|
|
- EOrderStatus[] handleStatuses = EnumExts.GetFields<EOrderStatus>().Select(d => (EOrderStatus)d.Key).ToArray();
|
|
|
- handleStatuses = handleStatuses.WhereIF(dto.IsHandled.HasValue,
|
|
|
- d => dto.IsHandled!.Value
|
|
|
- ? d is not EOrderStatus.WaitForAccept and not EOrderStatus.BackToUnAccept and not EOrderStatus.SpecialToUnAccept and not EOrderStatus.HandOverToUnAccept
|
|
|
- : d is EOrderStatus.WaitForAccept or EOrderStatus.BackToUnAccept or EOrderStatus.SpecialToUnAccept or EOrderStatus.HandOverToUnAccept or EOrderStatus.Handling
|
|
|
- or EOrderStatus.Countersigning)
|
|
|
- .ToArray();
|
|
|
+ //EOrderStatus[] handleStatuses = EnumExts.GetFields<EOrderStatus>().Select(d => (EOrderStatus)d.Key).ToArray();
|
|
|
+ //handleStatuses = handleStatuses.WhereIF(dto.IsHandled.HasValue,
|
|
|
+ // d => dto.IsHandled!.Value
|
|
|
+ // ? d is not EOrderStatus.WaitForAccept and not EOrderStatus.BackToUnAccept and not EOrderStatus.SpecialToUnAccept and not EOrderStatus.HandOverToUnAccept
|
|
|
+ // : d is EOrderStatus.WaitForAccept or EOrderStatus.BackToUnAccept or EOrderStatus.SpecialToUnAccept or EOrderStatus.HandOverToUnAccept or EOrderStatus.Handling
|
|
|
+ // or EOrderStatus.Countersigning)
|
|
|
+ // .ToArray();
|
|
|
|
|
|
//var query = _orderRepository.Queryable()
|
|
|
// .Includes(d => d.WorkflowSteps.Where(step =>
|
|
@@ -3758,11 +3758,38 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
// );
|
|
|
var query = _orderRepository.Queryable();
|
|
|
|
|
|
- var hasHandled = (dto.IsHandled.HasValue && dto.IsHandled.Value) || dto.TypeCode == 1 || dto.TypeCode == 2;
|
|
|
- if (hasHandled)
|
|
|
+ switch (dto.TypeCode)
|
|
|
{
|
|
|
- if (dto.TypeCode == 1)
|
|
|
- {
|
|
|
+ case 0://待办
|
|
|
+ query.Includes(d => d.WorkflowSteps.Where(step =>
|
|
|
+ ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)
|
|
|
+ && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId))
|
|
|
+ && step.Status < EWorkflowStepStatus.Handled)
|
|
|
+ .OrderByDescending(step => step.CreationTime)
|
|
|
+ .Take(1)
|
|
|
+ .ToList())
|
|
|
+ .Where(d => d.WorkflowSteps
|
|
|
+ .Any(step =>
|
|
|
+ ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)
|
|
|
+ && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId))
|
|
|
+ && step.Status < EWorkflowStepStatus.Handled)
|
|
|
+ || (SqlFunc.IsNullOrEmpty(d.WorkflowId)
|
|
|
+ && (SqlFunc.IsNullOrEmpty(d.SignerId) || (!SqlFunc.IsNullOrEmpty(d.SignerId) && d.SignerId == _sessionContext.UserId)))
|
|
|
+ )
|
|
|
+ .Where(d => d.Status <= EOrderStatus.HandOverToUnAccept
|
|
|
+ || d.Status == EOrderStatus.Handling//指派给班长再指派回坐席时
|
|
|
+ //|| d.Status == EOrderStatus.Countersigning//跨级派单业务如发起会签再回到坐席会签汇总时
|
|
|
+ )
|
|
|
+ ;
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 1://交办: 已派单其他节点的工单,该选项卡下工单若办结就不显示
|
|
|
query.Includes(d => d.WorkflowSteps.Where(step =>
|
|
|
!string.IsNullOrEmpty(step.HandlerId)
|
|
|
&& step.HandlerId == _sessionContext.UserId
|
|
@@ -3772,33 +3799,16 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Any(step =>
|
|
|
!string.IsNullOrEmpty(step.HandlerId)
|
|
|
&& step.HandlerId == _sessionContext.UserId
|
|
|
- && step.Status == EWorkflowStepStatus.Handled));
|
|
|
- }
|
|
|
+ && step.Status == EWorkflowStepStatus.Handled)
|
|
|
+ && d.Status < EOrderStatus.Filed);
|
|
|
+ break;
|
|
|
+ case 2://办结: 当前登录坐席作为最初受理人已办结的工单
|
|
|
+ query.Where(d =>
|
|
|
+ d.Status >= EOrderStatus.Filed
|
|
|
+ && d.AcceptorId == _sessionContextProvider.SessionContext.RequiredUserId);
|
|
|
+ break;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
|
|
|
- query.Includes(d => d.WorkflowSteps.Where(step =>
|
|
|
- ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)
|
|
|
- && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId)))
|
|
|
- .OrderByDescending(step => step.CreationTime)
|
|
|
- .Take(1)
|
|
|
- .ToList())
|
|
|
- .Where(d => d.WorkflowSteps
|
|
|
- .Any(step =>
|
|
|
- ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
|
|
|
- (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)
|
|
|
- && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId))
|
|
|
- && step.Status < EWorkflowStepStatus.Handled)
|
|
|
- || (SqlFunc.IsNullOrEmpty(d.WorkflowId) && SqlFunc.IsNullOrEmpty(d.SignerId)
|
|
|
- || (!SqlFunc.IsNullOrEmpty(d.SignerId) && d.SignerId == _sessionContext.UserId))
|
|
|
- );
|
|
|
- }
|
|
|
|
|
|
//query = query.Where(d => SqlFunc.Subqueryable<WorkflowTrace>()
|
|
|
//.Where(step => step.ExternalId == d.Id &&
|
|
@@ -3812,12 +3822,12 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
//);
|
|
|
|
|
|
return query
|
|
|
- // 交办件:已派单其他节点的工单,该选项卡下工单若办结就不显示
|
|
|
- .WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 1, d => /*d.ProcessType == EProcessType.Jiaoban &&*/ d.Status < EOrderStatus.Filed)
|
|
|
- // 办结件:当前登录坐席作为最初受理人已办结的工单
|
|
|
- .WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 2, d => d.Status >= EOrderStatus.Filed && d.AcceptorId == _sessionContextProvider.SessionContext.RequiredUserId)
|
|
|
+ //// 交办件:已派单其他节点的工单,该选项卡下工单若办结就不显示
|
|
|
+ //.WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 1, d => /*d.ProcessType == EProcessType.Jiaoban &&*/ d.Status < EOrderStatus.Filed)
|
|
|
+ //// 办结件:当前登录坐席作为最初受理人已办结的工单
|
|
|
+ //.WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 2, d => d.Status >= EOrderStatus.Filed && d.AcceptorId == _sessionContextProvider.SessionContext.RequiredUserId)
|
|
|
.WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
- .WhereIF(dto.IsHandled.HasValue, d => handleStatuses.Contains(d.Status))
|
|
|
+ //.WhereIF(dto.IsHandled.HasValue, d => handleStatuses.Contains(d.Status))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.StartsWith(dto.Keyword!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AreaCode), d => d.AreaCode == dto.AreaCode)
|
|
@@ -3835,13 +3845,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.IsUrgent.HasValue, d => d.IsUrgent == dto.IsUrgent.Value)
|
|
|
.Where(x => x.Source < ESource.MLSQ || x.Source > ESource.WZSC)
|
|
|
.Where(x => x.Status != EOrderStatus.BackToProvince)
|
|
|
- .WhereIF(dto.TypeCode.HasValue == false, m => m.Status < EOrderStatus.Filed)
|
|
|
+ //.WhereIF(dto.TypeCode.HasValue == false, m => m.Status < EOrderStatus.Filed)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptorName), d => d.AcceptorName == dto.AcceptorName)
|
|
|
//.OrderBy(d => d.Status)
|
|
|
- .OrderByIF(dto.IsHandled == true, d => d.StartTime, OrderByType.Desc)
|
|
|
+ .OrderByIF(dto.TypeCode != 0, d => d.StartTime, OrderByType.Desc)
|
|
|
//.OrderByIF(dto.IsHandled == false, d => new { IsUrgent = d.IsUrgent }, OrderByType.Desc)
|
|
|
//.OrderByIF(dto.IsHandled == false, d => new { d.Status })
|
|
|
- .OrderByIF(dto.IsHandled == false && string.IsNullOrEmpty(dto.SortField), d => d.CreationTime, OrderByType.Desc)
|
|
|
+ .OrderByIF(dto.TypeCode == 0 && string.IsNullOrEmpty(dto.SortField), d => d.CreationTime, OrderByType.Desc)
|
|
|
.OrderByIF(dto is { SortField: "creationTime", SortRule: 0 }, d => d.CreationTime, OrderByType.Asc) //创建时间升序
|
|
|
.OrderByIF(dto is { SortField: "creationTime", SortRule: 1 }, d => d.CreationTime, OrderByType.Desc) //创建时间降序
|
|
|
.OrderByIF(dto is { SortField: "startTime", SortRule: 0 }, d => d.StartTime, OrderByType.Asc) //受理时间升序
|
|
@@ -3897,6 +3907,15 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if (dto.QueryType is 1 || dto.QueryType is 2)
|
|
|
+ {
|
|
|
+ query.WhereIF(dto.QueryType is 1, d => d.IsForwarded == false)
|
|
|
+ .WhereIF(dto.QueryType is 2, d => d.IsForwarded == true)
|
|
|
+ .Where(d => SqlFunc.Subqueryable<OrderSpecial>().Where(os => os.OrderId == d.Id && os.IsDeleted == false && os.SpecialType == ESpecialType.ReTransact)
|
|
|
+ .NotAny())
|
|
|
+ ;
|
|
|
+ }
|
|
|
+
|
|
|
query.Where(d => d.Status != EOrderStatus.WaitForAccept &&
|
|
|
d.Status != EOrderStatus.BackToUnAccept &&
|
|
|
d.Status != EOrderStatus.SpecialToUnAccept &&
|
|
@@ -3906,11 +3925,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(d => SqlFunc.Subqueryable<OrderDelay>().Where(od => od.OrderId == d.Id && od.IsDeleted == false && od.DelayState == EDelayState.Examining).NotAny())
|
|
|
.Where(d => SqlFunc.Subqueryable<OrderSendBackAudit>().Where(osba => osba.OrderId == d.Id && osba.IsDeleted == false && osba.State == ESendBackAuditState.Apply)
|
|
|
.NotAny())
|
|
|
- .Where(d => SqlFunc.Subqueryable<OrderSpecial>().Where(s => s.OrderId == d.Id && s.State == 0 && s.IsDeleted == false)
|
|
|
- .WhereIF(dto.QueryType != null && (dto.QueryType == 1 || dto.QueryType == 2), s => s.SpecialType == ESpecialType.ReTransact)
|
|
|
- //.WhereIF(dto.QueryType != null && dto.QueryType == 3, s => s.SpecialType != ESpecialType.ReTransact)
|
|
|
- .NotAny())
|
|
|
- .WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
+ .Where(d => SqlFunc.Subqueryable<OrderSpecial>().Where(s => s.OrderId == d.Id && s.State == 0 && s.IsDeleted == false).NotAny())
|
|
|
+ .WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.StartsWith(dto.Keyword))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AreaCode), d => d.AreaCode == dto.AreaCode)
|