1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using Furion.JsonSerialization;
- using YBEE.EQM.Core;
- namespace YBEE.EQM.Application;
- /// <summary>
- /// 审核记录工具类
- /// </summary>
- public static class AuditUtil
- {
- /// <summary>
- /// 创建一个新的审核记录
- /// </summary>
- /// <param name="actionType"></param>
- /// <param name="status"></param>
- /// <param name="createTime"></param>
- /// <param name="remark"></param>
- /// <returns></returns>
- 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,
- };
- }
- /// <summary>
- /// 获取审核记录列表
- /// </summary>
- public static List<AuditItem> GetList(string audits)
- {
- return JSON.Deserialize<List<AuditItem>>(audits);
- }
- /// <summary>
- /// 向审核记录中插入新记录
- /// </summary>
- 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);
- }
- }
|