Commit 56da633d by lcx

修改信息类

parent 4433472b
......@@ -5,7 +5,7 @@
namespace Performance.DtoModels
{
public enum Classify
public enum Component
{
/// <summary>
/// 通知
......@@ -20,7 +20,7 @@ public enum Classify
Progress = 1,
}
public enum NoticeType
public enum ComponentType
{
/// <summary>
/// 成功
......
......@@ -5,56 +5,138 @@
namespace Performance.DtoModels
{
public class MessageInfo
public class MessageInfo : MessageInfo<string>
{
public MessageInfo(NoticeType typeValue, string uuid = null, Classify classify = Classify.Notification)
public MessageInfo()
: this(default, string.Empty, string.Empty)
{
}
public MessageInfo(int allotId, string title, string message)
: this(allotId, title, message, Component.Notification, ComponentType.info)
{
}
public MessageInfo(int allotId, string title, string message, ComponentType type)
: this(allotId, title, message, Component.Notification, type)
{
}
public MessageInfo(int allotId, string title, string message, Component component)
: this(allotId, title, message, component, ComponentType.info)
{
}
public MessageInfo(int allotId, string title, string message, Component component, ComponentType type)
: this(Guid.NewGuid().ToString("N"), allotId, title, message, component, type)
{
}
public MessageInfo(string uuid, int allotId, string title, string message, Component component, ComponentType type)
{
TypeValue = typeValue;
Uuid = uuid;
Classify = classify;
AllotId = allotId;
Title = title;
Message = message;
Component = component;
Status = type;
}
}
public class MessageInfo<TData> : IMessageInfo<TData>
{
public string Uuid { get; set; }
public int HospitalId { get; set; }
public int AllotId { get; set; }
/// <summary>
/// 分类
/// </summary>
public Classify Classify { get; set; }
public string Title { get; set; }
public TData Message { get; set; }
public Component Component { get; set; }
[JsonIgnore]
public ComponentType Status { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type
{
get
{
return TypeValue.ToString();
return Status.ToString();
}
}
public MessageInfo()
: this(default, string.Empty, default)
{
}
public MessageInfo(int allotId, string title, TData message)
: this(allotId, title, message, Component.Notification, ComponentType.info)
{
}
public MessageInfo(int allotId, string title, TData message, ComponentType type)
: this(allotId, title, message, Component.Notification, type)
{
}
public MessageInfo(int allotId, string title, TData message, Component component)
: this(allotId, title, message, component, ComponentType.info)
{
}
public MessageInfo(int allotId, string title, TData message, Component component, ComponentType type)
: this(Guid.NewGuid().ToString("N"), allotId, title, message, component, type)
{
}
public MessageInfo(string uuid, int allotId, string title, TData message, Component component, ComponentType type)
{
Uuid = uuid;
AllotId = allotId;
Title = title;
Message = message;
Component = component;
Status = type;
}
}
public interface IMessageInfo<TData>
{
/// <summary>
/// 唯一编码
/// </summary>
string Uuid { get; set; }
/// <summary>
/// 绩效Id
/// </summary>
int AllotId { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
string Title { get; set; }
/// <summary>
/// 消息
/// 内容
/// </summary>
public string Message { get; set; }
TData Message { get; set; }
/// <summary>
/// 百分比
/// 控件类型
/// </summary>
public decimal Percentage { get; set; }
Component Component { get; set; }
/// <summary>
/// 类型值
/// 状态(完成、警告、错误、信息)
/// </summary>
[JsonIgnore]
public NoticeType TypeValue { get; set; }
ComponentType Status { get; set; }
/// <summary>
/// 状态文本值
/// </summary>
string Type { get; }
}
}
......@@ -454,11 +454,11 @@ public void Generate(per_allot allot, string mail, string uuid, int userId)
//logManageService.WriteMsg("正在发送邮件", "正在发送邮件", 1, allot.ID, "ReceiveMessage", true);
//SendEmail(allot, mail, 1, time);
//logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
notificationsService.SendGenerateMessage(userId, allot, uuid, "绩效生成成功", NoticeType.success);
notificationsService.SendGenerateMessage(userId, allot, uuid, "绩效生成成功", ComponentType.success);
}
catch (Exception ex)
{
notificationsService.SendGenerateMessage(userId, allot, uuid, "绩效生成失败", NoticeType.error);
notificationsService.SendGenerateMessage(userId, allot, uuid, "绩效生成失败", ComponentType.error);
logdbug.Add(allot.ID, "绩效生成失败", ex.ToString(), 4, 1);
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
//SendEmail(allot, mail, 2, time);
......
......@@ -32,15 +32,9 @@ PerforLogdsignalrRepository repository
this.repository = repository;
}
public void SendGenerateMessage(int userId, per_allot allot, string uuid, string message, NoticeType typeValue = NoticeType.info)
public void SendGenerateMessage(int userId, string uuid, int allotId, string message, ComponentType type = ComponentType.info)
{
var info = new MessageInfo(typeValue, uuid, Classify.Notification)
{
HospitalId = allot.HospitalId,
AllotId = allot.ID,
Title = "生成绩效",
Message = message
};
var info = new MessageInfo(uuid, allotId, "生成绩效", message, Component.Notification, type);
SendMessage(userId, info);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment