|
@@ -34,6 +34,7 @@ using Hotline.Configurations;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using Hotline.Share.Tools;
|
|
|
using Hotline.Orders.Notifications;
|
|
|
+using Hotline.Share.Mq;
|
|
|
|
|
|
namespace Hotline.Orders;
|
|
|
|
|
@@ -164,9 +165,36 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
FeedBackPhone = order.Contact,
|
|
|
CreatorName = _sessionContext.UserName
|
|
|
};
|
|
|
- await _orderPublishRepository.AddAsync(orderPublish, cancellationToken);
|
|
|
+ var id = await _orderPublishRepository.AddAsync(orderPublish, cancellationToken);
|
|
|
order.Publish(orderPublish.PublishState);
|
|
|
await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+
|
|
|
+ //需求251 某些工单需自动发送短信
|
|
|
+ //任何类型的省工单都不需要发送短信
|
|
|
+ if (order.Source != ESource.ProvinceStraight)
|
|
|
+ {
|
|
|
+ var code = "";
|
|
|
+ //受理类型为“投诉、举报”
|
|
|
+ if (order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35")
|
|
|
+ code = "1017";
|
|
|
+ else
|
|
|
+ code = "1018";
|
|
|
+
|
|
|
+ var messageDto = new Share.Dtos.Push.MessageDto
|
|
|
+ {
|
|
|
+ PushBusiness = EPushBusiness.SearchSms,
|
|
|
+ ExternalId = id,
|
|
|
+ OrderId = order.Id,
|
|
|
+ PushPlatform = EPushPlatform.Sms,
|
|
|
+ Remark = order.Title,
|
|
|
+ Name = order.FromName,
|
|
|
+ TemplateCode = code,
|
|
|
+ Params = new List<string>() { order.No, order.Password },
|
|
|
+ TelNumber = order.Contact,
|
|
|
+ };
|
|
|
+ await _mediator.Publish(new PushMessageNotify(messageDto), cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
//推省上
|
|
|
var publishPublishOrder = orderPublish.Adapt<PublishPublishOrderDto>();
|
|
|
publishPublishOrder.Order = order.Adapt<OrderDto>();
|
|
@@ -196,7 +224,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
.CountAsync(cancellationToken);
|
|
|
|
|
|
// 若取消发布的工单,已经被回访过了,没有经过重新办理,再次发布后,自动跳过回访环节,展示取消发布前的回访结果
|
|
|
- if (orderPublishDeletedCount != 0 && orderVisitVisitedCount !=0)
|
|
|
+ if (orderPublishDeletedCount != 0 && orderVisitVisitedCount != 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -277,6 +305,51 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
|
await _publisher.PublishAsync(new UpdateOrderVisitNotify(orderVisit.Adapt<OrderVisitNotifyDto>()), cancellationToken);
|
|
|
|
|
|
+ //需求251 某些工单需自动发送短信
|
|
|
+ //任何类型的省工单都不需要发送短信
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (order.Source != ESource.ProvinceStraight)
|
|
|
+ {
|
|
|
+ var code = "";
|
|
|
+ //受理类型为“投诉、举报”
|
|
|
+ if ((order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35") && orderVisit.VisitState != EVisitState.Visited)
|
|
|
+ {
|
|
|
+ code = "1017";
|
|
|
+ orderVisit.VisitState = EVisitState.SMSVisiting;
|
|
|
+ await _orderVisitRepository.UpdateAsync(orderVisit);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ code = "1018";
|
|
|
+
|
|
|
+ //发送查询短信
|
|
|
+ var messageDto = new Share.Dtos.Push.MessageDto
|
|
|
+ {
|
|
|
+ PushBusiness = EPushBusiness.SearchSms,
|
|
|
+ ExternalId = visitId,
|
|
|
+ OrderId = order.Id,
|
|
|
+ PushPlatform = EPushPlatform.Sms,
|
|
|
+ Remark = order.Title,
|
|
|
+ Name = order.FromName,
|
|
|
+ TemplateCode = code,
|
|
|
+ Params = new List<string>() { order.No, order.Password },
|
|
|
+ TelNumber = order.Contact,
|
|
|
+ };
|
|
|
+ await _mediator.Publish(new PushMessageNotify(messageDto), cancellationToken);
|
|
|
+
|
|
|
+ // 发送短信后推送一个 48小时的延迟消息队列. 当消息队列收到消息时, 判断用户是否回复了, 如果未回复短信就 默认满意
|
|
|
+ var delaySecond = _systemSettingCacheManager.DefaultVisitSmsDelaySecond;
|
|
|
+ await _capPublisher.PublishDelayAsync(
|
|
|
+ TimeSpan.FromSeconds(delaySecond),
|
|
|
+ EventNames.UpdateVisitDelaySms,
|
|
|
+ messageDto,
|
|
|
+ cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
if (order.IsProvince == false && orderVisit.VisitState == EVisitState.Visited)
|
|
|
{
|
|
|
//推省上
|
|
@@ -366,7 +439,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
order.No = GenerateNewOrderNo();
|
|
|
if (order.Source == ESource.Police110)
|
|
|
{
|
|
|
- order.Title = @"(非警情工单-"+order.No.Substring(order.No.Length - 6) +")";
|
|
|
+ order.Title = @"(非警情工单-" + order.No.Substring(order.No.Length - 6) + ")";
|
|
|
}
|
|
|
order.Password = Random.Shared.Next(100000, 1000000).ToString();
|
|
|
order.ProvinceNo = string.IsNullOrEmpty(order.ProvinceNo) ? GenerateNewProvinceNo(order.No, order.SourceChannelCode) : order.ProvinceNo;
|
|
@@ -468,7 +541,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
.OrderBy(x => x.SendOrderNum).FirstAsync(cancellationToken);
|
|
|
var centerOrgName = _systemSettingCacheManager.GetSetting(SettingConstants.CenterOrgName)?.SettingValue[0];
|
|
|
var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
- if (scheduling is null)
|
|
|
+ if (scheduling is null)
|
|
|
return new FlowStepHandler
|
|
|
{
|
|
|
Key = AppDefaults.SendPoolId,
|
|
@@ -479,7 +552,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
OrgName = centerOrgName,
|
|
|
RoleId = roleId,
|
|
|
RoleName = "派单员"
|
|
|
- };
|
|
|
+ };
|
|
|
scheduling.SendOrderNum++;
|
|
|
await _schedulingRepository.UpdateAsync(scheduling, cancellationToken);
|
|
|
var user = scheduling.SchedulingUser;
|
|
@@ -493,7 +566,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
OrgName = user.OrgIdName,
|
|
|
RoleId = roleId,
|
|
|
RoleName = "派单员"
|
|
|
- };
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -511,7 +584,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
cancellationToken);
|
|
|
var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
|
|
|
- var user = await _userRepository.Queryable()
|
|
|
+ var user = await _userRepository.Queryable()
|
|
|
.Includes(d => d.Organization)
|
|
|
.FirstAsync(d => d.Id == userId, cancellationToken);
|
|
|
var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
@@ -527,12 +600,12 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
if (sendNum <= 0) return;
|
|
|
var sendSteps = steps.Take(sendNum).ToList();
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Order()
|
|
|
- {
|
|
|
- CenterToOrgHandlerId = user.OrgId,
|
|
|
- CenterToOrgHandlerName = user.Name
|
|
|
- }).Where(o => sendSteps.Any(s => s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
+ {
|
|
|
+ CenterToOrgHandlerId = user.OrgId,
|
|
|
+ CenterToOrgHandlerName = user.Name
|
|
|
+ }).Where(o => sendSteps.Any(s => s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
|
|
|
- await _workflowDomainService.ChangeHandlerBatchAsync(new List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)>
|
|
|
+ await _workflowDomainService.ChangeHandlerBatchAsync(new List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)>
|
|
|
{
|
|
|
new(user.Id, user.Name, user.OrgId, user.Organization.Name,roleId,"派单员", sendSteps)
|
|
|
}, cancellationToken);
|
|
@@ -554,7 +627,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
.Where(x => x.SchedulingTime!.Value == time && x.WorkingTime!.Value <= DateTime.Now.TimeOfDay && x.OffDutyTime!.Value >= DateTime.Now.TimeOfDay && x.AtWork == true)
|
|
|
.OrderBy(x => x.SendOrderNum).ToListAsync(cancellationToken);
|
|
|
var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
- if (schedulings.Any())
|
|
|
+ if (schedulings.Any())
|
|
|
{
|
|
|
var steps = await _workflowDomainService.GetStepsBelongsToAsync(AppDefaults.SendPoolId,
|
|
|
cancellationToken);
|
|
@@ -564,15 +637,15 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
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 size = avg + (i < remaining ? 1 : 0);
|
|
|
if (size > 0)
|
|
|
{
|
|
|
- var stSteps = steps.Skip(skip).Take(size).ToList();
|
|
|
+ var stSteps = steps.Skip(skip).Take(size).ToList();
|
|
|
|
|
|
- handlers.Add(new(
|
|
|
+ handlers.Add(new(
|
|
|
scheduling.SchedulingUser.UserId,
|
|
|
scheduling.SchedulingUser.UserName,
|
|
|
scheduling.SchedulingUser.OrgId,
|
|
@@ -585,11 +658,11 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
.SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum })
|
|
|
.Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Order()
|
|
|
- {
|
|
|
- CenterToOrgHandlerId = scheduling.SchedulingUser.UserId,
|
|
|
- CenterToOrgHandlerName = scheduling.SchedulingUser.UserName
|
|
|
- })
|
|
|
- .Where(o => stSteps.Any(s=>s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
+ {
|
|
|
+ CenterToOrgHandlerId = scheduling.SchedulingUser.UserId,
|
|
|
+ CenterToOrgHandlerName = scheduling.SchedulingUser.UserName
|
|
|
+ })
|
|
|
+ .Where(o => stSteps.Any(s => s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
}
|
|
|
}
|
|
|
if (handlers.Any())
|