using Hotline.FlowEngine.Workflows;
using Hotline.Share.Enums.Order;
using Hotline.Users;
using SqlSugar;
using XF.Domain.Extensions;
using XF.Domain.Repository;
namespace Hotline.Orders
{
///
/// 工单
///
public partial class Order : PositionWorkflowEntity
{
#region 来电信息
///
/// 来源渠道
///
public EChannel Channel { get; set; }
///
/// 接线员工(userId)
///
public string EmployeeId { get; set; }
///
/// 来电号码
///
public string? FromPhone { get; set; }
///
/// 转接号码(转接来源)
///
public string? TransferPhone { get; set; }
///
/// 来电/信人姓名
///
public string FromName { get; set; }
///
/// 来电/信人性别
///
public EGender FromGender { get; set; }
///
/// 来电/信人身份
///
public EIdentityType IdentityType { get; set; }
///
/// 证件类型
///
public ELicenceType? LicenceType { get; set; }
///
/// 证件号码
///
public string? LicenceNo { get; set; }
///
/// 年龄段
///
[SugarColumn(IsNullable = true)]
public string? AgeRangeCode { get; set; }
[SugarColumn(IsNullable = true)]
public string? AgeRange { get; set; }
///
/// 联系电话
///
[SugarColumn(ColumnDescription = "联系电话", IsNullable = true)]
public string? Contact { get; set; }
[SugarColumn(ColumnDescription = "联系电话脱敏", IsNullable = true)]
public string? ContactMask { get; set; }
///
/// 是否接受短信,勾选校验手机号
///
public bool AcceptSms { get; set; }
///
/// 是否需要联系
///
public bool NeedContact { get; set; }
///
/// 工作单位(当“来电/信人身份”为“企业”时必填,其他情况非必填)
///
[SugarColumn(ColumnDescription = "工作单位", IsNullable = true)]
public string? Company { get; set; }
#endregion
#region 诉求信息
///
/// 工单编码(202201010001)
///
public string No { get; set; }
///
/// 工单类型
///
public EOrderType OrderType { get; set; }
///
/// 受理类型
///
public EAcceptType AcceptType { get; set; }
///
/// 紧急程度
///
public EEmergencyLevel EmergencyLevel { get; set; } = EEmergencyLevel.Normal;
public string Title { get; set; }
///
/// 热点
///
public string HotspotId { get; set; }
public string Hotspot { get; set; }
public string HotspotSpliceName { get; set; }
///
/// 事发时间
///
public DateTime? IncidentTime { get; set; }
///
/// 重复工单
///
[SugarColumn(ColumnDescription = "重复工单Id", IsNullable = true)]
public string? DuplicateId { get; set; }
[SugarColumn(ColumnDescription = "重复工单", IsNullable = true)]
public string? DuplicateName { get; set; }
///
/// 推送分类
///
public EPushType PushType { get; set; }
///
/// 附件
///
[SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
public List Additions { get; set; } = new();
///
/// 诉求内容
///
[SugarColumn(ColumnDataType = "varchar(2000)")]
public string Content { get; set; }
#endregion
#region 工单属性
///
/// 当前节点名称
///
[SugarColumn(ColumnDescription = "当前节点名称", IsNullable = true)]
public string? CurrentStepName { get; set; }
///
/// 到达当前节点时间
///
public DateTime? CurrentStepTime { get; set; }
///
/// 工单状态
///
public EOrderStatus Status { get; set; }
///
/// 开始时间
///
public DateTime? StartTime { get; set; }
///
/// 过期时间
///
public DateTime? ExpiredTime { get; set; }
///
/// 过期状态
///
public EExpiredStatus ExpiredStatus { get; set; }
#endregion
///
/// 接线员(服务人)
///
[Navigate(NavigateType.OneToOne, nameof(EmployeeId))]
public User Employee { get; set; }
[Navigate(NavigateType.OneToMany, nameof(Workflow.ExternalId))]
public List Workflows { get; set; }
}
///
/// 渠道为电话时存在字段
///
public partial class Order
{
///
/// 工单扩展信息(12315-投诉)
///
[Navigate(NavigateType.OneToOne, nameof(Id))]
public OrderComplain OrderComplain { get; set; }
///
/// 工单扩展信息(12315-举报)
///
[Navigate(NavigateType.OneToOne, nameof(Id))]
public OrderReport OrderReport { get; set; }
#region Method
public void Init(string employeeId)
{
EmployeeId = employeeId;
if (!string.IsNullOrEmpty(Contact))
ContactMask = Contact.MaskPhoneNumber();
Status = EOrderStatus.Temporary;
ExpiredStatus = EExpiredStatus.Normal;
StartTime = DateTime.Now;
}
#endregion
}
}