using System.ComponentModel; using Hotline.Share.Enums.CallCenter; using SqlSugar; using XF.Domain.Entities; using XF.Domain.Repository; namespace Hotline.CallCenter.Tels { [Description("分机休息记录")] public class TelRest : WorkflowEntity//, CreationModificationEntity { /// /// 分机id /// public string TelId { get; set; } /// /// 分机号(冗余) /// public string TelNo { get; set; } /// /// 用户id /// public string UserId { get; set; } /// /// 用户名称(冗余) /// public string UserName { get; set; } /// /// 开始休息时间 /// [SugarColumn(ColumnDescription = "开始休息时间")] public DateTime? StartTime { get; set; } /// /// 结束休息时间 /// [SugarColumn(ColumnDescription = "结束休息时间")] public DateTime? EndTime { get; private set; } /// /// 休息时长(单位:秒) /// [SugarColumn(ColumnDescription = "休息时长(单位:秒)")] public double RestDuration { get; private set; } public string Reason { get; set; } /// /// 审核状态 /// public ETelRestApplyStatus ApplyStatus { get; set; } /// /// 工号(冗余) /// [SugarColumn( IsNullable = true)] public string? StaffNo { get; set; } public TelRest() { } public TelRest(string telId, string telNo, string userId, string userName,string reason,bool isApply,string staffNo) { TelId = telId; TelNo = telNo; UserId = userId; UserName = userName; Reason = reason;StaffNo = staffNo; if(isApply) { ApplyStatus = ETelRestApplyStatus.NoAudit; } else { ApplyStatus = ETelRestApplyStatus.Resting; StartTime = DateTime.Now; } } public void EndRest() { EndTime = DateTime.Now; RestDuration = (EndTime.Value - StartTime.Value).TotalSeconds; } } }