|
@@ -19,6 +19,7 @@ using Hotline.Share.Dtos;
|
|
|
using Hotline.Settings.Hotspots;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
+using Hotline.Settings;
|
|
|
|
|
|
namespace Hotline.Orders;
|
|
|
|
|
@@ -106,9 +107,9 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
{
|
|
|
if (autoAccept)
|
|
|
{
|
|
|
- order.AutoAccept(_sessionContext.RequiredUserId, _sessionContext.UserName, _sessionContext.StaffNo);
|
|
|
+ order.AutoAccept(_sessionContext.RequiredUserId, _sessionContext.UserName, _sessionContext.StaffNo);
|
|
|
order.Sign(_sessionContext.RequiredUserId, _sessionContext.UserName);
|
|
|
- }
|
|
|
+ }
|
|
|
order.Init();
|
|
|
order.No = GenerateNewOrderNo();
|
|
|
order.Password = Random.Shared.Next(100000, 1000000).ToString();
|
|
@@ -176,7 +177,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
{
|
|
|
var complement = _mapper.Map<OrderComplement>(dto);
|
|
|
complement.InitId();
|
|
|
- complement.IsProComplement = true;
|
|
|
+ complement.IsProComplement = true;
|
|
|
if (dto.Files.Any()) complement.FileJson = await _fileRepository.AddFileAsync(dto.Files, complement.Id, "", cancellationToken);
|
|
|
return await _orderComplementRepository.AddAsync(complement, cancellationToken);
|
|
|
}
|
|
@@ -184,6 +185,19 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 验证是否是管理员
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public bool IsCheckAdmin()
|
|
|
+ {
|
|
|
+ var systemAdministrator = _systemSettingCacheManager.GetSetting(SettingConstants.SystemAdministrator)?.SettingValue[0];
|
|
|
+ if (!string.IsNullOrEmpty(systemAdministrator) && (_sessionContext.Roles.Contains(systemAdministrator) || _sessionContext.Roles.Contains(RoleSeedData.AdminRole)))
|
|
|
+ return true;
|
|
|
+ else
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
#region 平均派单
|
|
|
/// <summary>
|
|
|
/// 平均派单
|
|
@@ -204,7 +218,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
Username = "待派单池",
|
|
|
OrgId = OrgSeedData.CenterId,
|
|
|
OrgName = "市民热线服务中心"
|
|
|
- };
|
|
|
+ };
|
|
|
scheduling.SendOrderNum++;
|
|
|
await _schedulingRepository.UpdateAsync(scheduling, cancellationToken);
|
|
|
var user = scheduling.SchedulingUser;
|
|
@@ -244,9 +258,9 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
var sendNum = steps.Count / schedulings;
|
|
|
scheduling.SendOrderNum += sendNum;
|
|
|
await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AtWork = scheduling.AtWork })
|
|
|
- .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
- if (sendNum <= 0) return;
|
|
|
+ .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AtWork = scheduling.AtWork })
|
|
|
+ .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
+ if (sendNum <= 0) return;
|
|
|
var sendSteps = steps.Take(sendNum).ToList();
|
|
|
await _workflowDomainService.ChangeHandlerBatchAsync(new List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)>
|
|
|
{
|
|
@@ -255,7 +269,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 触发平均派单
|
|
|
/// </summary>
|
|
@@ -276,7 +290,7 @@ 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();
|
|
|
+ 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;
|
|
|
for (var i = 0; i < schedulings.Count; i++)
|
|
@@ -288,13 +302,13 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
scheduling.SchedulingUser.UserName,
|
|
|
scheduling.SchedulingUser.OrgId,
|
|
|
scheduling.SchedulingUser.OrgIdName,
|
|
|
- null,null,
|
|
|
+ null, null,
|
|
|
steps.Take(size).ToList()));
|
|
|
scheduling.SendOrderNum += size;
|
|
|
- await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum })
|
|
|
- .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
- }
|
|
|
+ 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);
|
|
|
}
|