v3.4.6
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Linq.Expressions;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Models.WorkFlow;
|
||||
@@ -13,7 +12,6 @@ using JNPF.WorkFlow.Entitys;
|
||||
using JNPF.WorkFlow.Entitys.Dto.FlowBefore;
|
||||
using JNPF.WorkFlow.Entitys.Dto.FlowLaunch;
|
||||
using JNPF.WorkFlow.Entitys.Dto.FlowMonitor;
|
||||
using JNPF.WorkFlow.Entitys.Dto.FlowTemplate;
|
||||
using JNPF.WorkFlow.Entitys.Dto.WorkFlowForm.LeaveApply;
|
||||
using JNPF.WorkFlow.Entitys.Dto.WorkFlowForm.SalesOrder;
|
||||
using JNPF.WorkFlow.Entitys.Entity;
|
||||
@@ -23,6 +21,7 @@ using JNPF.WorkFlow.Entitys.Model.Properties;
|
||||
using JNPF.WorkFlow.Interfaces.Repository;
|
||||
using Mapster;
|
||||
using SqlSugar;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace JNPF.WorkFlow.Repository;
|
||||
|
||||
@@ -38,7 +37,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
/// <summary>
|
||||
/// 构造.
|
||||
/// </summary>
|
||||
/// <param name="flowTaskRepository"></param>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="userManager"></param>
|
||||
/// <param name="context"></param>
|
||||
public FlowTaskRepository(
|
||||
@@ -72,11 +71,17 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
if (!input.creatorUserId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.creatorUserId == input.creatorUserId);
|
||||
if (!input.flowCategory.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (!input.creatorUserId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(m => m.creatorUserId.Contains(input.creatorUserId));
|
||||
if (!input.flowId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
if (!input.templateId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
var flowJosnEntity = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().First(x => x.Id == input.flowId && x.DeleteMark == null);
|
||||
if (flowJosnEntity.IsNotEmptyOrNull())
|
||||
{
|
||||
var flowIds = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.GroupId == flowJosnEntity.GroupId).Select(x => x.Id).ToList();
|
||||
whereLambda = whereLambda.And(x => flowIds.Contains(x.flowId));
|
||||
}
|
||||
if (!input.status.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.status == input.status);
|
||||
if (!input.flowUrgent.IsNullOrEmpty())
|
||||
@@ -105,9 +110,11 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
startTime = a.StartTime,
|
||||
thisStep = a.ThisStep,
|
||||
userName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == a.CreatorUserId).Select(u => SqlFunc.MergeString(u.RealName, "/", u.Account)),
|
||||
status = a.Status,
|
||||
status = SqlFunc.IIF(a.Suspend == 1, 6, a.Status),
|
||||
sortCode = a.SortCode,
|
||||
templateId = a.TemplateId,
|
||||
suspend = a.Suspend,
|
||||
flowVersion = a.FlowVersion,
|
||||
}).MergeTable().Where(whereLambda).OrderBy(a => a.sortCode)
|
||||
.OrderBy(a => a.creatorTime, OrderByType.Desc)
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
@@ -137,9 +144,15 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
whereLambda = whereLambda.And(a => SqlFunc.Between(a.creatorTime, startTime, endTime));
|
||||
}
|
||||
if (!input.flowCategory.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
if (!input.flowId.IsNullOrEmpty())//flowId为流程主表id
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (!input.templateId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
var flowJosnEntity = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().First(x => x.Id == input.flowId && x.DeleteMark == null);
|
||||
if (flowJosnEntity.IsNotEmptyOrNull())
|
||||
{
|
||||
var flowIds = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.GroupId == flowJosnEntity.GroupId).Select(x => x.Id).ToList();
|
||||
whereLambda = whereLambda.And(x => flowIds.Contains(x.flowId));
|
||||
}
|
||||
if (!input.status.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.status == input.status);
|
||||
if (!input.flowUrgent.IsNullOrEmpty())
|
||||
@@ -156,7 +169,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
thisStep = a.ThisStep,
|
||||
flowUrgent = a.FlowUrgent,
|
||||
enCode = a.EnCode,
|
||||
status = a.Status,
|
||||
status = SqlFunc.IIF(a.Suspend == 1, 6, a.Status),
|
||||
flowCategory = a.FlowCategory,
|
||||
flowCode = a.FlowCode,
|
||||
completion = a.Completion,
|
||||
@@ -165,7 +178,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
flowId = a.FlowId,
|
||||
templateId = a.TemplateId,
|
||||
sortCode = a.SortCode,
|
||||
delegateUser = a.DelegateUser
|
||||
delegateUser = a.DelegateUser,
|
||||
suspend = a.Suspend,
|
||||
}).MergeTable().Where(whereLambda).OrderBy(a => a.status).OrderBy(a => a.startTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<FlowLaunchListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
@@ -185,9 +199,15 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
whereLambda = whereLambda.And(a => SqlFunc.Between(a.creatorTime, startTime, endTime));
|
||||
}
|
||||
if (input.flowCategory.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
if (input.flowId.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (input.templateId.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
var flowJosnEntity = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().First(x => x.Id == input.flowId && x.DeleteMark == null);
|
||||
if (flowJosnEntity.IsNotEmptyOrNull())
|
||||
{
|
||||
var flowIds = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.GroupId == flowJosnEntity.GroupId).Select(x => x.Id).ToList();
|
||||
whereLambda = whereLambda.And(x => flowIds.Contains(x.flowId));
|
||||
}
|
||||
if (input.keyword.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(m => m.enCode.Contains(input.keyword) || m.fullName.Contains(input.keyword));
|
||||
if (input.creatorUserId.IsNotEmptyOrNull())
|
||||
@@ -198,7 +218,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
// 经办审核
|
||||
var list1 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity>(
|
||||
(a, b) => new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId))
|
||||
.Where((a, b) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
.Where((a, b) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.HandleId == _userManager.UserId && b.CreatorTime < SqlFunc.GetDate())
|
||||
.Select((a, b) => new FlowBeforeListOutput()
|
||||
{
|
||||
@@ -221,6 +241,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
startTime = a.CreatorTime,
|
||||
completion = a.Completion,
|
||||
nodeName = b.NodeName,
|
||||
delegateUser = null,
|
||||
suspend = a.Suspend,
|
||||
templateId = a.TemplateId,
|
||||
});
|
||||
|
||||
@@ -228,7 +250,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
var list2 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity, FlowDelegateEntity>(
|
||||
(a, b, c) => new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, (a.TemplateId == SqlFunc.ToString(c.FlowId) || SqlFunc.ToString(c.FlowName) == "全部流程")
|
||||
&& c.EndTime > DateTime.Now))
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.HandleId == c.UserId && c.Type == "1" && c.ToUserId == _userManager.UserId && c.DeleteMark == null
|
||||
&& c.EnabledMark == 1 && c.EndTime > DateTime.Now && c.StartTime < DateTime.Now
|
||||
&& b.CreatorTime < SqlFunc.GetDate())
|
||||
@@ -240,7 +262,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
thisStep = a.ThisStep,
|
||||
thisStepId = b.TaskNodeId,
|
||||
flowCategory = a.FlowCategory,
|
||||
fullName = SqlFunc.MergeString(a.FullName, "(", SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == c.UserId).Select(u => u.RealName), "的委托)"),
|
||||
fullName = a.FullName,
|
||||
flowName = a.FlowName,
|
||||
status = a.Status,
|
||||
id = b.Id,
|
||||
@@ -253,6 +275,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
startTime = a.CreatorTime,
|
||||
completion = a.Completion,
|
||||
nodeName = b.NodeName,
|
||||
delegateUser = c.ToUserId,
|
||||
suspend = a.Suspend,
|
||||
templateId = a.TemplateId,
|
||||
});
|
||||
var output = await _repository.AsSugarClient().UnionAll(list1, list2).Where(whereLambda).MergeTable().OrderBy(x => x.creatorTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
@@ -274,9 +298,11 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
whereLambda = whereLambda.And(a => SqlFunc.Between(a.creatorTime, startTime, endTime));
|
||||
}
|
||||
if (!input.flowCategory.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (!input.templateId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
if (!input.flowId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
whereLambda = whereLambda.And(x => x.flowId == input.flowId);
|
||||
if (!input.keyword.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(m => m.enCode.Contains(input.keyword) || m.fullName.Contains(input.keyword));
|
||||
if (!input.creatorUserId.IsNullOrEmpty())
|
||||
@@ -288,7 +314,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
//经办审核
|
||||
var list1 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity, FlowTaskNodeEntity>((a, b, c) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, b.TaskNodeId == c.Id))
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.CreatorTime < SqlFunc.GetDate()
|
||||
&& b.HandleId == _userManager.UserId && a.IsBatch == 1)
|
||||
.Select((a, b, c) => new FlowBeforeListOutput()
|
||||
@@ -316,12 +342,14 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
flowVersion = a.FlowVersion,
|
||||
nodeCode = b.NodeCode,
|
||||
templateId = a.TemplateId,
|
||||
delegateUser = null,
|
||||
suspend = a.Suspend,
|
||||
});
|
||||
//委托审核
|
||||
var list2 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity, FlowDelegateEntity, FlowTaskNodeEntity>((a, b, c, d) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, (a.TemplateId == SqlFunc.ToString(c.FlowId) || SqlFunc.ToString(c.FlowName) == "全部流程")
|
||||
&& c.EndTime > DateTime.Now, JoinType.Left, b.TaskNodeId == d.Id))
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.IsBatch == 1
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.IsBatch == 1 && a.Suspend == null
|
||||
&& b.HandleId == c.UserId && c.Type == "1" && b.CreatorTime < SqlFunc.GetDate()
|
||||
&& c.ToUserId == _userManager.UserId && c.DeleteMark == null && c.EnabledMark == 1 && c.EndTime > DateTime.Now && c.StartTime < DateTime.Now)
|
||||
.Select((a, b, c, d) => new FlowBeforeListOutput()
|
||||
@@ -332,7 +360,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
thisStep = a.ThisStep,
|
||||
thisStepId = b.TaskNodeId,
|
||||
flowCategory = a.FlowCategory,
|
||||
fullName = SqlFunc.MergeString(a.FullName, "(", SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == c.UserId).Select(u => u.RealName), "的委托)"),
|
||||
fullName = a.FullName,
|
||||
flowName = a.FlowName,
|
||||
status = a.Status,
|
||||
id = b.Id,
|
||||
@@ -349,6 +377,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
flowVersion = a.FlowVersion,
|
||||
nodeCode = b.NodeCode,
|
||||
templateId = a.TemplateId,
|
||||
delegateUser = c.ToUserId,
|
||||
suspend = a.Suspend,
|
||||
});
|
||||
var output = await _repository.AsSugarClient().UnionAll(list1, list2).Where(whereLambda).MergeTable().OrderBy(x => x.creatorTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<FlowBeforeListOutput>.SqlSugarPageResult(output);
|
||||
@@ -370,9 +400,15 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
whereLambda = whereLambda.And(a => SqlFunc.Between(a.creatorTime, startTime, endTime));
|
||||
}
|
||||
if (!input.flowCategory.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
if (input.flowId.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (input.templateId.IsNotEmptyOrNull())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
var flowJosnEntity = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().First(x => x.Id == input.flowId && x.DeleteMark == null);
|
||||
if (flowJosnEntity.IsNotEmptyOrNull())
|
||||
{
|
||||
var flowIds = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.GroupId == flowJosnEntity.GroupId).Select(x => x.Id).ToList();
|
||||
whereLambda = whereLambda.And(x => flowIds.Contains(x.flowId));
|
||||
}
|
||||
if (!input.creatorUserId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(m => m.creatorUserId.Contains(input.creatorUserId));
|
||||
if (!input.keyword.IsNullOrEmpty())
|
||||
@@ -393,7 +429,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
thisStep = c.ThisStep,
|
||||
thisStepId = b.TaskNodeId,
|
||||
flowCategory = c.FlowCategory,
|
||||
fullName = b.HandleId == d.HandleId || c.Id == null ? c.FullName : SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == d.HandleId).Select(u => SqlFunc.MergeString(c.FullName, "(", u.RealName, "的委托)")),
|
||||
fullName = c.FullName,
|
||||
flowName = c.FlowName,
|
||||
status = b.HandleStatus,
|
||||
id = b.Id,
|
||||
@@ -404,6 +440,9 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
processId = c.ProcessId,
|
||||
flowUrgent = c.FlowUrgent,
|
||||
startTime = c.CreatorTime,
|
||||
templateId = c.TemplateId,
|
||||
delegateUser = b.HandleId == d.HandleId || c.Id == null ? null : d.HandleId,
|
||||
suspend = c.Suspend,
|
||||
}).MergeTable().Where(whereLambda).OrderBy(a => a.creatorTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<FlowBeforeListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
@@ -423,16 +462,22 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
whereLambda = whereLambda.And(a => SqlFunc.Between(a.creatorTime, startTime, endTime));
|
||||
}
|
||||
if (!input.flowCategory.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowCategory == input.flowCategory);
|
||||
if (!input.flowId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.flowId);
|
||||
whereLambda = whereLambda.And(x => input.flowCategory.Contains(x.flowCategory));
|
||||
if (!input.templateId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.templateId == input.templateId);
|
||||
var flowJosnEntity = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().First(x => x.Id == input.flowId && x.DeleteMark == null);
|
||||
if (flowJosnEntity.IsNotEmptyOrNull())
|
||||
{
|
||||
var flowIds = _repository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.GroupId == flowJosnEntity.GroupId).Select(x => x.Id).ToList();
|
||||
whereLambda = whereLambda.And(x => flowIds.Contains(x.flowId));
|
||||
}
|
||||
if (!input.creatorUserId.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(m => m.creatorUserId.Contains(input.creatorUserId));
|
||||
if (!input.keyword.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(m => m.enCode.Contains(input.keyword) || m.fullName.Contains(input.keyword));
|
||||
if (!input.flowUrgent.IsNullOrEmpty())
|
||||
whereLambda = whereLambda.And(x => x.flowUrgent == input.flowUrgent);
|
||||
var list = await _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskCirculateEntity, UserEntity, FlowEngineEntity>((a, b, c, d) => new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, a.CreatorUserId == c.Id, JoinType.Left, a.FlowId == d.Id)).Where((a, b) => b.ObjectId == _userManager.UserId).Select((a, b, c, d) => new FlowBeforeListOutput()
|
||||
var list = await _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskCirculateEntity, UserEntity>((a, b, c) => new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, a.CreatorUserId == c.Id)).Where((a, b) => b.ObjectId == _userManager.UserId).Select((a, b, c) => new FlowBeforeListOutput()
|
||||
{
|
||||
enCode = a.EnCode,
|
||||
creatorUserId = a.CreatorUserId,
|
||||
@@ -449,9 +494,10 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
flowCode = a.FlowCode,
|
||||
flowId = a.FlowId,
|
||||
processId = a.ProcessId,
|
||||
formType = d.FormType,
|
||||
flowUrgent = a.FlowUrgent,
|
||||
startTime = a.CreatorTime,
|
||||
suspend = a.Suspend,
|
||||
templateId = a.TemplateId,
|
||||
}).MergeTable().Where(whereLambda).OrderBy(x => x.creatorTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<FlowBeforeListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
@@ -462,12 +508,11 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> BatchFlowSelector()
|
||||
{
|
||||
var list = (await GetWaitList()).FindAll(x => x.IsBatch == 1);
|
||||
var list = (await GetWaitList()).FindAll(x => x.IsBatch == 1 && x.Suspend == null);
|
||||
var output = new List<object>();
|
||||
foreach (var item in list.GroupBy(x => x.TemplateId))
|
||||
{
|
||||
output.Add(new
|
||||
{
|
||||
output.Add(new {
|
||||
id = item.Key,
|
||||
fullName = string.Format("{0}({1})", item.FirstOrDefault().FlowName, item.Count()),
|
||||
count = item.Count()
|
||||
@@ -561,7 +606,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
{
|
||||
// 经办审核
|
||||
var list1 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId))
|
||||
.Where((a, b) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
.Where((a, b) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.CreatorTime < SqlFunc.GetDate() && b.HandleId == _userManager.UserId)
|
||||
.Select((a, b) => new FlowTaskEntity()
|
||||
{
|
||||
@@ -587,13 +632,15 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
LastModifyUserId = a.LastModifyUserId,
|
||||
IsBatch = a.IsBatch,
|
||||
TemplateId = a.TemplateId,
|
||||
DelegateUser = null,
|
||||
Suspend = a.Suspend,
|
||||
});
|
||||
|
||||
// 委托审核
|
||||
var list2 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity, FlowDelegateEntity, UserEntity>((a, b, c, d) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, (a.TemplateId == SqlFunc.ToString(c.FlowId) || SqlFunc.ToString(c.FlowName) == "全部流程"),
|
||||
JoinType.Left, c.UserId == d.Id)).Where((a, b, c) =>
|
||||
a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.CreatorTime < SqlFunc.GetDate()
|
||||
&& b.HandleId == c.UserId && c.Type == "1" && c.ToUserId == _userManager.UserId && c.DeleteMark == null && c.EndTime > DateTime.Now && c.StartTime < DateTime.Now)
|
||||
.Select((a, b, c, d) => new FlowTaskEntity()
|
||||
@@ -602,11 +649,11 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
ParentId = a.ParentId,
|
||||
ProcessId = a.ProcessId,
|
||||
EnCode = a.EnCode,
|
||||
FullName = SqlFunc.MergeString(a.FullName, "(", d.RealName, "的委托)"),
|
||||
FullName = a.FullName,
|
||||
FlowUrgent = a.FlowUrgent,
|
||||
FlowId = a.FlowId,
|
||||
FlowName = a.FlowName,
|
||||
FlowCode = a.FlowCode,
|
||||
FlowName = a.FlowName,
|
||||
FlowCategory = a.FlowCategory,
|
||||
StartTime = a.StartTime,
|
||||
EndTime = a.EndTime,
|
||||
@@ -620,6 +667,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
LastModifyUserId = a.LastModifyUserId,
|
||||
IsBatch = a.IsBatch,
|
||||
TemplateId = a.TemplateId,
|
||||
DelegateUser = c.ToUserId,
|
||||
Suspend = a.Suspend,
|
||||
});
|
||||
return await _repository.AsSugarClient().UnionAll(list1, list2).MergeTable().ToListAsync();
|
||||
}
|
||||
@@ -632,7 +681,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
{
|
||||
// 经办审核
|
||||
var list1 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity>((a, b) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId)).Where((a, b) => a.Status == 1 && a.DeleteMark == null
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId)).Where((a, b) => a.Status == 1 && a.DeleteMark == null && a.Suspend == null
|
||||
&& b.Completion == 0 && b.State == "0" && b.CreatorTime < SqlFunc.GetDate() && b.HandleId == _userManager.UserId)
|
||||
.Select((a, b) => new PortalWaitListModel()
|
||||
{
|
||||
@@ -645,20 +694,21 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
taskNodeId = b.TaskNodeId,
|
||||
taskOperatorId = b.Id,
|
||||
creatorTime = b.CreatorTime,
|
||||
type = 2
|
||||
type = 2,
|
||||
delegateUser = null,
|
||||
});
|
||||
|
||||
// 委托审核
|
||||
var list2 = _repository.AsSugarClient().Queryable<FlowTaskEntity, FlowTaskOperatorEntity, FlowDelegateEntity, UserEntity>((a, b, c, d) =>
|
||||
new JoinQueryInfos(JoinType.Left, a.Id == b.TaskId, JoinType.Left, (a.TemplateId == SqlFunc.ToString(c.FlowId) || SqlFunc.ToString(c.FlowName) == "全部流程"),
|
||||
JoinType.Left, c.UserId == d.Id))
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0"
|
||||
.Where((a, b, c) => a.Status == 1 && a.DeleteMark == null && b.Completion == 0 && b.State == "0" && a.Suspend == null
|
||||
&& b.CreatorTime < SqlFunc.GetDate()
|
||||
&& b.HandleId == c.UserId && c.Type == "1" && c.ToUserId == _userManager.UserId && c.DeleteMark == null && c.EndTime > DateTime.Now && c.StartTime < DateTime.Now)
|
||||
.Select((a, b, c, d) => new PortalWaitListModel()
|
||||
{
|
||||
id = b.Id,
|
||||
fullName = SqlFunc.MergeString(a.FullName, "(", d.RealName, "的委托)"),
|
||||
fullName = a.FullName,
|
||||
enCode = a.EnCode,
|
||||
flowId = a.FlowId,
|
||||
status = a.Status,
|
||||
@@ -666,7 +716,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
taskNodeId = b.TaskNodeId,
|
||||
taskOperatorId = b.Id,
|
||||
creatorTime = b.CreatorTime,
|
||||
type = 2
|
||||
type = 2,
|
||||
delegateUser = c.ToUserId,
|
||||
});
|
||||
return await _repository.AsSugarClient().UnionAll(list1, list2).MergeTable().ToListAsync();
|
||||
}
|
||||
@@ -686,7 +737,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
ParentId = a.ParentId,
|
||||
ProcessId = a.ProcessId,
|
||||
EnCode = a.EnCode,
|
||||
FullName = b.HandleId == c.HandleId || c.Id == null ? a.FullName : SqlFunc.MergeString(a.FullName, "(", d.RealName, "的委托)"),
|
||||
FullName = a.FullName,
|
||||
FlowUrgent = a.FlowUrgent,
|
||||
FlowId = a.FlowId,
|
||||
FlowCode = a.FlowCode,
|
||||
@@ -719,7 +770,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程信息 .
|
||||
/// 流程信息.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
@@ -735,8 +786,9 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
flowTemplateJson = a.FlowTemplateJson,
|
||||
type = b.Type,
|
||||
enCode = b.EnCode,
|
||||
fullName = b.FullName,
|
||||
fullName = a.FullName,
|
||||
category = b.Category,
|
||||
flowName = b.FullName
|
||||
}).First();
|
||||
}
|
||||
|
||||
@@ -1337,7 +1389,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
status = a.Status,
|
||||
userName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == a.HandleId).Select(u => SqlFunc.MergeString(u.RealName, "/", u.Account)),
|
||||
operatorId = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == a.OperatorId).Select(u => SqlFunc.MergeString(u.RealName, "/", u.Account)),
|
||||
creatorTime = b.CreatorTime,
|
||||
creatorTime = SqlFunc.IsNullOrEmpty(b.CreatorTime) ? a.HandleTime : b.CreatorTime,
|
||||
fileList = a.FileList
|
||||
}).ToListAsync();
|
||||
}
|
||||
@@ -1599,15 +1651,20 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
/// 驳回数据创建.
|
||||
/// </summary>
|
||||
/// <param name="taskId"></param>
|
||||
/// <param name="taskNodeIds"></param>
|
||||
/// <param name="taskNodeId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> CreateRejectData(string taskId, string taskNodeIds)
|
||||
public async Task<string> CreateRejectData(string taskId, string taskNodeId)
|
||||
{
|
||||
var entity = new FlowRejectDataEntity();
|
||||
entity.Id = SnowflakeIdHelper.NextId();
|
||||
entity.TaskJson = GetTaskFirstOrDefault(taskId).ToJsonString();
|
||||
#region 解决mysql字段长度太小
|
||||
var taskEntity = GetTaskFirstOrDefault(taskId);
|
||||
taskEntity.FlowFormContentJson = null;
|
||||
taskEntity.FlowTemplateJson = null;
|
||||
#endregion
|
||||
entity.TaskJson = taskEntity.ToJsonString();
|
||||
entity.TaskNodeJson = (await GetTaskNodeList(taskId)).ToJsonString();
|
||||
entity.TaskOperatorJson = (await GetTaskOperatorList(x => x.TaskId == taskId && x.State != "-1" && SqlFunc.IsNullOrEmpty(x.ParentId) && taskNodeIds.Contains(x.NodeCode))).ToJsonString();
|
||||
entity.TaskOperatorJson = (await GetTaskOperatorList(x => x.TaskId == taskId && x.State != "-1" && SqlFunc.IsNullOrEmpty(x.ParentId) && x.TaskNodeId == taskNodeId)).ToJsonString();
|
||||
await _repository.AsSugarClient().GetSimpleClient<FlowRejectDataEntity>().InsertAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
@@ -1620,6 +1677,11 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
|
||||
public async Task UpdateRejectData(FlowRejectDataEntity entity)
|
||||
{
|
||||
var taskEntity = entity.TaskJson.ToObject<FlowTaskEntity>();
|
||||
#region 解决mysql字段长度太小
|
||||
var thisTaskEntity = GetTaskFirstOrDefault(taskEntity.Id);
|
||||
taskEntity.FlowFormContentJson = thisTaskEntity.FlowFormContentJson;
|
||||
taskEntity.FlowTemplateJson = thisTaskEntity.FlowTemplateJson;
|
||||
#endregion
|
||||
var taskNodeEntityList = entity.TaskNodeJson.ToObject<List<FlowTaskNodeEntity>>();
|
||||
var taskOperatorEntityList = entity.TaskOperatorJson.ToObject<List<FlowTaskOperatorEntity>>();
|
||||
foreach (var item in taskOperatorEntityList)
|
||||
|
||||
Reference in New Issue
Block a user