From bbc55bb53bb332a34eca2f0b96ac00b36c12c688 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Sat, 5 Oct 2024 16:38:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=20#IAGT6Z=20=E5=A2=9E=E5=8A=A0=E7=9F=A5?= =?UTF-8?q?=E4=BC=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Define.cs | 40 ++++--- OpenAuth.App/FlowInstance/FlowInstanceApp.cs | 50 +++++++- .../Request/AddFlowInstanceReq.cs | 113 ++++++++++-------- 3 files changed, 132 insertions(+), 71 deletions(-) diff --git a/Infrastructure/Define.cs b/Infrastructure/Define.cs index 864fd511..fa4066a3 100644 --- a/Infrastructure/Define.cs +++ b/Infrastructure/Define.cs @@ -1,36 +1,42 @@ namespace Infrastructure { + /// + /// 常量定义 + /// public static class Define { - public static string USERROLE = "UserRole"; //用户角色关联KEY - public const string ROLERESOURCE = "RoleResource"; //角色资源关联KEY - public const string USERORG = "UserOrg"; //用户机构关联KEY + public static string USERROLE = "UserRole"; //用户角色关联KEY + public const string ROLERESOURCE = "RoleResource"; //角色资源关联KEY + public const string USERORG = "UserOrg"; //用户机构关联KEY public const string ROLEELEMENT = "RoleElement"; //角色菜单关联KEY - public const string ROLEMODULE = "RoleModule"; //角色模块关联KEY - public const string ROLEDATAPROPERTY = "RoleDataProperty"; //角色数据字段权限 - public const string MODULEPRINTERPLAN = "ModulePrinterPlan"; //模块配置打印方案 + public const string ROLEMODULE = "RoleModule"; //角色模块关联KEY + public const string ROLEDATAPROPERTY = "RoleDataProperty"; //角色数据字段权限 + public const string MODULEPRINTERPLAN = "ModulePrinterPlan"; //模块配置打印方案 - public const string DBTYPE_SQLSERVER = "SqlServer"; //sql server - public const string DBTYPE_MYSQL = "MySql"; //mysql - public const string DBTYPE_PostgreSQL = "PostgreSQL"; //PostgreSQL - public const string DBTYPE_ORACLE = "Oracle"; //oracle + public const string DBTYPE_SQLSERVER = "SqlServer"; //sql server + public const string DBTYPE_MYSQL = "MySql"; //mysql + public const string DBTYPE_PostgreSQL = "PostgreSQL"; //PostgreSQL + public const string DBTYPE_ORACLE = "Oracle"; //oracle - - public const int INVALID_TOKEN = 50014; //token无效 + 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"; - public const string DATAPRIVILEGE_LOGINUSER = "{loginUser}"; //数据权限配置中,当前登录用户的key - public const string DATAPRIVILEGE_LOGINROLE = "{loginRole}"; //数据权限配置中,当前登录用户角色的key - public const string DATAPRIVILEGE_LOGINORG = "{loginOrg}"; //数据权限配置中,当前登录用户部门的key + public const string DATAPRIVILEGE_LOGINUSER = "{loginUser}"; //数据权限配置中,当前登录用户的key + public const string DATAPRIVILEGE_LOGINROLE = "{loginRole}"; //数据权限配置中,当前登录用户角色的key + public const string DATAPRIVILEGE_LOGINORG = "{loginOrg}"; //数据权限配置中,当前登录用户部门的key 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"; } -} +} \ No newline at end of file diff --git a/OpenAuth.App/FlowInstance/FlowInstanceApp.cs b/OpenAuth.App/FlowInstance/FlowInstanceApp.cs index 28dad7ee..19c99c70 100644 --- a/OpenAuth.App/FlowInstance/FlowInstanceApp.cs +++ b/OpenAuth.App/FlowInstance/FlowInstanceApp.cs @@ -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().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(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); } diff --git a/OpenAuth.App/FlowInstance/Request/AddFlowInstanceReq.cs b/OpenAuth.App/FlowInstance/Request/AddFlowInstanceReq.cs index 1cf11ecc..01f80238 100644 --- a/OpenAuth.App/FlowInstance/Request/AddFlowInstanceReq.cs +++ b/OpenAuth.App/FlowInstance/Request/AddFlowInstanceReq.cs @@ -8,37 +8,37 @@ // //------------------------------------------------------------------------------ +using System.Collections.Generic; using System.ComponentModel; namespace OpenAuth.App.Request { /// - /// 创建工作流请求 - /// + /// 创建工作流请求 + /// public class AddFlowInstanceReq : NodeDesignateReq { + /// + /// 实例编号 + /// + [Description("实例编号")] + public string Code { get; set; } /// - /// 实例编号 - /// - [Description("实例编号")] - public string Code { get; set; } - /// - /// 自定义名称 - /// - [Description("自定义名称")] + /// 自定义名称 + /// + [Description("自定义名称")] public string CustomName { get; set; } - - /// - /// 流程模板内容 - /// - [Description("流程模板内容")] + /// 流程模板内容 + /// + [Description("流程模板内容")] public string SchemeContent { get; set; } + /// - /// 流程模板ID - /// + /// 流程模板ID + /// public string SchemeId { get; set; } /// @@ -46,39 +46,42 @@ namespace OpenAuth.App.Request /// public string SchemeCode { get; set; } + /// + /// 数据库名称 + /// + [Description("数据库名称")] + public string DbName { get; set; } /// - /// 数据库名称 - /// - [Description("数据库名称")] - public string DbName { get; set; } - /// - /// 表单数据 - /// - [Description("表单数据")] + /// 表单数据 + /// + [Description("表单数据")] public string FrmData { get; set; } + /// - /// 表单类型 - /// - [Description("表单类型")] + /// 表单类型 + /// + [Description("表单类型")] public int FrmType { get; set; } + /// - /// 表单中的控件属性描述 - /// - [Description("表单中的控件属性描述")] + /// 表单中的控件属性描述 + /// + [Description("表单中的控件属性描述")] public string FrmContentData { get; set; } + /// - /// 表单控件位置模板 - /// - [Description("表单控件位置模板")] + /// 表单控件位置模板 + /// + [Description("表单控件位置模板")] public string FrmContentParse { get; set; } + /// - /// 表单ID - /// - [Description("表单ID")] + /// 表单ID + /// + [Description("表单ID")] public string FrmId { get; set; } - - + /// /// 所属部门 /// @@ -86,21 +89,35 @@ namespace OpenAuth.App.Request public string OrgId { get; set; } /// - /// 创建用户主键 - /// - [Description("创建用户主键")] + /// 创建用户主键 + /// + [Description("创建用户主键")] public string CreateUserId { get; set; } + /// - /// 创建用户 - /// - [Description("创建用户")] + /// 创建用户 + /// + [Description("创建用户")] public string CreateUserName { get; set; } /// - /// 实例备注 - /// - [Description("实例备注")] + /// 实例备注 + /// + [Description("实例备注")] public string Description { get; set; } + /// + /// 知会类型 + /// INSTANCE_NOTICE_USER :知会具体用户 + /// INSTANCE_NOTICE_ROLE :知会角色 + /// + [Description("知会类型")] + public string NoticeType { get; set; } + + /// + /// 知会的用户或角色ID列表 + /// + [Description("知会的用户或角色ID列表")] + public List NoticeIds { get; set; } } } \ No newline at end of file