├── Source ├── __SkipCodeRush ├── UpgradeLog.htm ├── UpgradeLog2.htm ├── UpgradeLog3.htm ├── UpgradeLog4.htm ├── UpgradeLog5.htm ├── UpgradeLog6.htm ├── UpgradeLog7.htm ├── Common │ ├── packages.config │ ├── Entity │ │ ├── Model.cs │ │ ├── Model.Designer.cs │ │ ├── SYS_Data.cs │ │ ├── UserRole.cs │ │ ├── SYS_VerifyImage.cs │ │ ├── RoleMemberUser.cs │ │ ├── RoleMember.cs │ │ ├── SYS_Code_Record.cs │ │ ├── SYS_Logs.cs │ │ ├── SYS_Logs_Rules.cs │ │ ├── SYS_Role_Member.cs │ │ ├── SYS_OrgMember.cs │ │ ├── SYS_UserGroupMember.cs │ │ ├── SYS_Role_Action.cs │ │ ├── SYS_Role_Data.cs │ │ ├── SYS_ModuleParam.cs │ │ ├── SYS_ModuleGroup.cs │ │ ├── SYS_Allot_Record.cs │ │ ├── SYS_Code_Allot.cs │ │ ├── SYS_UserGroup.cs │ │ ├── SYS_ModuleAction.cs │ │ ├── SYS_Role.cs │ │ ├── SYS_Code_Scheme.cs │ │ ├── SYS_Module.cs │ │ ├── SYS_Organization.cs │ │ ├── Organization.cs │ │ ├── Log.cs │ │ └── Tenant.cs │ ├── DTO │ │ ├── SmsCode.cs │ │ ├── MemberUser.cs │ │ ├── AppTree.cs │ │ ├── GroupInfo.cs │ │ ├── App.cs │ │ ├── UserInfo.cs │ │ ├── OrgDTO.cs │ │ ├── RoleInfo.cs │ │ ├── TenantInfo.cs │ │ └── Permit.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Params.cs │ ├── JsonResult.cs │ ├── Logger.cs │ ├── Common.csproj │ └── DbHelper.cs ├── BaseServer │ ├── ProjectInstaller.cs │ ├── Program.cs │ ├── BaseServer.cs │ ├── BaseServer.Designer.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ServiceInfo.cs │ ├── App.config │ ├── ProjectInstaller.Designer.cs │ └── BaseServer.csproj ├── Insight_Base.sln.DotSettings ├── Services │ ├── Apps │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Apps.csproj │ ├── Logs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── DataAccess.cs │ │ ├── ILogs.cs │ │ ├── Logs.csproj │ │ └── Logs.cs │ ├── Rules │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── IRules.cs │ │ ├── Rules.csproj │ │ └── Rules.cs │ ├── Tenants │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Tenants.csproj │ │ └── ITenants.cs │ ├── Auth │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Auth.csproj │ ├── Reports │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Reports.csproj │ │ └── IReports.cs │ ├── Roles │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Roles.csproj │ ├── Users │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Users.csproj │ ├── Commons │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Commons.csproj │ │ └── ICommons.cs │ ├── Templates │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Templates.csproj │ ├── UserGroups │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── UserGroups.csproj │ │ └── IUserGroups.cs │ └── Organizations │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Organizations.csproj │ │ └── IOrganizations.cs └── OAuth │ ├── Properties │ └── AssemblyInfo.cs │ ├── ServiceBase.cs │ └── OAuth.csproj ├── Document ├── InterfaceTest.paw ├── 错误信息表.md └── Log.md ├── DataBase ├── other │ ├── 6-InitModule.sql │ ├── 3-初始化订单编码方案.sql │ └── 5-初始化图形验证码记录.sql ├── 2-InitRole.sql ├── Function │ ├── ucf_permit.sql │ ├── Get_FormatDate.sql │ ├── Get_CnAmount.sql │ └── Get_CodePreview.sql ├── View │ ├── RoleMember.sql │ └── MemberUser.sql └── 0-CreateView.sql └── .gitignore /Source/__SkipCodeRush: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Source/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog.htm -------------------------------------------------------------------------------- /Source/UpgradeLog2.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog2.htm -------------------------------------------------------------------------------- /Source/UpgradeLog3.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog3.htm -------------------------------------------------------------------------------- /Source/UpgradeLog4.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog4.htm -------------------------------------------------------------------------------- /Source/UpgradeLog5.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog5.htm -------------------------------------------------------------------------------- /Source/UpgradeLog6.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog6.htm -------------------------------------------------------------------------------- /Source/UpgradeLog7.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Source/UpgradeLog7.htm -------------------------------------------------------------------------------- /Document/InterfaceTest.paw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/Document/InterfaceTest.paw -------------------------------------------------------------------------------- /DataBase/other/6-InitModule.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuanbg/Insight_Base/HEAD/DataBase/other/6-InitModule.sql -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Release 2 | bin 3 | obj 4 | Debug 5 | *.suo 6 | /Images 7 | Insight Setup 8 | *.user 9 | packages 10 | /Source/.vs/Insight_Base 11 | -------------------------------------------------------------------------------- /DataBase/other/3-初始化订单编码方案.sql: -------------------------------------------------------------------------------- 1 | INSERT SYS_Code_Scheme (Name, CodeFormat, SerialFormat, Description, CreatorDeptId, CreatorUserId) 2 | select '订单编码方案', '@yymmdd#5', '@yymmdd', '订单专用编码方案,不要修改!不要删除!', NULL, N'00000000-0000-0000-0000-000000000000' 3 | -------------------------------------------------------------------------------- /Source/Common/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Common/Entity/Model.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /Source/BaseServer/ProjectInstaller.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Insight.Base.Server 4 | { 5 | [RunInstaller(true)] 6 | public partial class ProjectInstaller : System.Configuration.Install.Installer 7 | { 8 | public ProjectInstaller() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Source/Insight_Base.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True -------------------------------------------------------------------------------- /Source/Common/Entity/Model.Designer.cs: -------------------------------------------------------------------------------- 1 | // 为模型“C:\Users\Brian\Documents\Visual Studio 2017\Projects\Insight_Base\Source\Common\Entity\Model.edmx”启用了 T4 代码生成。 2 | // 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值 3 | // 更改为“旧的 ObjectContext”。当在设计器中打开该模型时,此属性会出现在 4 | // “属性”窗口中。 5 | 6 | // 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是 7 | // 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体 8 | // 类,请在设计器中打开该模型,右键单击设计器图面,然后 9 | // 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成 10 | // 项...”。 -------------------------------------------------------------------------------- /Source/BaseServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceProcess; 2 | 3 | namespace Insight.Base.Server 4 | { 5 | static class Program 6 | { 7 | /// 8 | /// 应用程序的主入口点。 9 | /// 10 | // ReSharper disable once InconsistentNaming 11 | static void Main() 12 | { 13 | var servicesToRun = new ServiceBase[] 14 | { 15 | new BaseServer() 16 | }; 17 | ServiceBase.Run(servicesToRun); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Source/Common/DTO/SmsCode.cs: -------------------------------------------------------------------------------- 1 | namespace Insight.Base.Common.DTO 2 | { 3 | public class SmsCode 4 | { 5 | /// 6 | /// 类型 7 | /// 8 | public int type { get; set; } 9 | 10 | /// 11 | /// 手机号 12 | /// 13 | public string mobile { get; set; } 14 | 15 | /// 16 | /// 验证码 17 | /// 18 | public string code { get; set; } 19 | 20 | /// 21 | /// 是否验证后删除 22 | /// 23 | public bool remove { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /DataBase/2-InitRole.sql: -------------------------------------------------------------------------------- 1 | use insight_base 2 | go 3 | 4 | /*****初始化角色:系统管理员*****/ 5 | delete ucr_role where name = '系统管理员' 6 | insert ucr_role (id, tenant_id, name, remark, is_builtin) 7 | select '1faf0cf9-c28e-427e-bbd0-107607c01306', '00000000-0000-0000-0000-000000000000', '系统管理员', '内置角色,角色成员为系统管理员组成员', 1; 8 | 9 | -- 初始化角色成员 10 | insert ucr_role_member(id, member_type, role_id, member_id) 11 | select lower(newid()), 1, '1faf0cf9-c28e-427e-bbd0-107607c01306', '00000000-0000-0000-0000-000000000000'; 12 | 13 | -- 设置功能权限 14 | insert ucr_role_function (id, role_id, function_id, permit) 15 | select lower(newid()), '1faf0cf9-c28e-427e-bbd0-107607c01306', a.id, 1 16 | from ucs_function a 17 | go -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Data.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Data 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public int Type { get; set; } 20 | public string Alias { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Source/Common/Entity/UserRole.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class UserRole 16 | { 17 | public System.Guid ID { get; set; } 18 | public System.Guid RoleId { get; set; } 19 | public System.Guid UserId { get; set; } 20 | public Nullable DiptId { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DataBase/Function/ucf_permit.sql: -------------------------------------------------------------------------------- 1 | if exists (select * from sysobjects where id = object_id(N'ucf_permit') and objectproperty(id, N'istablefunction') = 1) 2 | drop function ucf_permit 3 | go 4 | 5 | /*****表值函数:获取当前登录用户有效操作权限*****/ 6 | 7 | create function ucf_permit( 8 | @userId varchar(36), --当前登录用户id 9 | @deptId varchar(36) --当前登录部门id 10 | ) 11 | returns table as return select distinct 12 | f.id, 13 | f.navigator_id, 14 | f.alias, 15 | f.routes 16 | from 17 | ucs_function f 18 | join ucr_role_function p on p.function_id = f.id 19 | join ucv_user_role r on r.role_id = p.role_id 20 | where 21 | r.user_id = @userId 22 | and (r.dept_id = @deptId or r.dept_id is null) 23 | group by 24 | f.id, 25 | f.navigator_id, 26 | f.alias, 27 | f.routes 28 | having 29 | min (p.permit) > 0 30 | go -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_VerifyImage.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_VerifyImage 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public int Type { get; set; } 20 | public string Name { get; set; } 21 | public string Path { get; set; } 22 | public System.DateTime CreateTime { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DataBase/View/RoleMember.sql: -------------------------------------------------------------------------------- 1 | use insight_base 2 | go 3 | 4 | if exists (select * from sysobjects where id = object_id(N'ucv_role_member') and objectproperty(id, N'isview') = 1) 5 | drop view ucv_role_member 6 | go 7 | 8 | /*****视图:查询角色成员*****/ 9 | 10 | create view ucv_role_member as 11 | select 12 | m.id, m.role_id, m.member_type, m.member_id, u.name 13 | from 14 | ucr_role_member m 15 | join ucb_user u on u.id = m.member_id 16 | where 17 | m.member_type = 1 union 18 | select 19 | m.id, m.role_id, m.member_type, m.member_id, g.name 20 | from 21 | ucr_role_member m 22 | join ucg_group g on g.id = m.member_id 23 | where 24 | m.member_type = 2 union 25 | select 26 | m.id, m.role_id, m.member_type, m.member_id, o.alias as name 27 | from 28 | ucr_role_member m 29 | join uco_organization o on o.id = m.member_id 30 | where 31 | m.member_type = 3 32 | 33 | go -------------------------------------------------------------------------------- /Source/Common/DTO/MemberUser.cs: -------------------------------------------------------------------------------- 1 | namespace Insight.Base.Common.DTO 2 | { 3 | public class MemberUser 4 | { 5 | /// 6 | /// 唯一ID 7 | /// 8 | public string id { get; set; } 9 | 10 | /// 11 | /// 上级ID 12 | /// 13 | public string parentId { get; set; } 14 | 15 | /// 16 | /// 用户名 17 | /// 18 | public string name { get; set; } 19 | 20 | /// 21 | /// 用户登录名 22 | /// 23 | public string account { get; set; } 24 | 25 | /// 26 | /// 用户描述 27 | /// 28 | public string remark { get; set; } 29 | 30 | /// 31 | /// 是否有效 32 | /// 33 | public bool isInvalid { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /Source/Common/Entity/RoleMemberUser.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class RoleMemberUser 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid RoleId { get; set; } 20 | public string Name { get; set; } 21 | public string LoginName { get; set; } 22 | public string Description { get; set; } 23 | public bool Validity { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/Common/Entity/RoleMember.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class RoleMember 16 | { 17 | public System.Guid ID { get; set; } 18 | public Nullable ParentId { get; set; } 19 | public System.Guid RoleId { get; set; } 20 | public System.Guid MemberId { get; set; } 21 | public long Index { get; set; } 22 | public int NodeType { get; set; } 23 | public string Name { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/BaseServer/BaseServer.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceProcess; 2 | using Insight.WCF; 3 | 4 | namespace Insight.Base.Server 5 | { 6 | public partial class BaseServer : ServiceBase 7 | { 8 | private static readonly Service services = new Service(); 9 | 10 | /// 11 | /// 构造方法 12 | /// 13 | public BaseServer() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | /// 19 | /// 启动服务 20 | /// 21 | /// 22 | protected override void OnStart(string[] args) 23 | { 24 | services.createHosts(); 25 | services.startService(); 26 | } 27 | 28 | /// 29 | /// 停止服务 30 | /// 31 | protected override void OnStop() 32 | { 33 | services.stopService(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /DataBase/other/5-初始化图形验证码记录.sql: -------------------------------------------------------------------------------- 1 | use Insight_Base 2 | go 3 | 4 | insert SYS_VerifyImage (Type, Name, Path) 5 | select '0', 'mp0', '/image/0.png' union all 6 | select '0', 'mp1', '/image/1.png' union all 7 | select '0', 'mp2', '/image/2.png' union all 8 | select '0', 'mp3', '/image/3.png' union all 9 | select '0', 'mp4', '/image/4.png' union all 10 | select '0', 'mp5', '/image/5.png' union all 11 | select '0', 'mp6', '/image/6.png' union all 12 | select '0', 'mp7', '/image/7.png' union all 13 | select '0', 'mp8', '/image/8.png' union all 14 | select '1', 'bg0', '/image/0.jpg' union all 15 | select '1', 'bg1', '/image/1.jpg' union all 16 | select '1', 'bg2', '/image/2.jpg' union all 17 | select '1', 'bg3', '/image/3.jpg' union all 18 | select '1', 'bg4', '/image/4.jpg' union all 19 | select '1', 'bg5', '/image/5.jpg' union all 20 | select '1', 'bg6', '/image/6.jpg' union all 21 | select '1', 'bg7', '/image/7.jpg' union all 22 | select '1', 'bg8', '/image/8.jpg' union all 23 | select '1', 'bg9', '/image/9.jpg' 24 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Code_Record.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Code_Record 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid SchemeId { get; set; } 20 | public string RelationChar { get; set; } 21 | public int SerialNumber { get; set; } 22 | public Nullable BusinessId { get; set; } 23 | public System.DateTime CreateTime { get; set; } 24 | 25 | public virtual SYS_Code_Scheme SYS_Code_Scheme { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Logs.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Logs 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public int Level { get; set; } 20 | public string Code { get; set; } 21 | public string Source { get; set; } 22 | public string Action { get; set; } 23 | public string Message { get; set; } 24 | public string Key { get; set; } 25 | public Nullable SourceUserId { get; set; } 26 | public System.DateTime CreateTime { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Logs_Rules.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Logs_Rules 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public string Code { get; set; } 20 | public bool ToDataBase { get; set; } 21 | public int Level { get; set; } 22 | public string Source { get; set; } 23 | public string Action { get; set; } 24 | public string Message { get; set; } 25 | public System.Guid CreatorUserId { get; set; } 26 | public System.DateTime CreateTime { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Role_Member.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Role_Member 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public int Type { get; set; } 20 | public System.Guid RoleId { get; set; } 21 | public System.Guid MemberId { get; set; } 22 | public System.Guid CreatorUserId { get; set; } 23 | public System.DateTime CreateTime { get; set; } 24 | 25 | public virtual SYS_Role SYS_Role { get; set; } 26 | public virtual SYS_User SYS_User { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/BaseServer/BaseServer.Designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Insight.Base.Server 4 | { 5 | partial class BaseServer 6 | { 7 | /// 8 | /// 必需的设计器变量。 9 | /// 10 | private IContainer components = null; 11 | 12 | /// 13 | /// 清理所有正在使用的资源。 14 | /// 15 | /// 如果应释放托管资源,为 true;否则为 false。 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing && (components != null)) 19 | { 20 | components.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region 组件设计器生成的代码 26 | 27 | /// 28 | /// 设计器支持所需的方法 - 不要 29 | /// 使用代码编辑器修改此方法的内容。 30 | /// 31 | private void InitializeComponent() 32 | { 33 | ServiceName = "Insight Base Service"; 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Common/DTO/AppTree.cs: -------------------------------------------------------------------------------- 1 | namespace Insight.Base.Common.DTO 2 | { 3 | /// 4 | /// 应用树 5 | /// 6 | public class AppTree 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 父级ID 15 | /// 16 | public string parentId { get; set; } 17 | 18 | /// 19 | /// 图标类型 20 | /// 21 | public int nodeType { get; set; } 22 | 23 | /// 24 | /// 序号 25 | /// 26 | public long index { get; set; } 27 | 28 | /// 29 | /// 节点名称 30 | /// 31 | public string name { get; set; } 32 | 33 | /// 34 | /// 描述 35 | /// 36 | public string remark { get; set; } 37 | 38 | /// 39 | /// 授权 40 | /// 41 | public bool? permit { get; set; } 42 | } 43 | } -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_OrgMember.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_OrgMember 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid OrgId { get; set; } 20 | public System.Guid UserId { get; set; } 21 | public System.Guid CreatorUserId { get; set; } 22 | public System.DateTime CreateTime { get; set; } 23 | 24 | public virtual SYS_Organization SYS_Organization { get; set; } 25 | public virtual SYS_User SYS_User { get; set; } 26 | public virtual SYS_User SYS_User1 { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_UserGroupMember.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_UserGroupMember 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid GroupId { get; set; } 20 | public System.Guid UserId { get; set; } 21 | public System.Guid CreatorUserId { get; set; } 22 | public System.DateTime CreateTime { get; set; } 23 | 24 | public virtual SYS_User SYS_User { get; set; } 25 | public virtual SYS_User SYS_User1 { get; set; } 26 | public virtual SYS_UserGroup SYS_UserGroup { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Role_Action.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Role_Action 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid RoleId { get; set; } 20 | public System.Guid ActionId { get; set; } 21 | public int Action { get; set; } 22 | public System.Guid CreatorUserId { get; set; } 23 | public System.DateTime CreateTime { get; set; } 24 | 25 | public virtual SYS_ModuleAction SYS_ModuleAction { get; set; } 26 | public virtual SYS_Role SYS_Role { get; set; } 27 | public virtual SYS_User SYS_User { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/Services/Apps/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Apps Service")] 8 | [assembly: AssemblyDescription("应用服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 会使此程序集中的类型 17 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("03e429fa-6afd-4364-bb2b-ce566ecc5389")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 32 | //通过使用 "*",如下所示: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/OAuth/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("OAuth2")] 8 | [assembly: AssemblyDescription("OpenAuth公共库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("Insight Base Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("0a33f95f-4934-4860-bd25-2e75d4a1a68f")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/Services/Logs/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("LogServer")] 8 | [assembly: AssemblyDescription("日志服务器")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("c8ee59ad-2499-4c28-a4cf-7c726210d94d")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Rules/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rules Service")] 8 | [assembly: AssemblyDescription("报表分期服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("6e25d308-bb66-45d7-8283-9d86ccb83962")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/Services/Tenants/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Tenants Service")] 8 | [assembly: AssemblyDescription("租户服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 会使此程序集中的类型 17 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("8efdb90a-c184-4886-9353-df3ca4f84627")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 32 | //通过使用 "*",如下所示: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Base Common")] 8 | [assembly: AssemblyDescription("基础公共库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("Insight Base Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("c4f26dd1-de5a-4773-a789-7823e96ea166")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Auth/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("AuthService")] 8 | [assembly: AssemblyDescription("用户验证服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("b18dff40-4eb9-4777-b63e-756f36d5c5e2")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Reports/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Reports Service")] 8 | [assembly: AssemblyDescription("报表服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("6e25d308-bb66-45d7-8283-9d86ccb83962")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/Services/Roles/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Roles Service")] 8 | [assembly: AssemblyDescription("角色权限服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("d61f0159-9976-4e11-bf95-6ac44a64ebbd")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Users/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Users Service")] 8 | [assembly: AssemblyDescription("用户服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("f6f13cec-cca4-450e-8f02-743fc17a4f96")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Commons/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Modules Service")] 8 | [assembly: AssemblyDescription("业务模块服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("06751a2c-c718-4f53-a9f8-61401ba119d6")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Templates/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Templates Service")] 8 | [assembly: AssemblyDescription("报表模板服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("630f9f70-2b85-426a-8495-6f3db1b4f22c")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Source/Services/UserGroups/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Users Service")] 8 | [assembly: AssemblyDescription("用户服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("f6f13cec-cca4-450e-8f02-743fc17a4f96")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /DataBase/View/MemberUser.sql: -------------------------------------------------------------------------------- 1 | use insight_base 2 | go 3 | 4 | if exists (select * from sysobjects where id = object_id(N'ucv_role_user') and objectproperty(id, N'isview') = 1) 5 | drop view ucv_role_user 6 | go 7 | 8 | /*****视图:查询角色的所有成员用户*****/ 9 | 10 | create view ucv_role_user as 11 | select 12 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 13 | from 14 | ucr_role_member m 15 | join ucb_user u on u.id = m.member_id 16 | where 17 | m.member_type = 1 union 18 | select 19 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 20 | from 21 | ucr_role_member m 22 | join ucg_group g on g.id = m.member_id 23 | join ucg_group_member r on r.group_id = g.id 24 | join ucb_user u on u.id = r.user_id 25 | where 26 | m.member_type = 2 union 27 | select 28 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 29 | from 30 | ucr_role_member m 31 | join uco_organization o on o.id = m.member_id 32 | join uco_org_member r on r.org_id = o.id 33 | join ucb_user u on u.id = r.user_id 34 | where 35 | m.member_type = 3 36 | 37 | go -------------------------------------------------------------------------------- /Source/BaseServer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Base Server")] 8 | [assembly: AssemblyDescription("基础服务器")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("Insight Base Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("a23f14d8-4109-4796-84b7-2b21b578f442")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Services/Organizations/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Organizations Service")] 8 | [assembly: AssemblyDescription("组织机构服务库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Insight Software Ltd.")] 11 | [assembly: AssemblyProduct("WCF Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2014 Insight Software Ltd.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("0803e544-b979-4397-a853-deb7faf267bb")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyFileVersion("14.1.0622.12")] -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Role_Data.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Role_Data 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid RoleId { get; set; } 20 | public System.Guid ModuleId { get; set; } 21 | public int Mode { get; set; } 22 | public System.Guid ModeId { get; set; } 23 | public int Permission { get; set; } 24 | public System.Guid CreatorUserId { get; set; } 25 | public System.DateTime CreateTime { get; set; } 26 | 27 | public virtual SYS_Module SYS_Module { get; set; } 28 | public virtual SYS_Role SYS_Role { get; set; } 29 | public virtual SYS_User SYS_User { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_ModuleParam.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_ModuleParam 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid ModuleId { get; set; } 20 | public System.Guid ParamId { get; set; } 21 | public string Name { get; set; } 22 | public string Value { get; set; } 23 | public Nullable OrgId { get; set; } 24 | public Nullable UserId { get; set; } 25 | public string Description { get; set; } 26 | 27 | public virtual SYS_Module SYS_Module { get; set; } 28 | public virtual SYS_Organization SYS_Organization { get; set; } 29 | public virtual SYS_User SYS_User { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Document/错误信息表.md: -------------------------------------------------------------------------------- 1 | # 错误信息表 2 | 3 | |Code|Name|Message| 4 | | ------------ | ------------ | ------------ | 5 | |200|OK|接口调用成功| 6 | |201|Created|资源创建成功| 7 | |202|Multiple|账号已在其他设备登录| 8 | |204|NoContent|无可用内容| 9 | |300|SessionExpired|Session过期,请更新Session| 10 | | | | | 11 | |400|BadRequest|请求参数错误| 12 | |401|InvalidAuthenticationInfo|提供的身份验证信息不正确| 13 | |402|AccountIsDisabled|当前用户被禁止登录| 14 | |403|Forbidden当前用户未取得授权| 15 | |404|ResourceNotFound|指定的资源不存在| 16 | |405|IncompatibleVersions|客户端版本不兼容| 17 | |406|InvalidGUID|非法的GUID| 18 | |407|DataNotUpdate|未更新任何数据| 19 | |408|AccountIsBlocked账号已锁定| 20 | |409|AccountAlreadyExists|用户已存在| 21 | |410|SMSCodeError|短信验证码错误| 22 | |411|UnknownSmsType|未知的验证码类型| 23 | |412|TimeIntervalTooShort|获取验证码时间间隔过短,请稍后再试| 24 | |413|InvalidEventCode|未配置的事件代码,请先为该代码配置日志规则| 25 | |414|EventCodeUsed|事件代码已使用,请勿重复为该代码配置日志规则| 26 | |415|EventWithoutConfig|事件等级为:0/1/7的,无需配置事件规则| 27 | |416|XfbInterfaceFail|调用信分宝接口失败| 28 | |417|InvalidPayAmount|付款金额不一致| 29 | |418|InvalidPayKey|错误的支付密码| 30 | |419|ProductNotInSale|购买的商品已下架| 31 | |420|ProductIsLimit|购买的商品是限购商品,每天限购1件| 32 | |421|TooManyForOrder|未付款订单过多| 33 | | | | | 34 | |500|UnknownError|未知错误| 35 | |501|DataBaseError|写入数据失败| 36 | |502|DataAlreadyExists|数据已存在| 37 | |503|ServiceUnavailable|当前服务不可用| -------------------------------------------------------------------------------- /Source/Common/DTO/GroupInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Insight.Base.Common.DTO 5 | { 6 | public class GroupInfo 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 是否预置:0、自定;1、预置 15 | /// 16 | public string tenantId { get; set; } 17 | 18 | /// 19 | /// 姓名/昵称 20 | /// 21 | public string name { get; set; } 22 | 23 | /// 24 | /// 描述 25 | /// 26 | public string remark { get; set; } 27 | 28 | /// 29 | /// 是否预置:0、自定;1、预置 30 | /// 31 | public bool isBuiltin { get; set; } 32 | 33 | /// 34 | /// 创建人ID 35 | /// 36 | public string creatorId { get; set; } 37 | 38 | /// 39 | /// 创建时间 40 | /// 41 | public DateTime createTime { get; set; } 42 | 43 | /// 44 | /// 用户组成员 45 | /// 46 | public List members { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Source/BaseServer/ServiceInfo.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Insight.WS.Service 3 | { 4 | public class ServiceInfo 5 | { 6 | private string path; 7 | 8 | /// 9 | /// 服务基地址 10 | /// 11 | public string BaseAddress { get; set; } 12 | 13 | /// 14 | /// 服务端口号 15 | /// 16 | public string Port { get; set; } 17 | 18 | /// 19 | /// 访问路径 20 | /// 21 | public string Path 22 | { 23 | get { return path ?? ""; } 24 | set { path = value; } 25 | } 26 | 27 | /// 28 | /// 服务命名空间 29 | /// 30 | public string NameSpace { get; set; } 31 | 32 | /// 33 | /// Endpoint名称 34 | /// 35 | public string Interface { get; set; } 36 | 37 | /// 38 | /// 服务实现类型名称 39 | /// 40 | public string ComplyType { get; set; } 41 | 42 | /// 43 | /// 库文件路径 44 | /// 45 | public string ServiceFile { get; set; } 46 | 47 | /// 48 | /// 是否启用Gzip压缩 49 | /// 50 | public bool Compress { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_ModuleGroup.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_ModuleGroup 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_ModuleGroup() 19 | { 20 | this.SYS_Module = new HashSet(); 21 | } 22 | 23 | public System.Guid ID { get; set; } 24 | public long SN { get; set; } 25 | public Nullable Index { get; set; } 26 | public string Name { get; set; } 27 | public string Description { get; set; } 28 | public string IconUrl { get; set; } 29 | public byte[] Icon { get; set; } 30 | 31 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 32 | public virtual ICollection SYS_Module { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Document/Log.md: -------------------------------------------------------------------------------- 1 | # LogInfo数据结构 2 | 3 | |数据类型|属性名称|描述| 4 | | ------------ | ------------ | ------------ | 5 | |string|Interface|日志接口Url *| 6 | |TokenHelper|Token|AccessToken *| 7 | |string|EventSource|系统日志事件源,写到系统日志时必填| 8 | |EventLogEntryType|EventType|系统日志事件类型,默认Error| 9 | |string|Code|事件代码,根据事件表编制 *| 10 | |string|Source|事件源,见事件源表| 11 | |string|Action|事件名称,见事件名称表| 12 | |string|Message|事件消息,如日志规则已配置消息内容,可空| 13 | |string|Key|查询关键词| 14 | |Guid?|CreatorUserId|创建者用户ID| 15 | \* 写到日志服务器时必填 16 | 17 | # 事件代码结构 18 | 19 | |日志等级代码|事件源代码|事件名称代码| 20 | | ------------ | ------------ | ------------ | 21 | |2(1位)|001(3位)|01(2位)| 22 | 23 | # 日志等级 24 | 25 | |代码|名称|描述| 26 | | ------------ | ------------ | ------------ | 27 | |0|Emergency|不能配置规则| 28 | |1|Alert|不能配置规则| 29 | |2|Critical|| 30 | |3|Error|| 31 | |4|Warning|| 32 | |5|Notice|| 33 | |6|Informational|| 34 | |7|Debug|不能配置规则| 35 | 36 | # 事件源 37 | 38 | |代码|事件源|描述| 39 | | ------------ | ------------ | ------------ | 40 | |001|系统平台|| 41 | |006|日志服务|| 42 | 43 | # 事件 44 | 45 | |代码|事件名称|描述| 46 | | ------------ | ------------ | ------------ | 47 | |2|001|系统平台| 48 | |01|SqlQuery|| 49 | |02|SqlNonQuery|| 50 | |03|SqlScalar|| 51 | |04|SqlExecute|| 52 | |05|SqlExecute|| 53 | |3|006|日志服务| 54 | |01|新增规则|插入数据失败| 55 | |02|删除规则|删除数据失败| 56 | |03|编辑规则|更新数据失败| 57 | |5|001|系统平台| 58 | |01|接口验证|| 59 | |6|006|日志服务| 60 | |01|新增规则|| 61 | |02|删除规则|| 62 | |03|编辑规则|| 63 | |7|001|系统平台| 64 | |01|接口调用|| 65 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Allot_Record.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Allot_Record 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid SchemeId { get; set; } 20 | public System.Guid ModuleId { get; set; } 21 | public System.Guid OwnerId { get; set; } 22 | public string StartNumber { get; set; } 23 | public string EndNumber { get; set; } 24 | public Nullable CreatorDeptId { get; set; } 25 | public System.Guid CreatorUserId { get; set; } 26 | public System.DateTime CreateTime { get; set; } 27 | 28 | public virtual SYS_Organization SYS_Organization { get; set; } 29 | public virtual SYS_User SYS_User { get; set; } 30 | public virtual SYS_Module SYS_Module { get; set; } 31 | public virtual SYS_User SYS_User1 { get; set; } 32 | public virtual SYS_Code_Scheme SYS_Code_Scheme { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Code_Allot.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Code_Allot 16 | { 17 | public System.Guid ID { get; set; } 18 | public long SN { get; set; } 19 | public System.Guid SchemeId { get; set; } 20 | public System.Guid ModuleId { get; set; } 21 | public System.Guid OwnerId { get; set; } 22 | public string AllotNumber { get; set; } 23 | public Nullable BusinessId { get; set; } 24 | public Nullable UpdateTime { get; set; } 25 | public Nullable CreatorDeptId { get; set; } 26 | public System.Guid CreatorUserId { get; set; } 27 | public System.DateTime CreateTime { get; set; } 28 | 29 | public virtual SYS_Organization SYS_Organization { get; set; } 30 | public virtual SYS_User SYS_User { get; set; } 31 | public virtual SYS_Module SYS_Module { get; set; } 32 | public virtual SYS_User SYS_User1 { get; set; } 33 | public virtual SYS_Code_Scheme SYS_Code_Scheme { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_UserGroup.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_UserGroup 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_UserGroup() 19 | { 20 | this.SYS_UserGroupMember = new HashSet(); 21 | } 22 | 23 | public System.Guid ID { get; set; } 24 | public long SN { get; set; } 25 | public string Name { get; set; } 26 | public string Description { get; set; } 27 | public bool BuiltIn { get; set; } 28 | public bool Visible { get; set; } 29 | public System.Guid CreatorUserId { get; set; } 30 | public System.DateTime CreateTime { get; set; } 31 | 32 | public virtual SYS_User SYS_User { get; set; } 33 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 34 | public virtual ICollection SYS_UserGroupMember { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Source/BaseServer/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /DataBase/Function/Get_FormatDate.sql: -------------------------------------------------------------------------------- 1 | USE Insight_Base 2 | GO 3 | 4 | IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'Get_FormatDate') AND OBJECTPROPERTY(id, N'ISSCALARFUNCTION') = 1) 5 | DROP FUNCTION Get_FormatDate 6 | GO 7 | 8 | 9 | /*****标量值函数:获取任意格式的当前时间*****/ 10 | 11 | CREATE FUNCTION Get_FormatDate ( 12 | @Code NVARCHAR(16) --编码字段 13 | ) 14 | 15 | RETURNS NVARCHAR(16) AS 16 | BEGIN 17 | 18 | DECLARE @Datetime DATETIME 19 | set @Datetime = getdate() 20 | 21 | if (charindex ('yyyy', @Code) > 0) 22 | set @Code = replace(@Code, 'yyyy', datename(yy, @Datetime)) 23 | 24 | if (charindex ('yy', @Code) > 0) 25 | set @Code = replace(@Code, 'yy', right(datename(yy, @Datetime),2)) 26 | 27 | if (charindex ('mm', @Code) > 0) 28 | set @Code = replace(@Code, 'mm', right('0' + convert(varchar,datepart(mm, @Datetime)),2)) 29 | 30 | if (charindex ('dd', @Code) > 0) 31 | set @Code = replace(@Code, 'dd', right('0' + datename(dd, @Datetime), 2)) 32 | 33 | if (charindex ('month', @Code) > 0) 34 | set @Code = replace(@Code, 'month', datename(mm, @Datetime)) 35 | 36 | if (charindex ('mon', @Code collate sql_latin1_general_cp1_cs_as) > 0) 37 | set @Code = replace(@Code, 'mon', left(upper(datename(mm, @Datetime)),3)) 38 | 39 | if (charindex ('mon', @Code) > 0) 40 | set @Code = replace(@Code, 'mon', left(datename(mm, @Datetime),3)) 41 | 42 | if (charindex ('m', @Code) > 0) 43 | set @Code = replace(@Code, 'm', convert(varchar, datepart(mm, @Datetime))) 44 | 45 | if (charindex ('d', @Code) > 0) 46 | set @Code = replace(@Code, 'd', datename(dd, @Datetime)) 47 | 48 | RETURN @Code 49 | 50 | END 51 | 52 | GO -------------------------------------------------------------------------------- /Source/Common/Params.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using Insight.Base.Common.Entity; 6 | using Insight.Utils.Common; 7 | using Insight.Utils.Entity; 8 | using Insight.Utils.Redis; 9 | 10 | namespace Insight.Base.Common 11 | { 12 | public static class Params 13 | { 14 | private static List ruleList; 15 | 16 | // 客户端文件信息集合 17 | public static readonly Dictionary fileList = new Dictionary(); 18 | 19 | // 日志进程同步基元 20 | public static readonly Mutex mutex = new Mutex(); 21 | 22 | // 每日每用户Token配额 23 | public static readonly int tokenLimit = Convert.ToInt32(Util.getAppSetting("TokenLimit")); 24 | 25 | // 访问管理器 26 | public static CallManage callManage { get; } = new CallManage(); 27 | 28 | /// 29 | /// 规则缓存 30 | /// 31 | public static List rules 32 | { 33 | get 34 | { 35 | if (ruleList != null) return ruleList; 36 | 37 | using (var context = new Entities()) 38 | { 39 | ruleList = context.logRules.ToList(); 40 | } 41 | 42 | return ruleList; 43 | } 44 | } 45 | 46 | /// 47 | /// 用于生成短信验证码的随机数发生器 48 | /// 49 | public static readonly Random random = new Random(Environment.TickCount); 50 | 51 | /// 52 | /// 日志接口URL 53 | /// 54 | public static string logUrl; 55 | } 56 | } -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_ModuleAction.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_ModuleAction 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_ModuleAction() 19 | { 20 | this.SYS_Role_Action = new HashSet(); 21 | } 22 | 23 | public System.Guid ID { get; set; } 24 | public long SN { get; set; } 25 | public System.Guid ModuleId { get; set; } 26 | public Nullable Index { get; set; } 27 | public bool BeginGroup { get; set; } 28 | public bool ShowText { get; set; } 29 | public string Name { get; set; } 30 | public string Alias { get; set; } 31 | public string Description { get; set; } 32 | public bool Validity { get; set; } 33 | public string IconUrl { get; set; } 34 | public byte[] Icon { get; set; } 35 | 36 | public virtual SYS_Module SYS_Module { get; set; } 37 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 38 | public virtual ICollection SYS_Role_Action { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/Common/DTO/App.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Insight.Base.Common.DTO 5 | { 6 | public class App 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 序号 15 | /// 16 | public int index { get; set; } 17 | 18 | /// 19 | /// 应用名称 20 | /// 21 | public string name { get; set; } 22 | 23 | /// 24 | /// 应用别名 25 | /// 26 | public string alias { get; set; } 27 | 28 | /// 29 | /// 域名 30 | /// 31 | public string host { get; set; } 32 | 33 | /// 34 | /// 令牌生存周期(小时) 35 | /// 36 | public int tokenLife { get; set; } 37 | 38 | /// 39 | /// 图标url 40 | /// 41 | public string iconurl { get; set; } 42 | 43 | /// 44 | /// 图标 45 | /// 46 | public byte[] icon { get; set; } 47 | 48 | /// 49 | /// 描述 50 | /// 51 | public string remark { get; set; } 52 | 53 | /// 54 | /// 创建人ID 55 | /// 56 | public string creatorId { get; set; } 57 | 58 | /// 59 | /// 创建时间 60 | /// 61 | public DateTime createTime { get; set; } 62 | 63 | /// 64 | /// 导航 65 | /// 66 | public List navs { get; set; } 67 | } 68 | } -------------------------------------------------------------------------------- /Source/Common/DTO/UserInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Insight.Base.Common.DTO 5 | { 6 | public class UserDto 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 姓名/昵称 15 | /// 16 | public string name { get; set; } 17 | 18 | /// 19 | /// 登录账号 20 | /// 21 | public string account { get; set; } 22 | 23 | /// 24 | /// 手机号 25 | /// 26 | public string mobile { get; set; } 27 | 28 | /// 29 | /// 注册邮箱 30 | /// 31 | public string email { get; set; } 32 | 33 | /// 34 | /// 描述 35 | /// 36 | public string remark { get; set; } 37 | 38 | /// 39 | /// 是否预置:0、自定;1、预置 40 | /// 41 | public bool isBuiltin { get; set; } 42 | 43 | /// 44 | /// 是否失效:0、有效;1、失效 45 | /// 46 | public bool isInvalid { get; set; } 47 | 48 | /// 49 | /// 创建人ID 50 | /// 51 | public string creatorId { get; set; } 52 | 53 | /// 54 | /// 创建时间 55 | /// 56 | public DateTime createTime { get; set; } 57 | 58 | /// 59 | /// 授予用户的功能权限 60 | /// 61 | public List funcs { get; set; } 62 | 63 | /// 64 | /// 授予用户的数据权限 65 | /// 66 | public List datas { get; set; } 67 | } 68 | } -------------------------------------------------------------------------------- /Source/Common/DTO/OrgDTO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Insight.Base.Common.DTO 5 | { 6 | public class OrgDto 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 上级ID 15 | /// 16 | public string parentId { get; set; } 17 | 18 | /// 19 | /// 租户ID 20 | /// 21 | public string tenantId { get; set; } 22 | 23 | /// 24 | /// 序号 25 | /// 26 | public int nodeType { get; set; } 27 | 28 | /// 29 | /// 序号 30 | /// 31 | public int index { get; set; } 32 | 33 | /// 34 | /// 编码 35 | /// 36 | public string code { get; set; } 37 | 38 | /// 39 | /// 名称 40 | /// 41 | public string name { get; set; } 42 | 43 | /// 44 | /// 别名/简称 45 | /// 46 | public string alias { get; set; } 47 | 48 | /// 49 | /// 全称 50 | /// 51 | public string fullname { get; set; } 52 | 53 | /// 54 | /// 职能ID,字典 55 | /// 56 | public string positionId { get; set; } 57 | 58 | /// 59 | /// 描述 60 | /// 61 | public string remark { get; set; } 62 | 63 | /// 64 | /// 创建人ID 65 | /// 66 | public string creatorId { get; set; } 67 | 68 | /// 69 | /// 创建时间 70 | /// 71 | public DateTime createTime { get; set; } 72 | 73 | /// 74 | /// 成员用户 75 | /// 76 | public List members { get; set; } 77 | } 78 | } -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Role.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Role 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_Role() 19 | { 20 | this.SYS_Role_Member = new HashSet(); 21 | this.SYS_Role_Action = new HashSet(); 22 | this.SYS_Role_Data = new HashSet(); 23 | } 24 | 25 | public System.Guid ID { get; set; } 26 | public long SN { get; set; } 27 | public string Name { get; set; } 28 | public string Description { get; set; } 29 | public bool BuiltIn { get; set; } 30 | public bool Validity { get; set; } 31 | public System.Guid CreatorUserId { get; set; } 32 | public System.DateTime CreateTime { get; set; } 33 | 34 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 35 | public virtual ICollection SYS_Role_Member { get; set; } 36 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 37 | public virtual ICollection SYS_Role_Action { get; set; } 38 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 39 | public virtual ICollection SYS_Role_Data { get; set; } 40 | public virtual SYS_User SYS_User { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/OAuth/ServiceBase.cs: -------------------------------------------------------------------------------- 1 | using Insight.Utils.Common; 2 | using Insight.Utils.Entity; 3 | 4 | namespace Insight.Base.OAuth 5 | { 6 | public class ServiceBase 7 | { 8 | protected Result result = new Result(); 9 | protected TokenManage manage; 10 | protected string tokenId; 11 | protected string appId; 12 | protected string tenantId; 13 | protected string tenantCode; 14 | protected string tenantName; 15 | protected string deptId; 16 | protected string deptCode; 17 | protected string deptName; 18 | protected string userId; 19 | protected string userName; 20 | 21 | /// 22 | /// 会话合法性验证 23 | /// 24 | /// 操作权限代码,默认为空,即不进行鉴权 25 | /// 用户ID 26 | /// bool 身份是否通过验证 27 | protected bool verify(string key = null, string id = null) 28 | { 29 | var verify = new Verify(); 30 | tokenId = verify.tokenId; 31 | manage = verify.manage; 32 | if (manage == null) return false; 33 | 34 | appId = manage.getAppId(); 35 | tenantId = manage.getTenantId(); 36 | tenantCode = manage.getTenantCode(); 37 | tenantName = manage.getTenantName(); 38 | deptId = manage.getDeptId(); 39 | deptCode = manage.getDeptCode(); 40 | deptName = manage.getDeptName(); 41 | userId = manage.userId; 42 | userName = manage.userName; 43 | result = verify.compare(userId == id ? null : key); 44 | 45 | return result.successful; 46 | } 47 | 48 | /// 49 | /// 获取客户端特征指纹 50 | /// 51 | /// string 客户端特征指纹 52 | protected static string getFingerprint() 53 | { 54 | var verify = new Verify(false); 55 | 56 | return Util.hash(verify.ip + verify.userAgent); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/BaseServer/ProjectInstaller.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Insight.Base.Server 2 | { 3 | partial class ProjectInstaller 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller(); 32 | serviceInstaller = new System.ServiceProcess.ServiceInstaller(); 33 | // 34 | // serviceProcessInstaller 35 | // 36 | serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem; 37 | serviceProcessInstaller.Password = null; 38 | serviceProcessInstaller.Username = null; 39 | // 40 | // serviceInstaller 41 | // 42 | serviceInstaller.Description = "Insight 基础服务"; 43 | serviceInstaller.DisplayName = "Insight 基础服务"; 44 | serviceInstaller.ServiceName = "Insight Base Service"; 45 | serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic; 46 | // 47 | // ProjectInstaller 48 | // 49 | Installers.AddRange(new System.Configuration.Install.Installer[] { 50 | serviceProcessInstaller, 51 | serviceInstaller}); 52 | 53 | } 54 | 55 | #endregion 56 | 57 | private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller; 58 | private System.ServiceProcess.ServiceInstaller serviceInstaller; 59 | } 60 | } -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Code_Scheme.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Code_Scheme 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_Code_Scheme() 19 | { 20 | this.SYS_Allot_Record = new HashSet(); 21 | this.SYS_Code_Allot = new HashSet(); 22 | this.SYS_Code_Record = new HashSet(); 23 | } 24 | 25 | public System.Guid ID { get; set; } 26 | public long SN { get; set; } 27 | public string Name { get; set; } 28 | public string CodeFormat { get; set; } 29 | public string SerialFormat { get; set; } 30 | public string Description { get; set; } 31 | public bool Validity { get; set; } 32 | public Nullable CreatorDeptId { get; set; } 33 | public System.Guid CreatorUserId { get; set; } 34 | public System.DateTime CreateTime { get; set; } 35 | 36 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 37 | public virtual ICollection SYS_Allot_Record { get; set; } 38 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 39 | public virtual ICollection SYS_Code_Allot { get; set; } 40 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 41 | public virtual ICollection SYS_Code_Record { get; set; } 42 | public virtual SYS_Organization SYS_Organization { get; set; } 43 | public virtual SYS_User SYS_User { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Common/DTO/RoleInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Insight.Base.Common.DTO 5 | { 6 | public class RoleInfo 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 是否预置:0、自定;1、预置 15 | /// 16 | public string appId { get; set; } 17 | 18 | /// 19 | /// 所属应用名称 20 | /// 21 | public string appName { get; set; } 22 | 23 | /// 24 | /// 名称 25 | /// 26 | public string name { get; set; } 27 | 28 | /// 29 | /// 描述 30 | /// 31 | public string remark { get; set; } 32 | 33 | /// 34 | /// 是否预置:0、自定;1、预置 35 | /// 36 | public bool isBuiltin { get; set; } 37 | 38 | /// 39 | /// 创建人ID 40 | /// 41 | public string creatorId { get; set; } 42 | 43 | /// 44 | /// 创建时间 45 | /// 46 | public DateTime createTime { get; set; } 47 | 48 | /// 49 | /// 角色成员 50 | /// 51 | public List members { get; set; } 52 | 53 | /// 54 | /// 功能授权 55 | /// 56 | public List funcs { get; set; } 57 | 58 | /// 59 | /// 数据授权 60 | /// 61 | public List datas { get; set; } 62 | } 63 | 64 | public class MemberInfo 65 | { 66 | /// 67 | /// ID,唯一标识 68 | /// 69 | public string id { get; set; } 70 | 71 | /// 72 | /// 父节点ID 73 | /// 74 | public string parentId { get; set; } 75 | 76 | /// 77 | /// 节点类型(成员类型:1、用户;2、用户组;3、岗位) 78 | /// 79 | public int nodeType { get; set; } 80 | 81 | /// 82 | /// 成员ID 83 | /// 84 | public string memberId { get; set; } 85 | 86 | /// 87 | /// 节点名称 88 | /// 89 | public string name { get; set; } 90 | } 91 | } -------------------------------------------------------------------------------- /DataBase/Function/Get_CnAmount.sql: -------------------------------------------------------------------------------- 1 | IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'Get_CnAmount') AND OBJECTPROPERTY(id, N'ISSCALARFUNCTION') = 1) 2 | DROP FUNCTION Get_CnAmount 3 | GO 4 | 5 | 6 | /*****标量值函数:金额阿拉伯数字转换为中文*****/ 7 | 8 | CREATE FUNCTION Get_CnAmount( 9 | @Amount DECIMAL(18, 2), --金额 10 | @Type INT --0到元补整;1到角补整 11 | ) 12 | 13 | RETURNS NVARCHAR(36) AS 14 | BEGIN 15 | 16 | DECLARE @Digital NVARCHAR(10) 17 | DECLARE @Position NVARCHAR(18) 18 | DECLARE @Inputstr VARCHAR(18) 19 | DECLARE @L INT --金额乘以100后的字符串长度 20 | DECLARE @I INT --循环变量 21 | DECLARE @Zero INT --连续零计数器 22 | DECLARE @Posvalue INT --从金额中取出一位的值 23 | DECLARE @Chdig NVARCHAR(1) --数字大写 24 | DECLARE @Chpos NVARCHAR(1) --数字位大写 25 | DECLARE @CnAmount NVARCHAR(36) 26 | 27 | SET @Digital = '零壹贰叁肆伍陆柒捌玖' 28 | SET @Position = '万仟佰拾亿仟佰拾万仟佰拾元角分' 29 | SET @CnAmount = '' 30 | 31 | if abs(@Amount) < 1 32 | set @Inputstr = cast((abs(@Amount) * 100) as int) 33 | else 34 | set @Inputstr = replace(abs(@Amount), '.', '') 35 | set @L = len(@Inputstr) 36 | set @Position = right(@Position, @L) 37 | set @I = 1 38 | while @I <= @L 39 | begin 40 | set @Posvalue = cast(substring(@Inputstr, @I, 1) as int) --取第 i 位数字 41 | set @Chdig = substring(@Digital, @Posvalue + 1, 1) --取第 i 位数字的大写数字:零壹贰叁肆伍陆柒捌玖 42 | set @Chpos = substring(@Position, @I, 1) --取第 i 位数字的大写位名:万仟佰拾亿仟佰拾万仟佰拾元角分 43 | if @Posvalue > 0 44 | begin 45 | if (@Zero > 0) and ((@L - @I + 3) % 4 != 0) --补回除亿、万、元位外的零 46 | set @CnAmount = @CnAmount + '零' 47 | set @Zero = 0 48 | end 49 | if @Posvalue = 0 50 | begin 51 | set @Chdig = '' 52 | if ((@L - @I + 2) % 4 != 0) --去零对应位大写,保留亿、万、元位 53 | set @Chpos = '' 54 | if (@Zero > 2) and (@I = @L - 6) --亿万相连时只写亿 55 | set @Chpos = '' 56 | if (@Zero + @Type > 0) and (@I = @L) --补整(第二参数输入1时到角补整) 57 | set @Chpos = '整' 58 | set @Zero = @Zero + 1 59 | end 60 | set @CnAmount = @CnAmount + @Chdig + @Chpos 61 | set @I = @I + 1 62 | end 63 | if @Amount < 0 64 | set @CnAmount = '(负)' + @CnAmount 65 | if @Amount = 0 66 | set @CnAmount = '零元整' 67 | 68 | RETURN @CnAmount 69 | END 70 | 71 | GO -------------------------------------------------------------------------------- /Source/Services/Logs/DataAccess.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading; 3 | using Insight.Base.Common; 4 | using Insight.Base.Common.Entity; 5 | 6 | namespace Insight.Base.Services 7 | { 8 | public partial class Logs 9 | { 10 | /// 11 | /// 保存日志规则到数据库 12 | /// 13 | private static bool insert(LogRule rule) 14 | { 15 | using (var context = new Entities()) 16 | { 17 | context.logRules.Add(rule); 18 | if (context.SaveChanges() <= 0) 19 | { 20 | new Thread(() => Logger.write("300601")).Start(); 21 | 22 | return false; 23 | } 24 | 25 | Params.rules.Add(rule); 26 | return true; 27 | } 28 | } 29 | 30 | /// 31 | /// 删除日志规则 32 | /// 33 | private bool deleteRule(string id) 34 | { 35 | using (var context = new Entities()) 36 | { 37 | var rule = context.logRules.SingleOrDefault(r => r.id == id); 38 | if (rule == null) return false; 39 | 40 | context.logRules.Remove(rule); 41 | if (context.SaveChanges() <= 0) 42 | { 43 | new Thread(() => Logger.write("300602")).Start(); 44 | 45 | return false; 46 | } 47 | 48 | Params.rules.RemoveAll(r => r.id == id); 49 | return true; 50 | } 51 | } 52 | 53 | /// 54 | /// 编辑日志规则 55 | /// 56 | private bool update(LogRule rule) 57 | { 58 | using (var context = new Entities()) 59 | { 60 | var data = context.logRules.SingleOrDefault(r => r.id == rule.id); 61 | if (data == null) return false; 62 | 63 | data.isFile = rule.isFile; 64 | data.code = rule.code; 65 | data.level = rule.level; 66 | data.source = rule.source; 67 | data.action = rule.action; 68 | data.message = rule.message; 69 | if (context.SaveChanges() <= 0) 70 | { 71 | new Thread(() => Logger.write("300603")).Start(); 72 | 73 | return false; 74 | } 75 | } 76 | 77 | Params.rules.RemoveAll(r => r.id == rule.id); 78 | Params.rules.Add(rule); 79 | return true; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Source/Services/Rules/IRules.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Web; 3 | using Insight.Base.Common.Entity; 4 | using Insight.Utils.Entity; 5 | 6 | namespace Insight.Base.Services 7 | { 8 | [ServiceContract] 9 | public interface IRules 10 | { 11 | /// 12 | /// 为跨域请求设置响应头信息 13 | /// 14 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 15 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 16 | [OperationContract] 17 | void responseOptions(); 18 | 19 | /// 20 | /// 获取所有报表分期规则 21 | /// 22 | /// 每页行数 23 | /// 当前页 24 | /// Result 25 | [WebGet(UriTemplate = "rules?rows={rows}&page={page}", ResponseFormat = WebMessageFormat.Json)] 26 | [OperationContract] 27 | Result getRules(int rows, int page); 28 | 29 | /// 30 | /// 获取报表分期 31 | /// 32 | /// 分期ID 33 | /// Result 34 | [WebGet(UriTemplate = "rules/{id}", ResponseFormat = WebMessageFormat.Json)] 35 | [OperationContract] 36 | Result getRule(string id); 37 | 38 | /// 39 | /// 新建报表分期 40 | /// 41 | /// 报表分期 42 | /// Result 43 | [WebInvoke(Method = "POST", UriTemplate = "rules", ResponseFormat = WebMessageFormat.Json, 44 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 45 | [OperationContract] 46 | Result addRule(ReportRule rule); 47 | 48 | /// 49 | /// 编辑报表分期 50 | /// 51 | /// 报表分期ID 52 | /// 报表分期 53 | /// Result 54 | [WebInvoke(Method = "PUT", UriTemplate = "rules/{id}", ResponseFormat = WebMessageFormat.Json, 55 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 56 | [OperationContract] 57 | Result editRule(string id, ReportRule rule); 58 | 59 | /// 60 | /// 删除报表分期 61 | /// 62 | /// 报表分期ID 63 | /// Result 64 | [WebInvoke(Method = "DELETE", UriTemplate = "rules/{id}", ResponseFormat = WebMessageFormat.Json, 65 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 66 | [OperationContract] 67 | Result deleteRule(string id); 68 | } 69 | } -------------------------------------------------------------------------------- /Source/Common/DTO/TenantInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Insight.Base.Common.Entity; 4 | 5 | namespace Insight.Base.Common.DTO 6 | { 7 | public class TenantInfo 8 | { 9 | /// 10 | /// ID,唯一标识 11 | /// 12 | public string id { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | public string name { get; set; } 18 | 19 | /// 20 | /// 简称 21 | /// 22 | public string alias { get; set; } 23 | 24 | /// 25 | /// 图标 26 | /// 27 | public byte[] icon { get; set; } 28 | 29 | /// 30 | /// 联系人 31 | /// 32 | public string contact { get; set; } 33 | 34 | /// 35 | /// 手机号 36 | /// 37 | public string mobile { get; set; } 38 | 39 | /// 40 | /// 邮箱 41 | /// 42 | public string email { get; set; } 43 | 44 | /// 45 | /// 所在省/直辖市 46 | /// 47 | public string province { get; set; } 48 | 49 | /// 50 | /// 所在市/地区 51 | /// 52 | public string city { get; set; } 53 | 54 | /// 55 | /// 所在区/县 56 | /// 57 | public string county { get; set; } 58 | 59 | /// 60 | /// 街道楼门号 61 | /// 62 | public string address { get; set; } 63 | 64 | /// 65 | /// 描述 66 | /// 67 | public string remark { get; set; } 68 | 69 | /// 70 | /// 租户到期时间 71 | /// 72 | public DateTime expireDate { get; set; } 73 | 74 | /// 75 | /// 是否预置:0、自定;1、预置 76 | /// 77 | public bool isBuiltin { get; set; } 78 | 79 | /// 80 | /// 是否失效:0、有效;1、失效 81 | /// 82 | public bool isInvalid { get; set; } 83 | 84 | /// 85 | /// 创建人ID 86 | /// 87 | public string creatorId { get; set; } 88 | 89 | /// 90 | /// 创建时间 91 | /// 92 | public DateTime createTime { get; set; } 93 | 94 | /// 95 | /// 绑定应用 96 | /// 97 | public List apps { get; set; } 98 | 99 | /// 100 | /// 关联用户 101 | /// 102 | public List users { get; set; } 103 | } 104 | } -------------------------------------------------------------------------------- /Source/Common/DTO/Permit.cs: -------------------------------------------------------------------------------- 1 | namespace Insight.Base.Common.DTO 2 | { 3 | /// 4 | /// 导航/功能授权实体 5 | /// 6 | public class Permit 7 | { 8 | /// 9 | /// ID,唯一标识 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// 父级ID 15 | /// 16 | public string parentId { get; set; } 17 | 18 | /// 19 | /// 序号 20 | /// 21 | public int index { get; set; } 22 | 23 | /// 24 | /// 项目名称 25 | /// 26 | public string name { get; set; } 27 | 28 | /// 29 | /// 别名 30 | /// 31 | public string alias { get; set; } 32 | 33 | /// 34 | /// 文件路径 35 | /// 36 | public string url { get; set; } 37 | 38 | /// 39 | /// 图标 40 | /// 41 | public byte[] icon { get; set; } 42 | 43 | /// 44 | /// 授权 45 | /// 46 | public bool? permit { get; set; } 47 | 48 | /// 49 | /// 是否开始分组:0、否;1、是 50 | /// 51 | public bool isBegin { get; set; } 52 | 53 | /// 54 | /// 是否显示文字:0、隐藏;1、显示 55 | /// 56 | public bool isShowText { get; set; } 57 | 58 | /// 59 | /// 是否默认启动:0、否;1、是 60 | /// 61 | public bool isDefault { get; set; } 62 | } 63 | 64 | /// 65 | /// 功能授权关键数据 66 | /// 67 | public class PermitFunc 68 | { 69 | /// 70 | /// ID,唯一标识 71 | /// 72 | public string id { get; set; } 73 | 74 | /// 75 | /// 授权码 76 | /// 77 | public string key { get; set; } 78 | 79 | /// 80 | /// 授权 81 | /// 82 | public int permit { get; set; } 83 | } 84 | 85 | /// 86 | /// 数据授权关键数据 87 | /// 88 | public class PermitData 89 | { 90 | /// 91 | /// ID,唯一标识 92 | /// 93 | public string id { get; set; } 94 | 95 | /// 96 | /// 父级ID 97 | /// 98 | public string parentId { get; set; } 99 | 100 | /// 101 | /// 授权模式()数据权限 102 | /// 103 | public int mode { get; set; } 104 | 105 | /// 106 | /// 授权 107 | /// 108 | public int permit { get; set; } 109 | } 110 | } -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Module.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Module 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_Module() 19 | { 20 | this.SYS_Allot_Record = new HashSet(); 21 | this.SYS_Code_Allot = new HashSet(); 22 | this.SYS_ModuleAction = new HashSet(); 23 | this.SYS_ModuleParam = new HashSet(); 24 | this.SYS_Role_Data = new HashSet(); 25 | } 26 | 27 | public System.Guid ID { get; set; } 28 | public long SN { get; set; } 29 | public System.Guid ModuleGroupId { get; set; } 30 | public int Type { get; set; } 31 | public Nullable Index { get; set; } 32 | public string Name { get; set; } 33 | public string ProgramName { get; set; } 34 | public string NameSpace { get; set; } 35 | public string ApplicationName { get; set; } 36 | public string Location { get; set; } 37 | public string Description { get; set; } 38 | public Nullable RegisterTime { get; set; } 39 | public bool Default { get; set; } 40 | public bool Validity { get; set; } 41 | public string IconUrl { get; set; } 42 | public byte[] Icon { get; set; } 43 | 44 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 45 | public virtual ICollection SYS_Allot_Record { get; set; } 46 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 47 | public virtual ICollection SYS_Code_Allot { get; set; } 48 | public virtual SYS_ModuleGroup SYS_ModuleGroup { get; set; } 49 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 50 | public virtual ICollection SYS_ModuleAction { get; set; } 51 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 52 | public virtual ICollection SYS_ModuleParam { get; set; } 53 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 54 | public virtual ICollection SYS_Role_Data { get; set; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /DataBase/0-CreateView.sql: -------------------------------------------------------------------------------- 1 | use insight_base 2 | go 3 | 4 | if exists (select * from sysobjects where id = object_id(N'ucv_user_role') and objectproperty(id, N'isview') = 1) 5 | drop view ucv_user_role 6 | go 7 | 8 | /*****视图:查询用户拥有的所有角色*****/ 9 | 10 | create view ucv_user_role as 11 | select 12 | lower(newid()) as id, m.role_id, r.tenant_id, m.member_id as user_id, null as dept_id 13 | from ucr_role_member m 14 | join ucr_role r on r.id = m.role_id 15 | where 16 | m.member_type = 1 union 17 | select 18 | lower(newid()) as id, m.role_id, r.tenant_id, g.user_id, null as dept_id 19 | from ucr_role_member m 20 | join ucr_role r on r.id = m.role_id 21 | join ucg_group_member g on g.group_id = m.member_id 22 | where 23 | m.member_type = 2 union 24 | select 25 | lower(newid()) as id, m.role_id, r.tenant_id, o.user_id, d.parent_id as dept_id 26 | from ucr_role_member m 27 | join ucr_role r on r.id = m.role_id 28 | join uco_org_member o on o.org_id = m.member_id 29 | join uco_org d on d.id = o.org_id 30 | where 31 | m.member_type = 3 32 | 33 | go 34 | 35 | 36 | if exists (select * from sysobjects where id = object_id(N'ucv_role_user') and objectproperty(id, N'isview') = 1) 37 | drop view ucv_role_user 38 | go 39 | 40 | /*****视图:查询角色的所有成员用户*****/ 41 | 42 | create view ucv_role_user as 43 | select 44 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 45 | from 46 | ucr_role_member m 47 | join ucb_user u on u.id = m.member_id 48 | where 49 | m.member_type = 1 union 50 | select 51 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 52 | from 53 | ucr_role_member m 54 | join ucg_group g on g.id = m.member_id 55 | join ucg_group_member r on r.group_id = g.id 56 | join ucb_user u on u.id = r.user_id 57 | where 58 | m.member_type = 2 union 59 | select 60 | lower(newid()) as id, m.role_id, u.name, u.account, u.remark, u.is_invalid, u.created_time 61 | from 62 | ucr_role_member m 63 | join uco_org o on o.id = m.member_id 64 | join uco_org_member r on r.org_id = o.id 65 | join ucb_user u on u.id = r.user_id 66 | where 67 | m.member_type = 3 68 | 69 | go 70 | 71 | 72 | if exists (select * from sysobjects where id = object_id(N'ucv_role_member') and objectproperty(id, N'isview') = 1) 73 | drop view ucv_role_member 74 | go 75 | 76 | /*****视图:查询角色成员*****/ 77 | 78 | create view ucv_role_member as 79 | select 80 | m.id, m.role_id, m.member_type, m.member_id, u.name 81 | from 82 | ucr_role_member m 83 | join ucb_user u on u.id = m.member_id 84 | where 85 | m.member_type = 1 union 86 | select 87 | m.id, m.role_id, m.member_type, m.member_id, g.name 88 | from 89 | ucr_role_member m 90 | join ucg_group g on g.id = m.member_id 91 | where 92 | m.member_type = 2 union 93 | select 94 | m.id, m.role_id, m.member_type, m.member_id, o.alias as name 95 | from 96 | ucr_role_member m 97 | join uco_org o on o.id = m.member_id 98 | where 99 | m.member_type = 3 100 | 101 | go -------------------------------------------------------------------------------- /Source/Services/Apps/Apps.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {03E429FA-6AFD-4364-BB2B-CE566ECC5389} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Apps 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 38 | False 39 | 40 | 41 | 42 | 43 | 44 | 45 | ..\..\..\..\Utility\Utils.dll 46 | False 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 57 | Common 58 | False 59 | 60 | 61 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 62 | OAuth 63 | False 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Source/Services/Tenants/Tenants.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8EFDB90A-C184-4886-9353-DF3CA4F84627} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Tenants 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 38 | False 39 | 40 | 41 | 42 | 43 | 44 | 45 | ..\..\..\..\Utility\Utils.dll 46 | False 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 57 | Common 58 | False 59 | 60 | 61 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 62 | OAuth 63 | False 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Source/Common/Entity/SYS_Organization.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码已从模板生成。 4 | // 5 | // 手动更改此文件可能导致应用程序出现意外的行为。 6 | // 如果重新生成代码,将覆盖对此文件的手动更改。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Insight.Base.Common.Entity 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class SYS_Organization 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public SYS_Organization() 19 | { 20 | this.SYS_Allot_Record = new HashSet(); 21 | this.SYS_Code_Allot = new HashSet(); 22 | this.SYS_Code_Scheme = new HashSet(); 23 | this.SYS_ModuleParam = new HashSet(); 24 | this.SYS_Organization1 = new HashSet(); 25 | this.SYS_OrgMember = new HashSet(); 26 | } 27 | 28 | public System.Guid ID { get; set; } 29 | public long SN { get; set; } 30 | public Nullable ParentId { get; set; } 31 | public int NodeType { get; set; } 32 | public int Index { get; set; } 33 | public string Code { get; set; } 34 | public string Name { get; set; } 35 | public string Alias { get; set; } 36 | public string FullName { get; set; } 37 | public Nullable PositionId { get; set; } 38 | public bool Validity { get; set; } 39 | public System.Guid CreatorUserId { get; set; } 40 | public System.DateTime CreateTime { get; set; } 41 | 42 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 43 | public virtual ICollection SYS_Allot_Record { get; set; } 44 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 45 | public virtual ICollection SYS_Code_Allot { get; set; } 46 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 47 | public virtual ICollection SYS_Code_Scheme { get; set; } 48 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 49 | public virtual ICollection SYS_ModuleParam { get; set; } 50 | public virtual SYS_User SYS_User { get; set; } 51 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 52 | public virtual ICollection SYS_Organization1 { get; set; } 53 | public virtual SYS_Organization SYS_Organization2 { get; set; } 54 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 55 | public virtual ICollection SYS_OrgMember { get; set; } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/Services/Logs/ILogs.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Web; 3 | using Insight.Base.Common.Entity; 4 | using Insight.Utils.Entity; 5 | 6 | namespace Insight.Base.Services 7 | { 8 | [ServiceContract] 9 | interface ILogs 10 | { 11 | /// 12 | /// 为跨域请求设置响应头信息 13 | /// 14 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 15 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 16 | [OperationContract] 17 | void responseOptions(); 18 | 19 | /// 20 | /// 写入日志 21 | /// 22 | /// 事件代码(必须有) 23 | /// 事件消息,为空则使用默认消息文本 24 | /// 来源(可为空) 25 | /// 操作(可为空) 26 | /// 查询用的关键字段 27 | /// 事件源用户ID(可为空) 28 | /// Result 29 | [WebInvoke(Method = "POST", UriTemplate = "logs", ResponseFormat = WebMessageFormat.Json, 30 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 31 | [OperationContract] 32 | Result writeToLog(string code, string message, string source, string action, string key, string userid); 33 | 34 | /// 35 | /// 新增日志规则 36 | /// 37 | /// 日志规则数据对象 38 | /// Result 39 | [WebInvoke(Method = "POST", UriTemplate = "rules", ResponseFormat = WebMessageFormat.Json, 40 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 41 | [OperationContract] 42 | Result addRule(LogRule rule); 43 | 44 | /// 45 | /// 删除日志规则 46 | /// 47 | /// 日志规则ID 48 | /// Result 49 | [WebInvoke(Method = "DELETE", UriTemplate = "rules/{id}", ResponseFormat = WebMessageFormat.Json, 50 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 51 | [OperationContract] 52 | Result removeRule(string id); 53 | 54 | /// 55 | /// 编辑日志规则 56 | /// 57 | /// 日志规则数据对象 58 | /// Result 59 | [WebInvoke(Method = "PUT", UriTemplate = "rules", ResponseFormat = WebMessageFormat.Json, 60 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 61 | [OperationContract] 62 | Result editRule(LogRule rule); 63 | 64 | /// 65 | /// 获取日志规则 66 | /// 67 | /// 日志规则ID 68 | /// Result 69 | [WebGet(UriTemplate = "rules/{id}", ResponseFormat = WebMessageFormat.Json)] 70 | [OperationContract] 71 | Result getRule(string id); 72 | 73 | /// 74 | /// 获取全部日志规则 75 | /// 76 | /// Result 77 | [WebGet(UriTemplate = "rules", ResponseFormat = WebMessageFormat.Json)] 78 | [OperationContract] 79 | Result getRules(); 80 | } 81 | } -------------------------------------------------------------------------------- /Source/Services/Rules/Rules.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8F508F93-A2D9-4F8A-A186-5C726D43ECF0} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Rules 12 | v4.5 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\..\Debug\Services\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\..\Release\Services\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 35 | False 36 | 37 | 38 | 39 | 40 | 41 | 42 | ..\..\..\..\Utility\Utils.dll 43 | False 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 54 | Common 55 | False 56 | 57 | 58 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 59 | OAuth 60 | False 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /Source/Services/Reports/Reports.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AB51C22A-B4E3-489E-A355-8CCF7B855B22} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Reports 12 | v4.5 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\..\Debug\Services\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\..\Release\Services\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 35 | False 36 | 37 | 38 | 39 | 40 | 41 | 42 | ..\..\..\..\Utility\Utils.dll 43 | False 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 54 | Common 55 | False 56 | 57 | 58 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 59 | OAuth 60 | False 61 | 62 | 63 | 64 | 65 | 72 | -------------------------------------------------------------------------------- /Source/Services/Templates/Templates.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {630F9F70-2B85-426A-8495-6F3DB1B4F22C} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Templates 12 | v4.5 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\..\Debug\Services\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\..\Release\Services\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 35 | False 36 | 37 | 38 | 39 | 40 | 41 | 42 | ..\..\..\..\Utility\Utils.dll 43 | False 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 54 | Common 55 | False 56 | 57 | 58 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 59 | OAuth 60 | False 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /Source/Common/Entity/Organization.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Insight.Base.Common.Entity 6 | { 7 | /// 8 | /// 组织机构 9 | /// 10 | [Table("uco_organization")] 11 | public class Org 12 | { 13 | /// 14 | /// ID,唯一标识 15 | /// 16 | public string id { get; set; } 17 | 18 | /// 19 | /// 上级ID 20 | /// 21 | [Column("parent_id")] 22 | public string parentId { get; set; } 23 | 24 | /// 25 | /// 租户ID 26 | /// 27 | [Column("tenant_id")] 28 | public string tenantId { get; set; } 29 | 30 | /// 31 | /// 节点类型 32 | /// 33 | [Column("node_type")] 34 | public int nodeType { get; set; } 35 | 36 | /// 37 | /// 序号 38 | /// 39 | public int index { get; set; } 40 | 41 | /// 42 | /// 编码 43 | /// 44 | public string code { get; set; } 45 | 46 | /// 47 | /// 名称 48 | /// 49 | public string name { get; set; } 50 | 51 | /// 52 | /// 别名/简称 53 | /// 54 | public string alias { get; set; } 55 | 56 | /// 57 | /// 全称 58 | /// 59 | public string fullname { get; set; } 60 | 61 | /// 62 | /// 职能ID,字典 63 | /// 64 | [Column("position_id")] 65 | public string positionId { get; set; } 66 | 67 | /// 68 | /// 描述 69 | /// 70 | public string remark { get; set; } 71 | 72 | /// 73 | /// 是否失效:0、有效;1、失效 74 | /// 75 | [Column("is_invalid")] 76 | public bool isInvalid { get; set; } 77 | 78 | /// 79 | /// 创建人ID 80 | /// 81 | [Column("creator_id")] 82 | public string creatorId { get; set; } 83 | 84 | /// 85 | /// 创建时间 86 | /// 87 | [Column("created_time")] 88 | public DateTime createTime { get; set; } 89 | 90 | /// 91 | /// 成员用户 92 | /// 93 | public List members { get; set; } 94 | } 95 | 96 | 97 | [Table("uco_org_member")] 98 | public class OrgMember 99 | { 100 | /// 101 | /// ID,唯一标识 102 | /// 103 | public string id { get; set; } 104 | 105 | /// 106 | /// 角色ID 107 | /// 108 | [Column("org_id")] 109 | public string orgId { get; set; } 110 | 111 | /// 112 | /// 成员ID 113 | /// 114 | [Column("user_id")] 115 | public string userId { get; set; } 116 | 117 | /// 118 | /// 创建人ID 119 | /// 120 | [Column("creator_id")] 121 | public string creatorId { get; set; } 122 | 123 | /// 124 | /// 创建时间 125 | /// 126 | [Column("created_time")] 127 | public DateTime createTime { get; set; } 128 | } 129 | } -------------------------------------------------------------------------------- /Source/Services/Roles/Roles.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D61F0159-9976-4E11-BF95-6AC44A64EBBD} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Roles 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | False 38 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 39 | False 40 | 41 | 42 | 43 | 44 | 45 | 46 | ..\..\..\..\Utility\Utils.dll 47 | False 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 58 | Common 59 | False 60 | 61 | 62 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 63 | OAuth 64 | False 65 | 66 | 67 | 68 | 75 | -------------------------------------------------------------------------------- /Source/Services/UserGroups/UserGroups.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {003ECA41-652A-4D43-A8DC-2FE837C69B25} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | UserGroups 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 3 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | False 38 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 39 | False 40 | 41 | 42 | 43 | 44 | 45 | 46 | ..\..\..\..\Utility\Utils.dll 47 | False 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 58 | Common 59 | False 60 | 61 | 62 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 63 | OAuth 64 | False 65 | 66 | 67 | 68 | 75 | -------------------------------------------------------------------------------- /Source/Services/Auth/Auth.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B18DFF40-4EB9-4777-B63E-756F36D5C5E2} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Auth 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 38 | False 39 | 40 | 41 | ..\..\..\..\WCF\Redis.dll 42 | False 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | ..\..\..\..\Utility\Utils.dll 51 | False 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 62 | Common 63 | False 64 | 65 | 66 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 67 | OAuth 68 | False 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /Source/OAuth/OAuth.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 8 | Library 9 | Properties 10 | Insight.Base.OAuth 11 | OAuth 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 38 | 39 | 40 | False 41 | ..\..\..\WCF\Redis.dll 42 | False 43 | 44 | 45 | 46 | 47 | 48 | 49 | False 50 | ..\..\..\Utility\Utils.dll 51 | False 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 65 | Common 66 | False 67 | 68 | 69 | 70 | 77 | -------------------------------------------------------------------------------- /Source/Services/Organizations/Organizations.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0803E544-B979-4397-A853-DEB7FAF267BB} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Organizations 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | AnyCPU 25 | false 26 | 27 | 28 | pdbonly 29 | true 30 | ..\..\..\Release\Services\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | False 39 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 40 | False 41 | 42 | 43 | 44 | 45 | 46 | 47 | ..\..\..\..\Utility\Utils.dll 48 | False 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 59 | Common 60 | False 61 | 62 | 63 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 64 | OAuth 65 | False 66 | 67 | 68 | 69 | 76 | -------------------------------------------------------------------------------- /Source/Services/Users/Users.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F6F13CEC-CCA4-450E-8F02-743FC17A4F96} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Users 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\..\Debug\Services\ 21 | DEBUG;TRACE 22 | prompt 23 | 3 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\..\Release\Services\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | False 38 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 39 | False 40 | 41 | 42 | ..\..\..\..\WCF\Redis.dll 43 | False 44 | 45 | 46 | 47 | 48 | 49 | 50 | ..\..\..\..\Utility\Utils.dll 51 | False 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 62 | Common 63 | False 64 | 65 | 66 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 67 | OAuth 68 | False 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /Source/Common/JsonResult.cs: -------------------------------------------------------------------------------- 1 | using Insight.Utils.Entity; 2 | 3 | namespace Insight.Base.Common 4 | { 5 | /// 6 | /// Json接口返回值 7 | /// 8 | public static class JsonResult 9 | { 10 | /// 11 | /// 未知的验证码类型(440) 12 | /// 13 | public static Result unknownSmsType(this Result result) 14 | { 15 | result.successful = false; 16 | result.code = "440"; 17 | result.name = "UnknownSmsType"; 18 | result.message = "未知的验证码类型"; 19 | return result; 20 | } 21 | 22 | /// 23 | /// 短信验证码错误(441) 24 | /// 25 | public static Result smsCodeError(this Result result) 26 | { 27 | result.successful = false; 28 | result.code = "441"; 29 | result.name = "SMSCodeError"; 30 | result.message = "短信验证码错误"; 31 | return result; 32 | } 33 | 34 | /// 35 | /// 事件代码已使用(412) 36 | /// 37 | public static Result eventCodeUsed(this Result result) 38 | { 39 | result.successful = false; 40 | result.code = "412"; 41 | result.name = "EventCodeUsed"; 42 | result.message = "事件代码已使用,请勿重复为该代码配置日志规则"; 43 | return result; 44 | } 45 | 46 | /// 47 | /// 事件规则无需配置(413) 48 | /// 49 | public static Result eventWithoutConfig(this Result result) 50 | { 51 | result.successful = false; 52 | result.code = "413"; 53 | result.name = "EventWithoutConfig"; 54 | result.message = "事件等级为:0/1/7的,无需配置事件规则"; 55 | return result; 56 | } 57 | 58 | /// 59 | /// 事件代码未配置(414) 60 | /// 61 | public static Result eventCodeNotConfig(this Result result) 62 | { 63 | result.successful = false; 64 | result.code = "414"; 65 | result.name = "EventCodeNotConfig"; 66 | result.message = "未配置的事件代码,请先为该代码配置日志规则"; 67 | return result; 68 | } 69 | 70 | /// 71 | /// 事件代码错误(415) 72 | /// 73 | public static Result invalidEventCode(this Result result) 74 | { 75 | result.successful = false; 76 | result.code = "415"; 77 | result.name = "InvalidEventCode"; 78 | result.message = "错误的事件代码"; 79 | return result; 80 | } 81 | 82 | /// 83 | /// 错误的支付密码(416) 84 | /// 85 | public static Result invalidPayKey(this Result result) 86 | { 87 | result.successful = false; 88 | result.code = "416"; 89 | result.name = "InvalidPayKey"; 90 | result.message = "错误的支付密码"; 91 | return result; 92 | } 93 | 94 | /// 95 | /// 支付密码未设置(417) 96 | /// 97 | public static Result payKeyNotExists(this Result result) 98 | { 99 | result.successful = false; 100 | result.code = "417"; 101 | result.name = "PayKeyNotExists"; 102 | result.message = "支付密码未设置"; 103 | return result; 104 | } 105 | 106 | /// 107 | /// 指定的编码方案不存在(450) 108 | /// 109 | public static Result codeSchemeNotExists(this Result result) 110 | { 111 | result.successful = false; 112 | result.code = "450"; 113 | result.name = "CodeSchemeNotExists"; 114 | result.message = "指定的编码方案不存在"; 115 | return result; 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /Source/Services/Organizations/IOrganizations.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Web; 4 | using Insight.Base.Common.Entity; 5 | using Insight.Utils.Entity; 6 | 7 | namespace Insight.Base.Services 8 | { 9 | [ServiceContract] 10 | public interface IOrganizations 11 | { 12 | /// 13 | /// 为跨域请求设置响应头信息 14 | /// 15 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 16 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 17 | [OperationContract] 18 | void responseOptions(); 19 | 20 | /// 21 | /// 根据对象实体数据新增一个组织机构节点 22 | /// 23 | /// 组织节点对象 24 | /// Result 25 | [WebInvoke(Method = "POST", UriTemplate = "orgs", ResponseFormat = WebMessageFormat.Json, 26 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 27 | [OperationContract] 28 | Result addOrg(Org org); 29 | 30 | /// 31 | /// 根据ID删除组织机构节点 32 | /// 33 | /// 节点ID 34 | /// Result 35 | [WebInvoke(Method = "DELETE", UriTemplate = "orgs/{id}", ResponseFormat = WebMessageFormat.Json, 36 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 37 | [OperationContract] 38 | Result removeOrg(string id); 39 | 40 | /// 41 | /// 根据对象实体数据更新组织机构信息 42 | /// 43 | /// 44 | /// 组织节点对象 45 | /// Result 46 | [WebInvoke(Method = "PUT", UriTemplate = "orgs/{id}", ResponseFormat = WebMessageFormat.Json, 47 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 48 | [OperationContract] 49 | Result updateOrg(string id, Org org); 50 | 51 | /// 52 | /// 根据ID获取机构对象实体 53 | /// 54 | /// 节点ID 55 | /// Result 56 | [WebGet(UriTemplate = "orgs/{id}", ResponseFormat = WebMessageFormat.Json)] 57 | [OperationContract] 58 | Result getOrg(string id); 59 | 60 | /// 61 | /// 获取组织机构树 62 | /// 63 | /// Result 64 | [WebGet(UriTemplate = "orgs", ResponseFormat = WebMessageFormat.Json)] 65 | [OperationContract] 66 | Result getOrgs(); 67 | 68 | /// 69 | /// 新增职位成员关系 70 | /// 71 | /// 72 | /// 成员集合 73 | /// Result 74 | [WebInvoke(Method = "POST", UriTemplate = "orgs/{id}/members", ResponseFormat = WebMessageFormat.Json, 75 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 76 | [OperationContract] 77 | Result addOrgMember(string id, List members); 78 | 79 | /// 80 | /// 根删除职位成员关系 81 | /// 82 | /// 83 | /// 成员集合 84 | /// Result 85 | [WebInvoke(Method = "DELETE", UriTemplate = "orgs/{id}/members", ResponseFormat = WebMessageFormat.Json, 86 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 87 | [OperationContract] 88 | Result removeOrgMember(string id, List members); 89 | 90 | /// 91 | /// 获取职位成员之外的所有用户 92 | /// 93 | /// 节点ID 94 | /// Result 95 | [WebGet(UriTemplate = "orgs/{id}/other", ResponseFormat = WebMessageFormat.Json)] 96 | [OperationContract] 97 | Result getOtherOrgMember(string id); 98 | } 99 | } -------------------------------------------------------------------------------- /Source/Services/Commons/Commons.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {06751A2C-C718-4F53-A9F8-61401BA119D6} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Commons 12 | v4.5 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | ..\..\..\Debug\Services\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | ..\..\..\Release\Services\ 33 | TRACE 34 | prompt 35 | 4 36 | false 37 | 38 | 39 | 40 | 41 | 42 | 43 | False 44 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 45 | False 46 | 47 | 48 | ..\..\..\..\Utility\FastReport.dll 49 | False 50 | 51 | 52 | 53 | 54 | 55 | 56 | ..\..\..\..\Utility\Utils.dll 57 | False 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 68 | Common 69 | False 70 | 71 | 72 | {0a33f95f-4934-4860-bd25-2e75d4a1a68f} 73 | OAuth 74 | False 75 | 76 | 77 | 78 | 85 | -------------------------------------------------------------------------------- /Source/Common/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using Insight.Base.Common.Entity; 7 | using Insight.Utils.Common; 8 | using Insight.Utils.Entity; 9 | 10 | namespace Insight.Base.Common 11 | { 12 | public static class Logger 13 | { 14 | /// 15 | /// 构造SYS_Logs数据并写入 16 | /// 17 | /// 事件代码 18 | /// 事件消息 19 | /// 事件来源 20 | /// 操作名称 21 | /// 查询关键字 22 | /// 事件源用户ID 23 | /// bool 是否写入成功 24 | public static bool? write(string code, string message = null, string source = null, string action = null, 25 | string key = null, string userId = null) 26 | { 27 | if (string.IsNullOrEmpty(code) || !Regex.IsMatch(code, @"^\d{6}$")) return null; 28 | 29 | var level = Convert.ToInt32(code.Substring(0, 1)); 30 | var rule = Params.rules.SingleOrDefault(r => r.code == code); 31 | if (level > 1 && level < 7 && rule == null) return null; 32 | 33 | var log = new Log 34 | { 35 | id = Util.newId(), 36 | code = code, 37 | level = level, 38 | source = rule?.source ?? source, 39 | action = rule?.action ?? action, 40 | message = string.IsNullOrEmpty(message) ? rule?.message : message, 41 | key = key, 42 | userId = userId, 43 | createTime = DateTime.Now 44 | }; 45 | 46 | return (rule?.isFile ?? true) ? writeToFile(log) : writeToDb(log); 47 | } 48 | 49 | /// 50 | /// 将日志写入数据库 51 | /// 52 | /// 53 | /// bool 是否写入成功 54 | private static bool writeToDb(Log log) 55 | { 56 | using (var context = new Entities()) 57 | { 58 | context.logs.Add(log); 59 | return context.SaveChanges() > 0; 60 | } 61 | } 62 | 63 | /// 64 | /// 将日志写入文件 65 | /// 66 | /// 67 | /// bool 是否写入成功 68 | private static bool writeToFile(Log log) 69 | { 70 | Params.mutex.WaitOne(); 71 | var path = $"{Util.getAppSetting("LogLocal")}\\{getLevelName(log.level)}\\"; 72 | if (!Directory.Exists(path)) 73 | { 74 | Directory.CreateDirectory(path); 75 | } 76 | 77 | path += $"{DateTime.Today:yyyy-MM-dd}.log"; 78 | var time = log.createTime.ToString("O"); 79 | var text = 80 | $"[{log.createTime.Kind} {time}] [{log.code}] [{log.source}] [{log.action}] Message:{log.message}\r\n"; 81 | var buffer = Encoding.UTF8.GetBytes(text); 82 | try 83 | { 84 | using (var stream = new FileStream(path, FileMode.Append)) 85 | { 86 | stream.Write(buffer, 0, buffer.Length); 87 | } 88 | 89 | Params.mutex.ReleaseMutex(); 90 | return true; 91 | } 92 | catch (Exception) 93 | { 94 | Params.mutex.ReleaseMutex(); 95 | return false; 96 | } 97 | } 98 | 99 | /// 100 | /// 获取事件等级名称 101 | /// 102 | /// 103 | /// 104 | private static string getLevelName(int level) 105 | { 106 | var name = (Level) level; 107 | return name.ToString(); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Source/Common/Entity/Log.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Insight.Base.Common.Entity 6 | { 7 | [Table("ibl_rule")] 8 | public class LogRule 9 | { 10 | /// 11 | /// ID,唯一标识 12 | /// 13 | public string id { get; set; } 14 | 15 | /// 16 | /// 日志等级:0、emergency;1、alert;2、critical;3、error;4、warning;5、notice;6、informational;7、debug 17 | /// 18 | public int level { get; set; } 19 | 20 | /// 21 | /// 操作代码 22 | /// 23 | public string code { get; set; } 24 | 25 | /// 26 | /// 事件来源 27 | /// 28 | public string source { get; set; } 29 | 30 | /// 31 | /// 操作名称 32 | /// 33 | public string action { get; set; } 34 | 35 | /// 36 | /// 日志内容 37 | /// 38 | public string message { get; set; } 39 | 40 | /// 41 | /// 是否写到文件:0、否;1、是 42 | /// 43 | [Column("is_file")] 44 | public bool isFile { get; set; } 45 | 46 | /// 47 | /// 创建人ID 48 | /// 49 | [Column("creator_id")] 50 | public string creatorId { get; set; } 51 | 52 | /// 53 | /// 创建时间 54 | /// 55 | [Column("created_time")] 56 | public DateTime createTime { get; set; } 57 | } 58 | 59 | [Table("ibl_log")] 60 | public class Log 61 | { 62 | /// 63 | /// ID,唯一标识 64 | /// 65 | public string id { get; set; } 66 | 67 | /// 68 | /// 日志等级:0、emergency;1、alert;2、critical;3、error;4、warning;5、notice;6、informational;7、debug 69 | /// 70 | public int level { get; set; } 71 | 72 | /// 73 | /// 操作代码 74 | /// 75 | public string code { get; set; } 76 | 77 | /// 78 | /// 事件来源 79 | /// 80 | public string source { get; set; } 81 | 82 | /// 83 | /// 操作名称 84 | /// 85 | public string action { get; set; } 86 | 87 | /// 88 | /// 日志内容 89 | /// 90 | public string message { get; set; } 91 | 92 | /// 93 | /// 关键词 94 | /// 95 | public string key { get; set; } 96 | 97 | /// 98 | /// 来源用户ID 99 | /// 100 | [Column("user_id")] 101 | public string userId { get; set; } 102 | 103 | /// 104 | /// 创建时间 105 | /// 106 | [Column("created_time")] 107 | public DateTime createTime { get; set; } 108 | } 109 | 110 | /// 111 | /// 请求对象实体 112 | /// 113 | public class RequestEntity 114 | { 115 | /// 116 | /// 来源IP 117 | /// 118 | public string source { get; set; } 119 | 120 | /// 121 | /// 请求方法 122 | /// 123 | public string method { get; set; } 124 | 125 | /// 126 | /// 目标接口 127 | /// 128 | public string url { get; set; } 129 | 130 | /// 131 | /// 令牌 132 | /// 133 | public string token { get; set; } 134 | 135 | /// 136 | /// 请求头 137 | /// 138 | public Dictionary headers { get; set; } 139 | 140 | /// 141 | /// URL参数集合 142 | /// 143 | public Dictionary urlParams { get; set; } 144 | 145 | /// 146 | /// 请求体内容 147 | /// 148 | public object body { get; set; } 149 | } 150 | } -------------------------------------------------------------------------------- /Source/BaseServer/BaseServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3419DA7E-3706-4E91-9821-E66CDE1836CE} 8 | WinExe 9 | Properties 10 | Insight.Base.Server 11 | BaseServer 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | ..\..\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | ..\..\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | False 43 | ..\..\..\Utility\Utils.dll 44 | False 45 | 46 | 47 | False 48 | ..\..\..\WCF\WCF.dll 49 | True 50 | 51 | 52 | 53 | 54 | Component 55 | 56 | 57 | ProjectInstaller.cs 58 | 59 | 60 | Component 61 | 62 | 63 | BaseServer.cs 64 | 65 | 66 | 67 | 68 | 69 | 70 | Designer 71 | 72 | 73 | 74 | 75 | ProjectInstaller.cs 76 | 77 | 78 | BaseServer.cs 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /Source/Services/Logs/Logs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C8EE59AD-2499-4C28-A4CF-7C726210D94D} 8 | Library 9 | Properties 10 | Insight.Base.Services 11 | Logs 12 | v4.5 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | ..\..\..\Debug\Services\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | ..\..\..\Release\Services\ 33 | TRACE 34 | prompt 35 | 4 36 | false 37 | 38 | 39 | true 40 | ..\..\..\Insight_WS\ 41 | DEBUG;TRACE 42 | full 43 | AnyCPU 44 | prompt 45 | MinimumRecommendedRules.ruleset 46 | false 47 | 48 | 49 | 50 | 51 | 52 | 53 | ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 54 | False 55 | 56 | 57 | 58 | 59 | 60 | 61 | ..\..\..\..\Utility\Utils.dll 62 | False 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | {c4f26dd1-de5a-4773-a789-7823e96ea166} 77 | Common 78 | False 79 | 80 | 81 | {0A33F95F-4934-4860-BD25-2E75D4A1A68F} 82 | OAuth 83 | False 84 | 85 | 86 | 87 | 94 | -------------------------------------------------------------------------------- /Source/Services/Commons/ICommons.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Web; 4 | using Insight.Base.Common.Entity; 5 | using Insight.Utils.Entity; 6 | 7 | namespace Insight.Base.Services 8 | { 9 | [ServiceContract] 10 | public interface ICommons 11 | { 12 | /// 13 | /// 为跨域请求设置响应头信息 14 | /// 15 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 16 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 17 | [OperationContract] 18 | void responseOptions(); 19 | 20 | /// 21 | /// 获取登录用户的导航信息 22 | /// 23 | /// Result 24 | [WebGet(UriTemplate = "navigations", ResponseFormat = WebMessageFormat.Json)] 25 | [OperationContract] 26 | Result getNavigation(); 27 | 28 | /// 29 | /// 获取用户启动模块的工具栏操作信息 30 | /// 31 | /// 模块ID 32 | /// Result 33 | [WebGet(UriTemplate = "navigations/{id}/functions", ResponseFormat = WebMessageFormat.Json)] 34 | [OperationContract] 35 | Result getFunctions(string id); 36 | 37 | /// 38 | /// 获取模块有效选项参数 39 | /// 40 | /// Result 41 | [WebGet(UriTemplate = "params", ResponseFormat = WebMessageFormat.Json)] 42 | [OperationContract] 43 | Result getModuleParam(); 44 | 45 | /// 46 | /// 保存选项数据 47 | /// 48 | /// 选项数据集合 49 | /// Result 50 | [WebInvoke(Method = "PUT", UriTemplate = "params", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 51 | [OperationContract] 52 | Result saveModuleParam(List list); 53 | 54 | /// 55 | /// 获取行政区划 56 | /// 57 | /// 上级区划ID 58 | /// Result 59 | [WebGet(UriTemplate = "regions?pid={id}", ResponseFormat = WebMessageFormat.Json)] 60 | [OperationContract] 61 | Result getRegions(string id); 62 | 63 | /// 64 | /// 获取应用客户端文件信息集合 65 | /// 66 | /// 应用ID 67 | /// Result 68 | [WebGet(UriTemplate = "apps/{id}/files", ResponseFormat = WebMessageFormat.Json)] 69 | [OperationContract] 70 | Result getFiles(string id); 71 | 72 | /// 73 | /// 获取指定名称的文件 74 | /// 75 | /// 文件ID 76 | /// Result 77 | [WebGet(UriTemplate = "apps/files/{id}", ResponseFormat = WebMessageFormat.Json)] 78 | [OperationContract] 79 | Result getFile(string id); 80 | 81 | /// 82 | /// 获取指定ID的电子影像数据 83 | /// 84 | /// 影像ID 85 | /// Result 86 | [WebGet(UriTemplate = "images/{id}", ResponseFormat = WebMessageFormat.Json)] 87 | [OperationContract] 88 | Result getImageData(string id); 89 | 90 | /// 91 | /// 生成指定业务数据ID的报表 92 | /// 93 | /// 数据ID 94 | /// 模板ID 95 | /// 部门名称 96 | /// Result 97 | [WebInvoke(Method = "POST", UriTemplate = "images/{id}", ResponseFormat = WebMessageFormat.Json, 98 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 99 | [OperationContract] 100 | Result buildImageData(string id, string templateId, string deptName); 101 | 102 | /// 103 | /// 获取报表模板 104 | /// 105 | /// 模板ID 106 | /// Result 107 | [WebGet(UriTemplate = "templates/{id}", ResponseFormat = WebMessageFormat.Json)] 108 | [OperationContract] 109 | Result getTemplate(string id); 110 | } 111 | } -------------------------------------------------------------------------------- /Source/Services/UserGroups/IUserGroups.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Web; 4 | using Insight.Base.Common.Entity; 5 | using Insight.Utils.Entity; 6 | 7 | namespace Insight.Base.Services 8 | { 9 | [ServiceContract] 10 | public interface IUserGroups 11 | { 12 | /// 13 | /// 为跨域请求设置响应头信息 14 | /// 15 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 16 | [OperationContract] 17 | void responseOptions(); 18 | 19 | /// 20 | /// 根据对象实体数据新增一个用户组 21 | /// 22 | /// 用户组对象 23 | /// Result 24 | [WebInvoke(Method = "POST", UriTemplate = "groups", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 25 | [OperationContract] 26 | Result addGroup(Group group); 27 | 28 | /// 29 | /// 根据ID删除用户组 30 | /// 31 | /// 用户组ID 32 | /// Result 33 | [WebInvoke(Method = "DELETE", UriTemplate = "groups/{id}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 34 | [OperationContract] 35 | Result removeGroup(string id); 36 | 37 | /// 38 | /// 根据对象实体数据更新用户组信息 39 | /// 40 | /// 41 | /// 用户组对象 42 | /// Result 43 | [WebInvoke(Method = "PUT", UriTemplate = "groups/{id}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 44 | [OperationContract] 45 | Result updateGroup(string id, Group group); 46 | 47 | /// 48 | /// 根据ID获取用户组对象实体 49 | /// 50 | /// 用户组ID 51 | /// Result 52 | [WebGet(UriTemplate = "groups/{id}", ResponseFormat = WebMessageFormat.Json)] 53 | [OperationContract] 54 | Result getGroup(string id); 55 | 56 | /// 57 | /// 获取全部用户组 58 | /// 59 | /// 每页行数 60 | /// 当前页 61 | /// 查询关键词 62 | /// Result 63 | [WebGet(UriTemplate = "groups?rows={rows}&page={page}&key={key}", ResponseFormat = WebMessageFormat.Json)] 64 | [OperationContract] 65 | Result getGroups(int rows, int page, string key); 66 | 67 | /// 68 | /// 获取用户组成员 69 | /// 70 | /// 71 | /// Result 72 | [WebGet(UriTemplate = "groups/{id}/members", ResponseFormat = WebMessageFormat.Json)] 73 | [OperationContract] 74 | Result getMembers(string id); 75 | 76 | /// 77 | /// 根据参数组集合批量插入用户组成员关系 78 | /// 79 | /// 80 | /// 81 | /// Result 82 | [WebInvoke(Method = "POST", UriTemplate = "groups/{id}/members", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 83 | [OperationContract] 84 | Result addGroupMember(string id, List members); 85 | 86 | /// 87 | /// 根据ID集合删除用户组成员关系 88 | /// 89 | /// 90 | /// 91 | /// Result 92 | [WebInvoke(Method = "DELETE", UriTemplate = "groups/{id}/members", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] 93 | [OperationContract] 94 | Result removeMember(string id, List members); 95 | 96 | /// 97 | /// 根据ID获取组成员之外的全部用户 98 | /// 99 | /// 用户组ID 100 | /// Result 101 | [WebGet(UriTemplate = "groups/{id}/other", ResponseFormat = WebMessageFormat.Json)] 102 | [OperationContract] 103 | Result getOtherUser(string id); 104 | } 105 | } -------------------------------------------------------------------------------- /Source/Services/Reports/IReports.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Web; 3 | using Insight.Base.Common.Entity; 4 | using Insight.Utils.Entity; 5 | 6 | namespace Insight.Base.Services 7 | { 8 | [ServiceContract] 9 | public interface IReports 10 | { 11 | /// 12 | /// 为跨域请求设置响应头信息 13 | /// 14 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 15 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 16 | [OperationContract] 17 | void responseOptions(); 18 | 19 | /// 20 | /// 获取报表分类 21 | /// 22 | /// 模块ID 23 | /// Result 24 | [WebGet(UriTemplate = "reports/categorys?mid={id}", ResponseFormat = WebMessageFormat.Json)] 25 | [OperationContract] 26 | Result getCategorys(string id); 27 | 28 | /// 29 | /// 新建报表分类 30 | /// 31 | /// 32 | /// Result 33 | [WebInvoke(Method = "POST", UriTemplate = "reports/categorys", ResponseFormat = WebMessageFormat.Json, 34 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 35 | [OperationContract] 36 | Result addCategory(Catalog catalog); 37 | 38 | /// 39 | /// 编辑报表分类 40 | /// 41 | /// 报表分类ID 42 | /// 43 | /// Result 44 | [WebInvoke(Method = "PUT", UriTemplate = "reports/categorys/{id}", ResponseFormat = WebMessageFormat.Json, 45 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 46 | [OperationContract] 47 | Result editCategory(string id, Catalog catalog); 48 | 49 | /// 50 | /// 删除报表分类 51 | /// 52 | /// 报表分类ID 53 | /// Result 54 | [WebInvoke(Method = "DELETE", UriTemplate = "reports/categorys/{id}", ResponseFormat = WebMessageFormat.Json, 55 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 56 | [OperationContract] 57 | Result deleteCategory(string id); 58 | 59 | /// 60 | /// 获取分类下全部报表 61 | /// 62 | /// 分类ID 63 | /// 每页行数 64 | /// 页码 65 | /// Result 66 | [WebGet(UriTemplate = "reports?cid={id}&rows={rows}&page={page}", ResponseFormat = WebMessageFormat.Json)] 67 | [OperationContract] 68 | Result getReports(string id, int rows, int page); 69 | 70 | /// 71 | /// 获取报表 72 | /// 73 | /// ID 74 | /// Result 75 | [WebGet(UriTemplate = "reports/{id}", ResponseFormat = WebMessageFormat.Json)] 76 | [OperationContract] 77 | Result getReport(string id); 78 | 79 | /// 80 | /// 新建报表 81 | /// 82 | /// 报表 83 | /// Result 84 | [WebInvoke(Method = "POST", UriTemplate = "reports", ResponseFormat = WebMessageFormat.Json, 85 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 86 | [OperationContract] 87 | Result addReport(Definition report); 88 | 89 | /// 90 | /// 编辑报表 91 | /// 92 | /// 报表ID 93 | /// 报表 94 | /// Result 95 | [WebInvoke(Method = "PUT", UriTemplate = "reports/{id}", ResponseFormat = WebMessageFormat.Json, 96 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 97 | [OperationContract] 98 | Result editReport(string id, ReportDefinition report); 99 | 100 | /// 101 | /// 删除报表 102 | /// 103 | /// 报表ID 104 | /// Result 105 | [WebInvoke(Method = "DELETE", UriTemplate = "reports/{id}", ResponseFormat = WebMessageFormat.Json, 106 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 107 | [OperationContract] 108 | Result deleteReport(string id); 109 | } 110 | } -------------------------------------------------------------------------------- /DataBase/Function/Get_CodePreview.sql: -------------------------------------------------------------------------------- 1 | USE Insight_Base 2 | GO 3 | 4 | IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'Get_CodePreview') AND OBJECTPROPERTY(id, N'ISSCALARFUNCTION') = 1) 5 | DROP FUNCTION Get_CodePreview 6 | GO 7 | 8 | 9 | /*****标量值函数:获取编码字符串示例*****/ 10 | 11 | CREATE FUNCTION Get_CodePreview ( 12 | @SchemeId UNIQUEIDENTIFIER, --编码方案ID 13 | @DeptId UNIQUEIDENTIFIER, --部门ID 14 | @UserId UNIQUEIDENTIFIER, --用户ID 15 | @CodeFormat NVARCHAR(64), 16 | @SerialFormat NVARCHAR(16) 17 | ) 18 | 19 | RETURNS NVARCHAR(64) AS 20 | BEGIN 21 | 22 | DECLARE @UserCode NVARCHAR(16), 23 | @Datetime DATETIME, 24 | @Serial VARCHAR(8), 25 | @Number INT, 26 | @Dig INT, 27 | @Count INT 28 | 29 | set @Datetime = getdate() 30 | set @UserCode = '' 31 | 32 | 33 | /*****日期字段*****/ 34 | 35 | if (charindex ('yyyy', @CodeFormat) > 0) 36 | set @CodeFormat = replace(@CodeFormat, 'yyyy', datename(yy, @Datetime)) 37 | 38 | if (charindex ('yy', @CodeFormat) > 0) 39 | set @CodeFormat = replace(@CodeFormat, 'yy', right(datename(yy, @Datetime),2)) 40 | 41 | if (charindex ('mm', @CodeFormat) > 0) 42 | set @CodeFormat = replace(@CodeFormat, 'mm', right('0' + convert(varchar,datepart(mm, @Datetime)),2)) 43 | 44 | if (charindex ('dd', @CodeFormat) > 0) 45 | set @CodeFormat = replace(@CodeFormat, 'dd', right('0' + datename(dd, @Datetime), 2)) 46 | 47 | /*****自定义字段*****/ 48 | 49 | if (charindex ('@', @CodeFormat) > 0) 50 | set @CodeFormat = replace(@CodeFormat, '@', '(X)') 51 | 52 | /*****用户/部门/编码机构字段*****/ 53 | 54 | if (charindex ('$0', @CodeFormat) > 0) 55 | begin 56 | select @UserCode = isnull(Code, '') from MasterData where ID = @UserId 57 | set @CodeFormat = replace(@CodeFormat, '$0', @UserCode) 58 | end 59 | 60 | if (charindex ('$1', @CodeFormat) > 0) 61 | begin 62 | select @UserCode = isnull(Code, '') from SYS_Organization where ID = @DeptId 63 | set @CodeFormat = replace(@CodeFormat, '$1', @UserCode) 64 | end 65 | 66 | if (charindex ('$2', @CodeFormat) > 0) 67 | begin 68 | select @UserCode = isnull(Code, '') from SYS_Organization where ID = dbo.Get_SupOrg(@DeptId, 1) 69 | set @CodeFormat = replace(@CodeFormat, '$2', @UserCode) 70 | end 71 | 72 | if (charindex ('$3', @CodeFormat) > 0) 73 | begin 74 | select @UserCode = isnull(Code, '') from SYS_Organization where ID = dbo.Get_SupOrg(@DeptId, 0) 75 | set @CodeFormat = replace(@CodeFormat, '$3', @UserCode) 76 | end 77 | 78 | /*****计算流水码分组标识*****/ 79 | 80 | if (charindex ('yyyy', @SerialFormat) > 0) 81 | set @SerialFormat = replace(@SerialFormat, 'yyyy', datename(yy, @Datetime)) 82 | 83 | if (charindex ('yy', @SerialFormat) > 0) 84 | set @SerialFormat = replace(@SerialFormat, 'yy', right(datename(yy, @Datetime),2)) 85 | 86 | if (charindex ('mm', @SerialFormat) > 0) 87 | set @SerialFormat = replace(@SerialFormat, 'mm', right('0' + convert(varchar,datepart(mm, @Datetime)),2)) 88 | 89 | if (charindex ('dd', @SerialFormat) > 0) 90 | set @SerialFormat = replace(@SerialFormat, 'dd', right('0' + datename(dd, @Datetime), 2)) 91 | 92 | if (charindex ('$0', @SerialFormat) > 0) 93 | set @SerialFormat = replace(@SerialFormat, '$0', @UserCode) 94 | 95 | if (charindex ('$1', @SerialFormat) > 0) 96 | set @SerialFormat = replace(@SerialFormat, '$1', @UserCode) 97 | 98 | if (charindex ('$2', @SerialFormat) > 0) 99 | set @SerialFormat = replace(@SerialFormat, '$2', @UserCode) 100 | 101 | if (charindex ('$3', @SerialFormat) > 0) 102 | set @SerialFormat = replace(@SerialFormat, '$3', @UserCode) 103 | 104 | if (charindex ('@', @SerialFormat) > 0) 105 | set @SerialFormat = replace(@SerialFormat, '@', '(X)') 106 | 107 | /*****流水码字段*****/ 108 | 109 | if (charindex ('#', @CodeFormat) > 0) 110 | begin 111 | set @Dig = cast(substring(@CodeFormat, charindex ('#', @CodeFormat) + 1, 1) as int) 112 | if @Dig > 0 113 | begin 114 | select @Number = isnull(max(SerialNumber), -1) + 1 115 | from SYS_Code_Record 116 | where SchemeId = @SchemeId 117 | and RelationChar = @SerialFormat 118 | if (@Number % power(10, @Dig) = 0) 119 | set @Number = @Number + 1 120 | set @Serial = right(replicate('0', @Dig) + cast(@Number as varchar), @Dig) 121 | end 122 | else 123 | select @Serial = min(AllotNumber) 124 | from SYS_Code_Allot 125 | where SchemeId = @SchemeId 126 | and OwnerId = @UserId 127 | and BusinessId is null 128 | 129 | set @CodeFormat = replace(@CodeFormat, substring(@CodeFormat, charindex ('#', @CodeFormat), 2), @Serial) 130 | end 131 | 132 | RETURN @CodeFormat 133 | END 134 | 135 | GO 136 | -------------------------------------------------------------------------------- /Source/Common/Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C4F26DD1-DE5A-4773-A789-7823E96EA166} 8 | Library 9 | Properties 10 | Insight.Base.Common 11 | Common 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 38 | 39 | 40 | ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll 41 | 42 | 43 | False 44 | ..\..\..\WCF\Redis.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | False 52 | ..\..\..\Utility\Utils.dll 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /Source/Common/Entity/Tenant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Insight.Base.Common.Entity 6 | { 7 | [Table("ucb_tenant")] 8 | public class Tenant 9 | { 10 | /// 11 | /// ID,唯一标识 12 | /// 13 | public string id { get; set; } 14 | 15 | /// 16 | /// 名称 17 | /// 18 | public string name { get; set; } 19 | 20 | /// 21 | /// 简称 22 | /// 23 | public string alias { get; set; } 24 | 25 | /// 26 | /// 图标 27 | /// 28 | public byte[] icon { get; set; } 29 | 30 | /// 31 | /// 联系人 32 | /// 33 | public string contact { get; set; } 34 | 35 | /// 36 | /// 手机号 37 | /// 38 | public string mobile { get; set; } 39 | 40 | /// 41 | /// 邮箱 42 | /// 43 | public string email { get; set; } 44 | 45 | /// 46 | /// 所在省/直辖市 47 | /// 48 | public string province { get; set; } 49 | 50 | /// 51 | /// 所在市/地区 52 | /// 53 | public string city { get; set; } 54 | 55 | /// 56 | /// 所在区/县 57 | /// 58 | public string county { get; set; } 59 | 60 | /// 61 | /// 街道楼门号 62 | /// 63 | public string address { get; set; } 64 | 65 | /// 66 | /// 描述 67 | /// 68 | public string remark { get; set; } 69 | 70 | /// 71 | /// 租户到期时间 72 | /// 73 | [Column("expire_date")] 74 | public DateTime expireDate { get; set; } 75 | 76 | /// 77 | /// 是否预置:0、自定;1、预置 78 | /// 79 | [Column("is_builtin")] 80 | public bool isBuiltin { get; set; } 81 | 82 | /// 83 | /// 是否失效:0、有效;1、失效 84 | /// 85 | [Column("is_invalid")] 86 | public bool isInvalid { get; set; } 87 | 88 | /// 89 | /// 创建人ID 90 | /// 91 | [Column("creator_id")] 92 | public string creatorId { get; set; } 93 | 94 | /// 95 | /// 创建时间 96 | /// 97 | [Column("created_time")] 98 | public DateTime createTime { get; set; } 99 | 100 | /// 101 | /// 绑定应用 102 | /// 103 | public List apps { get; set; } 104 | 105 | /// 106 | /// 关联用户 107 | /// 108 | public List users { get; set; } 109 | } 110 | 111 | [Table("ucb_tenant_app")] 112 | public class TenantApp 113 | { 114 | /// 115 | /// ID,唯一标识 116 | /// 117 | public string id { get; set; } 118 | 119 | /// 120 | /// 租户ID 121 | /// 122 | [Column("tenant_id")] 123 | public string tenantId { get; set; } 124 | 125 | /// 126 | /// 应用ID 127 | /// 128 | [Column("app_id")] 129 | public string appId { get; set; } 130 | 131 | /// 132 | /// 创建人ID 133 | /// 134 | [Column("creator_id")] 135 | public string creatorId { get; set; } 136 | 137 | /// 138 | /// 创建时间 139 | /// 140 | [Column("created_time")] 141 | public DateTime createTime { get; set; } 142 | } 143 | 144 | [Table("ucb_tenant_user")] 145 | public class TenantUser 146 | { 147 | /// 148 | /// ID,唯一标识 149 | /// 150 | public string id { get; set; } 151 | 152 | /// 153 | /// 租户ID 154 | /// 155 | [Column("tenant_id")] 156 | public string tenantId { get; set; } 157 | 158 | /// 159 | /// 用户ID 160 | /// 161 | [Column("user_id")] 162 | public string userId { get; set; } 163 | 164 | /// 165 | /// 创建人ID 166 | /// 167 | [Column("creator_id")] 168 | public string creatorId { get; set; } 169 | 170 | /// 171 | /// 创建时间 172 | /// 173 | [Column("created_time")] 174 | public DateTime createTime { get; set; } 175 | } 176 | } -------------------------------------------------------------------------------- /Source/Services/Tenants/ITenants.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Web; 4 | using Insight.Base.Common.Entity; 5 | using Insight.Utils.Entity; 6 | 7 | namespace Insight.Base.Services 8 | { 9 | [ServiceContract] 10 | public interface ITenants 11 | { 12 | /// 13 | /// 为跨域请求设置响应头信息 14 | /// 15 | [WebInvoke(Method = "OPTIONS", UriTemplate = "*", ResponseFormat = WebMessageFormat.Json, 16 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 17 | [OperationContract] 18 | void responseOptions(); 19 | 20 | /// 21 | /// 根据关键词查询全部租户集合 22 | /// 23 | /// 每页行数 24 | /// 当前页 25 | /// 查询关键词 26 | /// Result 27 | [WebGet(UriTemplate = "tenants?rows={rows}&page={page}&key={key}", ResponseFormat = WebMessageFormat.Json)] 28 | [OperationContract] 29 | Result getTenants(int rows, int page, string key); 30 | 31 | /// 32 | /// 获取指定ID的租户 33 | /// 34 | /// 租户ID 35 | /// Result 36 | [WebGet(UriTemplate = "tenants/{id}", ResponseFormat = WebMessageFormat.Json)] 37 | [OperationContract] 38 | Result getTenant(string id); 39 | 40 | /// 41 | /// 新增租户信息 42 | /// 43 | /// 租户实体数据 44 | /// Result 45 | [WebInvoke(Method = "POST", UriTemplate = "tenants", ResponseFormat = WebMessageFormat.Json, 46 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 47 | [OperationContract] 48 | Result addTenant(Tenant tenant); 49 | 50 | /// 51 | /// 修改租户信息 52 | /// 53 | /// 租户ID 54 | /// 租户实体数据 55 | /// Result 56 | [WebInvoke(Method = "PUT", UriTemplate = "tenants/{id}", ResponseFormat = WebMessageFormat.Json, 57 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 58 | [OperationContract] 59 | Result editTenant(string id, Tenant tenant); 60 | 61 | /// 62 | /// 延长有效天数 63 | /// 64 | /// 租户ID 65 | /// 续租天数 66 | /// Result 67 | [WebInvoke(Method = "PUT", UriTemplate = "tenants/{id}/expire", ResponseFormat = WebMessageFormat.Json, 68 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 69 | [OperationContract] 70 | Result extendTenant(string id, int expire); 71 | 72 | /// 73 | /// 删除指定ID的租户 74 | /// 75 | /// 租户ID 76 | /// Result 77 | [WebInvoke(Method = "DELETE", UriTemplate = "tenants/{id}", ResponseFormat = WebMessageFormat.Json, 78 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 79 | [OperationContract] 80 | Result deleteTenant(string id); 81 | 82 | /// 83 | /// 为租户绑定应用 84 | /// 85 | /// 租户ID 86 | /// 绑定应用ID集合 87 | /// Result 88 | [WebInvoke(Method = "PUT", UriTemplate = "tenants/{id}/apps", ResponseFormat = WebMessageFormat.Json, 89 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 90 | [OperationContract] 91 | Result bindApp(string id, List apps); 92 | 93 | /// 94 | /// 为租户关联用户 95 | /// 96 | /// 租户ID 97 | /// 租户-用户关系实体数据 98 | /// Result 99 | [WebInvoke(Method = "POST", UriTemplate = "tenants/{id}/user", ResponseFormat = WebMessageFormat.Json, 100 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 101 | [OperationContract] 102 | Result addTenantUser(string id, TenantUser tenant); 103 | 104 | /// 105 | /// 删除指定ID的租户和用户的绑定关系 106 | /// 107 | /// 租户-用户关系ID 108 | /// Result 109 | [WebInvoke(Method = "DELETE", UriTemplate = "tenants/user/{id}", ResponseFormat = WebMessageFormat.Json, 110 | BodyStyle = WebMessageBodyStyle.WrappedRequest)] 111 | [OperationContract] 112 | Result deleteTenantUser(string id); 113 | } 114 | } -------------------------------------------------------------------------------- /Source/Services/Rules/Rules.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.ServiceModel; 4 | using Insight.Base.Common; 5 | using Insight.Base.Common.Entity; 6 | using Insight.Base.OAuth; 7 | using Insight.Utils.Common; 8 | using Insight.Utils.Entity; 9 | 10 | namespace Insight.Base.Services 11 | { 12 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] 13 | public class Rules : ServiceBase, IRules 14 | { 15 | /// 16 | /// 为跨域请求设置响应头信息 17 | /// 18 | public void responseOptions() 19 | { 20 | } 21 | 22 | /// 23 | /// 获取所有报表分期规则 24 | /// 25 | /// 每页行数 26 | /// 当前页 27 | /// Result 28 | public Result getRules(int rows, int page) 29 | { 30 | if (!verify("getRules")) return result; 31 | 32 | if (page < 1 || rows > 100) return result.badRequest(); 33 | 34 | var skip = rows * (page - 1); 35 | using (var context = new Entities()) 36 | { 37 | var list = context.rules.Where(i => !i.isInvalid && (i.tenantId == null || i.tenantId == tenantId)); 38 | var rules = list.OrderBy(i => i.createTime).Skip(skip).Take(rows).ToList(); 39 | 40 | return result.success(rules, list.Count()); 41 | } 42 | } 43 | 44 | /// 45 | /// 获取报表分期 46 | /// 47 | /// 分期ID 48 | /// Result 49 | public Result getRule(string id) 50 | { 51 | if (!verify("getRules")) return result; 52 | 53 | var data = DbHelper.find(id); 54 | 55 | return data == null ? result.notFound() : result.success(data); 56 | } 57 | 58 | /// 59 | /// 新建报表分期 60 | /// 61 | /// 报表分期 62 | /// Result 63 | public Result addRule(ReportRule rule) 64 | { 65 | if (!verify("newRule")) return result; 66 | 67 | rule.id = Util.newId(); 68 | rule.tenantId = tenantId; 69 | rule.isBuiltin = false; 70 | rule.isInvalid = false; 71 | rule.creatorDeptId = deptId; 72 | rule.creator = userName; 73 | rule.creatorId = userId; 74 | rule.createTime = DateTime.Now; 75 | if (existed(rule)) return result.dataAlreadyExists(); 76 | 77 | return DbHelper.insert(rule) ? result.created(rule) : result.dataBaseError(); 78 | } 79 | 80 | /// 81 | /// 编辑报表分期 82 | /// 83 | /// 报表分期ID 84 | /// 报表分期 85 | /// Result 86 | public Result editRule(string id, ReportRule rule) 87 | { 88 | if (!verify("editRule")) return result; 89 | 90 | var data = DbHelper.find(id); 91 | if (data == null) return result.notFound(); 92 | 93 | if (data.isBuiltin) return result.notBeModified(); 94 | 95 | data.cycleType = rule.cycleType; 96 | data.name = rule.name; 97 | data.cycle = rule.cycle; 98 | data.startTime = rule.startTime; 99 | data.remark = rule.remark; 100 | if (existed(data)) return result.dataAlreadyExists(); 101 | 102 | return DbHelper.update(data) ? result.success() : result.dataBaseError(); 103 | } 104 | 105 | /// 106 | /// 删除报表分期 107 | /// 108 | /// 报表分期ID 109 | /// Result 110 | public Result deleteRule(string id) 111 | { 112 | if (!verify("deleteRule")) return result; 113 | 114 | var data = DbHelper.find(id); 115 | if (data == null) return result.notFound(); 116 | 117 | if (data.isBuiltin) return result.notBeDeleted(); 118 | 119 | data.isInvalid = true; 120 | 121 | return DbHelper.update(data) ? result.success() : result.dataBaseError(); 122 | } 123 | 124 | /// 125 | /// 规则是否存在 126 | /// 127 | /// 128 | /// bool 是否存在 129 | public static bool existed(ReportRule rule) 130 | { 131 | using (var context = new Entities()) 132 | { 133 | return context.rules.Any(i => i.id != rule.id && i.tenantId == rule.tenantId && i.name == rule.name); 134 | } 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /Source/Common/DbHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using Insight.Base.Common.Entity; 5 | 6 | namespace Insight.Base.Common 7 | { 8 | public class DbHelper 9 | { 10 | /// 11 | /// 根据ID查询对象 12 | /// 13 | /// 14 | /// 15 | /// 16 | public static T find(string id) where T : class 17 | { 18 | using (var context = new Entities()) 19 | { 20 | var obj = context.Set(); 21 | return obj.Find(id); 22 | } 23 | } 24 | 25 | /// 26 | /// 插入数据库记录 27 | /// 28 | /// 实体类型 29 | /// 数据实体 30 | /// bool 是否成功 31 | public static bool insert(T entry) where T : class 32 | { 33 | using (var context = new Entities()) 34 | { 35 | var obj = context.Set(); 36 | obj.Add(entry); 37 | try 38 | { 39 | context.SaveChanges(); 40 | return true; 41 | } 42 | catch (Exception) 43 | { 44 | return false; 45 | } 46 | } 47 | } 48 | 49 | /// 50 | /// 插入多条数据库记录 51 | /// 52 | /// 实体类型 53 | /// 数据实体集合 54 | /// bool 是否成功 55 | public static bool insert(List entrys) where T : class 56 | { 57 | using (var context = new Entities()) 58 | { 59 | var obj = context.Set(); 60 | obj.AddRange(entrys); 61 | try 62 | { 63 | context.SaveChanges(); 64 | return true; 65 | } 66 | catch (Exception) 67 | { 68 | return false; 69 | } 70 | } 71 | } 72 | 73 | /// 74 | /// 删除数据库记录 75 | /// 76 | /// 实体类型 77 | /// 数据实体 78 | /// bool 是否成功 79 | public static bool delete(T entry) where T : class 80 | { 81 | using (var context = new Entities()) 82 | { 83 | var obj = context.Set(); 84 | obj.Attach(entry); 85 | context.Entry(entry).State = EntityState.Deleted; 86 | try 87 | { 88 | context.SaveChanges(); 89 | return true; 90 | } 91 | catch (Exception) 92 | { 93 | return false; 94 | } 95 | } 96 | } 97 | 98 | /// 99 | /// 删除多条数据库记录 100 | /// 101 | /// 实体类型 102 | /// 数据实体集合 103 | /// bool 是否成功 104 | public static bool delete(List entrys) where T : class 105 | { 106 | using (var context = new Entities()) 107 | { 108 | entrys.ForEach(i => 109 | { 110 | var obj = context.Set(); 111 | obj.Attach(i); 112 | context.Entry(i).State = EntityState.Deleted; 113 | }); 114 | try 115 | { 116 | context.SaveChanges(); 117 | return true; 118 | } 119 | catch (Exception) 120 | { 121 | return false; 122 | } 123 | } 124 | } 125 | 126 | /// 127 | /// 更新数据库记录 128 | /// 129 | /// 实体类型 130 | /// 数据实体 131 | /// bool 是否成功 132 | public static bool update(T entry) where T : class 133 | { 134 | using (var context = new Entities()) 135 | { 136 | var obj = context.Set(); 137 | obj.Attach(entry); 138 | context.Entry(entry).State = EntityState.Modified; 139 | try 140 | { 141 | context.SaveChanges(); 142 | return true; 143 | } 144 | catch (Exception) 145 | { 146 | return false; 147 | } 148 | } 149 | } 150 | } 151 | } -------------------------------------------------------------------------------- /Source/Services/Logs/Logs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.ServiceModel; 5 | using System.Text.RegularExpressions; 6 | using System.Threading; 7 | using Insight.Base.Common; 8 | using Insight.Base.Common.Entity; 9 | using Insight.Base.OAuth; 10 | using Insight.Utils.Common; 11 | using Insight.Utils.Entity; 12 | 13 | namespace Insight.Base.Services 14 | { 15 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] 16 | public partial class Logs : ServiceBase, ILogs 17 | { 18 | /// 19 | /// 为跨域请求设置响应头信息 20 | /// 21 | public void responseOptions() 22 | { 23 | } 24 | 25 | /// 26 | /// 写入日志 27 | /// 28 | /// 事件代码(必须有) 29 | /// 事件消息,为空则使用默认消息文本 30 | /// 来源(可为空) 31 | /// 操作(可为空) 32 | /// 查询用的关键字段 33 | /// 事件源用户ID(可为空) 34 | /// Result 35 | public Result writeToLog(string code, string message, string source, string action, string key, 36 | string userid) 37 | { 38 | if (!verify()) return result; 39 | 40 | new Thread(() => Logger.write(code, message, source, action, key, userid)).Start(); 41 | 42 | return result; 43 | } 44 | 45 | /// 46 | /// 新增日志规则 47 | /// 48 | /// 日志规则数据对象 49 | /// Result 50 | public Result addRule(LogRule rule) 51 | { 52 | if (!verify("60A97A33-0E6E-4856-BB2B-322FEEEFD96A")) return result; 53 | 54 | if (string.IsNullOrEmpty(rule.code) || !Regex.IsMatch(rule.code, @"^\d{6}$")) 55 | return result.invalidEventCode(); 56 | 57 | var level = Convert.ToInt32(rule.code.Substring(0, 1)); 58 | if (level <= 1 || level == 7) return result.eventWithoutConfig(); 59 | 60 | if (Params.rules.Any(r => r.code == rule.code)) return result.eventCodeUsed(); 61 | 62 | rule.creatorId = userId; 63 | if (!insert(rule)) return result.dataBaseError(); 64 | 65 | var log = new 66 | { 67 | UserID = userId, 68 | Message = $"事件代码【{rule.code}】已由{userName}创建和配置为:{Util.serialize(rule)}" 69 | }; 70 | new Thread(() => Logger.write("600601", Util.serialize(log))).Start(); 71 | 72 | return result; 73 | } 74 | 75 | /// 76 | /// 删除日志规则 77 | /// 78 | /// 日志规则ID 79 | /// Result 80 | public Result removeRule(string id) 81 | { 82 | if (!verify("BBC43098-A030-46CA-A681-0C3D1ECC15AB")) return result; 83 | 84 | if (!deleteRule(id)) return result.dataBaseError(); 85 | 86 | var log = new 87 | { 88 | UserID = userId, 89 | Message = $"事件配置【{id}】已被{userName}删除" 90 | }; 91 | new Thread(() => Logger.write("600602", Util.serialize(log))).Start(); 92 | 93 | return result; 94 | } 95 | 96 | /// 97 | /// 编辑日志规则 98 | /// 99 | /// 日志规则数据对象 100 | /// Result 101 | public Result editRule(LogRule rule) 102 | { 103 | if (!verify("9FF1547D-2E3F-4552-963F-5EA790D586EA")) return result; 104 | 105 | if (!update(rule)) return result.dataBaseError(); 106 | 107 | var log = new 108 | { 109 | UserID = userId, 110 | Message = $"事件代码【{rule.code}】已被{userName}修改为:{Util.serialize(rule)}" 111 | }; 112 | new Thread(() => Logger.write("600603", Util.serialize(log))).Start(); 113 | 114 | return result; 115 | } 116 | 117 | /// 118 | /// 获取日志规则 119 | /// 120 | /// 日志规则ID 121 | /// Result 122 | public Result getRule(string id) 123 | { 124 | if (!verify("E3CFC5AA-CD7D-4A3C-8900-8132ADB7099F")) return result; 125 | 126 | var rule = Params.rules.SingleOrDefault(r => r.id == id); 127 | return rule == null ? result.notFound() : result.success(rule); 128 | } 129 | 130 | /// 131 | /// 获取全部日志规则 132 | /// 133 | /// Result 134 | public Result getRules() 135 | { 136 | if (!verify("E3CFC5AA-CD7D-4A3C-8900-8132ADB7099F")) return result; 137 | 138 | return Params.rules.Any() ? result.success(Params.rules) : result.noContent(new List()); 139 | } 140 | } 141 | } --------------------------------------------------------------------------------