using Furion.JsonSerialization;
using YBEE.EQM.Core;
namespace YBEE.EQM.Application;
///
/// 审核记录工具类
///
public static class AuditUtil
{
///
/// 创建一个新的审核记录
///
///
///
///
///
///
public static AuditItem CreateNew(AuditActionType actionType, AuditStatus status, DateTime? createTime = null, string remark = "")
{
return new()
{
SysOrgId = CurrentSysUserInfo.SysOrgId,
SysOrgName = CurrentSysUserInfo.SysOrgName,
SysUserId = CurrentSysUserInfo.SysUserId,
SysUserName = CurrentSysUserInfo.Name,
Remark = remark,
CreateTime = createTime ?? DateTime.Now,
Status = status,
ActionType = actionType,
};
}
///
/// 获取审核记录列表
///
public static List GetList(string audits)
{
return JSON.Deserialize>(audits);
}
///
/// 向审核记录中插入新记录
///
public static string InsertInto(string audits, AuditItem newItem)
{
var auditList = GetList(audits);
newItem.Id = (auditList.Count > 0 ? auditList.Max(a => a.Id) : 0) + 1;
auditList.Add(newItem);
return JSON.Serialize(auditList);
}
}