init commit
This commit is contained in:
52
20220330_Vote/Ewide.RoadFlow/Data/FlowEntrust/FlowEntrust.cs
Normal file
52
20220330_Vote/Ewide.RoadFlow/Data/FlowEntrust/FlowEntrust.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Ewide.Core;
|
||||
using Furion.DependencyInjection;
|
||||
using RoadFlow.Model.FlowRunModel;
|
||||
using RoadFlow.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoadFlow.Data
|
||||
{
|
||||
public class FlowEntrust : RoadFlowRepository<RoadFlow.Model.rf_flowentrust>, IFlowEntrust, ITransient
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询一页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<RoadFlow.Model.rf_flowentrust> GetPagerList(out int count, int size, int number, string userId, string date1, string date2, string order)
|
||||
{
|
||||
int total = 0;
|
||||
var list = this.db.Queryable<RoadFlow.Model.rf_flowentrust>()
|
||||
.WhereIF(userId.IsGuid(), x => x.UserId == userId)
|
||||
.WhereIF(date1.IsDateTime(), x => x.StartTime >= DateTime.Parse(date1))
|
||||
.WhereIF(date2.IsDateTime(), x => x.EndTime <= DateTime.Parse(date2))
|
||||
.OrderByIF(!order.IsNullOrEmpty(), order)
|
||||
.ToPageList(number, size,ref total);
|
||||
count = total;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到一个人员一个流程的委托人员(如果没有则返回string.Empty)
|
||||
/// </summary>
|
||||
/// <param name="flowId">流程ID</param>
|
||||
/// <param name="user">人员实体</param>
|
||||
/// <returns>如果没有委托则返回string.Empty</returns>
|
||||
public string GetEntrustUserId(string flowId, SysUser user)
|
||||
{
|
||||
var all = GetAll();
|
||||
DateTime now = Utility.DateExtensions.Now;
|
||||
var entrust = all.Find(p => p.UserId == user.Id && (!p.FlowId.IsNullOrWhiteSpace() || p.FlowId == flowId) &&
|
||||
p.StartTime <= now && p.EndTime >= now);
|
||||
return null == entrust ? string.Empty : entrust.ToUserId;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoadFlow.Data
|
||||
{
|
||||
public interface IFlowEntrust : IRoadFlowRepository<RoadFlow.Model.rf_flowentrust>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询一页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<RoadFlow.Model.rf_flowentrust> GetPagerList(out int count, int size, int number, string userId, string date1, string date2, string order);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user