|
@@ -170,7 +170,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
var publishPublishOrder = orderPublish.Adapt<PublishPublishOrderDto>();
|
|
|
publishPublishOrder.Order = order.Adapt<OrderDto>();
|
|
|
//查询实际办理附件
|
|
|
- if (!string.IsNullOrEmpty(order.ActualHandleStepId))
|
|
|
+ if (!string.IsNullOrEmpty(order.ActualHandleStepId))
|
|
|
{
|
|
|
var actualHandleStep = await _workflowStepRepository.GetAsync(order.ActualHandleStepId, cancellationToken);
|
|
|
publishPublishOrder.FileJsons = actualHandleStep?.FileJson;
|
|
@@ -186,6 +186,19 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
await _publisher.PublishAsync(new ContingencyManagementNotify(order, order.Title, order.Content, order.ActualOpinion),
|
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
|
|
|
|
+ // 取消发布的工单数量
|
|
|
+ var orderPublishDeletedCount = await _orderPublishRepository.Queryable(includeDeleted: true)
|
|
|
+ .Where(m => m.OrderId == order.Id && m.IsDeleted == true)
|
|
|
+ .CountAsync(cancellationToken);
|
|
|
+ var orderVisitVisitedCount = await _orderVisitRepository.Queryable()
|
|
|
+ .Where(m => m.OrderId == order.Id && m.VisitState == EVisitState.Visited)
|
|
|
+ .CountAsync(cancellationToken);
|
|
|
+
|
|
|
+ // 若取消发布的工单,已经被回访过了,没有经过重新办理,再次发布后,自动跳过回访环节,展示取消发布前的回访结果
|
|
|
+ if (orderPublishDeletedCount != 0 && orderVisitVisitedCount !=0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
var orderVisit = new OrderVisit
|
|
|
{
|
|
|
No = order.No,
|
|
@@ -260,6 +273,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
visitedDetail.Add(seatDetail);
|
|
|
await _orderVisitDetailRepository.AddRangeAsync(visitedDetail, cancellationToken);
|
|
|
|
|
|
+
|
|
|
if (order.IsProvince == false && orderVisit.VisitState == EVisitState.Visited)
|
|
|
{
|
|
|
//推省上
|
|
@@ -293,6 +307,31 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}, cancellationToken: cancellationToken);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 重办和退回工单时如果有取消发布的工单, 清除回访待办和回访列表中的数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="orderId"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task VisitNoneByCancelPublishAsync(string orderId, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var cancelPublishOrderEnabled = _systemSettingCacheManager.CancelPublishOrderEnabled;
|
|
|
+
|
|
|
+ // 取消发布的工单数量
|
|
|
+ var orderPublishDeletedCount = await _orderPublishRepository.Queryable(includeDeleted: true)
|
|
|
+ .Where(m => m.OrderId == orderId && m.IsDeleted == true)
|
|
|
+ .CountAsync(cancellationToken);
|
|
|
+
|
|
|
+ if (orderPublishDeletedCount == 0 || cancelPublishOrderEnabled == false) return;
|
|
|
+
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.OrderId == orderId && x.VisitState != EVisitState.None, cancellationToken);
|
|
|
+ if (visit != null)
|
|
|
+ {
|
|
|
+ visit.VisitState = EVisitState.None;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public async Task<Order> GetOrderAsync(string? orderId, bool withHotspot = false, bool withAcceptor = false,
|
|
|
bool withExtension = false, CancellationToken cancellationToken = default)
|
|
|
{
|
|
@@ -323,8 +362,8 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
order.Init();
|
|
|
order.No = GenerateNewOrderNo();
|
|
|
order.Password = Random.Shared.Next(100000, 1000000).ToString();
|
|
|
- order.ProvinceNo = string.IsNullOrEmpty(order.ProvinceNo) ? GenerateNewProvinceNo(order.No, order.SourceChannelCode) : order.ProvinceNo;
|
|
|
- return await _orderRepository.AddOrderNavAsync(order, cancellationToken);
|
|
|
+ order.ProvinceNo = string.IsNullOrEmpty(order.ProvinceNo) ? GenerateNewProvinceNo(order.No, order.SourceChannelCode) : order.ProvinceNo;
|
|
|
+ return await _orderRepository.AddOrderNavAsync(order, cancellationToken);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -407,7 +446,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#region 平均派单
|
|
|
/// <summary>
|
|
@@ -501,30 +540,30 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
cancellationToken);
|
|
|
if (steps.Any())
|
|
|
{
|
|
|
- List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers = new();
|
|
|
- var avg = steps.Count / schedulings.Count;
|
|
|
+ List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers = new();
|
|
|
+ var avg = steps.Count / schedulings.Count;
|
|
|
var remaining = steps.Count % schedulings.Count;
|
|
|
var skip = 0;
|
|
|
- for (var i = 0; i < schedulings.Count; i++)
|
|
|
+ for (var i = 0;i < schedulings.Count;i++)
|
|
|
{
|
|
|
- var scheduling = schedulings[i];
|
|
|
+ var scheduling = schedulings[i];
|
|
|
var size = avg + (i < remaining ? 1 : 0);
|
|
|
if (size > 0)
|
|
|
{
|
|
|
- handlers.Add(new(
|
|
|
- scheduling.SchedulingUser.UserId,
|
|
|
- scheduling.SchedulingUser.UserName,
|
|
|
- scheduling.SchedulingUser.OrgId,
|
|
|
- scheduling.SchedulingUser.OrgIdName,
|
|
|
- null, null,
|
|
|
- steps.Skip(skip).Take(size).ToList()));
|
|
|
+ handlers.Add(new(
|
|
|
+ scheduling.SchedulingUser.UserId,
|
|
|
+ scheduling.SchedulingUser.UserName,
|
|
|
+ scheduling.SchedulingUser.OrgId,
|
|
|
+ scheduling.SchedulingUser.OrgIdName,
|
|
|
+ null, null,
|
|
|
+ steps.Skip(skip).Take(size).ToList()));
|
|
|
skip += size;
|
|
|
- scheduling.SendOrderNum += size;
|
|
|
- await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum })
|
|
|
- .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
+ scheduling.SendOrderNum += size;
|
|
|
+ await _schedulingRepository.Updateable()
|
|
|
+ .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum })
|
|
|
+ .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (handlers.Any())
|
|
|
await _workflowDomainService.ChangeHandlerBatchAsync(handlers, cancellationToken);
|
|
|
}
|
|
@@ -549,7 +588,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
//投诉举报
|
|
|
case "30":
|
|
|
case "35":
|
|
|
- valid.Validation = dto.Title.Contains("意见") || dto.Title.Contains("建议") || dto.Title.Contains("咨询")
|
|
|
+ valid.Validation = dto.Title.Contains("意见") || dto.Title.Contains("建议") || dto.Title.Contains("咨询")
|
|
|
|| dto.Content.Contains("意见") || dto.Content.Contains("建议") || dto.Content.Contains("咨询");
|
|
|
if (dto.Content.Length < 25)
|
|
|
{
|
|
@@ -559,7 +598,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
break;
|
|
|
// 意见
|
|
|
case "1":
|
|
|
- valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报")|| dto.Title.Contains("咨询")
|
|
|
+ valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("咨询")
|
|
|
|| dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("咨询");
|
|
|
if (dto.Content.Length < 5)
|
|
|
{
|
|
@@ -570,7 +609,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
//建议求助
|
|
|
case "15":
|
|
|
case "20":
|
|
|
- valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("咨询")
|
|
|
+ valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("咨询")
|
|
|
|| dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("咨询");
|
|
|
if (dto.Content.Length < 25)
|
|
|
{
|
|
@@ -580,7 +619,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
break;
|
|
|
// 咨询
|
|
|
case "10":
|
|
|
- valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("意见")
|
|
|
+ valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("意见")
|
|
|
|| dto.Title.Contains("建议") || dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("意见") || dto.Content.Contains("建议");
|
|
|
if (dto.Content.Length < 5)
|
|
|
{
|
|
@@ -629,19 +668,19 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}
|
|
|
//查询即将超期和超期工单
|
|
|
var orderList = await _orderRepository.Queryable()
|
|
|
- .Where(x=> x.Status< EOrderStatus.Filed && !string.IsNullOrEmpty(x.CurrentHandleOrgId))
|
|
|
- .GroupBy(x=>x.CurrentHandleOrgId)
|
|
|
+ .Where(x => x.Status < EOrderStatus.Filed && !string.IsNullOrEmpty(x.CurrentHandleOrgId))
|
|
|
+ .GroupBy(x => x.CurrentHandleOrgId)
|
|
|
.Select(x => new OverTimeOrderDto
|
|
|
- {
|
|
|
- OrgId = x.CurrentHandleOrgId,
|
|
|
- NearlyOrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(now >= x.NearlyExpiredTime && now < x.ExpiredTime ,1,0)),
|
|
|
- ExpiredTimeOrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.ExpiredTime<now,1,0))
|
|
|
+ {
|
|
|
+ OrgId = x.CurrentHandleOrgId,
|
|
|
+ NearlyOrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(now >= x.NearlyExpiredTime && now < x.ExpiredTime, 1, 0)),
|
|
|
+ ExpiredTimeOrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.ExpiredTime < now, 1, 0))
|
|
|
})
|
|
|
.ToListAsync(cancellationToken);
|
|
|
|
|
|
foreach (var item in orderList)
|
|
|
{
|
|
|
- if (item.NearlyOrderCount==0 && item.ExpiredTimeOrderCount==0)
|
|
|
+ if (item.NearlyOrderCount == 0 && item.ExpiredTimeOrderCount == 0)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
@@ -724,12 +763,12 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
//成员单位标识 99
|
|
|
//宜宾市 511500 市级
|
|
|
var today = DateTime.Today;
|
|
|
- //var count = no.Substring(no.Length - 5);
|
|
|
- var setting = _systemSettingCacheManager.GetSetting(SettingConstants.VersionsAreaCode);
|
|
|
+ //var count = no.Substring(no.Length - 5);
|
|
|
+ var setting = _systemSettingCacheManager.GetSetting(SettingConstants.VersionsAreaCode);
|
|
|
var versionsAreaCode = setting?.SettingValue[0];
|
|
|
|
|
|
- //todo 双系统并行暂时执行此方案
|
|
|
- var count = no.Substring(no.Length - 4);
|
|
|
+ //todo 双系统并行暂时执行此方案
|
|
|
+ var count = no.Substring(no.Length - 4);
|
|
|
count = (Convert.ToInt32(count) + 50000).ToString();
|
|
|
|
|
|
var provinceCodes = new[] { "RGDH", "WX", "WB", "AP", "WZ", "YJ", "SCZWFWW", "XCX", "QT" };
|