using Hotline.CallCenter.Calls; using Hotline.FlowEngine.Workflows; using Hotline.Settings; using Hotline.Settings.Hotspots; using Hotline.Share.Dtos; using Hotline.Share.Dtos.File; using Hotline.Share.Enums.FlowEngine; using Hotline.Share.Enums.Order; using Hotline.Share.Enums.Settings; using Hotline.Share.Tools; using Hotline.Users; using SqlSugar; using System.ComponentModel; using Hotline.Snapshot; using XF.Domain.Exceptions; using XF.Domain.Extensions; using XF.Domain.Repository; using XF.Utility.EnumExtensions; using Hotline.KnowledgeBase; namespace Hotline.Orders { /// /// 工单 /// [Description("工单")] [SugarIndex("unique_order_no", nameof(Order.No), OrderByType.Desc, true)] [SugarIndex("index_order_creationtime", nameof(Order.CreationTime), OrderByType.Desc)] [SugarIndex("index_order_startTime", nameof(Order.StartTime), OrderByType.Desc)] [SugarIndex("index_order_expiredTime", nameof(Order.ExpiredTime), OrderByType.Desc)] public partial class Order : PositionWorkflowEntity { public Order() { //HotspotCodeLv1 ??= HotspotCode?[..2]; } /// /// 第一次评价结果 /// [SugarColumn(ColumnDescription = "第一次评价结果")] public string? FirstVisitResult { get; set; } [SugarColumn(ColumnDescription = "第一次评价结果代码")] public string? FirstVisitResultCode { get; set; } #region 来电信息 /// /// 来源渠道(电话、网站、APP等) /// [SugarColumn(ColumnDescription = "来源渠道")] public string? SourceChannel { get; set; } [SugarColumn(ColumnDescription = "来源渠道代码")] public string? SourceChannelCode { get; set; } /// /// 渠道为电话时,此字段存在(Call.Id) /// [SugarColumn(ColumnDescription = "来电ID")] public string? CallId { get; set; } /// /// 来电归属地 /// [SugarColumn(ColumnDescription = "来电地址")] public string? CallAddress { get; set; } /// /// 来电号码 /// [SugarColumn(ColumnDescription = "来电号码")] public string? FromPhone { get; set; } /// /// 转接号码(转接来源) /// [SugarColumn(ColumnDescription = "转接号码")] public string? TransferPhone { get; set; } /// /// 来电/信人姓名 /// [SugarColumn(ColumnDescription = "来电姓名")] public string? FromName { get; set; } /// /// 来电/信人性别 /// [SugarColumn(ColumnDescription = "来电性别")] public EGender FromGender { get; set; } /// /// 来电/信人身份 /// [SugarColumn(ColumnDescription = "来电身份")] public EIdentityType? IdentityType { get; set; } /// /// 证件类型 /// [SugarColumn(ColumnDescription = "证件类型")] public string? LicenceTypeCode { get; set; } [SugarColumn(ColumnDescription = "证件类型名称")] public string? LicenceType { get; set; } /// /// 证件号码 /// [SugarColumn(ColumnDescription = "证件号码")] public string? LicenceNo { get; set; } /// /// 年龄段 /// [SugarColumn(ColumnDescription = "年龄段代码")] public string? AgeRangeCode { get; set; } [SugarColumn(ColumnDescription = "年龄段")] public string? AgeRange { get; set; } /// /// 联系电话 /// [SugarColumn(ColumnDescription = "联系电话")] public string? Contact { get; set; } [SugarColumn(ColumnDescription = "联系电话脱敏", IsNullable = true)] public string? ContactMask { get; set; } /// /// 是否接受短信,勾选校验手机号 /// [SugarColumn(ColumnDescription = "是否接受短信")] public bool AcceptSms { get; set; } /// /// 是否已发送短信 /// [SugarColumn(ColumnDescription = "是否已发送短信")] public bool SmsSended { get; set; } /// /// 是否保密 /// [SugarColumn(ColumnDescription = "是否保密")] public bool IsSecret { get; set; } /// /// 工作单位(当“来电/信人身份”为“企业”时必填,其他情况非必填) /// [SugarColumn(ColumnDescription = "工作单位", IsNullable = true)] public string? Company { get; set; } #endregion #region 诉求信息 /// /// 受理类型 /// [SugarColumn(ColumnDescription = "受理类型")] public string? AcceptType { get; set; } /// /// 受理类型代码 /// [SugarColumn(ColumnDescription = "受理类型代码")] public string? AcceptTypeCode { get; set; } [SugarColumn(ColumnDescription = "标题")] public string Title { get; set; } #region 工单标签(自贡) /// /// 工单标签(自贡)-- 弃用 /// [SugarColumn(ColumnDescription = "工单标签-- 弃用")] public string? OrderTag { get; set; } [SugarColumn(ColumnDescription = "工单标签代码")] public string? OrderTagCode { get; set; } /// /// 工单标签 /// [Navigate(typeof(OrderRelationTag), nameof(OrderRelationTag.OrderId), nameof(OrderRelationTag.TagId))] public List OrderTags { get; set; } #endregion #region 热点 /// /// 热点 /// [SugarColumn(ColumnDescription = "热点ID")] public string? HotspotId { get; set; } //public string? HotspotCode { get; set; } //public string? HotspotCodeLv1 { get; set; } [SugarColumn(ColumnDescription = "热点名称")] public string? HotspotName { get; set; } /// /// 热点分类类目名称 /// [SugarColumn(ColumnDescription = "热点分类名称")] public string? HotspotSpliceName { get; set; } /// /// 外部数据(为前端提供级联功能) /// [SugarColumn(ColumnDescription = "外部数据")] public string? HotspotExternal { get; set; } #endregion #region 事件分类 [SugarColumn(ColumnDescription = "事件分类ID")] public string? EventCategoryId { get; set; } [SugarColumn(ColumnDescription = "事件分类名称")] public string? EventCategoryName { get; set; } [SugarColumn(ColumnDescription = "事件分类拼接名称")] public string? EventCategorySpliceName { get; set; } [SugarColumn(ColumnDescription = "事件分类外部数据")] public string? EventCategoryExternal { get; set; } #endregion /// /// 事发时间 /// [SugarColumn(ColumnDescription = "事发时间")] public DateTime? IncidentTime { get; set; } /// /// 事件目的 /// [SugarColumn(ColumnDescription = "事件目的")] public string? IncidentPurpose { get; set; } /// /// 重复工单Id /// [SugarColumn(ColumnDescription = "重复工单Id", ColumnDataType = "json", IsJson = true)] public List? DuplicateIds { get; set; } /// /// 推送分类 -- 转为表存储 /// [SugarColumn(ColumnDescription = "推送分类代码")] public string? PushTypeCode { get; set; } /// /// 推送分类 -- 冗余 多选存储 ,分割 /// [SugarColumn(ColumnDescription = "推送分类")] public string? PushType { get; set; } /// /// 附件 /// [SugarColumn(ColumnDataType = "json", IsJson = true)] public List? Additions { get; set; } = new(); /// /// 诉求内容 /// [SugarColumn(ColumnDataType = "varchar(8000)", ColumnDescription = "诉求内容")] public string Content { get; set; } #endregion #region 工单属性 /// /// 工单状态 /// [SugarColumn(ColumnDescription = "工单状态")] public EOrderStatus Status { get; set; } /// /// 过期状态 //todo 延迟消息更新此字段 /// [SugarColumn(ColumnDescription = "过期状态")] public EExpiredStatus ExpiredStatus { get; set; } /// /// 来源,区分省平台或110等其他平台同步过来的工单 /// [SugarColumn(ColumnDescription = "来源")] public ESource Source { get; set; } /// /// 处理方式(直办、交办) /// [SugarColumn(ColumnDescription = "处理方式")] public EProcessType ProcessType { get; set; } = EProcessType.Zhiban; /// /// 是否公开 /// [SugarColumn(ColumnDescription = "是否公开")] public bool IsPublicity { get; set; } /// /// 是否为省工单(省派发工单非政民互动直派的为省工单) /// [SugarColumn(ColumnDescription = "是否省工单")] public bool IsProvince { get; set; } /// /// 工单编码(20220101000001) /// [SugarColumn(ColumnDescription = "工单编码")] public string? No { get; set; } /// /// 是否已撤销 /// [SugarColumn(ColumnDescription = "是否已撤销")] public bool IsCancel { get; set; } /// /// 市民查询密码 /// [SugarColumn(ColumnDescription = "查询密码")] public string? Password { get; set; } /// /// 企业名称 /// [SugarColumn(ColumnDescription = "企业名称")] public string? EnterpriseName { get; set; } /// /// 企业Code /// [SugarColumn(ColumnDescription = "企业编码")] public string? EnterpriseCode { get; set; } /// /// 专班名称 /// [SugarColumn(ColumnDescription = "专班名称")] public string? ZhuanBanMingCheng { get; set; } /// /// 专班Code /// [SugarColumn(ColumnDescription = "专班编码")] public string? ZhuanBanCode { get; set; } #endregion #region 流程信息 /// /// 工单开始时间(受理/接办时间=流程开启时间) /// [SugarColumn(ColumnDescription = "工单开始时间")] public DateTime? StartTime { get; set; } /// /// 超期时间(期满时间) /// [SugarColumn(ColumnDescription = "超期时间")] public DateTime? ExpiredTime { get; set; } /// /// 即将超期时间 /// [SugarColumn(ColumnDescription = "即将超期时间")] public DateTime? NearlyExpiredTime { get; set; } /// /// 即将超期时间第一级 /// [SugarColumn(ColumnDescription = "即将超期时间第一级")] public DateTime? NearlyExpiredTimeOne { get; set; } /// /// 交办时间(中心交部门办理时间) /// [SugarColumn(ColumnDescription = "交办时间")] public DateTime? CenterToOrgTime { get; set; } /// /// 交办意见 /// [SugarColumn(ColumnDataType = "text", ColumnDescription = "交办意见")] public string? CenterToOrgOpinion { get; set; } /// /// 交办人 /// [SugarColumn(ColumnDescription = "交办人ID")] public string? CenterToOrgHandlerId { get; set; } [SugarColumn(ColumnDescription = "交办人姓名")] public string? CenterToOrgHandlerName { get; set; } /// /// 归档时间(暂为流程结束时间,因流程结束自动归档) /// [SugarColumn(ColumnDescription = "归档时间")] public DateTime? FiledTime { get; set; } /// /// 办结时长(秒) 办结时间-交办时间 /// [SugarColumn(ColumnDescription = "办结时长")] public double? HandleDuration { get; set; } /// /// 办结工作日时长(秒) /// [SugarColumn(ColumnDescription = "办结工作日时长")] public double? HandleDurationWorkday { get; set; } /// /// 办结时长(秒)归档时间-受理时间(工单创建时间) /// [SugarColumn(ColumnDescription = "工单创建到办结时长")] public double? CreationTimeHandleDuration { get; set; } /// /// 办结工作日时长(秒)归档时间-受理时间(工单创建时间) /// [SugarColumn(ColumnDescription = "工作日办结时长")] public double? CreationTimeHandleDurationWorkday { get; set; } /// /// 办结时长(秒) 归档时间-派单时间(中心到部门时间) /// [SugarColumn(ColumnDescription = "中心到部门办结时长")] public double? CenterToOrgHandleDuration { get; set; } /// /// 办结工作日时长(秒)归档时间-派单时间(中心到部门时间) /// [SugarColumn(ColumnDescription = "中心到部门工作日办结时长")] public double? CenterToOrgHandleDurationWorkday { get; set; } /// /// 归档时长(秒) /// [SugarColumn(ColumnDescription = "归档时长")] public double? FileDuration { get; set; } /// /// 归档工作时长(秒) /// [SugarColumn(ColumnDescription = "归档工作时长")] public double? FileDurationWorkday { get; set; } /// /// 重办时长,最新二次办理审批通过后的归档时间-最新二次办理审批通过时间(秒) /// [SugarColumn(ColumnDescription = "重办时长,最新二次办理审批通过后的归档时间-最新二次办理审批通过时间(秒)")] public double? SecondaryHandlingDuration { get; set; } [SugarColumn(ColumnDescription = "重办时长工作日时长")] public double? SecondaryHandlingDurationWorkday { get; set; } /// /// 全流程时长(秒) /// [SugarColumn(ColumnDescription = "全流程时长")] public double? AllDuration { get; set; } [SugarColumn(ColumnDescription = "全流程工作日时长")] public double? AllDurationWorkday { get; set; } //public string? AllDurationHour { get; set; } /// /// 办理时间限制(如:24小时、7个工作日) /// [SugarColumn(ColumnDescription = "办理时间限制")] public string? TimeLimit { get; set; } [SugarColumn(ColumnDescription = "时间限制计数")] public int? TimeLimitCount { get; set; } [SugarColumn(ColumnDescription = "时间限制单位")] public ETimeType? TimeLimitUnit { get; set; } #region 会签实际办理对象 [SugarColumn(ColumnDataType = "json", IsJson = true, ColumnDescription = "会签实际办理对象")] public List? CsActualHandleOrgIds { get; set; } [SugarColumn(ColumnDataType = "json", IsJson = true, ColumnDescription = "会签实际办理用户ID")] public List? CsActualHandleUserIds { get; set; } #endregion #region 实际办理信息(节点,部门,意见) [SugarColumn(ColumnDescription = "实际办理步骤ID")] public string? ActualHandleStepId { get; set; } /// /// 实际办理节点code(会签状态此字段保存最外层会签发起节点code) /// [SugarColumn(ColumnDescription = "实际办理步骤code")] public string? ActualHandleStepCode { get; set; } /// /// 实际办理节点名称(会签状态此字段保存最外层会签发起节点名称) /// [SugarColumn(ColumnDescription = "实际办理步骤名称")] public string? ActualHandleStepName { get; set; } /// /// 到达实际办理节点时间(stepBox创建时间) /// [SugarColumn(ColumnDescription = "到达实际办理节点时间")] public DateTime? ActualHandleStepCreateTime { get; set; } /// /// 实际办理节点签收时间 /// [SugarColumn(ColumnDescription = "实际办理节点签收时间")] public DateTime? ActualHandleStepAcceptTime { get; set; } /// /// 实际办理时间 /// [SugarColumn(ColumnDescription = "实际办理时间")] public DateTime? ActualHandleTime { get; set; } /// /// 实际办理人id /// [SugarColumn(ColumnDescription = "实际办理人ID")] public string? ActualHandlerId { get; set; } /// /// 实际办理人名称 /// [SugarColumn(ColumnDescription = "实际办理人姓名")] public string? ActualHandlerName { get; set; } /// /// 实际办理部门名称 /// [SugarColumn(ColumnDescription = "实际办理部门名称")] public string? ActualHandleOrgName { get; set; } /// /// 实际办理部门编码 /// [SugarColumn(ColumnDescription = "实际办理部门编码")] public string? ActualHandleOrgCode { get; set; } /// /// 实际办理部门行政区划编码 /// [SugarColumn(ColumnDescription = "实际办理部门行政区划编码")] public string? ActualHandleOrgAreaCode { get; set; } /// /// 实际办理部门行政区划名称 /// [SugarColumn(ColumnDescription = "实际办理部门行政区划名称")] public string? ActualHandleOrgAreaName { get; set; } /// /// 实际办理意见(办理中...or 最终办理意见) /// [SugarColumn(ColumnDataType = "text", ColumnDescription = "实际办理意见")] public string ActualOpinion { get; set; } = "办理中..."; /// /// 真实办理人姓名(手动填写) /// [SugarColumn(ColumnDescription = "真实办理人姓名")] public string? RealHandlerName { get; set; } /// /// 真实办理人电话(手动填写) /// [SugarColumn(ColumnDescription = "真实办理人电话")] public string? RealHandlerPhone { get; set; } /// /// 沟通方式(手动填写) /// [SugarColumn(ColumnDescription = "沟通方式")] public ERealCommunicationMode? RealCommunicationMode { get; set; } /// /// 沟通时间(手动填写) /// [SugarColumn(ColumnDescription = "沟通时间")] public DateTime? RealCommunicationTime { get; set; } /// /// 沟通地点(手动填写) /// [SugarColumn(ColumnDescription = "沟通地点")] public string? RealCommunicationAddress { get; set; } /// /// 已与市民沟通 /// [SugarColumn(ColumnDescription = "已与市民沟通")] public bool? RealIsContacted { get; set; } /// /// 已与市民现场沟通 /// [SugarColumn(ColumnDescription = "已与市民现场沟通")] public bool? RealContactLocale { get; set; } /// /// 其它 /// [SugarColumn(ColumnDescription = "其它")] public bool? IsOther { get; set; } /// /// 其它的备注 /// [SugarColumn(ColumnDescription = "其它的备注")] public string? OtherRemark { get; set; } #endregion #region 当前办理节点信息(指派时赋值) [SugarColumn(ColumnDescription = "当前办理节点ID")] public string? CurrentStepId { get; set; } /// /// 当前办理节点code(非会签:当前被指派节点,会签:会签发起节点) /// [SugarColumn(ColumnDescription = "当前办理节点code")] public string? CurrentStepCode { get; set; } /// /// 当前节点名称 /// [SugarColumn(ColumnDescription = "当前节点名称")] public string? CurrentStepName { get; set; } /// /// 到达当前节点时间 /// [SugarColumn(ColumnDescription = "到达当前节点时间")] public DateTime? CurrentStepCreateTime { get; set; } /// /// 当前办理节点签收时间 /// [SugarColumn(ColumnDescription = "当前办理节点签收时间")] public DateTime? CurrentStepAcceptTime { get; set; } /// /// 当前办理时间 /// [SugarColumn(ColumnDescription = "当前办理时间")] public DateTime? CurrentHandleTime { get; set; } /// /// 当前办理人id /// [SugarColumn(ColumnDescription = "当前办理人ID")] public string? CurrentHandlerId { get; set; } /// /// 当前办理人名称 /// [SugarColumn(ColumnDescription = "当前办理人姓名")] public string? CurrentHandlerName { get; set; } /// /// 当前办理部门名称 /// [SugarColumn(ColumnDescription = "当前办理部门名称")] public string? CurrentHandleOrgName { get; set; } /// /// 当前办理部门编码 /// [SugarColumn(ColumnDescription = "当前办理部门编码")] public string? CurrentHandleOrgId { get; set; } /// /// 当前办理部门等级 /// [SugarColumn(ColumnDescription = "当前办理部门等级")] public int? CurrentHandleOrgLevel { get; set; } /// /// 当前办理部门行政区划编码 /// [SugarColumn(ColumnDescription = "当前办理部门行政区划编码")] public string? CurrentHandleOrgAreaCode { get; set; } /// /// 当前办理部门行政区划名称 /// [SugarColumn(ColumnDescription = "当前办理部门行政区划名称")] public string? CurrentHandleOrgAreaName { get; set; } #endregion #region 一级部门 /// /// 一级部门code /// [SugarColumn(IsNullable = true, ColumnDescription = "一级部门编码")] public string? OrgLevelOneCode { get; set; } /// /// 一级部门名称 /// [SugarColumn(IsNullable = true, ColumnDescription = "一级部门名称")] public string? OrgLevelOneName { get; set; } #endregion #region 二级部门 /// /// 二级部门code /// [SugarColumn(IsNullable = true, ColumnDescription = "二级部门编码")] public string? OrgLevelTwoCode { get; set; } /// /// 二级部门名称 /// [SugarColumn(IsNullable = true, ColumnDescription = "二级部门名称")] public string? OrgLevelTwoName { get; set; } #endregion #region 受理人(开启流程的话务员) /// /// 受理人id /// [SugarColumn(ColumnDescription = "受理人ID")] public string? AcceptorId { get; set; } /// /// 受理人名称 /// [SugarColumn(ColumnDescription = "受理人姓名")] public string? AcceptorName { get; set; } /// /// 受理人工号 /// [SugarColumn(ColumnDescription = "受理人工号")] public string? AcceptorStaffNo { get; set; } /// /// 受理人部门编码 /// [SugarColumn(ColumnDescription = "受理人部门编码")] public string? AcceptorOrgCode { get; set; } /// /// 受理人部门名称 /// [SugarColumn(ColumnDescription = "受理人部门名称")] public string? AcceptorOrgName { get; set; } #endregion #region 派单人 /// /// 派单次数 /// [SugarColumn(ColumnDescription = "派单次数")] public int? SendOrderNumber { get; set; } = 0; #endregion /// /// 会签类型 /// [SugarColumn(ColumnDescription = "会签类型")] public ECounterSignType? CounterSignType { get; set; } #region 签收 /// /// 签收人id /// [SugarColumn(ColumnDescription = "签收人ID")] public string? SignerId { get; set; } /// /// 签收人名称 /// [SugarColumn(ColumnDescription = "签收人姓名")] public string? SignerName { get; set; } #endregion #region 归档冗余字段 /// /// 归档人名称 /// [SugarColumn(ColumnDescription = "归档人姓名")] public string? FileUserName { get; set; } /// /// 归档人ID /// [SugarColumn(ColumnDescription = "归档人ID")] public string? FileUserId { get; set; } /// /// 归档人部门Id /// [SugarColumn(ColumnDescription = "归档人部门ID")] public string? FileUserOrgId { get; set; } /// /// 归档人部门名称 /// [SugarColumn(ColumnDescription = "归档人部门名称")] public string? FileUserOrgName { get; set; } /// /// 归档人部门是否属于中心 /// [SugarColumn(ColumnDescription = "归档人部门是否为中心")] public bool? FileOrgIsCenter { get; set; } /// /// 归档人类型 /// [SugarColumn(ColumnDescription = "归档人类型")] public EFileUserType? FileUserRole { get; set; } /// /// 归档意见 /// [SugarColumn(ColumnDataType = "text", ColumnDescription = "归档意见")] public string? FileOpinion { get; set; } #endregion #endregion #region 省工单字段 /// /// 省期满时间(省工单才有) /// [SugarColumn(ColumnDescription = "省期满时间")] public DateTime? ExpiredTimeProvince { get; set; } /// /// 省本地编号 /// [SugarColumn(ColumnDescription = "省本地编号")] public string? ProvinceNo { get; set; } /// /// 省交办编号 /// [SugarColumn(ColumnDescription = "省交办编号")] public string? ReceiveProvinceNo { get; set; } /// /// 外部工单唯一标识 /// [SugarColumn(ColumnDescription = "外部工单唯一标识")] public string? ExternalId { get; set; } /// /// 工单标签 /// [SugarColumn(ColumnDescription = "工单标签")] public string? TagNames { get; set; } /// /// 省退回结果 /// [SugarColumn(ColumnDescription = "省退回结果")] public bool? ProvinceSendBack { get; set; } #endregion #region 附件冗余 [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "附件JSON")] public List? FileJson { get; set; } //[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "附件列表附件JSON")] //public List? ListFileJson { get; set; } #endregion #region 市州工单互转 /// /// 是否转发 /// [SugarColumn(ColumnDescription = "是否转发")] public bool? Transpond { get; set; } /// /// 转发市州Id /// [SugarColumn(ColumnDescription = "转发市州ID")] public string? TranspondCityId { get; set; } /// /// 转发市州名称 /// [SugarColumn(ColumnDescription = "转发市州名称")] public string? TranspondCityName { get; set; } /// /// 转发市州Value /// [SugarColumn(ColumnDescription = "转发市州Value")] public string? TranspondCityValue { get; set; } #endregion #region 重办 /// /// 重办次数 /// [SugarColumn(ColumnDescription = "重办次数")] public int? ReTransactNum { get; set; } /// /// 派单退回次数 /// [SugarColumn(ColumnDescription = "派单退回次数")] public int? SendBackNum { get; set; } /// /// 省重办次数 /// [SugarColumn(ColumnDescription = "省重办次数")] public int? ProvinceReTransactNum { get; set; } /// /// 工单交办处理方式 10:直接办结,20:交办,30:派单员重派,40:结果审核重派,50:回访不满意重派 /// 处理方式为结果审核重派时禁止退单 /// 处理方式为回访不满意重派时禁止退单 /// [SugarColumn(ColumnDescription = " 工单交办处理方式 10:直接办结,20:交办,30:派单员重派,40:结果审核重派,50:回访不满意重派")] public string? CaseProcessType { get; set; } #endregion /// /// 敏感标签 /// [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "敏感标签")] public List? Sensitive { get; set; } /// /// 是否行政执法类 /// [SugarColumn(ColumnDescription = "是否行政执法类")] public bool? IsEnforcementOrder { get; set; } /// /// 形式主义工单 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否形式主义工单")] public bool IsFormalistWorkOrder { get; set; } /// /// 敏感类工单 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否敏感类工单")] public bool IsSensitiveWorkOrders { get; set; } /// /// 24小时办结 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否24小时办结")] public bool Is24HoursComplete { get; set; } /// /// 部门是否解决 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "部门是否解决")] public bool IsResolved { get; set; } /// /// 是否紧急 /// 在创单的时候勾选的是否紧急 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否紧急")] public bool IsUrgent { get; set; } /// /// 是否紧急 /// 在办理的时候勾选的是否紧急 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "办理勾选是否紧急")] public bool IsStepUrgent { get; set; } /// /// 是否推诿 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否推诿")] public bool IsEvasive { get; set; } /// /// 是否不积极 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否不积极")] public bool IsInactively { get; set; } /// /// 是否三方通话 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否三方通话")] public bool IsThreePartyConference { get; set; } /// /// 重点关注事件,保存前端选择,用于返回前端数据 /// [SugarColumn(ColumnDescription = "重点关注事件")] public string? FocusOnEvents { get; set; } /// /// 重点关注事件名称,保存前端选择,用于返回前端数据 /// [SugarColumn(ColumnDescription = "重点关注事件名称")] public string? FocusOnEventsName { get; set; } /// /// 待发布人Id /// [SugarColumn(ColumnDescription = "待发布人ID")] public string? WaitForPublisherId { get; set; } /// /// 是否政民互动公开 /// [SugarColumn(DefaultValue = "f", ColumnDescription = "是否政民互动公开")] public bool IsProvinceZmhd { get; set; } /// /// 初审人姓名 /// [SugarColumn(ColumnDescription = "初审人姓名")] public string? AuditFirstName { get; set; } /// /// 初审时间 /// [SugarColumn(ColumnDescription = "初审时间")] public DateTime? AuditFirstTime { get; set; } /// /// 政民互动公开ID /// [SugarColumn(ColumnDescription = "政民互动公开ID")] public string? OrderProvinceZmhdId { get; set; } /// /// 超期部门 /// [SugarColumn(IsIgnore = true, ColumnDescription = "超期部门名称")] public string? DaysOverdueOrgName { get; set; } /// /// 退回截至时间 /// [SugarColumn(ColumnDescription = "退回截至时间")] public DateTime? SendBackAuditEndTime { get; set; } /// /// 话务提醒是否转办 /// [SugarColumn(ColumnDescription = "话务提醒是否转办")] public bool? IsForwarded { get; set; } #region 回访信息 /// /// 话务员评价(话务评价) /// [SugarColumn(ColumnDescription = "话务员评价")] public ESeatEvaluate? SeatEvaluate { get; set; } /// /// 部门办件结果 /// [SugarColumn(ColumnDataType = "json", ColumnDescription = "部门办件结果", IsJson = true, IsNullable = true)] public Kv? OrgProcessingResults { get; set; } #endregion /// /// 老系统工单Id /// [SugarColumn(ColumnDescription = "老系统工单Id")] public string? OldOrderId { get; set; } /// ///知识库引用 /// [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "知识库引用")] public List? KnowledgeQuote { get; set; } } public partial class Order { /// /// 受理人 /// [Navigate(NavigateType.OneToOne, nameof(AcceptorId))] public User Acceptor { get; set; } /// /// 热点 /// [Navigate(NavigateType.OneToOne, nameof(HotspotId))] public Hotspot Hotspot { get; set; } /// /// 办理流程 /// [Navigate(NavigateType.OneToOne, nameof(WorkflowId))] public Workflow Workflow { get; set; } /// /// 工单扩展信息 /// [Navigate(NavigateType.OneToOne, nameof(Id))] public OrderExtension OrderExtension { get; set; } /// /// 已发布工单 /// [Navigate(NavigateType.OneToOne, nameof(Id), nameof(Orders.OrderPublish.OrderId))] public OrderPublish OrderPublish { get; set; } /// /// 已回访工单 /// [Navigate(NavigateType.OneToMany, nameof(OrderVisit.OrderId))] public List OrderVisits { get; set; } /// /// 甄别 /// [Navigate(NavigateType.OneToMany, nameof(OrderScreen.OrderId))] public List OrderScreens { get; set; } /// /// 终止 /// [Navigate(NavigateType.OneToMany, nameof(OrderTerminate.OrderId))] public List OrderTerminates { get; set; } /// /// /// [Navigate(NavigateType.OneToMany, nameof(OrderSpecial.OrderId))] public List OrderSpecials { get; set; } /// /// 延期 /// [Navigate(NavigateType.OneToMany, nameof(OrderDelay.OrderId))] public List OrderDelays { get; set; } /// /// 工单补充 /// [Navigate(NavigateType.OneToMany, nameof(OrderComplement.OrderId))] public List OrderComplements { get; set; } /// /// 工单推送分类 /// [Navigate(NavigateType.OneToMany, nameof(OrderPushType.OrderId))] public List OrderPushTypes { get; set; } /// /// 通话记录 /// //[Navigate(NavigateType.OneToOne, nameof(CallId), nameof(TrCallRecord.CallAccept))] //由CallAccept改成OtherAccept [Navigate(NavigateType.OneToOne, nameof(CallId), nameof(TrCallRecord.OtherAccept))] public TrCallRecord CallRecord { get; set; } /// /// 兴唐通话记录 /// //[Navigate(NavigateType.OneToOne, nameof(CallId), nameof(TrCallRecord.CallAccept))] //由CallAccept改成OtherAccept [Navigate(NavigateType.OneToOne, nameof(CallId), nameof(CallNative.Id))] public CallNative FwCallRecord { get; set; } [Navigate(NavigateType.OneToMany, nameof(WorkflowStep.ExternalId))] public List WorkflowSteps { get; set; } [Navigate(NavigateType.OneToMany, nameof(WorkflowTrace.ExternalId))] public List WorkflowTraces { get; set; } [Navigate(NavigateType.OneToOne, nameof(Id), nameof(OrderSnapshot.Id))] public OrderSnapshot OrderSnapshot { get; set; } /// /// 工单督办 /// [Navigate(NavigateType.OneToMany, nameof(OrderSupervise.OrderId))] public List OrderSupervises { get; set; } #region Method public void Cancel() { IsCancel = true; } public void Redo() { Status = EOrderStatus.Handling; ExpiredStatus = EExpiredStatus.Normal; } public void CheckIfFiled() { if (Status is EOrderStatus.Filed) throw UserFriendlyException.SameMessage("工单已归档"); } public void Init() { if (!string.IsNullOrEmpty(Contact)) ContactMask = Contact.MaskPhoneNumber(); Status = EOrderStatus.WaitForAccept; ExpiredStatus = EExpiredStatus.Normal; } public void AutoAccept(string userId, string? userName, string? staffNo) { AcceptorId = userId; AcceptorName = userName; AcceptorStaffNo = staffNo; } /// /// 开始工单办理流程 /// public void StartManageFlow() => Status = EOrderStatus.Handling; /// /// 更新工单办理中状态 /// public void UpdateHandlingStatus(bool isInCountersign) => Status = isInCountersign && Status < EOrderStatus.Filed ? EOrderStatus.Countersigning : EOrderStatus.Handling; /// /// 归档 /// public void File(DateTime filedTime, double handleDurationWorkday, double fileDurationWorkday, double allDurationWorkday , double creationTimeHandleDurationWorkday, double centerToOrgHandleDurationWorkday, double? secondaryHandlingDurationWorkday, DateTime? secondaryHandlingAuditTime) { if (Status is EOrderStatus.Filed) return; Status = EOrderStatus.Filed; FiledTime = filedTime; HandleDurationWorkday = handleDurationWorkday; FileDurationWorkday = fileDurationWorkday; AllDurationWorkday = allDurationWorkday; CreationTimeHandleDurationWorkday = creationTimeHandleDurationWorkday; CenterToOrgHandleDurationWorkday = centerToOrgHandleDurationWorkday; SecondaryHandlingDurationWorkday = secondaryHandlingDurationWorkday; //计算实际办结时长 SetHandleDuration(); SetFileDuration(); SetAllDuration(); SetCreationTimeHandleDurationWorkday(); SetCenterToOrgHandleDurationWorkday(); SetSecondaryHandlingDuration(secondaryHandlingAuditTime); } /// /// 特提之后 归档信息清空 /// public void FileEmpty() { FiledTime = null; FileOpinion = string.Empty; HandleDurationWorkday = 0; HandleDuration = 0; FileDurationWorkday = 0; FileDuration = 0; AllDurationWorkday = 0; AllDuration = 0; CreationTimeHandleDurationWorkday = 0; CreationTimeHandleDuration = 0; CenterToOrgHandleDurationWorkday = 0; CenterToOrgHandleDuration = 0; } /// /// 发布 /// /// public void Publish(bool isPublicity) { //Progress = EProgress.Published; Status = EOrderStatus.Published; IsPublicity = isPublicity; } /// /// 已回访 /// public void Visited(string resultCode, string result) { if (string.IsNullOrEmpty(resultCode) || string.IsNullOrEmpty(result)) return; if (!string.IsNullOrEmpty(FirstVisitResultCode)) return; FirstVisitResultCode = resultCode; FirstVisitResult = result; //Progress = EProgress.Visited; Status = EOrderStatus.Visited; } public void CenterToOrg(string timelimit, int timelimitCount, ETimeType timilimitUnit, DateTime expiredTime, DateTime nearlyExpiredTime, DateTime nearlyExpiredTimeOne, string opinion, string handlerId, string handlerName, bool canUpdateOrderSender) { ProcessType = EProcessType.Jiaoban; TimeLimit = timelimit; TimeLimitCount = timelimitCount; TimeLimitUnit = timilimitUnit; ExpiredTime = expiredTime; if (CenterToOrgTime is null || canUpdateOrderSender) { CenterToOrgTime = DateTime.Now; CenterToOrgOpinion = opinion; CenterToOrgHandlerId = handlerId; CenterToOrgHandlerName = handlerName; } NearlyExpiredTime = nearlyExpiredTime; NearlyExpiredTimeOne = nearlyExpiredTimeOne; SendOrderNumber += 1; if (string.IsNullOrEmpty(WaitForPublisherId)) WaitForPublisherId = handlerId; } public void OrgToCenter(string timelimit, int timelimitCount, ETimeType timilimitUnit, DateTime expiredTime, DateTime nearlyExpiredTime, DateTime nearlyExpiredTimeOne) { ProcessType = EProcessType.Zhiban; TimeLimit = timelimit; TimeLimitCount = timelimitCount; TimeLimitUnit = timilimitUnit; ExpiredTime = expiredTime; NearlyExpiredTime = nearlyExpiredTime; NearlyExpiredTimeOne = nearlyExpiredTimeOne; CenterToOrgTime = null; CenterToOrgOpinion = null; CenterToOrgHandlerId = null; CenterToOrgHandlerName = null; } public void CenterToCenter(string timelimit, int timelimitCount, ETimeType timilimitUnit, DateTime expiredTime, DateTime nearlyExpiredTime, DateTime nearlyExpiredTimeOne) { TimeLimit = timelimit; TimeLimitCount = timelimitCount; TimeLimitUnit = timilimitUnit; ExpiredTime = expiredTime; NearlyExpiredTime = nearlyExpiredTime; NearlyExpiredTimeOne = nearlyExpiredTimeOne; } public void SetHandleDuration() { if (!ActualHandleTime.HasValue) return; if (!CenterToOrgTime.HasValue) return; HandleDuration = Math.Round((ActualHandleTime - CenterToOrgTime).Value.TotalSeconds); } public void SetAllDuration() { if (!FiledTime.HasValue) return; if (!StartTime.HasValue) return; AllDuration = Math.Round((FiledTime - StartTime).Value.TotalSeconds); } public void SetFileDuration() { if (!FiledTime.HasValue) return; if (!CenterToOrgTime.HasValue) return; FileDuration = Math.Round((FiledTime - CenterToOrgTime).Value.TotalSeconds); } /// /// 自贡 任务 390【标】综合查询增加“重办时长”数据列 /// /// public void SetSecondaryHandlingDuration(DateTime? SecondaryHandlingAuditTime) { if (!FiledTime.HasValue || !SecondaryHandlingAuditTime.HasValue) SecondaryHandlingDuration = null; else SecondaryHandlingDuration = Math.Round((FiledTime - SecondaryHandlingAuditTime).Value.TotalSeconds); } /// /// 办结时长(秒) 归档时间-受理时间(工单创建时间) /// public void SetCreationTimeHandleDurationWorkday() { if (!FiledTime.HasValue) CreationTimeHandleDuration = 0; else { var count = Math.Round((FiledTime - CreationTime).Value.TotalSeconds); CreationTimeHandleDuration = count <= 0 ? 1 : count; } } /// /// 办结时长(秒) 归档时间-派单时间(中心到部门时间) /// public void SetCenterToOrgHandleDurationWorkday() { if (FiledTime.HasValue && CenterToOrgTime.HasValue) { var count = Math.Round((FiledTime - CenterToOrgTime).Value.TotalSeconds); CenterToOrgHandleDuration = count <= 0 ? 1 : count; } else CenterToOrgHandleDuration = 0; } /// /// 是否已签收 /// public bool IsSigned() => !string.IsNullOrEmpty(SignerId); /// /// 签收 /// public void Sign(string userId, string userName) { if (string.IsNullOrEmpty(SignerId)) { SignerId = userId; SignerName = userName; } } /// /// 自动发布条件检测 /// /// public string AutoPublishCheck() { if (CounterSignType != null) return "会签工单自动发布失败;"; if (IsProvince) return "省工单自动发布失败;"; if (Status != EOrderStatus.Filed) return "工单状态非 已归档, " + Status.GetDescription(); return ""; } #endregion } public class UnsignedOrder { public Order Order { get; set; } public WorkflowStep WorkflowStep { get; set; } } }