未办结关于驳回重走流程去重
parent
c02e0bb6fd
commit
f27e45c0be
|
|
@ -588,26 +588,39 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
|
|||
var pageIndex = pageQueryDto.page < 1 ? 1 : pageQueryDto.page;
|
||||
var pageSize = pageQueryDto.limit < 1 ? 10 : pageQueryDto.limit;
|
||||
|
||||
var maxWorkitemSubQuery = _sqlSugar.Queryable<ZyFlowWorkitem>()
|
||||
.GroupBy(w => w.InstanceId)
|
||||
.GroupBy(w => w.HandlerId)
|
||||
.Select(w => new
|
||||
{
|
||||
w.InstanceId,
|
||||
MaxWorkitemId = SqlFunc.AggregateMax(w.WorkitemId)
|
||||
});
|
||||
// 未办结逻辑:
|
||||
// 1. 当前用户参与过(处理过/待处理)
|
||||
// 2. 流程状态不是"Completed"(未完成)
|
||||
// Draft(拟办)、Submitted(已提交)、Forwarded(已转发)、Auditing(审核中)、Summarized(已汇总)、Completed(已完成)、Rejected(已驳回)
|
||||
var doneInstanceIds = _sqlSugar
|
||||
.Queryable<ZyFlowWorkitem>()
|
||||
.LeftJoin<ZyFlowNode>((w, n) => w.NodeId == n.NodeId)
|
||||
.LeftJoin<ZyFlowInstance>((w, n, i)
|
||||
.InnerJoin(maxWorkitemSubQuery,
|
||||
(w, sub)
|
||||
=> w.InstanceId == sub.InstanceId
|
||||
&& w.WorkitemId == sub.MaxWorkitemId)
|
||||
// 原有多表关联逻辑(顺序
|
||||
.LeftJoin<ZyFlowNode>((w, sub, n) => w.NodeId == n.NodeId)
|
||||
.LeftJoin<ZyFlowInstance>((w, sub, n, i)
|
||||
=> w.InstanceId == i.InstanceId)
|
||||
.LeftJoin<IllegalConstructionAssessment>((w, n, i, t)
|
||||
.LeftJoin<IllegalConstructionAssessment>((w, sub, n, i, t)
|
||||
=> i.BusinessNo == t.BusinessNumber)
|
||||
.WhereIF(!string.IsNullOrEmpty(pageQueryDto.key), (w, n, i, t)
|
||||
.WhereIF(!string.IsNullOrEmpty(pageQueryDto.key), (w, sub, n, i, t)
|
||||
=> t.BusinessNumber.Contains(pageQueryDto.key))
|
||||
.Where((w, n, i, t)
|
||||
.Where((w, sub, n, i, t)
|
||||
=> w.Status == "Done" && i.Status != "Completed")
|
||||
.Where((w, n, i, t)
|
||||
.Where((w, sub, n, i, t)
|
||||
=> w.HandlerId == userId)
|
||||
.OrderByDescending((w, n, i, t) =>
|
||||
t.CreateTime)
|
||||
.Select((w, n, i, t)
|
||||
.OrderByDescending((w, sub, n, i, t)
|
||||
=> t.CreateTime)
|
||||
.Select((w, sub, n, i, t)
|
||||
=> new FlowQuerySingleResultDto
|
||||
{
|
||||
workitemId = w.WorkitemId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue