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

180 lines
4.7 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>
/// 通知设置实体
/// 根据决策点5通知设置不支持多租户继承EntityBase
/// </summary>
[Table(Name = DbConsts.TableNamePrefix + "notification_setting")]
public partial class NotificationSettingEntity : EntityBase
{
#region
/// <summary>
/// 通知名称
/// </summary>
[Column(StringLength = 200)]
[Required(ErrorMessage = "通知名称不能为空")]
public string NotificationName { get; set; } = "";
/// <summary>
/// 通知描述
/// </summary>
[Column(StringLength = 500)]
public string Description { get; set; } = "";
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnabled { get; set; } = true;
#endregion
#region 1
/// <summary>
/// 通知方式(支持多选,使用位运算)
/// </summary>
public int NotificationTypes { get; set; }
/// <summary>
/// 是否启用邮件通知
/// </summary>
[Column(MapType = typeof(bool), IsIgnore = true)]
public bool IsEmailEnabled
{
get => (NotificationTypes & (int)NotificationTypeEnum.Email) != 0;
set
{
if (value)
NotificationTypes |= (int)NotificationTypeEnum.Email;
else
NotificationTypes &= ~(int)NotificationTypeEnum.Email;
}
}
/// <summary>
/// 是否启用系统消息通知
/// </summary>
[Column(MapType = typeof(bool), IsIgnore = true)]
public bool IsSystemMessageEnabled
{
get => (NotificationTypes & (int)NotificationTypeEnum.SystemMessage) != 0;
set
{
if (value)
NotificationTypes |= (int)NotificationTypeEnum.SystemMessage;
else
NotificationTypes &= ~(int)NotificationTypeEnum.SystemMessage;
}
}
#endregion
#region 2 -
/// <summary>
/// 通知开始时间HH:mm格式09:00
/// </summary>
[Column(StringLength = 10)]
[Required(ErrorMessage = "通知开始时间不能为空")]
public string StartTime { get; set; } = "";
/// <summary>
/// 通知结束时间HH:mm格式18:00
/// </summary>
[Column(StringLength = 10)]
[Required(ErrorMessage = "通知结束时间不能为空")]
public string EndTime { get; set; } = "";
#endregion
#region 3 vs
/// <summary>
/// 通知频次类型
/// </summary>
public int FrequencyType { get; set; } = (int)NotificationFrequencyEnum.Once;
/// <summary>
/// 间隔时间(分钟)
/// 当FrequencyType为FixedInterval时有效
/// </summary>
public int? IntervalMinutes { get; set; }
#endregion
#region
/// <summary>
/// 关联的人员组ID
/// </summary>
[Required(ErrorMessage = "人员组不能为空")]
public long PersonnelGroupId { get; set; }
#endregion
#region 7
/// <summary>
/// 邮件主题模板
/// </summary>
[Column(StringLength = 500)]
public string EmailSubjectTemplate { get; set; } = "";
/// <summary>
/// 邮件内容模板
/// </summary>
[Column(DbType = "text")]
public string EmailContentTemplate { get; set; } = "";
/// <summary>
/// 系统消息标题模板
/// </summary>
[Column(StringLength = 500)]
public string SystemMessageTitleTemplate { get; set; } = "";
/// <summary>
/// 系统消息内容模板
/// </summary>
[Column(DbType = "text")]
public string SystemMessageContentTemplate { get; set; } = "";
#endregion
#region
/// <summary>
/// 触发条件表达式JSON格式存储
/// 用于定义什么条件下触发通知
/// </summary>
[Column(DbType = "text")]
public string TriggerConditions { get; set; } = "";
#endregion
#region
/// <summary>
/// 最后修改时间
/// </summary>
public DateTime? LastModifiedTime { get; set; }
#endregion
#region
/// <summary>
/// 人员组实体
/// </summary>
[Navigate("PersonnelGroupId")]
public PersonnelGroupEntity? PersonnelGroup { get; set; }
#endregion
}