
- 新增通知系统完整架构,包含通知设置、历史记录、任务管理等核心功能 - 实现工作任务分配服务,支持人员和设备的智能分配 - 添加人员分组管理功能,支持灵活的通知目标配置 - 完善相关枚举定义和数据传输对象 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
147 lines
3.5 KiB
C#
147 lines
3.5 KiB
C#
using System;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using FreeSql.DataAnnotations;
|
||
using ZhonTai.Admin.Core.Entities;
|
||
using NPP.SmartSchedue.Api.Contracts.Core.Consts;
|
||
using NPP.SmartSchedue.Api.Contracts.Core.Enums;
|
||
|
||
namespace NPP.SmartSchedue.Api.Contracts.Domain.Notification;
|
||
|
||
/// <summary>
|
||
/// 通知历史记录实体
|
||
/// 决策点8:简单记录,记录发送时间、接收人、成功失败状态
|
||
/// 决策点5:不支持多租户,继承EntityBase
|
||
/// </summary>
|
||
[Table(Name = DbConsts.TableNamePrefix + "notification_history")]
|
||
public partial class NotificationHistoryEntity : EntityBase
|
||
{
|
||
#region 关联信息
|
||
|
||
/// <summary>
|
||
/// 通知设置ID
|
||
/// </summary>
|
||
[Required(ErrorMessage = "通知设置ID不能为空")]
|
||
public long NotificationSettingId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 接收人员ID
|
||
/// </summary>
|
||
[Required(ErrorMessage = "接收人员ID不能为空")]
|
||
public long RecipientPersonnelId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 接收人员姓名
|
||
/// </summary>
|
||
[Column(StringLength = 100)]
|
||
public string RecipientPersonnelName { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 接收人员邮箱
|
||
/// </summary>
|
||
[Column(StringLength = 200)]
|
||
public string RecipientEmail { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region 通知内容
|
||
|
||
/// <summary>
|
||
/// 通知方式
|
||
/// </summary>
|
||
public int NotificationType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 通知标题
|
||
/// </summary>
|
||
[Column(StringLength = 500)]
|
||
public string NotificationTitle { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 通知内容
|
||
/// </summary>
|
||
[Column(DbType = "text")]
|
||
public string NotificationContent { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region 发送信息
|
||
|
||
/// <summary>
|
||
/// 计划发送时间
|
||
/// </summary>
|
||
public DateTime PlannedSendTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 实际发送时间
|
||
/// </summary>
|
||
public DateTime? ActualSendTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 发送状态
|
||
/// </summary>
|
||
public int SendStatus { get; set; } = (int)NotificationStatusEnum.Pending;
|
||
|
||
/// <summary>
|
||
/// 发送结果信息
|
||
/// </summary>
|
||
[Column(StringLength = 1000)]
|
||
public string SendResult { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 错误信息
|
||
/// </summary>
|
||
[Column(StringLength = 1000)]
|
||
public string ErrorMessage { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region 重试机制
|
||
|
||
/// <summary>
|
||
/// 重试次数
|
||
/// </summary>
|
||
public int RetryCount { get; set; } = 0;
|
||
|
||
/// <summary>
|
||
/// 最大重试次数
|
||
/// </summary>
|
||
public int MaxRetryCount { get; set; } = 3;
|
||
|
||
/// <summary>
|
||
/// 下次重试时间
|
||
/// </summary>
|
||
public DateTime? NextRetryTime { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region 业务上下文
|
||
|
||
/// <summary>
|
||
/// 业务类型(如:工作任务、设备维护等)
|
||
/// </summary>
|
||
[Column(StringLength = 100)]
|
||
public string BusinessType { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 业务ID(如:工作任务ID、设备ID等)
|
||
/// </summary>
|
||
public long? BusinessId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 业务数据(JSON格式存储相关业务信息)
|
||
/// </summary>
|
||
[Column(DbType = "text")]
|
||
public string BusinessData { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region 导航属性
|
||
|
||
/// <summary>
|
||
/// 通知设置实体
|
||
/// </summary>
|
||
[Navigate("NotificationSettingId")]
|
||
public NotificationSettingEntity? NotificationSetting { get; set; }
|
||
|
||
#endregion
|
||
} |