Jason 1 rok temu
rodzic
commit
d2291cb311

+ 25 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -76,6 +76,7 @@ public class OrderController : BaseController
     private readonly IRepeatableEventDetailRepository _repeatableEventDetailRepository;
     private readonly IRepository<OrderWord> _orderWrodRepository;
     private readonly IRepository<OrderObserve> _orderObserveRepository;
+    private readonly IRepository<OrderVisitApply> _orderVisitApplyRepository;
     private readonly IRepository<OrderFinality> _orderFinalityRepository;
 
 
@@ -114,7 +115,8 @@ public class OrderController : BaseController
         IRepeatableEventDetailRepository repeatableEventDetailRepository,
         IRepository<OrderWord> orderWrodRepository,
         IRepository<OrderObserve> orderObserveRepository,
-        IRepository<OrderFinality> orderFinalityRepository
+        IRepository<OrderFinality> orderFinalityRepository,
+        IRepository<OrderVisitApply> orderVisitApplyRepository
     )
     {
         _orderDomainService = orderDomainService;
@@ -151,6 +153,7 @@ public class OrderController : BaseController
         _orderWrodRepository = orderWrodRepository;
         _orderObserveRepository = orderObserveRepository;
         _orderFinalityRepository = orderFinalityRepository;
+        _orderVisitApplyRepository = orderVisitApplyRepository;
 
 
     }
@@ -600,6 +603,27 @@ public class OrderController : BaseController
     }
 
 
+    #endregion
+
+    #region 二次回访申请
+
+    public async Task ApplyOrderVisit([FromBody]VisitStartFlowDto dto)
+    {
+        var orderVisitApply = _mapper.Map<AddVisitApply>(dto.Data);
+        //验证是否可以申请二次回访
+        
+
+        var isAny = await _orderVisitApplyRepository.AnyAsync(x => x.OrderId == orderVisitApply.OrderId && x.VisitApplyState != EVisitApplyState.NoPass,HttpContext.RequestAborted);
+        if (isAny)
+        {
+            throw UserFriendlyException.SameMessage("当前状态不能申请二次回访");
+        }
+
+        var orderModel = await _orderRepository.GetAsync(x => x.Id == orderVisitApply.OrderId, HttpContext.RequestAborted);
+        
+
+    }
+
     #endregion
 
     #region 工单重办

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -60,7 +60,7 @@
     }
   },
   "DatabaseConfiguration": {
-    "ApplyDbMigrations": false,
+    "ApplyDbMigrations": true,
     "ApplySeed": false
   },
   "MqConfiguration": {

+ 6 - 0
src/Hotline.Share/Dtos/Order/OrderStartFlowDto.cs

@@ -32,4 +32,10 @@ namespace Hotline.Share.Dtos.Order
     {
 
     }
+
+    public class VisitStartFlowDto:StartWorkflowDto<AddVisitApply>
+    {
+
+    }
+
 }

+ 13 - 0
src/Hotline.Share/Dtos/Order/QueryOrderDto.cs

@@ -506,4 +506,17 @@ namespace Hotline.Share.Dtos.Order
         NoPub = 2
     }
 
+    public class AddVisitApply 
+    {
+        public string OrderNo { get; set; }
+
+        public string OrderId { get; set; }
+
+        public string VisitReason { get; set; }
+
+        public string OrderVisitId { get; set; }
+
+        public List<string> FileIds { get; set; }
+    }
+
 }

+ 30 - 0
src/Hotline.Share/Enums/Order/EVisitApplyState.cs

@@ -0,0 +1,30 @@
+using System.ComponentModel;
+
+
+namespace Hotline.Share.Enums.Order
+{
+    public enum EVisitApplyState
+    {
+
+        [Description("审批中")]
+        Examining = 0,
+
+        /// <summary>
+        /// 通过
+        /// </summary>
+        [Description("通过")]
+        Pass = 1,
+
+        /// <summary>
+        /// 拒绝
+        /// </summary>
+        [Description("拒绝")]
+        NoPass = 2,
+
+        /// <summary>
+		/// 审批拒绝
+		/// </summary>
+		[Description("审批拒绝")]
+        Refuse = 3,
+    }
+}

+ 6 - 0
src/Hotline.Share/Enums/Order/EVisitState.cs

@@ -32,5 +32,11 @@ namespace Hotline.Share.Enums.Order
         /// </summary>
         [Description("不满意待回访")]
         NoSatisfiedWaitForVisit =40,
+
+        /// <summary>
+        /// 失效
+        /// </summary>
+        [Description("失效")]
+        None = 50,
     }
 }

+ 2 - 2
src/Hotline/Orders/OrderVisit.cs

@@ -48,13 +48,13 @@ public class OrderVisit : CreationEntity
     /// 回访人
     /// </summary>
     [SugarColumn(IsNullable = true)]
-    public string EmployeeId { get; set; }
+    public string? EmployeeId { get; set; }
 
     /// <summary>
     /// 回访人(对象)
     /// </summary>
     [Navigate(NavigateType.OneToOne, nameof(EmployeeId))]
-    public User Employee { get; set; }
+    public User? Employee { get; set; }
 
     /// <summary>
     /// 是否接通

+ 46 - 0
src/Hotline/Orders/OrderVisitApply.cs

@@ -0,0 +1,46 @@
+using Hotline.FlowEngine.Workflows;
+using Hotline.Share.Enums.Order;
+using Hotline.Users;
+using SqlSugar;
+using XF.Domain.Repository;
+
+namespace Hotline.Orders
+{
+
+    public class OrderVisitApply: CreationEntity
+    {
+        public string OrderNo { get; set; }
+
+        public string OrderId { get; set; }
+
+        [Navigate(NavigateType.OneToOne, nameof(OrderId))]
+        public Order Order { get; set; }
+
+        public string EmployeeId { get; set; }
+
+        [Navigate(NavigateType.OneToOne, nameof(EmployeeId))]
+        public User Employee { get; set; }
+
+        public string VisitReason { get; set; }
+
+        /// <summary>
+        /// 源单号
+        /// </summary>
+        public string OrderVisitId { get; set; }
+
+        [Navigate(NavigateType.OneToOne,nameof(OrderVisitId))]
+        public OrderVisit OrderVisit { get; set; }
+
+
+        /// <summary>
+        /// 流程ID
+        /// </summary>
+        public string? WorkflowId { get; set; }
+
+        [Navigate(NavigateType.OneToOne,nameof(WorkflowId))]
+        public Workflow? Workflow { get; set; }
+
+
+        public EVisitApplyState VisitApplyState { get; set; }
+    }
+}

+ 0 - 4
src/Hotline/Orders/OrderVisitDetail.cs

@@ -68,9 +68,5 @@ namespace Hotline.Orders
         /// </summary>
         public EVisitTarget VisitTarget { get; set; }
 
-        ///// <summary>
-        ///// 是否可甄别
-        ///// </summary>
-        //public bool? IsCanScreen { get; set; }
     }
 }