mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 18:34:44 +08:00
fix #I9J6WS 增加加签逻辑
This commit is contained in:
79
OpenAuth.App/FlowApproverApp/FlowApproverApp.cs
Normal file
79
OpenAuth.App/FlowApproverApp/FlowApproverApp.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository.Interface;
|
||||
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
public class FlowApproverApp : BaseTreeApp<FlowApprover,OpenAuthDBContext>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 加载列表
|
||||
/// </summary>
|
||||
public async Task<TableData> Load(QueryFlowApproverListReq request)
|
||||
{
|
||||
var loginContext = _auth.GetCurrentUser();
|
||||
if (loginContext == null)
|
||||
{
|
||||
throw new CommonException("登录已过期", Define.INVALID_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
var result = new TableData();
|
||||
var objs = GetDataPrivilege("u");
|
||||
if (!string.IsNullOrEmpty(request.key))
|
||||
{
|
||||
//增加筛选条件,如:
|
||||
//objs = objs.Where(u => u.Name.Contains(request.key));
|
||||
}
|
||||
|
||||
|
||||
|
||||
result.data = objs.OrderBy(u => u.Id)
|
||||
.Skip((request.page - 1) * request.limit)
|
||||
.Take(request.limit);
|
||||
result.count =await objs.CountAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Add(AddOrUpdateFlowApproverReq obj)
|
||||
{
|
||||
var loginContext = _auth.GetCurrentUser();
|
||||
if (loginContext == null)
|
||||
{
|
||||
throw new CommonException("登录已过期", Define.INVALID_TOKEN);
|
||||
}
|
||||
|
||||
//程序类型取入口应用的名称,可以根据自己需要调整
|
||||
var addObj = obj.MapTo<FlowApprover>();
|
||||
CaculateCascade(addObj);
|
||||
addObj.CreateDate = DateTime.Now;
|
||||
addObj.CreateUserId = loginContext.User.Id;
|
||||
addObj.CreateUserName = loginContext.User.Name;
|
||||
addObj.Name = addObj.Id;
|
||||
Repository.Add(addObj);
|
||||
}
|
||||
|
||||
public void Update(AddOrUpdateFlowApproverReq obj)
|
||||
{
|
||||
UnitWork.Update<FlowApprover>(u => u.Id == obj.Id, u => new FlowApprover
|
||||
{
|
||||
//todo:要修改的字段赋值
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public FlowApproverApp(IUnitWork<OpenAuthDBContext> unitWork, IRepository<FlowApprover,OpenAuthDBContext> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
//------------------------------------------------------------------------------
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using OpenAuth.Repository.Core;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class AddOrUpdateFlowApproverReq
|
||||
{
|
||||
/// <summary>
|
||||
///Id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///加签原因
|
||||
/// </summary>
|
||||
public string Reason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///审批人
|
||||
/// </summary>
|
||||
public string ApproverName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///工作流实例Id
|
||||
/// </summary>
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///审批意见
|
||||
/// </summary>
|
||||
public string VerifyComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///审批人ID
|
||||
/// </summary>
|
||||
public string ApproverId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///类型(0顺序,1并行且,2并行或)
|
||||
/// </summary>
|
||||
public int ApproveType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///父节点ID,应对多次加签
|
||||
/// </summary>
|
||||
public string ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///审批日期
|
||||
/// </summary>
|
||||
public DateTime? VerifyDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///状态(0未处理,1通过,2未通过,3驳回)
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///当前节点ID
|
||||
/// </summary>
|
||||
public string ActivityId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///顺序号(当类型为0时)
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryFlowApproverListReq : PageReq
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user