mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
fix #IAGT6Z 增加知会功能
This commit is contained in:
parent
3484c3468a
commit
bbc55bb53b
@ -1,5 +1,8 @@
|
||||
namespace Infrastructure
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
public static class Define
|
||||
{
|
||||
public static string USERROLE = "UserRole"; //用户角色关联KEY
|
||||
@ -15,13 +18,11 @@
|
||||
public const string DBTYPE_PostgreSQL = "PostgreSQL"; //PostgreSQL
|
||||
public const string DBTYPE_ORACLE = "Oracle"; //oracle
|
||||
|
||||
|
||||
public const int INVALID_TOKEN = 50014; //token无效
|
||||
|
||||
public const string TOKEN_NAME = "X-Token";
|
||||
public const string TENANT_ID = "tenantId";
|
||||
|
||||
|
||||
public const string SYSTEM_USERNAME = "System";
|
||||
public const string SYSTEM_USERPWD = "123456";
|
||||
|
||||
@ -32,5 +33,10 @@
|
||||
public const string JOBMAPKEY = "OpenJob";
|
||||
|
||||
public const string DEFAULT_FORM_INSTANCE_ID_NAME = "InstanceId";
|
||||
|
||||
//流程实例知会用户
|
||||
public const string INSTANCE_NOTICE_USER = "INSTANCE_NOTICE_USER";
|
||||
//流程实例知会角色
|
||||
public const string INSTANCE_NOTICE_ROLE = "INSTANCE_NOTICE_ROLE";
|
||||
}
|
||||
}
|
@ -104,6 +104,17 @@ namespace OpenAuth.App
|
||||
SugarClient.Insertable(flowInstance).ExecuteCommand();
|
||||
wfruntime.flowInstanceId = flowInstance.Id;
|
||||
|
||||
//知会
|
||||
if (addFlowInstanceReq.NoticeType.IsNullOrEmpty() && addFlowInstanceReq.NoticeIds != null)
|
||||
{
|
||||
_revelanceApp.Assign(new AssignReq
|
||||
{
|
||||
type = addFlowInstanceReq.NoticeType,
|
||||
firstId = flowInstance.Id,
|
||||
secIds = addFlowInstanceReq.NoticeIds.ToArray()
|
||||
});
|
||||
}
|
||||
|
||||
if (flowInstance.FrmType == 1) //如果是开发者自定义的表单
|
||||
{
|
||||
var t = Type.GetType("OpenAuth.App." + flowInstance.DbName + "App");
|
||||
@ -903,16 +914,43 @@ namespace OpenAuth.App
|
||||
.ToPageListAsync(request.page, request.limit);
|
||||
result.count = await finalQuery.CountAsync();
|
||||
}
|
||||
else //我的流程
|
||||
else //我的流程(包含知会我的)
|
||||
{
|
||||
var query = SugarClient.Queryable<FlowInstance>().Where(u => u.CreateUserId == user.User.Id);
|
||||
if (!string.IsNullOrEmpty(request.key))
|
||||
var sql = $@"
|
||||
SELECT fi.*
|
||||
FROM FlowInstance fi
|
||||
JOIN (select Id as InstanceId
|
||||
from FlowInstance
|
||||
where CreateUserId = '{user.User.Id}'
|
||||
union
|
||||
select FirstId as InstanceId
|
||||
from Relevance
|
||||
where `Key` = '{Define.INSTANCE_NOTICE_USER}'
|
||||
and SecondId = '{user.User.Id}'
|
||||
union
|
||||
select a.FirstId as InstanceId
|
||||
from Relevance a
|
||||
inner join (select SecondId as RoleId
|
||||
from Relevance
|
||||
where `Key` = '{Define.USERROLE}'
|
||||
and FirstId = '{user.User.Id}') b on a.SecondId = b.RoleId
|
||||
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
||||
ON fi.Id = UniqueInstanceIds.InstanceId
|
||||
";
|
||||
|
||||
if (SugarClient.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
||||
{
|
||||
query = query.Where(t => t.CustomName.Contains(request.key));
|
||||
sql = sql.Replace("`Key`", "[Key]");
|
||||
}else if (SugarClient.CurrentConnectionConfig.DbType == DbType.Oracle)
|
||||
{
|
||||
sql = sql.Replace("`Key`", "\"Key\"");
|
||||
}
|
||||
|
||||
result.count = await query.CountAsync();
|
||||
result.data = await query.OrderByDescending(u => u.CreateDate)
|
||||
var finalQuery = SugarClient.SqlQueryable<FlowInstance>(sql)
|
||||
.WhereIF(!string.IsNullOrEmpty(request.key), t => t.CustomName.Contains(request.key));
|
||||
|
||||
result.count = await finalQuery.CountAsync();
|
||||
result.data = await finalQuery.OrderByDescending(u => u.CreateDate)
|
||||
.ToPageListAsync(request.page, request.limit);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
@ -17,25 +18,24 @@ namespace OpenAuth.App.Request
|
||||
/// </summary>
|
||||
public class AddFlowInstanceReq : NodeDesignateReq
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 实例编号
|
||||
/// </summary>
|
||||
[Description("实例编号")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义名称
|
||||
/// </summary>
|
||||
[Description("自定义名称")]
|
||||
public string CustomName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 流程模板内容
|
||||
/// </summary>
|
||||
[Description("流程模板内容")]
|
||||
public string SchemeContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程模板ID
|
||||
/// </summary>
|
||||
@ -46,39 +46,42 @@ namespace OpenAuth.App.Request
|
||||
/// </summary>
|
||||
public string SchemeCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据库名称
|
||||
/// </summary>
|
||||
[Description("数据库名称")]
|
||||
public string DbName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单数据
|
||||
/// </summary>
|
||||
[Description("表单数据")]
|
||||
public string FrmData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单类型
|
||||
/// </summary>
|
||||
[Description("表单类型")]
|
||||
public int FrmType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单中的控件属性描述
|
||||
/// </summary>
|
||||
[Description("表单中的控件属性描述")]
|
||||
public string FrmContentData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单控件位置模板
|
||||
/// </summary>
|
||||
[Description("表单控件位置模板")]
|
||||
public string FrmContentParse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单ID
|
||||
/// </summary>
|
||||
[Description("表单ID")]
|
||||
public string FrmId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门
|
||||
/// </summary>
|
||||
@ -90,6 +93,7 @@ namespace OpenAuth.App.Request
|
||||
/// </summary>
|
||||
[Description("创建用户主键")]
|
||||
public string CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
@ -102,5 +106,18 @@ namespace OpenAuth.App.Request
|
||||
[Description("实例备注")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 知会类型
|
||||
/// INSTANCE_NOTICE_USER :知会具体用户
|
||||
/// INSTANCE_NOTICE_ROLE :知会角色
|
||||
/// </summary>
|
||||
[Description("知会类型")]
|
||||
public string NoticeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 知会的用户或角色ID列表
|
||||
/// </summary>
|
||||
[Description("知会的用户或角色ID列表")]
|
||||
public List<string> NoticeIds { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user