admin 1 anno fa
parent
commit
ebf42ece40

+ 22 - 1
src/Hotline.Api/Controllers/PbxController.cs

@@ -303,12 +303,33 @@ namespace Hotline.Api.Controllers
             await _telRestRepository.AddAsync(telRest, HttpContext.RequestAborted);
 
             var startWorkflowDto = _mapper.Map<StartWorkflowDto>(dto);
-            startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApply;
+            startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApplyNew;
             startWorkflowDto.Title = dto.Reason;
             await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, HttpContext.RequestAborted);
         }
 
 
+        /// <summary>
+        /// 开始分机休息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [Permission(EPermission.Rest)]
+        [HttpGet("begin-rest")]
+        public async Task BeginRest(string id)
+        {
+            if (string.IsNullOrEmpty(id))
+                throw UserFriendlyException.SameMessage("无效分机休息编号");
+            var telRest = await _telRestRepository.GetAsync(id, HttpContext.RequestAborted);
+            if (telRest == null)
+                throw new UserFriendlyException($"无效分机休息编号, telRestId: {id}", "无效分机休息编号");
+
+            telRest.ApplyStatus = ETelRestApplyStatus.Resting;
+            telRest.StartTime = DateTime.Now;
+            await _telRestRepository.UpdateAsync(telRest, HttpContext.RequestAborted);
+        }
+
+
         /// <summary>
         /// 分机休息
         /// </summary>

+ 8 - 0
src/Hotline/CallCenter/Tels/ITelDomainService.cs

@@ -60,6 +60,14 @@ namespace Hotline.CallCenter.Tels
         /// <returns></returns>
         Task TelRestApplyPassAsync(string? id, CancellationToken cancellationToken);
 
+        /// <summary>
+        /// 分机小休审批通过(新)
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        Task TelRestApplyPassNewAsync(string? id, CancellationToken cancellationToken);
+
         /// <summary>
         /// 分机结束休息
         /// </summary>

+ 20 - 0
src/Hotline/CallCenter/Tels/TelDomainService.cs

@@ -91,6 +91,26 @@ public class TelDomainService : ITelDomainService, IScopeDependency
     //    throw new UserFriendlyException("当前坐席正在休息");
     //}
 
+    /// <summary>
+    /// 分机审批通过(新)
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public async Task TelRestApplyPassNewAsync(string? id, CancellationToken cancellationToken)
+    {
+        if (string.IsNullOrEmpty(id))
+            throw UserFriendlyException.SameMessage("无效分机休息编号");
+
+        var telRest = await _telRestRepository.GetAsync(id, cancellationToken);
+        if (telRest == null)
+            throw new UserFriendlyException($"无效分机休息编号, telRestId: {id}", "无效分机休息编号");
+
+        //通知前端休息通过
+        await _realtimeService.RestApplyPassAsync(telRest.UserId, cancellationToken);
+    }
+
+
     /// <summary>
     /// 分机审批通过
     /// </summary>

+ 6 - 0
src/Hotline/FlowEngine/WfModules/WorkflowModule.cs

@@ -90,6 +90,11 @@ public class WorkflowModuleConsts
     /// </summary>
     public const string TelRestApply = "TelRestApply";
 
+    /// <summary>
+    /// 分机小休申请(新)
+    /// </summary>
+    public const string TelRestApplyNew = "TelRestApplyNew";
+
     public static List<WorkflowModule> AllModules =>
         new List<WorkflowModule>
         {
@@ -98,5 +103,6 @@ public class WorkflowModuleConsts
             new WorkflowModule(KnowledgeUpdate,"知识更新"),
             new WorkflowModule(KnowledgeDelete,"知识删除"),
             new WorkflowModule(TelRestApply,"分机小休申请"),
+            new WorkflowModule(TelRestApplyNew,"分机小休申请(新)")
         };
 }