工作流实例操作历史增加若干字段

usertest
嵇文龙 5 months ago
parent f1aa698215
commit 0477aa7642

@ -13,6 +13,21 @@ public class FlowInstanceHistoryRes
/// </summary> /// </summary>
public string Content { get; set; } public string Content { get; set; }
/// <summary>
/// 审批结果
/// </summary>
public int Result { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Note { get; set; }
/// <summary>
/// 审批人
/// </summary>
public string? UserName { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>

@ -20,4 +20,16 @@ public class FlowInstanceHistory: BaseTenantModel<long>
/// </summary> /// </summary>
[Description("操作内容")] [Description("操作内容")]
public string Content { get; set; } public string Content { get; set; }
/// <summary>
/// 审批结果
/// </summary>
[Description("审批结果")]
public int? Result { get; set; }
/// <summary>
/// 审批人
/// </summary>
[Description("审批人")]
public string? UserName { get; set; }
} }

@ -8,7 +8,6 @@ using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Interface;
using Mapster; using Mapster;
using MathNet.Numerics.Distributions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json; using Newtonsoft.Json;
using SqlSugar; using SqlSugar;
@ -152,7 +151,8 @@ public class FlowInstanceService : IFlowInstanceService
Content = "【创建】" Content = "【创建】"
+ userInfo.UserName + userInfo.UserName
+ "创建了一个流程进程【" + "创建了一个流程进程【"
+ instance.CustomName + "】" + instance.CustomName + "】",
UserName = userInfo.UserName
}; };
db.Insertable(history).ExecuteCommand(); db.Insertable(history).ExecuteCommand();
// var info = db.Queryable<FlowInstance>().Where(x => x.Id == req.Id).First(); // var info = db.Queryable<FlowInstance>().Where(x => x.Id == req.Id).First();
@ -208,13 +208,13 @@ public class FlowInstanceService : IFlowInstanceService
instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings); instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings);
db.Updateable(instance).ExecuteCommand(); db.Updateable(instance).ExecuteCommand();
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId)); var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory var history = new FlowInstanceHistory
{ {
InstanceId = instance.Id, InstanceId = instance.Id,
Content = $"【撤销】由{userInfo.UserName}撤销,备注:{req.Note}" Content = $"【撤销】由{userInfo.UserName}撤销,备注:{req.Note}",
Result = -1,
UserName = userInfo.UserName
}; };
db.Insertable(history).ExecuteCommand(); db.Insertable(history).ExecuteCommand();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess); return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
@ -278,7 +278,8 @@ public class FlowInstanceService : IFlowInstanceService
var history = new FlowInstanceHistory var history = new FlowInstanceHistory
{ {
InstanceId = instance.Id, InstanceId = instance.Id,
Content = $"【启动】由{userInfo.UserName}启动该流程。" Content = $"【启动】由{userInfo.UserName}启动该流程。",
UserName = userInfo.UserName
}; };
db.Insertable(history).ExecuteCommand(); db.Insertable(history).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.FlowInstanceUpdateSuccess); return DataResult.Successed("更新成功!", MultiLanguageConst.FlowInstanceUpdateSuccess);
@ -406,7 +407,10 @@ public class FlowInstanceService : IFlowInstanceService
Content = "【" + runtime.CurrentNode.Name Content = "【" + runtime.CurrentNode.Name
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:" + "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
+ tag.Description + tag.Description,
UserName = tag.UserName,
Result = status,
Note = auditNote
}; };
db.Insertable(history).ExecuteCommand(); db.Insertable(history).ExecuteCommand();
@ -499,7 +503,7 @@ public class FlowInstanceService : IFlowInstanceService
var users = db.Queryable<SysRoleUser>().Where(x => var users = db.Queryable<SysRoleUser>().Where(x =>
wfruntime.CurrentNode.Roles.Contains(x.RoleId.ToString())) wfruntime.CurrentNode.Roles.Contains(x.RoleId.ToString()))
.Select(x => x.UserId).Distinct().ToList(); .Select(x => x.UserId).Distinct().ToList();
//makerList = GenericHelper.ArrayToString(users, makerList);
makerList = string.Join(',', users); makerList = string.Join(',', users);
} }
else if (wfruntime.CurrentNode.AssigneeType == "user") else if (wfruntime.CurrentNode.AssigneeType == "user")

Loading…
Cancel
Save