
- 新增通知系统完整架构,包含通知设置、历史记录、任务管理等核心功能 - 实现工作任务分配服务,支持人员和设备的智能分配 - 添加人员分组管理功能,支持灵活的通知目标配置 - 完善相关枚举定义和数据传输对象 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
144 lines
3.4 KiB
C#
144 lines
3.4 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>
|
||
/// 通知任务实体
|
||
/// 决策点6:定时任务,支持定时检查和触发通知
|
||
/// 决策点5:不支持多租户,继承EntityBase
|
||
/// </summary>
|
||
[Table(Name = DbConsts.TableNamePrefix + "notification_task")]
|
||
public partial class NotificationTaskEntity : EntityBase
|
||
{
|
||
#region 关联信息
|
||
|
||
/// <summary>
|
||
/// 通知设置ID
|
||
/// </summary>
|
||
[Required(ErrorMessage = "通知设置ID不能为空")]
|
||
public long NotificationSettingId { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region 任务信息
|
||
|
||
/// <summary>
|
||
/// 任务名称
|
||
/// </summary>
|
||
[Column(StringLength = 200)]
|
||
[Required(ErrorMessage = "任务名称不能为空")]
|
||
public string TaskName { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 任务状态
|
||
/// </summary>
|
||
public int TaskStatus { get; set; } = (int)NotificationStatusEnum.Pending;
|
||
|
||
/// <summary>
|
||
/// 是否启用
|
||
/// </summary>
|
||
public bool IsEnabled { get; set; } = true;
|
||
|
||
#endregion
|
||
|
||
#region 执行时间配置
|
||
|
||
/// <summary>
|
||
/// 计划执行时间
|
||
/// </summary>
|
||
public DateTime PlannedExecutionTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 下次执行时间
|
||
/// </summary>
|
||
public DateTime? NextExecutionTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 最后执行时间
|
||
/// </summary>
|
||
public DateTime? LastExecutionTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 执行次数
|
||
/// </summary>
|
||
public int ExecutionCount { get; set; } = 0;
|
||
|
||
/// <summary>
|
||
/// 最大执行次数(0表示无限制)
|
||
/// </summary>
|
||
public int MaxExecutionCount { get; set; } = 0;
|
||
|
||
#endregion
|
||
|
||
#region 执行结果
|
||
|
||
/// <summary>
|
||
/// 最后执行结果
|
||
/// </summary>
|
||
[Column(StringLength = 1000)]
|
||
public string LastExecutionResult { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 最后执行错误信息
|
||
/// </summary>
|
||
[Column(StringLength = 1000)]
|
||
public string LastExecutionError { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 成功执行次数
|
||
/// </summary>
|
||
public int SuccessExecutionCount { get; set; } = 0;
|
||
|
||
/// <summary>
|
||
/// 失败执行次数
|
||
/// </summary>
|
||
public int FailedExecutionCount { get; set; } = 0;
|
||
|
||
#endregion
|
||
|
||
#region 业务上下文
|
||
|
||
/// <summary>
|
||
/// 业务类型(如:工作任务提醒、设备维护提醒等)
|
||
/// </summary>
|
||
[Column(StringLength = 100)]
|
||
public string BusinessType { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 业务ID
|
||
/// </summary>
|
||
public long? BusinessId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 业务数据(JSON格式存储)
|
||
/// </summary>
|
||
[Column(DbType = "text")]
|
||
public string BusinessData { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region Cron表达式支持
|
||
|
||
/// <summary>
|
||
/// Cron表达式(用于复杂的定时规则)
|
||
/// </summary>
|
||
[Column(StringLength = 100)]
|
||
public string CronExpression { get; set; } = "";
|
||
|
||
#endregion
|
||
|
||
#region 导航属性
|
||
|
||
/// <summary>
|
||
/// 通知设置实体
|
||
/// </summary>
|
||
[Navigate("NotificationSettingId")]
|
||
public NotificationSettingEntity? NotificationSetting { get; set; }
|
||
|
||
#endregion
|
||
} |