Developer 058d8edffa 添加通知系统和工作任务分配功能
- 新增通知系统完整架构,包含通知设置、历史记录、任务管理等核心功能
- 实现工作任务分配服务,支持人员和设备的智能分配
- 添加人员分组管理功能,支持灵活的通知目标配置
- 完善相关枚举定义和数据传输对象

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 08:34:01 +08:00

144 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}