|
@@ -69,7 +69,7 @@ using XF.Utility.EnumExtensions;
|
|
|
using Newtonsoft.Json;
|
|
|
using static NPOI.SS.Format.CellNumberFormatter;
|
|
|
using System.Linq;
|
|
|
-using DocumentFormat.OpenXml.Bibliography;
|
|
|
+using System.Linq.Dynamic.Core;
|
|
|
|
|
|
namespace Hotline.Application.Orders;
|
|
|
|
|
@@ -77,6 +77,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
private readonly IMediator _mediator;
|
|
|
private readonly IRepository<TranspondCityRawData> _transpondCityRawDataRepository;
|
|
|
+ private readonly Publisher _publisher;
|
|
|
private readonly ISessionContextProvider _sessionContextProvider;
|
|
|
private readonly ISystemDicDataCacheManager _sysDicDataCacheManager;
|
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
@@ -143,6 +144,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderVisitDetail> orderVisitedDetailRepository,
|
|
|
IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
+ Publisher publisher,
|
|
|
ISessionContextProvider sessionContextProvider,
|
|
|
IRepository<TranspondCityRawData> transpondCityRawDataRepository,
|
|
|
IRepository<OrderObserve> orderObserveRepository,
|
|
@@ -178,6 +180,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderVisitedDetailRepository = orderVisitedDetailRepository;
|
|
|
_appOptions = appOptions;
|
|
|
_sysDicDataCacheManager = sysDicDataCacheManager;
|
|
|
+ _publisher = publisher;
|
|
|
_sessionContextProvider = sessionContextProvider;
|
|
|
_transpondCityRawDataRepository = transpondCityRawDataRepository;
|
|
|
_orderObserveRepository = orderObserveRepository;
|
|
@@ -216,7 +219,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
order.ExpiredTimeProvince = expiredTimeConfig.ExpiredTime;
|
|
|
}
|
|
|
-
|
|
|
//if (string.IsNullOrEmpty(order.WorkflowId))
|
|
|
// throw new UserFriendlyException("该工单流程id异常");
|
|
|
//var workflow = await _workflowDomainService.GetWorkflowAsync(order.WorkflowId, cancellationToken: cancellationToken);
|
|
@@ -228,10 +230,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
await _workflowDomainService.UpdateUnhandleExpiredTimeAsync(order.WorkflowId, expiredTimeConfig.ExpiredTime, cancellationToken);
|
|
|
|
|
|
await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
-
|
|
|
- //推省上
|
|
|
- await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate,
|
|
|
- _mapper.Map<OrderDto>(order), cancellationToken: cancellationToken);
|
|
|
}
|
|
|
|
|
|
// /// <summary>
|
|
@@ -329,7 +327,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var orgCode = _sessionContextProvider.SessionContext.OrgId;
|
|
|
return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
|
|
|
- .WhereIF(orgLevel ==3,d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
+ .WhereIF(orgLevel==3,d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id && step.Status != EWorkflowStepStatus.Handled &&
|
|
|
((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) &&
|
|
|
step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
@@ -338,14 +336,17 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
(step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) &&
|
|
|
_sessionContextProvider.SessionContext.Roles.Contains(step.RoleId))))
|
|
|
.Any())
|
|
|
- .WhereIF(orgLevel == 1 || orgLevel == 2, d=> d.ActualHandleOrgCode.StartsWith(orgCode))
|
|
|
+ .WhereIF(orgLevel==2 || orgLevel == 1,d=> d.ActualHandleOrgCode.StartsWith(orgCode))
|
|
|
.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.NearlyExpiredTime && dateTime < d.ExpiredTime)
|
|
|
- .OrderBy(d => d.ExpiredTime);
|
|
|
+ .OrderBy(d => d.NearlyExpiredTime);
|
|
|
}
|
|
|
|
|
|
// /// <summary>
|
|
@@ -389,7 +390,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
int orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
var orgCode = _sessionContextProvider.SessionContext.OrgId;
|
|
|
return _orderRepository.Queryable(canView: false).Includes(d => d.OrderDelays)
|
|
|
- .WhereIF(orgLevel == 3 , d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
+ .WhereIF(orgLevel == 3,d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id && step.Status != EWorkflowStepStatus.Handled &&
|
|
|
((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) &&
|
|
|
step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
@@ -398,14 +399,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
(step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) &&
|
|
|
_sessionContextProvider.SessionContext.Roles.Contains(step.RoleId))))
|
|
|
.Any())
|
|
|
- .WhereIF(orgLevel == 1 || orgLevel == 2, d => d.ActualHandleOrgCode.StartsWith(orgCode))
|
|
|
+ .WhereIF(orgLevel == 2 || orgLevel == 1, d => d.ActualHandleOrgCode.StartsWith(orgCode))
|
|
|
.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))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.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)
|
|
|
- .Where(d=> d.Status < EOrderStatus.Filed)
|
|
|
.Where(d => d.ExpiredTime != null &&
|
|
|
(((d.Status == EOrderStatus.Filed || d.Status == EOrderStatus.Published || d.Status == EOrderStatus.Visited) &&
|
|
|
d.FiledTime >= d.ExpiredTime) ||
|
|
@@ -1086,8 +1086,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
d.SourceChannelCode == "S12345" && d.IsProvince == true) //省12345
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ContentRetrieval),
|
|
|
d => d.Title.Contains(dto.ContentRetrieval) || d.Content.Contains(dto.ContentRetrieval) || d.FileOpinion.Contains(dto.ContentRetrieval) || d.ActualOpinion.Contains(dto.ContentRetrieval))
|
|
|
- .WhereIF(dto.IsSgin.HasValue && dto.IsSgin == true, d => d.ActualHandleStepAcceptTime != null)
|
|
|
- .WhereIF(dto.IsSgin.HasValue && dto.IsSgin == false, d => d.ActualHandleStepAcceptTime == null)
|
|
|
+ .WhereIF(dto.IsSgin.HasValue && dto.IsSgin == true, d => d.CurrentStepAcceptTime != null)
|
|
|
+ .WhereIF(dto.IsSgin.HasValue && dto.IsSgin == false, d => d.CurrentStepAcceptTime == null)
|
|
|
.WhereIF(dto.FiledType is FiledType.CenterFiled, d => d.ProcessType == EProcessType.Zhiban)
|
|
|
.WhereIF(dto.FiledType is FiledType.OrgFiled, d => d.ProcessType == EProcessType.Jiaoban)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrderTagCode), d => d.OrderTagCode == dto.OrderTagCode)
|
|
@@ -2247,8 +2247,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Select(x => new OrderScreenAuditVo
|
|
|
{
|
|
|
AuditName = x.HandlerName,
|
|
|
- AuditNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceState == EWorkflowTraceState.Normal, 1, 0)),
|
|
|
- AuditBackNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceState == EWorkflowTraceState.StepRemoveByPrevious, 1, 0)),
|
|
|
+ AuditNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceType == EWorkflowTraceType.Normal, 1, 0)),
|
|
|
+ AuditBackNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceType == EWorkflowTraceType.Previous, 1, 0)),
|
|
|
});
|
|
|
return query;
|
|
|
}
|
|
@@ -2769,5 +2769,121 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.OrderByIF(dto.IsHandled == false, d => new { IsUrgent = d.IsUrgent, CreationTime = d.CreationTime }, OrderByType.Desc)
|
|
|
.Select<OrderListOutDto>();
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 受理前十
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="isExport"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<(List<SystemDicData> acceptTypes, object items, DataTable data)> AcceptTypeTop10List(ReportPagedRequest dto, bool isExport)
|
|
|
+ {
|
|
|
+
|
|
|
+ var dicList = _systemDicDataRepository.Queryable().Where(x => x.DicTypeCode == "AcceptType").OrderBy(x => x.Sort).MergeTable();
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+
|
|
|
+ var hotspotList = _hotspotRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 2)
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ HotspotId = x.Id,
|
|
|
+ HotspotName = x.HotSpotFullName,
|
|
|
+ }).MergeTable();
|
|
|
+
|
|
|
+ var orderList = _orderRepository.Queryable()
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(IsCenter == false, x => x.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ HotspotId = x.HotspotId.Substring(0, 2),
|
|
|
+ AcceptTypeCode = x.AcceptTypeCode,
|
|
|
+ }).MergeTable();
|
|
|
+
|
|
|
+ var hotListAndOrder = hotspotList.LeftJoin(orderList, (it, o) => it.HotspotId == o.HotspotId)
|
|
|
+ .GroupBy((it, o) => new
|
|
|
+ {
|
|
|
+ it.HotspotId,
|
|
|
+ it.HotspotName,
|
|
|
+ AcceptTypeCode = o.AcceptTypeCode,
|
|
|
+ })
|
|
|
+ .OrderBy((it, o) => it.HotspotId)
|
|
|
+ .Select((it, o) => new
|
|
|
+ {
|
|
|
+ HotspotId = it.HotspotId,
|
|
|
+ HotspotName = it.HotspotName,
|
|
|
+ AcceptTypeCode = o.AcceptTypeCode,
|
|
|
+ Count = SqlFunc.AggregateCount(it.HotspotId)
|
|
|
+ }).MergeTable();
|
|
|
+
|
|
|
+ var returnList = await dicList.LeftJoin(hotListAndOrder, (pp, dd) => pp.DicDataValue == dd.AcceptTypeCode)
|
|
|
+ .GroupBy((pp, dd) => new
|
|
|
+ {
|
|
|
+ HotspotId = dd.HotspotId,
|
|
|
+ HotspotName = dd.HotspotName,
|
|
|
+ AcceptTypeCode = pp.DicDataValue,
|
|
|
+ AcceptType = pp.DicDataName,
|
|
|
+ })
|
|
|
+ .OrderBy((pp, dd) => dd.HotspotId)
|
|
|
+ .Select((pp, dd) => new
|
|
|
+ {
|
|
|
+ HotspotId = dd.HotspotId,
|
|
|
+ HotspotName = dd.HotspotName,
|
|
|
+ AcceptTypeCode = pp.DicDataValue,
|
|
|
+ AcceptType = pp.DicDataName,
|
|
|
+ Count = SqlFunc.AggregateSum(dd.Count)
|
|
|
+ }).ToPivotTableAsync(q => q.AcceptType, q => new { q.HotspotName }, q => q.Sum(x => x.Count));
|
|
|
+ DataColumn totalColumn = new DataColumn("有效受理量", typeof(int));
|
|
|
+ returnList.Columns.Add(totalColumn);
|
|
|
+
|
|
|
+ returnList.Columns["HotspotName"].ColumnName = "省一级热点名称";
|
|
|
+ var titleList = await _systemDicDataRepository.Queryable().Where(x => x.DicTypeCode == "AcceptType").OrderBy(x => x.Sort).ToListAsync();
|
|
|
+ for (int z = 0; z < returnList.Rows.Count; z++)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(returnList.Rows[z]["省一级热点名称"].ToString()))
|
|
|
+ {
|
|
|
+ returnList.Rows.Remove(returnList.Rows[z]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int num = 0;
|
|
|
+ var colTotal = returnList.Columns.Count - 1;
|
|
|
+ for (int i = 1; i < colTotal; i++)
|
|
|
+ {
|
|
|
+ num += int.Parse(returnList.Rows[z][i].ToString());
|
|
|
+ }
|
|
|
+ returnList.Rows[z]["有效受理量"] = num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnList.Columns["有效受理量"].SetOrdinal(1);
|
|
|
+ DataTable list = new DataTable();
|
|
|
+ if (returnList.Rows.Count > 0)
|
|
|
+ list = returnList.Select("", "有效受理量 DESC").Take(10).CopyToDataTable();
|
|
|
+ if (isExport)
|
|
|
+ {
|
|
|
+ return (new List<SystemDicData>(), null, list);
|
|
|
+ }
|
|
|
+ var listDy = ToDynamicList(list);
|
|
|
+ return (titleList, listDy, list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<dynamic> ToDynamicList(DataTable dataTable)
|
|
|
+ {
|
|
|
+ var list = new List<dynamic>();
|
|
|
+
|
|
|
+ foreach (DataRow row in dataTable.Rows)
|
|
|
+ {
|
|
|
+ dynamic expando = new ExpandoObject();
|
|
|
+ var expandoDic = (IDictionary<string, object>)expando;
|
|
|
+
|
|
|
+ foreach (DataColumn column in dataTable.Columns)
|
|
|
+ {
|
|
|
+ expandoDic.Add(column.ColumnName, row[column]);
|
|
|
+ }
|
|
|
+
|
|
|
+ list.Add(expando);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|