├── _config.yml ├── class.png ├── level.png ├── class_ext.png ├── inter_new.png ├── SuperGMS.RpcProxyTools ├── 说明.txt ├── InterfaceBodyTemplate.txt ├── ClassBodyTemplate.txt └── SuperGMS.RpcProxyTools.csproj ├── SuperGMS.HttpProxy ├── Config │ ├── sqlmap.config │ ├── DataBase.config │ ├── database.pre.config │ ├── database.prod.config │ └── database.test.config ├── Dockerfile ├── config.pre.json ├── config.prod.json ├── config.test_a.json ├── config.test_b.json ├── config.json ├── Program.cs └── Startup.cs ├── SuperGMS.WebSocketService ├── config │ ├── sqlmap.config │ ├── database.config │ ├── database.pre.config │ ├── database.prod.config │ ├── database.test_a.config │ └── database.test_b.config ├── config.json ├── config.pre.json ├── config.prod.json ├── config.test_a.json ├── config.test_b.json ├── SendMessageToUser.cs ├── SuperGMS.WebSocketService.csproj └── Program.cs ├── SuperGMS ├── Rpc │ ├── 1.Grpc │ │ └── Protos │ │ │ ├── readme.txt │ │ │ └── GrantGrpc.proto │ ├── 0.Thrift │ │ └── Server │ │ │ ├── ThriftService.cs │ │ │ ├── Thrift.Thrift │ │ │ └── ThriftRpcServer.cs │ ├── AssemblyTools │ │ ├── InterfaceBodyTemplate.txt │ │ ├── ClassBodyTemplate.txt │ │ └── ClassTemplate.txt │ ├── ServerStatus.cs │ ├── Manage │ │ └── AppServerInfo.cs │ ├── SuperGMSServer.cs │ ├── TaskWorker │ │ └── TaskWorker.cs │ ├── 2.Server │ │ ├── UnRegisterMethodAttribute.cs │ │ └── InitlizeMethodAttribute.cs │ ├── ConfigTemplate.cs │ ├── Nullables.cs │ ├── ISuperGMSRpcClient.cs │ ├── ISuperGMSRpcServer.cs │ ├── ServerType.cs │ └── ClientItem.cs ├── Properties │ ├── launchSettings.json │ └── PublishProfiles │ │ └── FolderProfile.pubxml ├── DB │ ├── EFEx │ │ ├── DynamicSearch │ │ │ ├── Model │ │ │ │ ├── QueryMethod.cs │ │ │ │ ├── QueryModel.cs │ │ │ │ └── PageResult.cs │ │ │ ├── TypeUtil.cs │ │ │ └── PageInfo.cs │ │ ├── MyDbContext │ │ │ ├── ISqlSugarDbContext.cs │ │ │ ├── IDbContext.cs │ │ │ ├── IEFDbContext.cs │ │ │ ├── IDapperDbContext.cs │ │ │ ├── SqlSugarDBContext.cs │ │ │ └── DapperDBContext.cs │ │ ├── MyDbFactory │ │ │ ├── MySql.cs │ │ │ ├── SqlPara.cs │ │ │ ├── PostgreSql.cs │ │ │ ├── SqlServer.cs │ │ │ ├── Oracle.cs │ │ │ └── DBConnection.cs │ │ ├── IContextOptionFactory.cs │ │ ├── CrudRepository │ │ │ └── DapperCrudRepository.cs │ │ ├── DbOptionBulider │ │ │ ├── PostgresqlDBContextOptionBuilder.cs │ │ │ ├── SqlServerDBContextOptionBuilder.cs │ │ │ ├── OracleDBContextOptionBuilder.cs │ │ │ └── MySqlDBContextOptionBuilder.cs │ │ ├── DBType.cs │ │ └── DBInfo.cs │ ├── AttributeEx │ │ └── ViewOraModelAttribute.cs │ └── MapperEx │ │ └── AutoMapperTool.cs ├── AttributeEx │ ├── NotImportAttribute.cs │ ├── ErrorCodeAttribute.cs │ ├── ImportCommentAttribute.cs │ ├── UdfModelAttribute.cs │ ├── OraModelAttribute.cs │ ├── OpenApiAttribute.cs │ ├── CodeDescAttribute.cs │ └── StatusCodeExtension.cs ├── SqlMap.config ├── Extensions │ ├── Enum │ │ └── HashKeyType.cs │ └── RpcContextExtensions.cs ├── UserSession │ └── UserLoginInfo │ │ ├── Role.cs │ │ ├── Rolefunction.cs │ │ ├── FunctionInfo.cs │ │ ├── SysDbInfo.cs │ │ ├── SystemInfo.cs │ │ ├── Menu.cs │ │ └── TenantInfo.cs ├── Router │ ├── IUri.cs │ ├── TTIDUri.cs │ ├── UserUri.cs │ └── RouterType.cs ├── Config │ ├── DataBase │ │ ├── Master.cs │ │ ├── DataBaseInfo.cs │ │ ├── Slave.cs │ │ ├── SqlMap.cs │ │ ├── DbIpPort.cs │ │ ├── DataBase.cs │ │ └── DbModelContext.cs │ ├── HttpProxy │ │ ├── HttpProxyItem.cs │ │ └── HttpProxy.cs │ ├── ConstKeyValue │ │ ├── ConstItem.cs │ │ └── ConstKeyValue.cs │ ├── FileServer │ │ ├── FileServerItem.cs │ │ ├── FileServer.cs │ │ └── FileServerManager.cs │ ├── Redis │ │ ├── RedisNode.cs │ │ └── RedisItem.cs │ ├── ZKConfigSetting.cs │ ├── LogConfig │ │ ├── LogConfig.cs │ │ └── Filter.cs │ ├── RemoteJsonFile │ │ └── RemoteJsonFileConfigurationSource.cs │ ├── RabbitMQ │ │ ├── HostItem.cs │ │ └── RabbitMQ.cs │ ├── ServerConfig.cs │ ├── ConfigCenter.cs │ ├── RpcService.cs │ └── RpcClient │ │ └── RpcClients.cs ├── Tools │ ├── ExtentionTool.cs │ ├── C.cs │ ├── FileHelper.cs │ ├── WebClientEx.cs │ └── EncryptionTools.cs ├── FileEx │ ├── IUdfButtonJob.cs │ └── ISftpClient.cs ├── Protocol │ ├── RpcProtocol │ │ ├── ClientTypeParser.cs │ │ ├── ClientType.cs │ │ ├── ArgsEx.cs │ │ ├── BasicArgs.cs │ │ └── Result.cs │ ├── ApiProtocol │ │ ├── ApiArgs.cs │ │ └── ApiResult.cs │ └── MQProtocol │ │ └── MQProtocol.cs ├── DataBase.config ├── SuperGMSHost.cs ├── Cache │ ├── CacheDefault.cs │ └── ResourceCache.cs ├── Zookeeper │ ├── BaseWatcher.cs │ ├── NullWatcher.cs │ ├── ZKConnectionWatcher.cs │ ├── ServiceRouterWatcher.cs │ └── ConfigWatcher.cs ├── ApiHelper │ ├── FieldDescInfo.cs │ ├── ServiceInfo.cs │ ├── Xml │ │ └── XmlCommentsFileCollection.cs │ └── BaseGetApiHelp.cs ├── ExceptionEx │ ├── FrameworkException.cs │ └── BusinessException.cs ├── MQ │ ├── RabbitMQ │ │ ├── Config │ │ │ ├── ExchangeType.cs │ │ │ ├── Exchange.cs │ │ │ ├── VirtualHost.cs │ │ │ └── MQueue.cs │ │ └── MQConnection.cs │ └── ConstManager.cs ├── 说明.txt ├── Log │ ├── LogFactory.cs │ └── LogBase.cs └── Redis │ └── RedisServer.cs ├── SuperGMS.Extend ├── ImportExport │ ├── ImportResultDto.cs │ ├── ImportParamDto.cs │ └── ExportParamDto.cs ├── FileServer │ ├── FileOperateAction.cs │ ├── CheckFileRightResult.cs │ ├── FileUploadInfo.cs │ ├── DownFileInfo.cs │ └── FileCheckInfo.cs ├── Tools │ ├── SysResourceDto.cs │ └── EntityHumpHelper.cs ├── SuperGMS.Extend.csproj ├── Extensions │ ├── TaskExCallBackResult.cs │ ├── TaskExArgs.cs │ └── TaskExResult.cs ├── BaseAppExtend │ └── EditFormFieldHelper │ │ ├── ValidateType.cs │ │ ├── EditFormAttribute.cs │ │ ├── ControlType.cs │ │ └── EditFormApiArgs.cs ├── Print │ └── PrintParamDto.cs ├── BackGroundMessage │ ├── SetBackGroudMessageArgs.cs │ └── BackGroundMessageProcessArgs.cs └── MicroServiceAssembly.cs └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/class.png -------------------------------------------------------------------------------- /level.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/level.png -------------------------------------------------------------------------------- /class_ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/class_ext.png -------------------------------------------------------------------------------- /inter_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/inter_new.png -------------------------------------------------------------------------------- /SuperGMS.RpcProxyTools/说明.txt: -------------------------------------------------------------------------------- 1 | 如果出现无法加载的提示,需要检查,工具的SuperGMS的版本跟要生成代理微服务的引用是同一个版本,否则会失败 2 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Config/sqlmap.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/sqlmap.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Config/DataBase.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Config/database.pre.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/database.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Config/database.prod.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Config/database.test.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/database.pre.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/database.prod.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/database.test_a.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config/database.test_b.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/1.Grpc/Protos/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/SuperGMS/Rpc/1.Grpc/Protos/readme.txt -------------------------------------------------------------------------------- /SuperGMS/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SuperGMS": { 4 | "commandName": "Project" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/0.Thrift/Server/ThriftService.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/SuperGMS/Rpc/0.Thrift/Server/ThriftService.cs -------------------------------------------------------------------------------- /SuperGMS.RpcProxyTools/InterfaceBodyTemplate.txt: -------------------------------------------------------------------------------- 1 | #return_type# #clazz_name#(#args_type# valueArgs,out StatusCode code,RpcContext context); 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS.Extend/ImportExport/ImportResultDto.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.ImportExport 2 | { 3 | public class ImportResultDto 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DynamicSearch/Model/QueryMethod.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/SuperGMS/DB/EFEx/DynamicSearch/Model/QueryMethod.cs -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DynamicSearch/Model/QueryModel.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grantgonggithub/SuperGMS/HEAD/SuperGMS/DB/EFEx/DynamicSearch/Model/QueryModel.cs -------------------------------------------------------------------------------- /SuperGMS/Rpc/AssemblyTools/InterfaceBodyTemplate.txt: -------------------------------------------------------------------------------- 1 | #return_type# #clazz_name#(#args_type# valueArgs,out StatusCode code,RpcContext context); 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/0.Thrift/Server/Thrift.Thrift: -------------------------------------------------------------------------------- 1 | namespace csharp SuperGMS.GrantRpc.Thrift.IGrantRpc 2 | 3 | service GrantService{ 4 | string Send(1:string my_args) 5 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base 2 | 3 | WORKDIR /publish_dir 4 | COPY . /publish_dir/ 5 | ENTRYPOINT ["dotnet", "SuperGMS.HttpProxy.dll"] -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://localhost/config.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/config.pre.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://xxx.com/config/config.pre.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/config.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://xxx.com/config/config.prod.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config.pre.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://xxx.com/config/config.pre.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://xxx.com/config/config.prod.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/config.test_a.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://192.168.1.201/config/config.test_a.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/config.test_b.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 4, 5 | "Ip": "192.168.100.172:8848", 6 | "SessionTimeout": 5000 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config.test_a.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://192.168.100.201/config/config.test_a.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/config.test_b.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://192.168.100.201/config/config.test_b.json" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/NotImportAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 非导入属性标签 7 | /// 8 | public class NotImportAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SuperGMS/SqlMap.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | select a,b,c from xxx where a=xx 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/ErrorCodeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 系统错误码定义属性,协助帮助子系统抓取各个微服务定义的错误码 7 | /// 8 | public class ErrorCodeAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SuperGMS.RpcProxyTools/ClassBodyTemplate.txt: -------------------------------------------------------------------------------- 1 | public #return_type# #clazz_name#(#args_type# valueArgs,out StatusCode code,RpcContext context) 2 | { 3 | return RpcClientManager.Send<#args_type#,#return_type#>(serviceName, "#clazz_name#",valueArgs, context, out code); 4 | } 5 | 6 | 7 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/AssemblyTools/ClassBodyTemplate.txt: -------------------------------------------------------------------------------- 1 | public #return_type# #clazz_name#(#args_type# valueArgs,out StatusCode code,RpcContext context) 2 | { 3 | return GrantRpcClientManager.Send<#args_type#,#return_type#>(serviceName, "#clazz_name#",valueArgs, context, out code); 4 | } 5 | 6 | 7 | -------------------------------------------------------------------------------- /SuperGMS.Extend/FileServer/FileOperateAction.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.FileServer 2 | { 3 | /// 4 | /// 文件操作动作 5 | /// 6 | public enum FileOperateAction 7 | { 8 | FileUpload = 1, 9 | FileDownload, 10 | FileDelete, 11 | DirCreate, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/1.Grpc/Protos/GrantGrpc.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option csharp_namespace = "SuperGMS.Rpc.Grpc.Server"; 4 | 5 | package GrpcService; 6 | 7 | service GrpcService{ 8 | rpc Send(GRpcRequest) returns (GrpcResponse); 9 | } 10 | 11 | message GRpcRequest 12 | { 13 | string my_args=1; 14 | } 15 | 16 | message GrpcResponse 17 | { 18 | string my_result=1; 19 | } -------------------------------------------------------------------------------- /SuperGMS/Extensions/Enum/HashKeyType.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extensions.Enum 2 | { 3 | /// 4 | /// Hash Key 枚举 5 | /// 6 | public enum HashKeyType 7 | { 8 | /// 9 | /// 默认资源 10 | /// 11 | LocalResource, 12 | 13 | /// 14 | /// 租户级别 15 | /// 16 | TtResource, 17 | } 18 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DynamicSearch/Model/PageResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SuperGMS.DB.EFEx.DynamicSearch.Model 6 | { 7 | /// 8 | /// rpc返回接口的泛型对象, 继承此对象 9 | /// 10 | public class PageResult 11 | { 12 | public PageInfo Page { set; get; } 13 | public List ListValue { set; get; } 14 | } 15 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/ISqlSugarDbContext.cs: -------------------------------------------------------------------------------- 1 | using SqlSugar; 2 | using SuperGMS.DB.EFEx.CrudRepository; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace SuperGMS.DB.EFEx.MyDbContext 10 | { 11 | public interface ISqlSugarDbContext : IDbContext 12 | { 13 | ISqlSugarClient GetRepository(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/ServerStatus.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Rpc 2 | { 3 | public enum ServerStatus 4 | { 5 | /// 6 | /// 运行 7 | /// 8 | Running=1, 9 | /// 10 | /// 不存在,要么没安装,要么已卸载 11 | /// 12 | NotExist=2, 13 | /// 14 | /// 异常停止 15 | /// 16 | ErrorStop=3, 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/Role.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.UserSession 2 | { 3 | /// 4 | /// 角色功能权限 5 | /// 6 | public class Role 7 | { 8 | /// 9 | /// 角色Id 10 | /// 11 | public int RoleId { get; set; } 12 | /// 13 | /// 角色名称 14 | /// 15 | public string RoleName { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SuperGMS.Extend/FileServer/CheckFileRightResult.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.FileServer 2 | { 3 | /// 4 | /// 检查结果 5 | /// 6 | public class CheckFileRightResult 7 | { 8 | /// 9 | /// 结果 10 | /// 11 | public bool Result { get; set; } 12 | 13 | /// 14 | /// 结果消息 15 | /// 16 | public string Message { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SuperGMS.Extend/Tools/SysResourceDto.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.Tools 2 | { 3 | /// 4 | /// 系统资源文件,兼顾其他系统 5 | /// 6 | public class SysResourceDto 7 | { 8 | /// 9 | /// 资源key,子系统同语种内唯一 10 | /// 11 | public string ResourceKey { get; set; } 12 | 13 | /// 14 | /// 键值 15 | /// 16 | public string ViewText { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SuperGMS.Extend/FileServer/FileUploadInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.FileServer 2 | { 3 | /// 4 | /// 文件上传信息 5 | /// 6 | public class FileUploadInfo 7 | { 8 | /// 9 | /// Gets or sets 远程服务器名称 10 | /// 11 | public string FileName { get; set; } 12 | 13 | /// 14 | /// Gets or sets 上传业务Guid 15 | /// 16 | public string Guid { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/Manage/AppServerInfo.cs: -------------------------------------------------------------------------------- 1 | /*using System; 2 | 3 | namespace SuperGMS.Rpc 4 | { 5 | public class AppServerInfo 6 | { 7 | public GrantServerConfig Config { get; set; } 8 | 9 | public ServerStatus Status { get; set; } 10 | /// 11 | /// 占用内存cpu的情况 12 | /// 13 | //public computerInfo info { get; set; } 14 | 15 | public long Memory { get; set; } 16 | 17 | public TimeSpan Cputime { get; set; } 18 | } 19 | } 20 | */ -------------------------------------------------------------------------------- /SuperGMS/Router/IUri.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Router 5 | 文件名:IUri 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 16:26:37 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Router 15 | { 16 | public interface IUri 17 | { 18 | IUri Parse(string uri); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerConfig": { 3 | "ConfigCenter": { 4 | "ConfigType": 3, 5 | "Ip": "http://localhost/config.json" 6 | } 7 | } 8 | } 9 | //{ 10 | // "ServerConfig": { 11 | // "ConfigCenter": { 12 | // "ConfigType": 4, 13 | // "Ip": "http://192.168.1.172:8848", 14 | // "SessionTimeout": 5000 15 | // } 16 | // } 17 | //} 18 | 19 | //{ 20 | // "ServerConfig": { 21 | // "ConfigCenter": { 22 | // "ConfigType": 2, 23 | // "Ip": "192.168.1.172:2181", 24 | // "SessionTimeout": 10000 25 | // } 26 | // } 27 | //} -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/Master.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config.Models.DataBase 5 | 文件名: Master 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/22 11:41:15 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// Master 17 | /// 18 | internal class Master : DbIpPort 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/DataBaseInfo.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: DataBaseInfo 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:07:16 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// DataBaseInfo 17 | /// 18 | public class DataBaseInfo 19 | { 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /SuperGMS/Tools/ExtentionTool.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Tools 2 | { 3 | /// 4 | /// 扩展类 5 | /// 6 | public static class ExtentionTool 7 | { 8 | /// 9 | /// Copy 方法, 解决引用类型无法复制问题 10 | /// 11 | /// 类型 12 | /// 对象 13 | /// 新对象 14 | public static T GrantCopy(this T obj) 15 | { 16 | return JsonEx.JsonConvert.DeserializeObject(JsonEx.JsonConvert.JsonSerializer(obj)); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/SuperGMS.Extend.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 12 6 | 6.2.1 7 | gongjianchun 8 | SuperGMS 9 | 10 | 11 | true 12 | SuperGMS 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /SuperGMS.Extend/ImportExport/ImportParamDto.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.ImportExport 2 | { 3 | /// 4 | /// 导入参数 5 | /// 6 | public class ImportParamDto 7 | { 8 | /// 9 | /// Gets or sets 远程服务器名称 10 | /// 11 | public string FileName { get; set; } 12 | 13 | /// 14 | /// Gets or sets 上传业务Guid 15 | /// 16 | public string Guid { get; set; } 17 | 18 | /// 19 | /// 保留字段 20 | /// 21 | public string Reserve { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SuperGMS/DB/AttributeEx/ViewOraModelAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // 文件:OraModelAttribute.cs 3 | // 作者:Grant 4 | // 最后更新日期:2014-8-20 5 | using System; 6 | 7 | namespace SuperGMS.DB.AttributeEx 8 | { 9 | public class ViewOraModelAttribute : Attribute 10 | { 11 | /// 12 | /// 原始对象 13 | /// 14 | public Type OraModel { get; set; } 15 | 16 | 17 | /// 18 | /// 记录原始Model 19 | /// 20 | /// 21 | public ViewOraModelAttribute(Type oraModel) 22 | { 23 | OraModel = oraModel; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/ImportCommentAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 导入模板中的说明内容,此内容会生成到导入模板的第一行中 7 | /// 8 | public class ImportCommentAttribute : Attribute 9 | { 10 | /// 11 | /// 默认构造函数,需要传递导入列的说明 12 | /// 13 | /// 导入列的说明, 会根据字符串获取多语言 14 | public ImportCommentAttribute(string comment) 15 | { 16 | Commont = comment; 17 | } 18 | 19 | /// 20 | /// 备注内容 21 | /// 22 | public string Commont { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/SuperGMSServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Thrift.Server 5 | 文件名:GrantServer 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 14:50:44 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Rpc 14 | { 15 | public class SuperGMSServer 16 | { 17 | public SuperGMSBaseServer Server { get; set; } 18 | 19 | public SuperGMSServerConfig Config { get; set; } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SuperGMS/FileEx/IUdfButtonJob.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SuperGMS.FileEx 4 | { 5 | /// 6 | /// 自定义按钮接口 7 | /// 当自定义按钮是以Job形式运行,则会通过接口实例化一个Job对象并调用Excute方法 8 | /// 需要将主键数组传入进来 9 | /// 10 | public interface IUdfButtonJob 11 | { 12 | /// 13 | /// 执行方法 14 | /// 15 | /// 16 | /// 关于对象的泛型主键集合 17 | /// 18 | /// 19 | /// 自定义按钮ID 20 | /// 21 | /// 22 | /// 23 | string Excute(List listObject, string buttonId); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SuperGMS/Protocol/RpcProtocol/ClientTypeParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.Protocol.RpcProtocol 4 | { 5 | /// 6 | /// 客户端转换类 7 | /// 8 | public class ClientTypeParser 9 | { 10 | /// 11 | /// 转换客户端类型为枚举 12 | /// 13 | /// 客户端类型字符串 14 | /// 枚举 15 | public static ClientType Parser(string clientType) 16 | { 17 | if (!Enum.TryParse(clientType,true, out var ct)) 18 | { 19 | ct = ClientType.Unkunwn; 20 | } 21 | 22 | return ct; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/Extensions/TaskExCallBackResult.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Extend.Extensions 5 | 文件名: TaskExCallBackResult 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/11 19:07:24 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Extend.Extensions 14 | { 15 | /// 16 | /// TaskExCallBackResult 17 | /// 18 | public class TaskExCallBackResult 19 | { 20 | public object SetCallBackData { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/Slave.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config.Models.DataBase 5 | 文件名: Slave 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/22 11:42:10 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// Slave 17 | /// 18 | internal class Slave : DbIpPort 19 | { 20 | /// 21 | /// Gets or sets 索引 22 | /// 23 | public int Pool { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SuperGMS/Router/TTIDUri.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Router 5 | 文件名: TTIDUri 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/11/20 13:38:59 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Router 16 | { 17 | /// 18 | /// TTIDUri 19 | /// 20 | public class TTIDUri : IUri 21 | { 22 | public IUri Parse(string uri) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SuperGMS/Router/UserUri.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Router 5 | 文件名: UserUri 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/11/20 13:38:32 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Router 16 | { 17 | /// 18 | /// UserUri 19 | /// 20 | public class UserUri : IUri 21 | { 22 | public IUri Parse(string uri) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SuperGMS/Config/HttpProxy/HttpProxyItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: HttpProxyItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:20:10 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// HttpProxyItem 17 | /// 18 | public class HttpProxyItem 19 | { 20 | /// 21 | /// 22 | /// 23 | public string Name { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /SuperGMS/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | Release 10 | netcoreapp2.0 11 | bin\Release\PublishOutput 12 | 13 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/TaskWorker/TaskWorker.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Rpc.TaskWorker 2 | { 3 | /// 4 | /// 长轮询的一个Base服务 5 | /// 6 | public class TaskWorker : SuperGMSBaseServer 7 | { 8 | private SuperGMSServerConfig server; 9 | 10 | /// 11 | /// 12 | /// 13 | protected override void Dispose() 14 | { 15 | } 16 | 17 | /// 18 | /// 定时任务的服务不需要注册,直接通过InitlizeMethodAttribute属性初始化 19 | /// 20 | /// 21 | protected override void ServerRegister(SuperGMSServerConfig server, string[] args) 22 | { 23 | this.server = server; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/2.Server/UnRegisterMethodAttribute.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc.Server 5 | 文件名: UnRegisterMethodAttribute 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/9/28 16:52:06 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | 16 | namespace SuperGMS.Rpc.Server 17 | { 18 | /// 19 | /// 标记为当前属性的方法,将在服务卸载,停止时调用,来执行清理工作 20 | /// 21 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] 22 | public class UnRegisterMethodAttribute : Attribute 23 | { 24 | } 25 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/BaseAppExtend/EditFormFieldHelper/ValidateType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 5 | 文件名: ValidateType 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/24 13:56:19 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | 17 | namespace SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 18 | { 19 | /// 20 | /// ValidateType 验证类型 21 | /// 22 | public enum ValidateType : int 23 | { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/ConfigTemplate.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Rpc 5 | 文件名: ConfigTemplate 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/3/14 10:41:12 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Rpc 14 | { 15 | /// 16 | /// ConfigTemplate 17 | /// 18 | public class ConfigTemplate 19 | { 20 | public const string RPC_CLIENT= "< Client ServerName=\"{0}\" RouterType=\"random\">"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SuperGMS/DataBase.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 一个NetCore的微服务框架,当前版本支持Net6 (3.1版本见分支NetCore3.1) 2 | 3 | #一、逻辑结构图 4 | 5 | ![逻辑结构图](https://github.com/grantgonggithub/GMS/blob/master/level.png) 6 | 7 | #二、拓扑结构图 8 | 9 | ![拓扑结构图](https://github.com/grantgonggithub/GMS/blob/master/inter_new.png) 10 | 11 | #三、类库结构图 12 | (一)、基础类库 13 | 14 | ![基础类库](https://github.com/grantgonggithub/GMS/blob/master/class.png) 15 | 16 | (二)、扩展类库 17 | 18 | ![扩展类库](https://github.com/grantgonggithub/GMS/blob/master/class_ext.png) 19 | 20 | ## -----注意:有时候由于某些情况,可能图片无法正常展示,如果看不到图片,可以尝试下载源码项目中的图片到本地查看---- 21 | 22 | 说明: 为了支持开源和犒劳作者的辛苦付出,你可以向作者捐赠,一表对作者辛苦劳动的尊重(微信捐赠二维码见下图) 23 | 24 | ![捐赠二维码](https://github.com/grantgonggithub/CRM/blob/master/qrcode.png?raw=true) 25 | 26 | 27 | 作者: grant (巩建春) 28 | email: nnn987@126.com 29 | QQ: 406333743 30 | 31 | 32 | 欢迎交流! 33 | -------------------------------------------------------------------------------- /SuperGMS.Extend/Print/PrintParamDto.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Extend.Print 2 | { 3 | /// 4 | /// 打印参数 5 | /// 6 | public class PrintParamDto 7 | { 8 | /// 打印模板文件guid 9 | public string TemplateGuid { get; set; } 10 | 11 | /// 12 | /// 系统id 13 | /// 14 | public string SysId { get; set; } 15 | 16 | /// 17 | /// 模块名称,迷失时验证用,或显示用 18 | /// 19 | public string ModelName { get; set; } 20 | 21 | /// 22 | /// 业务id集合 23 | /// 24 | public string[] Ids { get; set; } 25 | 26 | /// 27 | /// 保留字段 28 | /// 29 | public string Reserve { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SuperGMS/Config/ConstKeyValue/ConstItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: ConstItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:10:28 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// ConstItem 17 | /// 18 | 19 | public class ConstItem 20 | { 21 | /// 22 | /// 23 | /// 24 | public string Key { get; set; } 25 | /// 26 | /// 27 | /// 28 | public string Value { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/2.Server/InitlizeMethodAttribute.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc.Server 5 | 文件名:InitlizeMethodAttribute 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 17:59:56 9 | 10 | 功能描述:用于标记一个需要在系统加载时初始化的类和方法 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | 16 | namespace SuperGMS.Rpc.Server 17 | { 18 | /// 19 | /// 微服务启动中需要初始化的方法标签, 此标签必须同时标记类 和 方法才生效 20 | /// 21 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] 22 | public class InitlizeMethodAttribute : Attribute 23 | { 24 | } 25 | } -------------------------------------------------------------------------------- /SuperGMS/Config/FileServer/FileServerItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: FileServerItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:23:33 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// FileServerItem 17 | /// 18 | public class FileServerItem 19 | { 20 | /// 21 | /// 22 | /// 23 | public int Pool { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | public string Url { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/SqlMap.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: SqlMap 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:08:02 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// SqlMap 17 | /// 18 | internal class SqlMap 19 | { 20 | /// 21 | /// 22 | /// 23 | //public grantOmsDBContext grantOmsDBContext { get; set; } 24 | /// 25 | /// 26 | /// 27 | //public string grantUUIDDBContext { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/DbIpPort.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config.Models.DataBase 5 | 文件名: DbIpPort 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/22 11:49:09 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Config 15 | { 16 | /// 17 | /// DbIpPort 18 | /// 19 | internal class DbIpPort 20 | { 21 | /// 22 | /// Gets or sets 数据库Ip 23 | /// 24 | public string Ip { get; set; } 25 | 26 | /// 27 | /// Gets or sets 数据库Port 28 | /// 29 | public int Port { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/IDbContext.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbContext 5 | 文件名: IGrantDbContext 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/3 0:38:27 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | 17 | namespace SuperGMS.DB.EFEx 18 | { 19 | /// 20 | /// IGrantDbContext 21 | /// 22 | public interface IDbContext : IDisposable 23 | { 24 | /// 25 | /// 获取数据库信息 26 | /// 27 | /// 28 | DbInfo DbInfo { get; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/UdfModelAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 指定参数模型约束符合 udf模型定义的约束 7 | /// 8 | public class UdfModelAttribute : Attribute 9 | { 10 | /// 11 | /// 指定dto的自定义模型 遵守的原型 12 | /// 13 | /// 14 | /// 15 | public UdfModelAttribute(string sysId, string modelName) 16 | { 17 | this.SysId = sysId; 18 | this.ModelName = modelName; 19 | } 20 | 21 | /// 22 | /// sysId 23 | /// 24 | public string SysId { get; set; } 25 | /// 26 | /// 模型名称 27 | /// 28 | public string ModelName { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SuperGMS/SuperGMSHost.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS 5 | 文件名: GrantHost 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/11/22 18:46:19 9 | 10 | 功能描述: 11 | dev 12 | dev 13 | ----------------------------------------------------------------*/ 14 | 15 | namespace SuperGMS 16 | { 17 | /// 18 | /// GrantHost,这个主要是提供一个通用的Host程序,在HttpProxy引用的时候 19 | /// 20 | //class GrantHost 21 | //{ 22 | // static void Main(string[] args) 23 | // { 24 | // Console.WriteLine("app start!"); 25 | // ServerProxy.Register(); 26 | // Console.WriteLine("start ok"); 27 | // System.Threading.Thread.Sleep(int.MaxValue); 28 | // } 29 | //} 30 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/MySql.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名: MySql 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 21:37:39 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | 15 | namespace SuperGMS.DB.EFEx.GrantDbFactory 16 | { 17 | /// 18 | /// MySql 19 | /// 20 | public class MySql : DbBase 21 | { 22 | /// 23 | /// Gets mysql的参数前缀 24 | /// 25 | protected override string Prefix 26 | { 27 | get { return "@"; } 28 | } 29 | 30 | public MySql(DbInfo dbInfo) 31 | : base(dbInfo) 32 | { 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/FileServer/DownFileInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) PlaceholderCompany. All rights reserved. 3 | // 4 | namespace SuperGMS.Extend.FileServer 5 | { 6 | /// 7 | /// 下载文件参数 8 | /// 9 | public class DownFileInfo 10 | { 11 | /// 12 | /// Gets or sets 远程文件路径 13 | /// 14 | public string File { get; set; } 15 | 16 | /// 17 | /// Gets or sets 文件原始名称 18 | /// 19 | public string FileName { get; set; } 20 | 21 | /// 22 | /// Gets or sets 错误引导页面 23 | /// 24 | public string ErrUri { get; set; } 25 | 26 | /// 27 | /// Gets or sets token 28 | /// 29 | public string Token { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/Nullables.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Utility 5 | 文件名:Class1 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 16:33:11 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Rpc 16 | { 17 | /// 18 | /// 系统可空类型 19 | /// 20 | [Serializable] 21 | public class Nullables 22 | { 23 | private static Nullables nullValue; 24 | 25 | public static Nullables NullValue 26 | { 27 | get 28 | { 29 | nullValue = new Nullables(); 30 | return nullValue; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SuperGMS/Tools/C.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Cache; 2 | 3 | namespace SuperGMS.Tools 4 | { 5 | /// 6 | /// 简写类, 调用资源文件 7 | /// 8 | public static class C 9 | { 10 | /// 11 | /// 方便用户直接使用C.R() 来获取资源文件,更少的参数,可以采用 RpcContext.R("key") 12 | /// 13 | /// 资源key 14 | /// 语言种类 15 | /// 资源文字 16 | public static string R(string resourceName, string lang) 17 | { 18 | string field = CacheTools.GetPublicResourceKey(lang); 19 | var res = ResourceCache.Instance.GetHash(field, resourceName); 20 | return string.IsNullOrEmpty(res) ? resourceName : res; // 没有取到资源文件把key原样返回; 21 | // return ResourceCache.Instance.GetHash(resourceName, $"LocalResource.{subSystem}.{lang}"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/IContextOptionFactory.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx 5 | 文件名: IContextOptionFactory 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 19:53:33 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | using Microsoft.EntityFrameworkCore; 17 | 18 | namespace SuperGMS.DB.EFEx 19 | { 20 | /// 21 | /// IContextOptionFactory 22 | /// 23 | public interface IContextOptionBuilderFactory 24 | { 25 | DbContextOptionsBuilder CreateOptionsBuilder(string connectionString) 26 | where T : DbContext; 27 | 28 | string GetConnectionString(DbInfo dbInfo); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/OraModelAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 原始模型,用来获取数据长度,自动构建验证框架,QtFrom控件使用 7 | /// 另外自定义列表和编辑时也会用oraModel匹配自定义属性 8 | /// 9 | /// 10 | public class OraModelAttribute : Attribute 11 | { 12 | /// 13 | /// 记录原始Model,用来获取MaxLength 14 | /// 15 | /// 原始模型 16 | /// dbcontext 17 | public OraModelAttribute(Type oraModel, Type dbContext) 18 | { 19 | OraModel = oraModel; 20 | DbContext = dbContext; 21 | } 22 | 23 | /// 24 | /// 原始对象 25 | /// 26 | public Type OraModel { get; set; } 27 | 28 | /// 29 | /// 数据库 30 | /// 31 | public Type DbContext { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/IEFDbContext.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbContext 5 | 文件名: IGrantEFDbContext 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 16:55:31 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | using System.Linq.Expressions; 18 | using System.Text; 19 | using SuperGMS.DB.EFEx.DynamicSearch; 20 | 21 | namespace SuperGMS.DB.EFEx.GrantDbContext 22 | { 23 | /// 24 | /// IGrantEFDbContext 25 | /// 26 | public interface IEFDbContext : IDbContext 27 | { 28 | ICrudRepository GetRepository() 29 | where TEntity : class; 30 | void Commit(); 31 | } 32 | } -------------------------------------------------------------------------------- /SuperGMS/Cache/CacheDefault.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.Cache 2 | { 3 | /// 4 | /// DefaultCache 5 | /// 6 | public class DefaultCache 7 | { 8 | private static ICache _instance; 9 | 10 | /// 11 | /// 操作redis的实例 12 | /// 13 | public static ICache Instance 14 | { 15 | get { return _instance; } 16 | } 17 | 18 | //[InitlizeMethod] 19 | internal static void Initlize() 20 | { 21 | _instance = new RedisCache(); 22 | } 23 | 24 | /// 25 | /// 单元测试时, Mock 缓存时,使用,手动初始化 26 | /// 27 | /// Mock 的缓存 28 | internal static void Initlize(ICache cache) 29 | { 30 | if (_instance == null && cache != null) 31 | { 32 | _instance = cache; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/IDapperDbContext.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbContext 5 | 文件名: IGrantDapperDbContext 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 16:56:49 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | using SuperGMS.DB.EFEx.CrudRepository; 17 | 18 | namespace SuperGMS.DB.EFEx.GrantDbContext 19 | { 20 | /// 21 | /// IGrantDapperDbContext 22 | /// 23 | public interface IDapperDbContext : IDbContext 24 | { 25 | /// 26 | /// GetRepository() 27 | /// 28 | /// ISqlRepository 29 | ISqlRepository GetRepository(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/SqlPara.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名: SqlPara 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/11/12 17:42:59 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using Dapper; 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Data.Common; 17 | using System.Text; 18 | 19 | namespace SuperGMS.DB.EFEx.GrantDbFactory 20 | { 21 | /// 22 | /// SqlPara 23 | /// 24 | public class SqlPara 25 | { 26 | public string sql { get; set; } 27 | 28 | public DynamicParameters parameters { get; set; } 29 | 30 | public object param { get; set; } 31 | 32 | public DbTransaction dbTransaction { get; set; } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SuperGMS.RpcProxyTools/SuperGMS.RpcProxyTools.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Always 17 | 18 | 19 | Always 20 | 21 | 22 | Always 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SuperGMS/Config/Redis/RedisNode.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: NodeItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:14:22 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// NodeItem 19 | /// 20 | public class RedisNode 21 | { 22 | /// 23 | /// 24 | /// 25 | public string NodeName { get; set; } 26 | 27 | /// 28 | /// 29 | /// 30 | public bool IsMasterSlave { get; set; } 31 | 32 | /// 33 | /// 34 | /// 35 | public List Items { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/PostgreSql.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名:PostgreSql.cs 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2019/9/11 15:25:29 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | 17 | namespace SuperGMS.DB.EFEx.GrantDbFactory 18 | { 19 | /// 20 | /// 21 | /// 22 | /// 23 | public class PostgreSql : DbBase 24 | { 25 | public PostgreSql(DbInfo dbInfo) : base(dbInfo) 26 | { 27 | } 28 | /// 29 | /// 参数前缀 30 | /// 31 | protected override string Prefix => ":"; 32 | } 33 | } -------------------------------------------------------------------------------- /SuperGMS/Zookeeper/BaseWatcher.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Zookeeper 5 | 文件名: BaseWatcher 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/18 11:25:52 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using org.apache.zookeeper; 14 | 15 | namespace SuperGMS.Zookeeper 16 | { 17 | public delegate void WatcherCallBack(string path,Watcher watcher,string state); 18 | 19 | /// 20 | /// BaseWatcher 21 | /// 22 | public abstract class BaseWatcher : Watcher 23 | { 24 | public event WatcherCallBack OnChange; 25 | 26 | public void CallBack(string path, Watcher watcher, string state) 27 | { 28 | if (OnChange != null) 29 | { 30 | OnChange(path,watcher,state); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SuperGMS/Zookeeper/NullWatcher.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Zookeeper 5 | 文件名: NullWatcher 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/3/9 15:43:55 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using org.apache.zookeeper; 14 | 15 | using System.Threading.Tasks; 16 | 17 | namespace SuperGMS.Zookeeper 18 | { 19 | /// 20 | /// NullWatcher 21 | /// 22 | public class NullWatcher : Watcher 23 | { 24 | internal static readonly Task CompletedTask = Task.FromResult(1); 25 | public static readonly NullWatcher Instance = new NullWatcher(); 26 | 27 | private NullWatcher() 28 | { 29 | } 30 | 31 | /// 32 | public override Task process(WatchedEvent @event) 33 | { 34 | return CompletedTask; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SuperGMS.Extend/ImportExport/ExportParamDto.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.DB.EFEx.DynamicSearch; 2 | 3 | namespace SuperGMS.Extend.ImportExport 4 | { 5 | /// 6 | /// 导出参数 7 | /// 8 | public class ExportParamDto 9 | { 10 | /// 导出模板文件guid 11 | public string TemplateGuid { get; set; } 12 | 13 | /// 14 | /// 系统id 15 | /// 16 | public string SysId { get; set; } 17 | 18 | /// 19 | /// 模块名称,迷失时验证用,或显示用 20 | /// 21 | public string ModelName { get; set; } 22 | 23 | /// 搜索过滤参数 24 | public SearchParameters SearchParameters { get; set; } 25 | 26 | /// 从第几页开始 27 | public int FromPage { get; set; } 28 | 29 | /// 到第几页结束 30 | public int ToPage { get; set; } 31 | 32 | /// 33 | /// 保留字段 34 | /// 35 | public string Reserve { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/OpenApiAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SuperGMS.AttributeEx 5 | { 6 | /// 7 | /// 指定api为开放的供第三方调用Api 8 | /// 9 | public class OpenApiAttribute : Attribute 10 | { 11 | /// 12 | /// 初始化api为开放api 13 | /// 14 | /// 15 | /// api描述的资源Key 16 | public OpenApiAttribute(string keyDesc = "", string[] ttid = null) 17 | { 18 | this.Ttids = new List(); 19 | if (ttid != null) 20 | { 21 | this.Ttids.AddRange(ttid); 22 | } 23 | 24 | this.ApiDesc = keyDesc; 25 | } 26 | 27 | /// 28 | /// 允许查看的ttid 29 | /// 30 | public List Ttids { get; set; } 31 | 32 | /// 33 | /// api描述资源Key 34 | /// 35 | public string ApiDesc { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SuperGMS/Config/ZKConfigSetting.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config 5 | 文件名: ZookeeperConfigSetting 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/11/13 18:10:27 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Xml.Linq; 15 | 16 | namespace SuperGMS.Config 17 | { 18 | /// 19 | /// ZKConfigSetting 20 | /// 21 | public class ZKConfigSetting 22 | { 23 | /// 24 | /// LoadConfig 25 | /// 26 | /// appName 27 | /// ip 28 | /// port 29 | /// xml 30 | public XElement LoadConfig(string appName, string ip, int port) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/SqlServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名: SqlServer 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 23:04:48 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Data; 17 | using System.Data.Common; 18 | using System.Text; 19 | using SuperGMS.DB.EFEx.CrudRepository; 20 | using SuperGMS.DB.EFEx.DynamicSearch; 21 | 22 | namespace SuperGMS.DB.EFEx.GrantDbFactory 23 | { 24 | /// 25 | /// SqlServer 26 | /// 27 | public class SqlServer : DbBase 28 | { 29 | public SqlServer(DbInfo dbInfo) 30 | : base(dbInfo) 31 | { 32 | } 33 | 34 | protected override string Prefix 35 | { 36 | get { return "@"; } 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/CodeDescAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.AttributeEx 4 | { 5 | /// 6 | /// 错误代码描述属性 7 | /// 8 | public class CodeDescAttribute : Attribute 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 默认构造函数,提供接口函数名称 和 错误描述信息 13 | /// 用于ErrorCode标记的枚举类的枚举属性上,辅助生成帮助文档 14 | /// 15 | /// 接口函数名称 16 | /// 错误描述信息 17 | public CodeDescAttribute(string desc, params string[] interfaceName) 18 | { 19 | InterfaceName = interfaceName; 20 | Description = desc; 21 | } 22 | 23 | /// 24 | /// Gets or sets 代码引用的接口 25 | /// 26 | public string[] InterfaceName { get; set; } 27 | 28 | /// 29 | /// Gets or sets 错误代码内容 30 | /// 31 | public string Description { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/Oracle.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名: Oracle 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 23:02:52 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Data; 17 | using System.Data.Common; 18 | using System.Text; 19 | using Dapper; 20 | using SuperGMS.Config; 21 | using SuperGMS.DB.EFEx.CrudRepository; 22 | using SuperGMS.DB.EFEx.DynamicSearch; 23 | 24 | namespace SuperGMS.DB.EFEx.GrantDbFactory 25 | { 26 | /// 27 | /// Oracle 28 | /// 29 | public class Oracle : DbBase 30 | { 31 | public Oracle(DbInfo dbInfo) 32 | : base(dbInfo) 33 | { 34 | } 35 | 36 | protected override string Prefix 37 | { 38 | get { return ":"; } 39 | } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /SuperGMS/ApiHelper/FieldDescInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SuperGMS.ApiHelper 4 | { 5 | public class FieldDescInfo 6 | { 7 | public string FieldName { get; set; } 8 | public string ControlType { get; set; } 9 | public string GroupName { get; set; } 10 | public int IsHidden { get; set; } 11 | public string DefaultValue { get; set; } 12 | public int ReadOnly { get; set; } 13 | public int EditReadOnly { get; set; } 14 | public int CanHidden { get; set; } 15 | public int IsRequired { get; set; } 16 | 17 | public string ValidateRule { get; set; } 18 | public int MaxLength { get; set; } 19 | public decimal NumberMax { get; set; } 20 | public decimal NumberMin { get; set; } 21 | public int IsDigits { get; set; } 22 | public int DecimalDigits { get; set; } 23 | public string DateFormat { get; set; } 24 | public string DateDefaultTime { get; set; } 25 | 26 | public Dictionary DicSource { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/SendMessageToUser.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Protocol.MQProtocol; 2 | using SuperGMS.Protocol.RpcProtocol; 3 | using SuperGMS.Rpc; 4 | using SuperGMS.Rpc.Server; 5 | using SuperGMS.WebSocketEx; 6 | 7 | namespace WebSocketService 8 | { 9 | /// 10 | /// 给指定的WebSocket客户端发送消息 11 | /// 12 | public class SendMessageToUser : RpcBaseServer, Nullables> 13 | { 14 | protected override Nullables Process(EventMsg valueArgs, out StatusCode code) 15 | { 16 | code = StatusCode.OK; 17 | SuperWebSocketManager.SendMessage(valueArgs); 18 | return Nullables.NullValue; 19 | } 20 | 21 | protected override bool Check(EventMsg args, out StatusCode code) 22 | { 23 | if (Context.Args.ct == ClientType.InnerRpc.ToString()||base.CheckLogin(args,out code)) 24 | { 25 | code = StatusCode.OK; 26 | return true; 27 | } 28 | 29 | code = StatusCode.Unauthorized; 30 | return false; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SuperGMS/Protocol/ApiProtocol/ApiArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol.ApiProtocol 5 | 文件名:ApiArgs.cs 6 | 创建者:grant(巩建春) 7 | CLR版本:4.0.30319.42000 8 | 时间:2020/8/18 星期二 11:05:16 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Protocol.ApiProtocol 16 | { 17 | /// 18 | /// 可以有自由定义WebApi参数个格式,不走标准格式 19 | /// 20 | /// 21 | public class ApiArgs 22 | { 23 | /// 24 | /// Http请求的Header头 25 | /// 26 | public Dictionary Headers { get; set; } 27 | 28 | /// 29 | /// Url ?后面的参数 30 | /// 31 | public Dictionary Params { get; set; } 32 | /// 33 | /// http body的内容 34 | /// 35 | public string Body { get; set; } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/SqlSugarDBContext.cs: -------------------------------------------------------------------------------- 1 | using SqlSugar; 2 | using SuperGMS.DB.EFEx.GrantDbFactory; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace SuperGMS.DB.EFEx.MyDbContext 10 | { 11 | public class SqlSugarDBContext : ISqlSugarDbContext 12 | { 13 | private DbInfo dbInfo; 14 | public DbInfo DbInfo => dbInfo; 15 | private ISqlSugarClient sqlSugarClient; 16 | 17 | public SqlSugarDBContext(DbInfo info) 18 | { 19 | dbInfo = info; 20 | } 21 | 22 | public void Dispose() 23 | { 24 | sqlSugarClient?.Ado.Close(); 25 | sqlSugarClient?.Ado.Dispose(); 26 | sqlSugarClient?.Dispose(); 27 | dbInfo=null; 28 | } 29 | 30 | public ISqlSugarClient GetRepository() 31 | { 32 | if(sqlSugarClient!=null) throw new Exception("SqlSugarDBContext.GetRepository(),在一个rpc上下文只能获取一次"); 33 | return sqlSugarClient = SqlRepositoryManager.GetSqlSugarClient(dbInfo); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SuperGMS/Config/LogConfig/LogConfig.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config.LogConfig 5 | 文件名: LogConfig 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/23 16:38:28 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config.LogConfig 16 | { 17 | /// 18 | /// LogConfig 19 | /// 20 | public class LogConfig 21 | { 22 | /// 23 | /// 24 | /// 25 | public string LogLocation { get; set; } 26 | 27 | /// 28 | /// 29 | /// 30 | public int ShowConsole { get; set; } 31 | 32 | public int LogLastError { get; set; } 33 | 34 | //过滤日志级别 35 | public string LogLevel { get; set; } 36 | 37 | /// 38 | /// 39 | /// 40 | public List Filter { get; set; } 41 | } 42 | } -------------------------------------------------------------------------------- /SuperGMS/ExceptionEx/FrameworkException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SuperGMS.ExceptionEx 4 | { 5 | /// 6 | /// 框架异常,上层业务类应该捕获框架类异常并做进一步处理 7 | /// 8 | public class FrameworkException : Exception 9 | { 10 | /// 11 | /// 构造的时候给一个异常说明 12 | /// 13 | /// 14 | protected FrameworkException(string message) : base(message) 15 | { 16 | 17 | } 18 | /// 19 | /// 构造的时候给一个异常说明 20 | /// 21 | /// 22 | /// 23 | protected FrameworkException(string message, Exception inner = null) : base(message, inner) 24 | { 25 | 26 | } 27 | 28 | public static FrameworkException CreateNew(string message) 29 | { 30 | return new FrameworkException(message); 31 | } 32 | public static FrameworkException CreateNew(string message,Exception ex) 33 | { 34 | return new FrameworkException(message, ex); 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DynamicSearch/TypeUtil.cs: -------------------------------------------------------------------------------- 1 | // 2 | // 文件:TypeUtil.cs 3 | // 作者:Grant 4 | // 最后更新日期:2014-06-05 14:29 5 | 6 | #region 7 | 8 | using System; 9 | using System.ComponentModel; 10 | 11 | #endregion 12 | 13 | namespace SuperGMS.DB.EFEx.DynamicSearch 14 | { 15 | /// 16 | /// Type类的处理工具类 17 | /// Add By Grant 2014-3-27 18 | /// 19 | public class TypeUtil 20 | { 21 | /// 22 | /// 如果类型是 类型? 或者 Nullable 类型的,直接转换成 原始类型 23 | /// 24 | /// 可Null类型 25 | /// 实际类型 26 | public static Type GetUnNullableType(Type conversionType) 27 | { 28 | if (conversionType.IsGenericType && conversionType.GetGenericTypeDefinition() == typeof(Nullable<>)) 29 | { 30 | //如果是泛型方法,且泛型类型为Nullable<>则视为可空类型 31 | //并使用NullableConverter转换器进行转换 32 | var nullableConverter = new NullableConverter(conversionType); 33 | conversionType = nullableConverter.UnderlyingType; 34 | } 35 | return conversionType; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/FileServer/FileCheckInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SuperGMS.Extend.FileServer 4 | { 5 | /// 6 | /// 文件检查信息 7 | /// 8 | public class FileCheckInfo 9 | { 10 | /// 11 | /// 消息处理 编号 12 | /// 13 | public string Guid { get; set; } 14 | 15 | /// 16 | /// 业务类型 17 | /// 18 | public string BussinessType { get; set; } 19 | 20 | /// 21 | /// 文件大小 22 | /// 23 | public int FileSize { get; set; } 24 | 25 | /// 26 | /// 发起请求的Token信息 27 | /// 28 | public string Token { get; set; } 29 | 30 | /// 31 | /// 上传文件名 32 | /// 33 | public string FileName { get; set; } 34 | 35 | /// 36 | /// 文件操作动作 37 | /// 38 | public FileOperateAction Action { get; set; } 39 | 40 | /// 41 | /// 其他扩展属性 42 | /// 43 | public Dictionary Other { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SuperGMS/Config/FileServer/FileServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: FileServer 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:22:46 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// FileServer 19 | /// 20 | public class FileServer 21 | { 22 | /// 23 | /// 24 | /// 25 | public List Items { get; set; } 26 | 27 | 28 | //public static FileServer Default 29 | //{ 30 | // get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } 31 | //} 32 | 33 | public const string DefaultJson = @"{ ""FileServer"": { 34 | ""Items"": [ 35 | { 36 | ""Url"": ""http://192.168.100.214/file_server"" 37 | } 38 | ] 39 | }}"; 40 | } 41 | } -------------------------------------------------------------------------------- /SuperGMS/Config/RemoteJsonFile/RemoteJsonFileConfigurationSource.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | 3 | namespace SuperGMS.Config.RemoteJsonFile 4 | { 5 | public class RemoteJsonFileConfigurationSource : object, IConfigurationSource 6 | { 7 | /// 8 | /// The Uri for download file. 9 | /// 10 | public string Uri { get; set; } 11 | 12 | /// 13 | /// Determines if loading the file is optional. 14 | /// 15 | public bool Optional { get; set; } 16 | /// 17 | /// Builds the for this source. 18 | /// 19 | /// The . 20 | /// A 21 | public IConfigurationProvider Build(IConfigurationBuilder builder) 22 | { 23 | return new RemoteJsonFileConfigurationProvider(this); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SuperGMS/MQ/RabbitMQ/Config/ExchangeType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.RabbitMQ.Config 5 | 文件名:ExchangeType 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/20 14:26:15 9 | 10 | 功能描述:交换机类型 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.MQ.RabbitMQ 15 | { 16 | /// 17 | /// 交换机类型 18 | /// 19 | public class ExchangeType 20 | { 21 | /// 22 | /// 直接投送模式,关键字完全匹配 23 | /// 24 | public const string Direct = "direct"; 25 | /// 26 | /// 键值对匹配模式 27 | /// 28 | public const string Headers = "headers"; 29 | /// 30 | /// 绑定广播模式,所有绑定到Exchange上的队列都会投送 31 | /// 32 | public const string Fanout = "fanout"; 33 | /// 34 | /// 主题匹配模式,模糊匹配 35 | /// 36 | public const string Topic = "topic"; 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/Rolefunction.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.UserSession.UserLoginInfo 5 | 文件名:Rolefunction 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:59:07 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.UserSession.UserLoginInfo 14 | { 15 | /// 16 | /// 17 | /// 18 | /// 19 | public class Rolefunction 20 | { 21 | /// 22 | /// 角色Id 23 | /// 24 | public int RoleId { get; set; } 25 | /// 26 | /// 功能按钮列 27 | /// 28 | public int FunctionId { get; set; } 29 | /// 30 | /// 菜单Id 31 | /// 32 | public string MenuId { get; set; } 33 | /// 34 | /// 系统Id 35 | /// 36 | public string SysId { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/FunctionInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.UserSession 2 | { 3 | /// 4 | /// 功能列表信息 5 | /// 6 | public class FunctionInfo 7 | { 8 | /// 9 | /// 功能按钮Id 10 | /// 11 | public string FunctionId { get; set; } 12 | /// 13 | /// 功能按钮菜单 14 | /// 15 | public string FunctionName { get; set; } 16 | /// 17 | /// 操作类型 List/add/update/del/view 18 | /// 19 | public string ViewType { get; set; } 20 | /// 21 | /// 系统Id 22 | /// 23 | public string SysId { get; set; } 24 | /// 25 | /// 菜单Id 26 | /// 27 | public string MenuId { get; set; } 28 | /// 29 | /// 微服务名称 30 | /// 31 | public string ServiceName { get; set; } 32 | /// 33 | /// 接口名称 34 | /// 35 | public string ApiName { get; set; } 36 | /// 37 | /// 排序 38 | /// 39 | public int SortNo { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SuperGMS/Protocol/RpcProtocol/ClientType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol.RpcProtocol 5 | 文件名: ClientType 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/21 13:47:55 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Protocol.RpcProtocol 15 | { 16 | /// 17 | /// ClientType 18 | /// 19 | public enum ClientType 20 | { 21 | /// 22 | /// web前端,需要检查接入ip或者域名 23 | /// 24 | Web, 25 | 26 | /// 27 | /// 移动app 28 | /// 29 | App, 30 | 31 | /// 32 | /// 微信 33 | /// 34 | WeiXin, 35 | 36 | /// 37 | /// 第三方 38 | /// 39 | ThirdPart, 40 | 41 | /// 42 | /// 内部微服务,前端接入层会拦截这个类型 43 | /// 44 | InnerRpc, 45 | 46 | /// 47 | /// 未知类型 48 | /// 49 | Unkunwn, 50 | } 51 | } -------------------------------------------------------------------------------- /SuperGMS/Config/HttpProxy/HttpProxy.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: HttpProxy 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:18:49 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// HttpProxy 19 | /// 20 | public class HttpProxy 21 | { 22 | /// 23 | /// 24 | /// 25 | public List Items { get; set; } 26 | 27 | //public static HttpProxy Default 28 | //{ 29 | // get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } 30 | //} 31 | 32 | public const string DefaultJson = @"{ ""HttpProxy"": { 33 | ""Items"": [ 34 | { 35 | ""Name"": ""ExpService1"" 36 | }, 37 | { 38 | ""Name"": ""ExpService2"" 39 | } 40 | ] 41 | }}"; 42 | } 43 | } -------------------------------------------------------------------------------- /SuperGMS/说明.txt: -------------------------------------------------------------------------------- 1 | 1、理论上在任何服务初始化之前请先ServerSetting.Initlize(appName); 2 | 2、因为我们做的微服务是自动注册的,所以这个appName是在启动前自动生成的所以初始化:ServerProxy.Register();里面已经主动初始化了ServerSetting, 3 | 所以如果是发布成微服务的,第1点是不需要的 4 | 3、在初始化完ServerProxy之后,才可以继续初始化其他的,如:CacheManager.Initlize(),MQHostConfigManager.Initlize() 5 | 6 | 这里是重点: 7 | 系统支持三种配置类型来适应不同部署场景: 8 | 1、单机部署所有微服务: 9 | 在所有微服务部署的同级目录配置Conf目录,里面包含config.json的完整配置,这里说的完整是指所有微服务的配置集中到一个文件,包括database.config,sqlmap.config,通过这三个文件配置所有本台机器上的服务 10 | ConfigType=1 PortList必须配置; 11 | 2、Zookeeper在线上要求灵活部署,自动配置和容灾时这样配置,详见Zookeeper的配置; 12 | ConfigType=2 Ip="本机Ip" PortList必须配置 Ip="zk地址" timeout="连接zk超时时间" 13 | 3、私有化多机器集群配置: 14 | 在所有机器的微服务同级目录Conf,里面配置config.json配置内容如下: 15 | { 16 | "ServerConfig": { 17 | "ConfigCenter": { 18 | "ConfigType": 3, 19 | "Ip": "http://a.com/config/config.json" 20 | } 21 | } 22 | ConfigType=3 Ip="配置中心文件地址" 配置中心这个文件需要放置在当前集群所有机器都可以访问的一个web站点中(IIS,或者Nginx) 这个配置文件可以是前两种配置类型,但是一定不能是第三种类型,防止配置死循环 23 | } 24 | 4、最后说明,配置文件的优先级问题: 25 | a、程序启动会先检查当前运行目录下的config.json , 26 | b、如果找不到然后会找同级目录是否有Conf中config.json 27 | c、如果这两个地方都没有,则保持找不到配置文件,如果找到则配置文件正常; 28 | d、如果c步骤正常,会根据配置的ConfigType是否为3 即 httpFile 如果是 则根据配置Ip 其实这里是个完整的url 指向了另外一个config.json ,会下载这个配置进行初始化 29 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/ISuperGMSRpcClient.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc 5 | 文件名:IGrantClient 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/5/8 15:11:38 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Rpc 16 | { 17 | public interface ISuperGMSRpcClient:IDisposable 18 | { 19 | /// 20 | /// 连接信息 21 | /// 22 | ClientItem Item { get; } 23 | /// 24 | /// 发送数据 25 | /// 26 | /// 27 | /// 28 | /// 29 | bool Send(string args,string m,out string result); 30 | /// 31 | /// 关闭掉,物理释放,这里把Dispose特殊用途了, 32 | /// 所以另外起了个关闭的名字,不清楚不要随便用 33 | /// 34 | void Close(); 35 | 36 | /// 37 | /// 是否连接状态 38 | /// 39 | bool IsConnected { get; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/DataBase.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: DataBase 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 13:03:43 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// DataBase 17 | /// 18 | public class DataBase 19 | { 20 | public string RefFile { get; set; } 21 | 22 | /// 23 | /// 数据库文件引用路径 24 | /// 25 | public string DbFile { get; set; } 26 | 27 | public string SqlFile { get; set; } 28 | 29 | //public static DataBase Default 30 | //{ 31 | // get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } 32 | //} 33 | 34 | public static string DefaultJson(string env) => @"{ ""DataBase"": { 35 | ""RefFile"": ""true"", 36 | ""DbFile"": ""database." + (string.IsNullOrEmpty(env)?"":env+".") + @"config"", 37 | ""SqlFile"": ""sqlmap.config"" 38 | }}"; 39 | } 40 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/CrudRepository/DapperCrudRepository.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.CrudRepository 5 | 文件名: DapperCrudRepository 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 22:00:13 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.DB.EFEx 15 | { 16 | // 已经被ISqlRepository的实现类替代,如Mysql, 17 | /// 18 | /// DapperCrudRepository 19 | /// 20 | // public class DapperCrudRepository : ISqlRepository 21 | // { 22 | // private DbInfo _dbInfo; 23 | 24 | // public DapperCrudRepository(DbConnection dbConn, DbInfo dbInfo) 25 | // { 26 | // _DbConnection = dbConn; 27 | // _dbInfo = dbInfo; 28 | // } 29 | 30 | // public List SqlQuery(string sql, params object[] parameters) 31 | // { 32 | // throw new NotImplementedException(); 33 | // } 34 | 35 | // public int ExecuteSqlCommand(string sql, params object[] parameters) 36 | // { 37 | // throw new NotImplementedException(); 38 | // } 39 | // } 40 | } -------------------------------------------------------------------------------- /SuperGMS/ExceptionEx/BusinessException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SuperGMS.Protocol.RpcProtocol; 3 | 4 | namespace SuperGMS.ExceptionEx 5 | { 6 | /// 7 | /// 业务异常,用来区分是代码级别的异常还是逻辑类的异常 8 | /// 业务的状态码必须大于600 9 | /// 10 | public class BusinessException : Exception 11 | { 12 | private StatusCode _code; 13 | 14 | public StatusCode Code { get { return _code; } } 15 | 16 | /// 17 | /// 构造的时候给一个异常说明 18 | /// 19 | /// 20 | public BusinessException(StatusCode code) : base(code.msg) 21 | { 22 | _code = code; 23 | } 24 | 25 | /// 26 | /// 默认返回600,如果有特殊流程自己定义大于600的即可 27 | /// 28 | /// 29 | public BusinessException(string msg) : base(msg) 30 | { 31 | _code = new StatusCode(600, msg); 32 | } 33 | 34 | /// 35 | /// 默认返回600,如果有特殊流程自己定义大于600的即可 36 | /// 37 | /// 38 | public BusinessException(string msg, Exception exception) : base(msg, exception) 39 | { 40 | _code = new StatusCode(600, msg); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /SuperGMS/FileEx/ISftpClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace SuperGMS.FileEx 4 | { 5 | public interface ISftpClient 6 | { 7 | bool Connected { get; } 8 | bool Connect(); 9 | void Disconnect(); 10 | bool Put(string localPath, string remotePath); 11 | bool Put(byte[] fileContent, string remotePath); 12 | bool PutStream(System.IO.Stream localFile, string remotePath); 13 | bool Move(string oldPath, string newPath); 14 | void Get(string fromFilePath); 15 | void Get(string[] fromFilePaths); 16 | void Get(string[] fromFilePaths, string toDirPath); 17 | void Get(string fromFilePath, string toFilePath); 18 | bool Delete(string remoteFile); 19 | ArrayList GetFileList(string remotePath, string fileType); 20 | ArrayList GetFileList(string path); 21 | 22 | /// 23 | /// 目录是否存在 24 | /// 25 | /// 目录名称必须从根开始 26 | /// 27 | bool DirExist(string dirName); 28 | 29 | /// 30 | /// 创建目录 31 | /// 32 | /// 目录名称必须从根开始 33 | /// 34 | void Mkdir(string dirName); 35 | } 36 | } -------------------------------------------------------------------------------- /SuperGMS/Config/RabbitMQ/HostItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: HostItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:12:50 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// HostItem 17 | /// 18 | public class HostItem 19 | { 20 | /// 21 | /// 22 | /// 23 | public string Name { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | public string Ip { get; set; } 29 | 30 | /// 31 | /// 32 | /// 33 | public int Port { get; set; } 34 | 35 | /// 36 | /// 37 | /// 38 | public string UserName { get; set; } 39 | 40 | /// 41 | /// 42 | /// 43 | public string PassWord { get; set; } 44 | 45 | /// 46 | /// 最大允许未Ack的消息数量 47 | /// 48 | public ushort NoAckMsgCount { get; set; } 49 | } 50 | } -------------------------------------------------------------------------------- /SuperGMS/Log/LogFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using NLog.Extensions.Logging; 3 | 4 | namespace SuperGMS.Log 5 | { 6 | /// 7 | /// 日志记录器工厂 8 | /// 9 | public static class LogFactory 10 | { 11 | private readonly static LoggerFactory _fac; 12 | 13 | public static LoggerFactory LoggerFactory 14 | { 15 | get { return _fac; } 16 | } 17 | /// 18 | /// 构造一个文件日志提供者 19 | /// 20 | static LogFactory() 21 | { 22 | _fac = new LoggerFactory(); 23 | _fac.AddProvider(new NLogLoggerProvider()); 24 | } 25 | /// 26 | /// 构造日志记录器 27 | /// 28 | /// 分类 29 | /// 日志记录 30 | public static ILogger CreateLogger(string categoryName = "FrameWork") 31 | { 32 | return _fac.CreateLogger(categoryName); 33 | } 34 | /// 35 | /// 构造日志记录器 36 | /// 37 | /// 记录器使用泛型名称 38 | /// 39 | public static ILogger CreateLogger() 40 | { 41 | return _fac.CreateLogger(typeof(T).FullName); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SuperGMS/Config/RabbitMQ/RabbitMQ.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: RabbitMQ 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 13:13:10 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// RabbitMQ 19 | /// 20 | public class RabbitMQ 21 | { 22 | /// 23 | /// 24 | /// 25 | public List Host { get; set; } 26 | 27 | //public static RabbitMQ Default 28 | //{ 29 | // get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } 30 | //} 31 | 32 | public const string DefaultJson = @"{ ""RabbitMQ"": { 33 | ""Host"": [ 34 | { 35 | ""Name"": ""Default"", 36 | ""Ip"": ""192.168.0.11"", 37 | ""Port"": 5672, 38 | ""UserName"": ""admin"", 39 | ""PassWord"": ""admin"", 40 | ""NoAckMsgCount"": 3 41 | } 42 | ] 43 | }}"; 44 | } 45 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/Extensions/TaskExArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Extend.Extensions 5 | 文件名: TaskExArgs 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/4 15:32:34 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Extend.Extensions 16 | { 17 | /// 18 | /// TaskExArgs 19 | /// 20 | public class TaskExArgs 21 | { 22 | /// 23 | /// 每一行记录 24 | /// 25 | public T Row { get; set; } 26 | 27 | /// 28 | /// 用户需要传递给执行方法的上下文 29 | /// 30 | public object UserCtx { get; set; } 31 | 32 | /// 33 | /// Gets or sets 原始记录 34 | /// 35 | public T[] Tables { get; set; } 36 | 37 | /// 38 | /// Gets or sets 当前行在Tables 中的索引 39 | /// 40 | public int RowIndx { get; set; } 41 | 42 | /// 43 | /// 前面执行数据的结果集 44 | /// 45 | public List> TaskResult { get; set; } 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /SuperGMS/Config/LogConfig/Filter.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config.LogConfig 5 | 文件名: Filter 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/23 16:39:05 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config.LogConfig 14 | { 15 | /// 16 | /// Filter 17 | /// 18 | public class Filter 19 | { 20 | /// 21 | /// 22 | /// 23 | public string FilterGroup { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | public string FilterApiName { get; set; } 29 | 30 | /// 31 | /// 32 | /// 33 | public string FilterServiceName { get; set; } 34 | 35 | /// 36 | /// 37 | /// 38 | public string FilterWords { get; set; } 39 | 40 | /// 41 | /// 42 | /// 43 | public string LogLevel { get; set; } 44 | 45 | /// 46 | /// 47 | /// 48 | public int MaxSize { get; set; } 49 | } 50 | } -------------------------------------------------------------------------------- /SuperGMS/DB/MapperEx/AutoMapperTool.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | 3 | namespace SuperGMS.DB.MapperEx 4 | { 5 | using System; 6 | using System.Text.RegularExpressions; 7 | 8 | /// 9 | /// Auto Mapper 注册工具类 10 | /// 11 | public static class AutoMapperTool 12 | { 13 | /// 14 | /// AutoMapper实例 15 | /// 16 | public static Mapper Mapper => mapper == null ? throw new Exception("请先在系统启动时调用AutoMapperTool.Initlize方法"): mapper; 17 | private static Mapper mapper = null; 18 | private static object lockObj = new object(); 19 | 20 | /// 21 | /// 初始化AutoMapper 22 | /// 23 | /// 24 | public static void Initlize(Profile profiles) 25 | { 26 | if (mapper == null) 27 | lock (lockObj) 28 | { 29 | if (mapper == null) 30 | { 31 | var configuration = new MapperConfiguration(cfg => 32 | { 33 | cfg.AddProfile(profiles); 34 | }); 35 | 36 | mapper = new Mapper(configuration); 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SuperGMS/Log/LogBase.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Protocol.RpcProtocol; 2 | using System; 3 | 4 | namespace SuperGMS.Log 5 | { 6 | /// 7 | /// 日志基类,抽象类,实现 公共方法 8 | /// 9 | public abstract class LogBase 10 | { 11 | /// 12 | /// 设置结果信息日志 13 | /// 14 | /// 参数信息 15 | /// 结果信息 16 | /// 异常 17 | public abstract void SetInfo(Args args, Result result = null, Exception ex = null); 18 | 19 | /// 20 | /// 自增序号 21 | /// 22 | public long Id { get; set; } 23 | /// 24 | /// 事务ID 25 | /// 26 | public string TransactionId { get; set; } 27 | 28 | /// 29 | /// 描述 30 | /// 31 | public string Desc { get; set; } 32 | 33 | /// 34 | /// 微服务名 35 | /// 36 | public string ServiceName { get; set; } 37 | 38 | /// 39 | /// api名称 40 | /// 41 | public string ApiName { get; set; } 42 | 43 | /// 44 | /// 创建日期 45 | /// 46 | public DateTime CreatedDate { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SuperGMS/Cache/ResourceCache.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Cache 5 | 文件名: DefaultCache 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/23 17:32:53 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | 15 | namespace SuperGMS.Cache 16 | { 17 | /// 18 | /// 资源文件 19 | /// 20 | //[InitlizeMethod] 21 | public class ResourceCache 22 | { 23 | private static ICache _instance; 24 | 25 | /// 26 | /// 操作redis的实例 27 | /// 28 | public static ICache Instance 29 | { 30 | get { return _instance; } 31 | } 32 | 33 | //[InitlizeMethod] 34 | internal static void Initlize() 35 | { 36 | _instance = new RedisCache("resource"); 37 | } 38 | 39 | /// 40 | /// 单元测试时, Mock 缓存时,使用,手动初始化 41 | /// 42 | /// Mock 的缓存 43 | internal static void Initlize(ICache cache) 44 | { 45 | if (_instance == null && cache != null) 46 | { 47 | _instance = cache; 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/SysDbInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SuperGMS.UserSession 2 | { 3 | /// 4 | /// 租户数据库信息 5 | /// 6 | public class SysDbInfo 7 | { 8 | 9 | /// 10 | /// Gets or sets 系统ID 11 | /// 12 | public string SysID { get; set; } 13 | 14 | 15 | /// 16 | /// Gets or sets 数据库User 17 | /// 18 | public string DBUser { get; set; } 19 | 20 | /// 21 | /// Gets or sets 数据库Pwd 22 | /// 23 | public string DBPwd { get; set; } 24 | 25 | /// 26 | /// Gets or sets 数据库Name 27 | /// 28 | public string DBName { get; set; } 29 | 30 | /// 31 | /// Gets or sets 数据库地址 32 | /// 33 | public string DBIP { get; set; } 34 | 35 | /// 36 | /// Gets or sets 数据库类型 37 | /// 38 | public string DBType { get; set; } 39 | 40 | /// 41 | /// Gets or sets 跟dbcontext对应数据库模型名称,用于获取dbcontext的连接信息 42 | /// 43 | public string DbModelName { get; set; } 44 | 45 | /// 46 | /// Gets or sets 数据库端口号 47 | /// 48 | public int DbPort { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SuperGMS/Protocol/RpcProtocol/ArgsEx.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol.RpcProtocol 5 | 文件名: ArgsEx 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/3/5 13:08:19 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Protocol.RpcProtocol 14 | { 15 | /// 16 | /// ArgsEx 17 | /// 18 | public static class ArgsEx 19 | { 20 | /// 21 | /// 拷贝一个当前上下文的args,作为下一个内部调用的args使用, 22 | /// 这里除了m和v没有拷贝,需要调用时赋值,其他都会原样拷贝结构和值 23 | /// 24 | /// 当前上下文的args 25 | /// 返回除了m和v之外全新的Args 26 | public static Args Copy(this Args args) 27 | { 28 | return new Args() 29 | { 30 | cs = args.cs, 31 | ct = args.ct, 32 | cv = args.cv, 33 | Headers = args.Headers, 34 | icp = args.icp, 35 | lg = args.lg, 36 | rid = args.rid, 37 | mv = args.mv, 38 | tk = args.tk, 39 | uri = args.uri, 40 | }; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SuperGMS/Config/ServerConfig.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: Configuration 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 11:56:47 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Config 15 | { 16 | public class ServerConfig 17 | { 18 | /// 19 | /// rpcService 20 | /// 21 | public RpcService RpcService { get; set; } 22 | 23 | public ConfigCenter ConfigCenter { get; set; } 24 | 25 | //public static ServerConfig Default { get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } } 26 | public static string DefaultJson(string appName) => string.Concat(@"{ 27 | ""ServerConfig"": { 28 | ""RpcService"": { 29 | ""Pool"": 0, 30 | ""Ip"": ""192.168.100.*"", 31 | ""Port"": 0, 32 | ""PortList"": { 33 | """+appName+ @""": 19999 34 | }, 35 | ""ServerType"": 1, 36 | ""RouterType"": 2, 37 | ""AssemblyPath"": null, 38 | ""TimeOut"": 0, 39 | ""Enable"": true 40 | } 41 | } 42 | }"); 43 | } 44 | } -------------------------------------------------------------------------------- /SuperGMS/MQ/ConstManager.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantMQ 5 | 文件名:ConstManager 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/21 11:32:58 9 | 10 | 功能描述:这个只在框架里面用,外面自己定义 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.MQ 15 | { 16 | /// 17 | /// 定义交换机相关的常量 18 | /// 19 | internal class ExchangeConst 20 | { 21 | public const string DefaultExchange = "GrantExchange.direct"; 22 | public const string DefaultFanoutExchange = "GrantExchange.fanout"; 23 | } 24 | /// 25 | /// 虚拟机 26 | /// 27 | internal class VirtualHostConst 28 | { 29 | public const string DefaultVirtualHost = "DefaultVirtualHost"; 30 | } 31 | /// 32 | /// 定义队列名称常量 33 | /// 34 | internal class MQueueConst 35 | { 36 | public const string DefaultGrantMQ = "DefaultGrantMQ"; 37 | } 38 | 39 | /// 40 | /// 路由key,根据这个key进行分发路由 41 | /// 42 | internal class RouterKeyConst 43 | { 44 | public const string DefaultRouterKey = "DefaultRouterKey"; 45 | 46 | } 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /SuperGMS/Zookeeper/ZKConnectionWatcher.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Zookeeper 5 | 文件名: ZKConnectionWatcher 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/16 14:57:20 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using org.apache.zookeeper; 14 | 15 | using System.Threading; 16 | using System.Threading.Tasks; 17 | 18 | namespace SuperGMS.Zookeeper 19 | { 20 | /// 21 | /// ZKConnectionWatcher 22 | /// 23 | public class ZKConnectionWatcher : BaseWatcher 24 | { 25 | public override Task process(WatchedEvent @event) 26 | { 27 | Event.KeeperState state = @event.getState(); 28 | switch (state) 29 | { 30 | case Event.KeeperState.AuthFailed: 31 | case Event.KeeperState.Disconnected: 32 | case Event.KeeperState.Expired: 33 | //case Event.KeeperState.SyncConnected: 34 | var task = new Task(() => { Thread.Sleep(1000); this.CallBack(null,this,state.ToString()); }); 35 | task.Start(); 36 | return task; 37 | } 38 | 39 | return Task.FromResult(1); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SuperGMS/MQ/RabbitMQ/Config/Exchange.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.RabbitMQ 5 | 文件名:RabbitMQConfig 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/20 13:25:16 9 | 10 | 功能描述:一个虚拟主机上的一个交换机 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.MQ.RabbitMQ 15 | { 16 | /// 17 | /// 交换机 18 | /// 19 | public class Exchange 20 | { 21 | /// 22 | /// 所属虚拟Host 23 | /// 24 | public VirtualHost VHost { get; set; } 25 | /// 26 | /// 交换机名称 27 | /// 28 | public string ExchangeName { get; set; } 29 | /// 30 | /// 投送模式 31 | /// 32 | public string ExchangeType { get; set; } 33 | 34 | /// 35 | /// 是否是持久化的交换机 36 | /// 37 | public bool Durable { get; set; } 38 | /// 39 | /// 是否可以自动创建 40 | /// 41 | public bool AutoDeclare { get; set; } 42 | /// 43 | /// 是否可以在空闲时自动删除 44 | /// 45 | public bool AutoDelete { get; set; } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/SystemInfo.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.UserSession 5 | 文件名:SystemInfo 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:59:07 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.UserSession 14 | { 15 | /// 16 | /// 17 | /// 18 | /// 19 | public class SystemInfo 20 | { 21 | /// 22 | /// 系统Id 23 | /// 24 | public string SysId { get; set; } 25 | /// 26 | /// 系统名称 27 | /// 28 | public string SysName { get; set; } 29 | /// 30 | /// 菜单显示在那种类型的终端上 31 | /// 32 | public string PlatFormType { get; set; } 33 | /// 34 | /// 排序 35 | /// 36 | public int SortNo { get; set; } 37 | /// 38 | /// 系统图片 39 | /// 40 | public string DefaultIcon { get; set; } 41 | /// 42 | /// 系统首页地址 43 | /// 44 | public string DefaultUrl { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SuperGMS/Router/RouterType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Router 5 | 文件名:RouterType 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/5/8 16:17:34 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Router 16 | { 17 | public enum RouterType 18 | { 19 | /// 20 | /// 一致性Hash 21 | /// 22 | Hash=1, 23 | /// 24 | /// 随机 25 | /// 26 | Random=2, 27 | 28 | /// 29 | /// 轮询 30 | /// 31 | Polling=3, 32 | 33 | } 34 | 35 | /// 36 | /// 路由类型转换 37 | /// 38 | public class RouterTypeParse 39 | { 40 | /// 41 | /// 路由类型转换 42 | /// 43 | /// 44 | /// 45 | public static RouterType Parse(string routerType) 46 | { 47 | RouterType r = RouterType.Hash; 48 | if (Enum.TryParse(routerType, out r)) 49 | r=RouterType.Hash; 50 | return r; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbFactory/DBConnection.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.DB.EFEx.GrantDbFactory 5 | 文件名: GrantDBConnection 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/8/28 18:16:22 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Data; 16 | using System.Data.Common; 17 | using System.Text; 18 | 19 | namespace SuperGMS.DB.EFEx.GrantDbFactory 20 | { 21 | /// 22 | /// GrantDBConnection 23 | /// 24 | public class DBConnection:IDisposable 25 | { 26 | private DbConnection _connection; 27 | public DBConnection(DbConnection connection) 28 | { 29 | this._connection = connection; 30 | } 31 | public DbConnection Connection { get { return _connection; } } 32 | 33 | /// 34 | /// 后面改成连接池的释放 35 | /// 36 | public void Dispose() 37 | { 38 | if (_connection != null) 39 | { 40 | if(_connection.State == ConnectionState.Open) 41 | { 42 | _connection.Close(); 43 | } 44 | _connection.Dispose(); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/BackGroundMessage/SetBackGroudMessageArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:grant.RpcProxy.GlobalTools.BackGroundMessage 5 | 文件名: SetBackGroudMessageArgs 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/30 10:23:11 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using SuperGMS.Protocol.RpcProtocol; 15 | 16 | namespace SuperGMS.Extend.BackGroundMessage 17 | { 18 | using System; 19 | 20 | /// 21 | /// SetBackGroudMessageArgs 22 | /// 23 | public class SetBackGroudMessageArgs 24 | { 25 | public string Data { get; set; } 26 | 27 | /// 28 | /// 如果这个是点对点消息,此值为Router 如果是扇波消息则为ExChangeName 29 | /// 30 | public string MQRouterName { get; set; } 31 | 32 | public string TtId { get; set; } 33 | 34 | public int UserId { get; set; } 35 | 36 | public DateTime CreateDateTime { get; set; } 37 | 38 | public string BussinessId { get; set; } 39 | 40 | // public string Rid { get; set; } 41 | 42 | // public string Tk { get; set; } 43 | public Args Args { get; set; } 44 | } 45 | 46 | public class SetBackGroudMessageResult 47 | { 48 | public string TaskGuid { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SuperGMS/Config/ConstKeyValue/ConstKeyValue.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: ConstKeyValue 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:09:53 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// ConstKeyValue 19 | /// 20 | 21 | public class ConstKeyValue 22 | { 23 | /// 24 | /// 25 | /// 26 | public List Items { get; set; } 27 | 28 | //public static ConstKeyValue Default 29 | //{ 30 | // get { return Newtonsoft.Json.JsonConvert.DeserializeObject(DefaultJson); } 31 | //} 32 | 33 | public const string DefaultJson = @"{""ConstKeyValue"": { 34 | ""Items"": [ 35 | { 36 | ""Key"": ""MaxHttpBody"", 37 | ""Value"": ""104857600"" 38 | }, 39 | { 40 | ""Key"": ""TrackSql"", 41 | ""Value"": ""true"" 42 | }, 43 | { 44 | ""Key"": ""HttpProxy"", 45 | ""Value"": ""http://192.168.100.2/v2_api/"" 46 | } 47 | ] 48 | }}"; 49 | } 50 | } -------------------------------------------------------------------------------- /SuperGMS/Tools/FileHelper.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Tools 5 | 文件名: FileHelper 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/31 10:49:20 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.IO; 15 | 16 | namespace SuperGMS.Tools 17 | { 18 | /// 19 | /// FileHelper 20 | /// 21 | public class FileHelper 22 | { 23 | /// 24 | /// 按路径读取文件 25 | /// 26 | /// 文件的完整路径 27 | /// 文件内容 28 | public static string ReadFile(string filePath) 29 | { 30 | // filePath = AppContext.BaseDirectory + filePath; 这是个公共方法,路径应该从外面构造,要不就乱套了,这个方法只能按外面的路径来读文件,不应该有任何路径上的处理 31 | if (string.IsNullOrEmpty(filePath)) 32 | { 33 | throw new Exception($"FileHelper.ReadFile.Error,文件路径不为空"); 34 | } 35 | 36 | if (!File.Exists(filePath)) 37 | { 38 | throw new Exception($"{filePath}文件路径不存在"); 39 | } 40 | 41 | using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) 42 | { 43 | StreamReader reader = new StreamReader(stream); 44 | return reader.ReadToEnd(); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SuperGMS/MQ/RabbitMQ/MQConnection.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.MQ.RabbitMQ 5 | 文件名: MQConnection 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/5/14 15:37:23 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using RabbitMQ.Client; 14 | 15 | using System; 16 | 17 | namespace SuperGMS.MQ.RabbitMQ 18 | { 19 | /// 20 | /// MQConnection 21 | /// 22 | public class MQConnection : IDisposable 23 | { 24 | public MQConnection(IConnection connection,string key) 25 | { 26 | _connection = connection; 27 | _key = key; 28 | } 29 | 30 | private string _key; 31 | 32 | public string Key { 33 | get { return _key; } 34 | } 35 | 36 | private IConnection _connection; 37 | 38 | public IConnection Connection { 39 | get { return _connection; } 40 | } 41 | 42 | public void Close() 43 | { 44 | try 45 | { 46 | _connection?.Close(); 47 | _connection?.Dispose(); 48 | } 49 | catch 50 | { 51 | //关闭、释放MQ连接异常,暂不做处理 52 | } 53 | } 54 | 55 | public void Dispose() 56 | { 57 | MQConnectionManager.RelaceConnection(this,_key); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /SuperGMS/Protocol/ApiProtocol/ApiResult.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol.ApiProtocol 5 | 文件名:ApiResult.cs 6 | 创建者:grant(巩建春) 7 | CLR版本:4.0.30319.42000 8 | 时间:2020/8/18 星期二 11:09:32 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | using System.Net; 15 | using System.Text; 16 | 17 | namespace SuperGMS.Protocol.ApiProtocol 18 | { 19 | /// 20 | /// 21 | /// 22 | /// 23 | public class ApiResult 24 | { 25 | /// 26 | /// 返回的Body内容 27 | /// 28 | public string Body { get; set; } 29 | /// 30 | /// 要写给客户端的Header内容 31 | /// 32 | public Dictionary Headers { get; set; } 33 | 34 | /// 35 | /// 写给客户端的cookies 36 | /// 37 | public Dictionary Cookies { get; set; } 38 | 39 | /// 40 | /// 返回内容的格式 41 | /// 42 | public string ContentType { get; set; } 43 | 44 | /// 45 | /// 编码 46 | /// 47 | public Encoding Encoding { get; set; } 48 | 49 | /// 50 | /// 返回给对方的HttpCode 51 | /// 52 | public HttpStatusCode Code { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/Menu.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.UserSession 5 | 文件名:Menu 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:59:07 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.UserSession 14 | { 15 | /// 16 | /// 17 | /// 18 | /// 19 | public class Menu 20 | { 21 | /// 22 | /// 系统Id 23 | /// 24 | public string SysId { get; set; } 25 | /// 26 | /// 菜单Id 27 | /// 28 | public string MenuId { get; set; } 29 | /// 30 | /// 菜单名称 31 | /// 32 | public string MenuName { get; set; } 33 | /// 34 | /// 父菜单Id 35 | /// 36 | public string ParentId { get; set; } 37 | 38 | /// 39 | /// 排序 40 | /// 41 | public string SortNo { get; set; } 42 | 43 | /// 44 | /// 是否展示,有时只为控制按钮,不展示在菜单上 45 | /// 46 | public int Display { get; set; } 47 | 48 | /// 49 | /// 菜单下的按钮列表, 便于查询,这里不构造树结构 50 | /// 51 | //public List Functions { get; set; } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SuperGMS/MQ/RabbitMQ/Config/VirtualHost.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.RabbitMQ.Config 5 | 文件名:VirtualHost 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/20 14:23:04 9 | 10 | 功能描述:一个MQ的虚拟Host主要是用于用户隔离 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.MQ.RabbitMQ 15 | { 16 | /// 17 | /// 虚拟主机 18 | /// 19 | public class VirtualHost 20 | { 21 | /// 22 | /// 虚拟主机名 23 | /// 24 | public string HostName { get; set; } 25 | /// 26 | /// 物理主机,ip或者机器名称,用于建立连接 27 | /// 28 | public string Host { get; set; } 29 | /// 30 | /// 端口 31 | /// 32 | public int Port { get; set; } 33 | /// 34 | /// 登录名 35 | /// 36 | public string Username { get; set; } 37 | /// 38 | /// 登录密码 39 | /// 40 | public string Password { get; set; } 41 | 42 | /// 43 | /// 最大允许未Ack的消息数量 44 | /// 45 | public ushort NoAckMsgCount { get; set; } 46 | 47 | 48 | public override string ToString() 49 | { 50 | return $"HostName:{HostName},Host:{Host},Port:{Port},NoAckMsgCount:{NoAckMsgCount}"; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SuperGMS/Zookeeper/ServiceRouterWatcher.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Zookeeper 5 | 文件名: ServiceWatcher 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/2/23 17:05:26 9 | 10 | 功能描述:监听微服务状态,包括注册,离线 11 | 12 | ----------------------------------------------------------------*/ 13 | using org.apache.zookeeper; 14 | 15 | using System.Threading; 16 | using System.Threading.Tasks; 17 | 18 | namespace SuperGMS.Zookeeper 19 | { 20 | /// 21 | /// ServiceRouterWatcher 22 | /// 23 | public class ServiceRouterWatcher : BaseWatcher 24 | { 25 | public override Task process(WatchedEvent @event) 26 | { 27 | Event.EventType eventType = @event.get_Type(); 28 | string path = @event.getPath(); 29 | if (eventType != Event.EventType.None) 30 | { 31 | switch (eventType) 32 | { 33 | case Event.EventType.NodeChildrenChanged: 34 | case Event.EventType.NodeCreated: 35 | case Event.EventType.NodeDataChanged: 36 | case Event.EventType.NodeDeleted: 37 | 38 | var tsk = new Task(() => { Thread.Sleep(1000); this.CallBack(path,this,eventType.ToString()); }); 39 | tsk.Start(); 40 | return tsk; 41 | } 42 | } 43 | 44 | return Task.FromResult(1); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/ISuperGMSRpcServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc 5 | 文件名:IGrantRpcServer 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/5/8 15:14:32 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System.Threading; 15 | 16 | namespace SuperGMS.Rpc 17 | { 18 | /// 19 | /// 微服务接口 20 | /// 21 | public interface ISuperGMSRpcServer : IAsync 22 | { 23 | /// 24 | /// 程序停止时,回收系统资源,包括调用应用标记的回收方法 25 | /// 26 | /// 回收结果 27 | void QtDispose(); 28 | 29 | /// 30 | /// 注册一个本地的服务 31 | /// 32 | /// 服务配置 33 | void RpcServerRegister(SuperGMSServerConfig server, string[] args); 34 | } 35 | 36 | /// 37 | /// 消息接口, Thrift 直接调用此接口的 Send 方法 38 | /// 39 | public interface IAsync 40 | { 41 | /// 42 | /// 发送 43 | /// 44 | /// 参数 45 | /// 调用上下文 46 | /// 返回结果 47 | global::System.Threading.Tasks.Task Send(string my_args, object appContext, CancellationToken cancellationToken = default); 48 | } 49 | 50 | //public interface Iface : IAsync 51 | //{ 52 | //} 53 | } -------------------------------------------------------------------------------- /SuperGMS/ApiHelper/ServiceInfo.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Config; 2 | 3 | using System; 4 | 5 | namespace SuperGMS.ApiHelper 6 | { 7 | /// 8 | /// 微服务信息 9 | /// 10 | public class ServiceInfo 11 | { 12 | /// 13 | /// 微服务名称 14 | /// 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 版本 19 | /// 20 | public string Version { get; set; } 21 | 22 | /// 23 | /// 发布日期 24 | /// 25 | public DateTime ReleaseDate { get; set; } 26 | 27 | /// 28 | /// 完成名称 29 | /// 30 | public string AssemblyName { get; set; } 31 | 32 | /// 33 | /// 完整路径 34 | /// 35 | public string AssemblyPath { get; set; } 36 | 37 | /// 38 | /// 监听端口 39 | /// 40 | public int ListenPort { get; set; } 41 | 42 | /// 43 | /// 计算机名称 44 | /// 45 | public string ComputerName { get; set; } 46 | 47 | /// 48 | /// 进程信息 49 | /// 50 | public string ProcessInfo { get; set; } 51 | 52 | /// 53 | /// 计算机地址 54 | /// 55 | public string ComputerAddress { get; set; } 56 | 57 | /// 58 | /// netcore runtime version 59 | /// 60 | public string NetCoreVersion { get; set; } 61 | 62 | public Configuration Config { get; set; } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SuperGMS.Extend/BaseAppExtend/EditFormFieldHelper/EditFormAttribute.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 5 | 文件名: EditFormAttribute 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/24 15:10:07 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System.Linq; 15 | 16 | namespace SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 17 | { 18 | using System; 19 | 20 | /// 21 | /// EditFormAttribute 22 | /// 23 | public class EditFormAttribute : Attribute 24 | { 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 表单DTO的标记,例如:grantContext 28 | /// 这里之所以要用字符串,是想grant.RpcProxy跟业务的Model解耦合 29 | /// 所在的dbContext 30 | /// 31 | public EditFormAttribute(params string[] dbContextFullName) 32 | { 33 | this.DbContextFullName = dbContextFullName.Select(a => a.ToLower()).ToArray(); 34 | } 35 | 36 | /// 37 | /// Initializes a new instance of the class. 38 | /// 暂时用这个构造 39 | /// 40 | public EditFormAttribute() 41 | { 42 | } 43 | 44 | /// 45 | /// Gets or sets 要查找的DbContext 46 | /// 47 | public string[] DbContextFullName { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SuperGMS/Config/FileServer/FileServerManager.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config.Models.FileServer 5 | 文件名: FileServerManager 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/17 17:50:54 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System.Collections.Generic; 14 | 15 | namespace SuperGMS.Config 16 | { 17 | /// 18 | /// FileServerManager 19 | /// 20 | internal class FileServerManager 21 | { 22 | public const string FileServerName = "FileServer"; 23 | private static List fileServers; 24 | 25 | private static object _root = new object(); 26 | 27 | /// 28 | /// 初始化配置 29 | /// 30 | /// xml 31 | public static void Initlize(FileServer fileServer) 32 | { 33 | if (fileServer != null && fileServer.Items != null && fileServer.Items.Count > 0) 34 | { 35 | lock (_root) 36 | { 37 | fileServers = fileServer.Items; 38 | } 39 | } 40 | } 41 | 42 | /// 43 | /// 获取文件服务器列表 44 | /// 45 | /// 文件服务器列表 46 | public static FileServerItem[] GetFileServers() 47 | { 48 | lock (_root) 49 | { 50 | return fileServers?.ToArray(); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SuperGMS/MQ/RabbitMQ/Config/MQueue.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.RabbitMQ.Config 5 | 文件名:MQueue 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/20 14:37:59 9 | 10 | 功能描述:队列 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.MQ.RabbitMQ 15 | { 16 | /// 17 | /// 队列 18 | /// 19 | public class MQueue 20 | { 21 | /// 22 | /// 队列名称 23 | /// 24 | public string QueueName { get; set; } 25 | 26 | /// 27 | /// 如果投送模式是Direct 需要指定这个值,作为投送的key,匹配到此Queue 28 | /// 29 | public string RouteKey { get; set; } 30 | /// 31 | /// 是否是持久化队列 32 | /// 33 | public bool Durable { get; set; } 34 | /// 35 | /// 是否允许自动创建 36 | /// 37 | public bool AutoDeclare { get; set; } 38 | /// 39 | /// 是否在空闲时允许删除 40 | /// 41 | public bool AutoDelete { get; set; } 42 | /// 43 | /// 排他性 44 | /// 45 | public bool Exclusive { get; set; } 46 | 47 | /// 48 | /// 所在的虚拟主机 49 | /// 50 | public VirtualHost Host { get; set; } 51 | 52 | /// 53 | /// 所绑定的交换机 54 | /// 55 | public Exchange Exchange { get; set; } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SuperGMS/Tools/WebClientEx.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Tools 5 | 文件名: WebClientEx 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/8/29 10:12:55 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Net; 16 | using System.Text; 17 | 18 | namespace SuperGMS.Tools 19 | { 20 | /// 21 | /// WebClientEx 22 | /// 23 | public class WebClientEx:WebClient 24 | { 25 | private int _timeOut; 26 | 27 | public int TimeOut { 28 | get { return _timeOut; } 29 | set { _timeOut = value; } 30 | } 31 | 32 | /// 33 | /// 无参构造,默认超时6s 34 | /// 35 | public WebClientEx() 36 | { 37 | this._timeOut = 3 * 1000; // 默认2s 38 | } 39 | 40 | /// 41 | /// 需要传入超时时间 42 | /// 43 | /// 44 | public WebClientEx(int timeOut) 45 | { 46 | this._timeOut = timeOut > 3000 ? timeOut : 3000; 47 | } 48 | 49 | /// 50 | /// 重载 51 | /// 52 | /// 53 | /// 54 | protected override WebRequest GetWebRequest(Uri address) 55 | { 56 | var req=base.GetWebRequest(address); 57 | req.Timeout = this._timeOut; 58 | return req; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | using SuperGMS.Config; 4 | using SuperGMS.HttpProxy; 5 | using System.Linq; 6 | 7 | namespace SuperGMS.HttpProxy 8 | { 9 | public class Program 10 | { 11 | public static void Main(string[] args) 12 | { 13 | BuildWebHost(args).Run(); 14 | } 15 | 16 | public static IWebHost BuildWebHost(string[] args) 17 | { 18 | // 要做weapi就需要指定服务名,因为根据服务名才能知道相关配置,这个是因为webapi在启动前首先要指定端口 19 | if (args != null && args.Length > 0) 20 | { 21 | SuperGMS.HttpProxy.SuperHttpProxy.HttpProxyName = args[0]; 22 | } 23 | var server = ServerSetting.GetRpcServer(SuperHttpProxy.HttpProxyName); 24 | var host = WebHost.CreateDefaultBuilder() 25 | .UseUrls( 26 | $"http://*:{server.Port}/") 27 | .UseStartup().UseKestrel(options=> { 28 | //请求内容长度限制(单位B) 29 | int maxLength = 0; 30 | // var maxBody = ServerSetting.Config.ConstKeyValue.Items.FirstOrDefault(i => i.Key == "MaxHttpBody")?.Value; 31 | //if (!string.IsNullOrEmpty(maxBody)) 32 | //{ 33 | // int.TryParse(maxBody, out maxLength); 34 | //} 35 | if (maxLength < 4194304) maxLength = 4194304; // 最小4M 36 | if (maxLength > 104857600) maxLength = 104857600; // 最大100M 37 | options.Limits.MaxRequestBodySize = maxLength; 38 | options.AllowSynchronousIO = true; 39 | }).Build(); 40 | return host; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DbOptionBulider/PostgresqlDBContextOptionBuilder.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.DbOptionBulider 5 | 文件名:PostgresqlDBContextOptionBuilder.cs 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2019/9/11 14:57:44 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using Microsoft.EntityFrameworkCore; 14 | 15 | namespace SuperGMS.DB.EFEx 16 | { 17 | /// 18 | /// 19 | /// 20 | /// 21 | public class PostgresqlDBContextOptionBuilder : IContextOptionBuilderFactory 22 | { 23 | /// 24 | /// 根据数据类型获取连接字符串 25 | /// 26 | /// dbInfo 27 | /// string 28 | public static string GetDbConnectionString(DbInfo dbInfo) 29 | { 30 | return $"Host={dbInfo.Ip}; Port={(dbInfo.Port > 0 ? dbInfo.Port : 5432)}; Database={dbInfo.DbName};User ID={dbInfo.UserName}; Password ={dbInfo.Pwd};Pooling=true;"; 31 | } 32 | 33 | public DbContextOptionsBuilder CreateOptionsBuilder(string connectionString) where T : DbContext 34 | { 35 | DbContextOptionsBuilder options = new DbContextOptionsBuilder(); 36 | options.UseNpgsql(connectionString); 37 | return options; 38 | } 39 | 40 | public string GetConnectionString(DbInfo dbInfo) 41 | { 42 | return PostgresqlDBContextOptionBuilder.GetDbConnectionString(dbInfo); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /SuperGMS/UserSession/UserLoginInfo/TenantInfo.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.UserSession 5 | 文件名:TenantInfo 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:59:07 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.UserSession 16 | { 17 | /// 18 | /// 19 | /// 20 | /// 21 | public class TenantInfo 22 | { 23 | /// 24 | /// Gets or sets 租户ID 25 | /// 26 | public int TTID { get; set; } 27 | 28 | /// 29 | /// 租户名称 30 | /// 31 | public string TenantName { get; set; } 32 | 33 | /// 34 | /// 使用开始时间 35 | /// 36 | public DateTime StartTime { get; set; } 37 | 38 | /// 39 | /// 截止时间 40 | /// 41 | public DateTime EndTime { get; set; } 42 | 43 | /// 44 | /// 租户需要扩展的信息 45 | /// 46 | public object TenantObjCtx { get; set; } 47 | 48 | /// 49 | /// 获取租户扩展信息 50 | /// 51 | /// 52 | /// 53 | public T GetTenantObjCtx() where T : class, new() 54 | { 55 | if (TenantObjCtx == null) return default(T); 56 | return Newtonsoft.Json.JsonConvert.DeserializeObject(TenantObjCtx.ToString()); 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SuperGMS/Rpc/ServerType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc 5 | 文件名:ServerType 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/5/8 15:41:24 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Rpc 16 | { 17 | /// 18 | /// 服务器发布类型 19 | /// 20 | public enum ServerType 21 | { 22 | /// 23 | /// 做为WebApi直接处理业务 24 | /// 25 | HttpWebApi = 1, 26 | 27 | ///// 28 | ///// 服务器接口发布为 29 | ///// 30 | //WCF =1, 31 | /// 32 | /// 服务器接口发布为ThriftRpc 33 | /// 34 | Thrift=2, 35 | /// 36 | /// 服务接口发布为Grpc 37 | /// 38 | Grpc=3, 39 | 40 | /// 41 | /// 代理层 42 | /// 43 | HttpProxy = 4, 44 | 45 | ///// 46 | ///// 不用发布接口,只执行定时任务 47 | ///// 48 | //TaskWorker =4, 49 | 50 | ///// 51 | ///// 跨网关http 52 | ///// 53 | //Http =6, 54 | } 55 | 56 | /// 57 | /// 服务器发布类型转换类 58 | /// 59 | public class ServerTypeParse 60 | { 61 | public static ServerType Parse(string serverType) 62 | { 63 | ServerType r =ServerType.Thrift; 64 | if (!Enum.TryParse(serverType,true, out r)) 65 | r = ServerType.Thrift; 66 | return r; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SuperGMS/Config/DataBase/DbModelContext.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Config.Models.DataBase 5 | 文件名: DataBaseInfo 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/22 11:42:34 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System.Collections.Generic; 15 | 16 | namespace SuperGMS.Config 17 | { 18 | /// 19 | /// 数据库配置对象, 包含了数据库连接信息, 以及EF对应的上下文名称, 以及数据库类型, 主从配置 20 | /// 21 | internal class DbModelContext 22 | { 23 | /// 24 | /// Gets or sets dbcontext名字,通过这个名字来关联物理数据库和数据模型 25 | /// 26 | public string DbContextName { get; set; } 27 | 28 | /// 29 | /// Gets or sets 数据库类型 30 | /// 31 | public string DbType { get; set; } 32 | 33 | /// 34 | /// Gets or sets 索引 35 | /// 36 | public int Pool { get; set; } 37 | 38 | /// 39 | /// Gets or sets 登录用户名 40 | /// 41 | public string UserName { get; set; } 42 | 43 | /// 44 | /// Gets or sets 密码 45 | /// 46 | public string PassWord { get; set; } 47 | 48 | /// 49 | /// Gets or sets 数据库名称 50 | /// 51 | public string Database { get; set; } 52 | 53 | /// 54 | /// Gets or sets 主库配置 55 | /// 56 | public Master Master { get; set; } 57 | 58 | /// 59 | /// Gets or sets 从库配置列表 60 | /// 61 | public List Slaves { get; set; } 62 | } 63 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DbOptionBulider/SqlServerDBContextOptionBuilder.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.DbOptionBulider 5 | 文件名: SqlServerDBContextOptionBuilder 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 21:04:05 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | using Microsoft.EntityFrameworkCore; 17 | 18 | namespace SuperGMS.DB.EFEx 19 | { 20 | /// 21 | /// SqlServerDBContextOptionBuilder 22 | /// 23 | public class SqlServerDBContextOptionBuilder : IContextOptionBuilderFactory 24 | { 25 | public DbContextOptionsBuilder CreateOptionsBuilder(string connectionString) where T : DbContext 26 | { 27 | DbContextOptionsBuilder options = new DbContextOptionsBuilder(); 28 | options.UseSqlServer(connectionString); 29 | return options; 30 | } 31 | 32 | public string GetConnectionString(DbInfo dbInfo) 33 | { 34 | return SqlServerDBContextOptionBuilder.GetDbConnectionString(dbInfo); 35 | } 36 | 37 | /// 38 | /// 根据数据类型获取连接字符串 39 | /// 40 | /// dbInfo 41 | /// string 42 | public static string GetDbConnectionString(DbInfo dbInfo) 43 | { 44 | dbInfo.Port = dbInfo.Port > 0 ? dbInfo.Port : 1433; 45 | return $"Data Source = {dbInfo.Ip},{dbInfo.Port};Network Library = DBMSSOCN;Initial Catalog = {dbInfo.DbName};User ID = {dbInfo.UserName};Password = {dbInfo.Pwd};"; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SuperGMS.Extend/BackGroundMessage/BackGroundMessageProcessArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:grant.RpcProxy.GlobalTools.BackGroundMessage 5 | 文件名: GetBackGroundMessageProcessArgs 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/30 10:27:02 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using SuperGMS.Protocol.RpcProtocol; 15 | 16 | namespace SuperGMS.Extend.BackGroundMessage 17 | { 18 | public class BackGroundMessageProcessArgs 19 | { 20 | /// 21 | /// 任务Id 22 | /// 23 | public string TaskGuid { get; set; } 24 | } 25 | 26 | /// 27 | /// GetBackGroundMessageProcessArgs 28 | /// 29 | public class BackGroundMessageProcessResult 30 | { 31 | /// 32 | /// 总记录数 33 | /// 34 | public int TotalNum { get; set; } 35 | 36 | /// 37 | /// 处理记录数 38 | /// 39 | public int ProcessNum { get; set; } 40 | 41 | /// 42 | /// 成功数量 43 | /// 44 | public int SuccessNum 45 | { 46 | get; 47 | set; 48 | } 49 | 50 | /// 51 | /// 自定义任务数据 52 | /// 53 | public string Data { get; set; } 54 | 55 | /// 56 | /// 请求Rid 57 | /// 58 | public string Rid { get; set; } 59 | 60 | /// 61 | /// 执行状态码,用于标识执行情况,正常是200, 62 | /// 其他,如数据格式错误,如果状态码不为200,就需要解析Data,这个可能是返回的错误Execl下载路径,具体内容需要业务层和前端共同确定 63 | /// 64 | public StatusCode Code { get; set; } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /SuperGMS/Config/ConfigCenter.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: ConfigCenter 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 12:01:39 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// ConfigCenter 17 | /// 18 | public class ConfigCenter 19 | { 20 | /// 21 | /// 配置类型 22 | /// 23 | public ConfigType ConfigType { get; set; } 24 | 25 | /// 26 | /// Gets or sets ip zk的ip和端口是统一配置在一起的,主要考虑到zk集群部署会有多个节点 ip1:port1,ip2:port2 27 | /// 28 | public string Ip { get; set; } 29 | 30 | /// 31 | /// 如果配置是zk/nacos 这个表示的zk/nacos连接的超时时间 32 | /// 33 | public int SessionTimeout { get; set; } 34 | 35 | /// 36 | /// Nacos的用户名 37 | /// 38 | public string UserName { get; set; } 39 | 40 | /// 41 | /// Nacos的密码 42 | /// 43 | public string Password { get; set; } 44 | } 45 | 46 | /// 47 | /// 配置类型 48 | /// 49 | public enum ConfigType 50 | { 51 | /// 52 | /// 本地配置 53 | /// 54 | Local = 1, 55 | 56 | /// 57 | /// zookeeper配置 58 | /// 59 | Zookeeper=2, 60 | 61 | /// 62 | /// 文件配置中心 63 | /// 64 | HttpFile=3, 65 | 66 | /// 67 | /// Nacos配置 68 | /// 69 | Nacos=4, 70 | } 71 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/BaseAppExtend/EditFormFieldHelper/ControlType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 5 | 文件名: ControlType 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/24 13:54:18 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper 15 | { 16 | /// 17 | /// ControlType 18 | /// 19 | public enum ControlType : int 20 | { 21 | /// 22 | /// 单行文本输入框 23 | /// 24 | Input = 1, 25 | 26 | /// 27 | /// 数字输入框 28 | /// 29 | InputNumber = 2, 30 | 31 | /// 32 | /// 复选框 33 | /// 34 | CheckBox = 3, 35 | 36 | /// 37 | /// 下拉框 38 | /// 39 | Select = 4, 40 | 41 | /// 42 | /// 下拉框带单位 43 | /// 44 | SelectUnit = 5, 45 | 46 | /// 47 | /// 搜索输入框 48 | /// 49 | InputSearch = 6, 50 | 51 | /// 52 | /// 日期选择框 年月日 53 | /// 54 | DateSelect = 7, 55 | 56 | /// 57 | /// 日期时间选择 年月日时分秒 58 | /// 59 | DateTimeSelect = 8, 60 | 61 | /// 62 | /// 级联选择框 63 | /// 64 | Cascader = 9, 65 | 66 | /// 67 | /// 地址选择 68 | /// 69 | AddressCascader = 10, 70 | 71 | /// 72 | /// 多行输入 73 | /// 74 | TextArea = 11, 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /SuperGMS/ApiHelper/Xml/XmlCommentsFileCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using System.Xml; 4 | 5 | namespace SuperGMS.ApiHelper.Xml 6 | { 7 | /// 8 | /// 注释文档集合 9 | /// 10 | public class XmlCommentsFileCollection 11 | { 12 | private List files; 13 | private List nodes; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public XmlCommentsFileCollection() 19 | { 20 | files = new List(); 21 | nodes = new List(); 22 | } 23 | 24 | /// 25 | /// 添加注释文档文件 26 | /// 27 | /// 文档 28 | public void Add(XmlCommentsFile file) 29 | { 30 | files.Add(file); 31 | nodes.Add(file.Members); 32 | } 33 | 34 | /// 35 | /// Search all comments files for the specified member. If not found, add the blank member to the first 36 | /// file. 37 | /// 38 | /// The member name for which to search. 39 | /// The XML node of the found or added member 40 | public XmlNode FindMember(string memberName) 41 | { 42 | XmlNode member = null; 43 | string xPathQuery = string.Format(CultureInfo.InvariantCulture, "member[@name='{0}']", memberName); 44 | foreach (var node in nodes) 45 | { 46 | member = node.SelectSingleNode(xPathQuery); 47 | 48 | if (member != null) 49 | { 50 | break; 51 | } 52 | } 53 | 54 | return member; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/Tools/EntityHumpHelper.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Extend.Tools 5 | 文件名: EntityHumpHelper 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/29 13:37:10 9 | 10 | 功能描述:收集nick的一个驼峰转换方法到框架 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Extend.Tools 15 | { 16 | /// 17 | /// EntityHumpHelper 18 | /// 19 | public class EntityHumpHelper 20 | { 21 | /// 22 | /// 转成驼峰命名 23 | /// 24 | /// 需要转换为驼峰的字段名称 25 | /// string 26 | public static string GetNiceName(string fieldName) 27 | { 28 | // 段生成规则 29 | string result = string.Empty; 30 | 31 | string[] tempField = fieldName.Split('_'); 32 | if (tempField.Length > 1) 33 | { 34 | result = tempField[0].Substring(0, 1).ToUpper() + 35 | tempField[0].Substring(1, tempField[0].Length - 1).ToLower(); 36 | for (int i = 1; i <= tempField.Length - 1; i++) 37 | { 38 | if (!string.IsNullOrEmpty(tempField[i])) 39 | { 40 | result += tempField[i].Substring(0, 1).ToUpper() + 41 | tempField[i].Substring(1, tempField[i].Length - 1).ToLower(); 42 | } 43 | } 44 | } 45 | else 46 | { 47 | result = tempField[0].Substring(0, 1).ToUpper() + 48 | tempField[0].Substring(1, tempField[0].Length - 1).ToLower(); 49 | } 50 | 51 | return result; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SuperGMS/AttributeEx/StatusCodeExtension.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Log; 2 | using SuperGMS.Protocol.RpcProtocol; 3 | 4 | using System.Reflection; 5 | 6 | namespace SuperGMS.AttributeEx 7 | { 8 | /// 9 | /// 状态码扩展类 10 | /// 11 | public static class StatusCodeExtension 12 | { 13 | /// 14 | /// 枚举转为 StatusCode 15 | /// 16 | /// 枚举类型 17 | /// 枚举值 18 | /// 状态码 19 | public static StatusCode ToCode(this TEnumClass enumValue) 20 | where TEnumClass : struct 21 | { 22 | var cd = GetEnumCodeDescription(enumValue); 23 | var code = (int)(object)enumValue; 24 | if (cd == null) 25 | { 26 | LogTextWriter.Write($"枚举值{enumValue} 没有定义属性[CodeDescAttribute]"); 27 | 28 | // return StatusCode.ErrorCodeUndefined; 29 | return new StatusCode(code, StatusCode.ErrorCodeUndefined.ToString()); 30 | } 31 | 32 | return new StatusCode(code, cd.Description); 33 | } 34 | 35 | /// 36 | /// 得到枚举类型的CodeDesc属性标签 37 | /// 38 | /// 枚举值 39 | /// CodeDesc属性标签 40 | private static CodeDescAttribute GetEnumCodeDescription(TEnumClass enumValue) 41 | { 42 | string value = enumValue.ToString(); 43 | FieldInfo field = enumValue.GetType().GetField(value); 44 | object[] objs = field.GetCustomAttributes(typeof(CodeDescAttribute), false); 45 | if (objs == null || objs.Length == 0) 46 | { 47 | return null; 48 | } 49 | 50 | CodeDescAttribute descriptionAttribute = (CodeDescAttribute)objs[0]; 51 | return descriptionAttribute; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /SuperGMS/Config/Redis/RedisItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: RedisItem 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 16:17:57 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Config 14 | { 15 | /// 16 | /// RedisItem 17 | /// 18 | public class RedisItem 19 | { 20 | /// 21 | /// 22 | /// 23 | public int Pool { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | public bool IsMaster { get; set; } 29 | 30 | /// 31 | /// 32 | /// 33 | public string Server { get; set; } 34 | 35 | /// 36 | /// 37 | /// 38 | public int Port { get; set; } 39 | 40 | /// 41 | /// 42 | /// 43 | public bool AllowAdmin { get; set; } 44 | 45 | /// 46 | /// 47 | /// 48 | public int ConnectTimeout { get; set; } 49 | 50 | /// 51 | /// 同步时间,这个会影响redis做get操作的是否会超时 52 | /// 53 | public int SyncTimeout { get; set; } 54 | 55 | /// 56 | /// 57 | /// 58 | public bool Ssl { get; set; } 59 | 60 | /// 61 | /// 新加redis ssl配置,为了兼容老的ssl 默认是false 62 | /// 63 | public bool Ssl2 { get; set; } 64 | 65 | /// 66 | /// 67 | /// 68 | public string Pwd { get; set; } 69 | 70 | /// 71 | /// redis 数据库索引 72 | /// 73 | public int DbIndex { get; set; } 74 | 75 | } 76 | } -------------------------------------------------------------------------------- /SuperGMS/Zookeeper/ConfigWatcher.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Zookeeper 5 | 文件名: DataWatcher 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/2/23 17:05:53 9 | 10 | 功能描述:监听数据的变化,主要是配置信息 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using org.apache.zookeeper; 15 | 16 | using System.Threading; 17 | using System.Threading.Tasks; 18 | 19 | namespace SuperGMS.Zookeeper 20 | { 21 | /// 22 | /// DataWatcher 监控数据节点变化,全部都是永久性节点,不存在动态增加和删除的功能,所以这里只关注Changed的节点 23 | /// 24 | public class ConfigWatcher : BaseWatcher 25 | { 26 | /// 27 | /// process 28 | /// 29 | /// event 30 | /// Task 31 | public override Task process(WatchedEvent @event) 32 | { 33 | // 写日志 34 | Event.EventType eventType = @event.get_Type(); 35 | if (eventType != Event.EventType.None) 36 | { 37 | string path = @event.getPath(); 38 | // Event.KeeperState keeperState = @event.getState(); 39 | switch (eventType) 40 | { 41 | case Event.EventType.NodeChildrenChanged: 42 | case Event.EventType.NodeCreated: 43 | case Event.EventType.NodeDataChanged: 44 | case Event.EventType.NodeDeleted: 45 | var tsk = new Task(() => { Thread.Sleep(1000); this.CallBack(path,this,eventType.ToString()); }); 46 | tsk.Start(); 47 | return tsk; 48 | default: 49 | // 写日志忽略变更 50 | break; 51 | } 52 | } 53 | 54 | return Task.CompletedTask; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SuperGMS/Tools/EncryptionTools.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Utility 5 | 文件名:EncryptionTools 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:59:07 9 | 10 | 功能描述:加密工具集 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Security.Cryptography; 15 | using System.Text; 16 | 17 | namespace SuperGMS.Tools 18 | { 19 | /// 20 | /// 加密工具集 21 | /// 22 | public class EncryptionTools 23 | { 24 | /// 25 | /// 字符串转换为32位MD5大写或者小写 26 | /// 27 | /// 要加密的字符串 28 | /// 转为小写,默认大写 29 | /// 30 | public static string HashMd5(string input, bool toLower=false) 31 | { 32 | byte[] result = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(Encoding.UTF8.GetBytes(input)); 33 | StringBuilder ouput = new StringBuilder(32); 34 | string prix = toLower ? "x2" : "x"; 35 | for (int i = 0; i < result.Length; i++) 36 | { 37 | ouput.Append((result[i]).ToString(prix, System.Globalization.CultureInfo.InvariantCulture)); 38 | } 39 | return ouput.ToString(); 40 | } 41 | 42 | /// 43 | /// SHA256 44 | /// 45 | /// /// 原始字符串 46 | /// 结果 47 | public static string Sha256(string str) 48 | { 49 | byte[] SHA256Data = Encoding.UTF8.GetBytes(str); 50 | SHA256Managed Sha256 = new SHA256Managed(); 51 | byte[] Result = Sha256.ComputeHash(SHA256Data); 52 | return Convert.ToBase64String(Result); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DbOptionBulider/OracleDBContextOptionBuilder.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.DbOptionBulider 5 | 文件名: OracleDBContextOptionBuilder 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 21:03:01 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using Microsoft.EntityFrameworkCore; 14 | 15 | using System; 16 | 17 | namespace SuperGMS.DB.EFEx 18 | { 19 | /// 20 | /// OracleDBContextOptionBuilder 21 | /// 22 | public class OracleDBContextOptionBuilder : IContextOptionBuilderFactory 23 | { 24 | public DbContextOptionsBuilder CreateOptionsBuilder(string connectionString) where T : DbContext 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | 29 | /// 30 | /// GetConnectionString 31 | /// 32 | /// 33 | /// 34 | public string GetConnectionString(DbInfo dbInfo) 35 | { 36 | return OracleDBContextOptionBuilder.GetDbConnectionString(dbInfo); 37 | } 38 | 39 | /// 40 | /// 根据数据类型获取连接字符串 41 | /// 42 | /// dbInfo 43 | /// string 44 | public static string GetDbConnectionString(DbInfo dbInfo) 45 | { 46 | //return $"DATA SOURCE ={dbInfo.Ip}:{dbInfo.Port}/{dbInfo.DbName}; PASSWORD = {dbInfo.Pwd}; PERSIST SECURITY INFO = True; USER ID = {dbInfo.UserName}"; 47 | return $"Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = {dbInfo.Ip})(PORT = {(dbInfo.Port>0?dbInfo.Port:1521)}))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = {dbInfo.DbName}))); User ID = {dbInfo.UserName}; Password = {dbInfo.Pwd}; Persist Security Info = True"; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SuperGMS/Protocol/RpcProtocol/BasicArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol 5 | 文件名:BasicArgs 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 11:49:24 9 | 10 | 功能描述:Args和Result的基类 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | 15 | namespace SuperGMS.Protocol.RpcProtocol 16 | { 17 | /// 18 | /// 统一参数的基类 19 | /// 20 | /// 21 | [Serializable] 22 | public class BasicArgs 23 | { 24 | private string checkSum; 25 | /// 26 | /// 校验值 27 | /// 28 | public string cs 29 | { 30 | get { return checkSum; } 31 | set { checkSum = value; } 32 | } 33 | 34 | private T _value; 35 | 36 | /// 37 | /// 业务数据 38 | /// 39 | public T v 40 | { 41 | get { return _value; } 42 | set { _value = value; } 43 | } 44 | 45 | private bool isCiphertext; 46 | /// 47 | /// 当前传输的是否密文,这里说的加密指的是对有效业务数据的加密指的是_Value; 48 | /// 49 | public bool icp 50 | { 51 | get { return isCiphertext; } 52 | set { isCiphertext = value; } 53 | } 54 | 55 | private string routerUri; 56 | /// 57 | /// 可以路由的Uri 58 | /// 59 | public string uri 60 | { 61 | get { return routerUri; } 62 | set { routerUri = value; } 63 | } 64 | 65 | private string language; 66 | 67 | /// 68 | /// 语言 69 | /// 70 | public string lg 71 | { 72 | get { return language; } 73 | set { language = value; } 74 | } 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/SuperGMS.WebSocketService.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | WebSocketService 8 | WebSocketService 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Always 18 | 19 | 20 | Always 21 | 22 | 23 | Always 24 | 25 | 26 | Always 27 | 28 | 29 | Always 30 | 31 | 32 | Always 33 | 34 | 35 | Always 36 | 37 | 38 | Always 39 | 40 | 41 | Always 42 | 43 | 44 | Always 45 | 46 | 47 | Always 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DBType.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx 5 | 文件名: DataBaseType 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 23:11:38 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | 17 | namespace SuperGMS.DB.EFEx 18 | { 19 | /// 20 | /// 数据访问层的类型 21 | /// 22 | public enum DataAccessLayerType 23 | { 24 | EF = 1, 25 | Dapper = 2, 26 | } 27 | 28 | /// 29 | /// DataBaseType 30 | /// 31 | public enum DbType 32 | { 33 | InMemory = -1, 34 | MySql = 0, 35 | SqlServer = 1, 36 | Sqlite = 2, 37 | Oracle = 3, 38 | PostgreSQL = 4, 39 | Dm = 5, 40 | Kdbndp = 6, 41 | Oscar = 7, 42 | MySqlConnector = 8, 43 | Access = 9, 44 | OpenGauss = 10, 45 | QuestDB = 11, 46 | HG = 12, 47 | ClickHouse = 13, 48 | GBase = 14, 49 | Odbc = 15, 50 | OceanBaseForOracle = 16, 51 | TDengine = 17, 52 | GaussDB = 18, 53 | OceanBase = 19, 54 | Tidb = 20, 55 | Vastbase = 21, 56 | PolarDB = 22, 57 | Doris = 23, 58 | Xugu = 24, 59 | GoldenDB = 25, 60 | TDSQLForPGODBC = 26, 61 | TDSQL = 27, 62 | HANA = 28, 63 | DB2 = 29, 64 | GaussDBNative = 30, 65 | DuckDB = 31, 66 | MongoDb = 32, 67 | Custom = 900 68 | } 69 | 70 | public class DbTypeParser 71 | { 72 | public static DbType Parser(string dbType) 73 | { 74 | DbType dt = DbType.MySql; 75 | if (!Enum.TryParse(dbType, out dt)) 76 | { 77 | dt = DbType.MySql; 78 | } 79 | 80 | return dt; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SuperGMS/Config/RpcService.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: Configuration 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 11:56:47 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using SuperGMS.Router; 15 | using SuperGMS.Rpc; 16 | 17 | using System.Collections.Generic; 18 | 19 | namespace SuperGMS.Config 20 | { 21 | public class RpcService 22 | { 23 | /// 24 | /// 25 | /// 26 | public int Pool { get; set; } 27 | 28 | /// 29 | /// 30 | /// 31 | public string Ip { get; set; } 32 | 33 | /// 34 | /// 35 | /// 36 | public int Port { get; set; } 37 | 38 | /// 39 | /// 集中配置是的服务和Port列表 40 | /// 41 | public Dictionary PortList { get; set; } 42 | 43 | /// 44 | /// 45 | /// 46 | public ServerType ServerType { get; set; } 47 | 48 | /// 49 | /// 路由方式 50 | /// 51 | public RouterType RouterType { get; set; } = RouterType.Random; 52 | 53 | /// 54 | /// 55 | /// 56 | public string AssemblyPath { get; set; } 57 | 58 | private int timeout; 59 | 60 | /// 61 | /// timeout 62 | /// 63 | public int TimeOut 64 | { 65 | get { return timeout; } 66 | set { timeout = value; } 67 | } 68 | 69 | private bool enable = true; 70 | /// 71 | /// 当前服务是否被标记为可用,默认可用,除非被标记,这个标记变了之后,本地也要修改,下次启动需要根据这个值来处理 72 | /// 73 | public bool Enable { 74 | get { return enable; } 75 | set { enable = value; } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DynamicSearch/PageInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // 文件:PageInfo.cs 3 | // 作者:Grant 4 | // 最后更新日期:2014-06-05 14:29 5 | 6 | #region 7 | 8 | using System; 9 | using System.Runtime.Serialization; 10 | 11 | #endregion 12 | 13 | namespace SuperGMS.DB.EFEx.DynamicSearch 14 | { 15 | using Microsoft.AspNetCore.Http; 16 | using System.Web; 17 | 18 | /// 19 | /// 分页实体 20 | /// 21 | [Serializable] 22 | [DataContract] 23 | public class PageInfo 24 | { 25 | public PageInfo() 26 | { 27 | IsGetTotalCount = false; 28 | } 29 | /// 30 | /// 当前页 , 和SkipCount不能同时赋值, 否则以SkipCount为准 31 | /// 32 | [DataMember] 33 | public int CurrentPage { get; set; } 34 | 35 | /// 36 | /// 跳过条数,和CurrentPage不能同时赋值, 否则以SkipCount为准 37 | /// 38 | [DataMember] 39 | public int SkipCount { get; set; } 40 | 41 | /// 42 | /// 页大小 43 | /// 44 | [DataMember] 45 | public int PageSize { get; set; } 46 | 47 | /// 48 | /// 排序字段 49 | /// 50 | [DataMember] 51 | public string SortField { get; set; } 52 | 53 | /// 54 | /// 升序 降序 55 | /// 56 | [DataMember] 57 | public string SortDirection { get; set; } 58 | 59 | /// 60 | /// 是否分页, 因为性能原因,此处设置false无效,为了提高性能必须分页,如果为了获取更多条数据,可以增大PageSize 到一个已知的最大值 61 | /// 62 | [DataMember] 63 | public bool IsPaging { get; set; } 64 | 65 | /// 66 | /// 是否获取总条数,默认是False,如果为了提高性能,而不关注总条数,可以将此值设置为false。因为获取总条数非常!非常!非常!消耗时间 add by Grant 2016-11-9 67 | /// 68 | [DataMember] 69 | public bool IsGetTotalCount { get; set; } 70 | 71 | /// 72 | /// 是否分页 73 | /// 74 | [DataMember] 75 | public int TotalCount { get; set; } 76 | 77 | 78 | } 79 | } -------------------------------------------------------------------------------- /SuperGMS.Extend/Extensions/TaskExResult.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Extend.Extensions 5 | 文件名: TaskExResult 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/4 14:32:29 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | namespace SuperGMS.Extend.Extensions 14 | { 15 | using System; 16 | 17 | /// 18 | /// TaskExResult 19 | /// 20 | public class TaskExResult 21 | { 22 | /// 23 | /// Gets or sets a value indicating whether 是否成功 24 | /// 25 | public bool IsSuccess { get; set; } 26 | 27 | /// 28 | /// Gets or sets 错误内容 29 | /// 30 | public string Message { get; set; } 31 | 32 | /// 33 | /// Gets or sets 如果失败,失败原因 34 | /// 35 | public Exception Ex { get; set; } 36 | 37 | /// 38 | /// Gets or sets 调用方想传递的上下文 39 | /// 40 | public object ObjCxt { get; set; } 41 | 42 | /// 43 | /// Gets or sets 本次成功数量,如果是单条这个值可以省略,如果是自己改变成功数量则需要赋值>1 44 | /// 45 | public int SuccessNum { get; set; } 46 | 47 | /// 48 | /// Gets or sets 本次执行的总数,注意区别:Tot,如果单条可以省略,如果自己想改变成功数量则需要赋值>1 49 | /// 50 | public int TotNum { get; set; } 51 | 52 | /// 53 | /// Gets or sets 当前处理的记录 54 | /// 55 | public T Row { get; set; } 56 | 57 | /// 58 | /// Gets or sets 原始记录 59 | /// 60 | public T[] Tables { get; set; } 61 | 62 | /// 63 | /// Gets or sets 当前行在Tables 中的索引 64 | /// 65 | public int RowIndx { get; set; } 66 | 67 | /// 68 | /// 想传给客户端的数据 69 | /// 70 | public string Data { get; set; } 71 | } 72 | } -------------------------------------------------------------------------------- /SuperGMS/Protocol/RpcProtocol/Result.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol 5 | 文件名:Result 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 11:40:44 9 | 10 | 功能描述:定义一个统一的返回结果外壳 11 | 12 | { 13 | "rid": "0ad0ffcd5e6546eab1612885709adc49", 14 | "c": 200, 15 | "msg": "ok", 16 | "v": { 17 | "v1": true 18 | }, 19 | "icp": false, 20 | "cs": "xx234rwerwerwerwer" 21 | } 22 | ----------------------------------------------------------------*/ 23 | 24 | 25 | namespace SuperGMS.Protocol.RpcProtocol 26 | { 27 | /// 28 | /// 请求返回结果 29 | /// 30 | /// 31 | public class Result:BasicArgs 32 | { 33 | private string responseId; 34 | /// 35 | /// 响应的Id,跟RequestId对应 36 | /// 37 | public string rid 38 | { 39 | get { return responseId; } 40 | set { responseId = value; } 41 | } 42 | 43 | private int code; 44 | /// 45 | /// 业务处理状态 46 | /// 47 | public int c 48 | { 49 | get { return code; } 50 | set { code = value; } 51 | } 52 | 53 | private string codeMsg; 54 | /// 55 | /// 状态描述 56 | /// 57 | public string msg 58 | { 59 | get { return codeMsg; } 60 | set { codeMsg = value; } 61 | } 62 | 63 | private string _error; 64 | /// 65 | /// 错误描述 66 | /// 67 | public string error 68 | { 69 | get { return _error; } 70 | set { _error = value; } 71 | } 72 | 73 | private string[] _msgParam; 74 | 75 | public string[] MsgParam 76 | { 77 | get { return _msgParam; } 78 | set { _msgParam = value; } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/MyDbContext/DapperDBContext.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx.GrantDbContext 5 | 文件名: GrantDapperDBContext 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/3 0:40:46 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Data; 17 | using System.Data.Common; 18 | using System.Text; 19 | using Dapper; 20 | using SuperGMS.DB.EFEx.CrudRepository; 21 | using SuperGMS.DB.EFEx.GrantDbContext; 22 | using SuperGMS.DB.EFEx.GrantDbFactory; 23 | 24 | namespace SuperGMS.DB.EFEx 25 | { 26 | /// 27 | /// GrantDapperDBContext 28 | /// 29 | public class DapperDBContext : IDapperDbContext 30 | { 31 | //public event DbDapperCommit OnDbCommit; 32 | 33 | private DbInfo dbInfo; 34 | private ISqlRepository sqlRepository; 35 | 36 | /// 37 | /// 当前数据库信息 38 | /// 39 | public DbInfo DbInfo { get { return dbInfo; } } 40 | 41 | public DapperDBContext(DbInfo info) 42 | { 43 | dbInfo = info; 44 | // 这里应该根据工厂生成 mysql或者其他数据库连接实例, 45 | // _dbConnection = ConnectionManager.CreateConection(connectionString, info.DbType); 46 | } 47 | 48 | private void SqlRepositoryManager_OnDbCommit(DBConnection GrantDBConnection, SqlPara auditSql) 49 | { 50 | //OnDbCommit?.Invoke(GrantDBConnection, auditSql); 51 | } 52 | 53 | public void Dispose() 54 | { 55 | dbInfo = null; 56 | } 57 | 58 | /// 59 | /// 获取执行Sql的Repository 60 | /// 61 | /// ISqlRepository 62 | public ISqlRepository GetRepository() 63 | { 64 | if (sqlRepository != null) throw new Exception("DapperDBContext.GetRepository(),在一个rpc上下文只能获取一次"); 65 | return sqlRepository=SqlRepositoryManager.GetSqlRepository(dbInfo); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /SuperGMS/Protocol/MQProtocol/MQProtocol.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Protocol 5 | 文件名:MQProtocol 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/21 10:50:07 9 | 10 | 功能描述:定义一个MQ的协议外壳 11 | 12 | ----------------------------------------------------------------*/ 13 | using Newtonsoft.Json; 14 | 15 | namespace SuperGMS.Protocol.MQProtocol 16 | { 17 | /// 18 | /// MQ的消息 19 | /// 20 | /// 21 | public class MQProtocol : EventMsg where M:class 22 | { 23 | private string _exChange; 24 | 25 | /// 26 | /// 所属交换机 27 | /// 28 | public string ExChange { get { return _exChange; } set { _exChange = value; } } 29 | 30 | private string _routerKey; 31 | 32 | /// 33 | /// 路由关键字 34 | /// 35 | public string RouterKey { get { return _routerKey; } set { _routerKey = value; } } 36 | /// 37 | /// MQ的消息 38 | /// 39 | /// 40 | /// 41 | /// 42 | public MQProtocol(string eventName, M msg, string from) 43 | : base(eventName, msg, null, from) 44 | { 45 | 46 | } 47 | 48 | /// 49 | /// 将字符串转换成MQProtocol 50 | /// 51 | /// 52 | /// 53 | public static MQProtocol Parse(string msg) 54 | { 55 | if (string.IsNullOrEmpty(msg)) return null; 56 | return JsonConvert.DeserializeObject>(msg); 57 | } 58 | /// 59 | /// 将对象转出Json字符串 60 | /// 61 | /// 62 | public override string ToString() 63 | { 64 | return JsonConvert.SerializeObject(this); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SuperGMS/Extensions/RpcContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Cache; 2 | using SuperGMS.Rpc.Server; 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace SuperGMS.Extensions 7 | { 8 | /// 9 | /// 获取资源信息 10 | /// 11 | public static class RpcContextExtensions 12 | { 13 | /// 14 | /// 得到指定key的资源信息,默认按照 微服务名称获取相关信息 15 | /// 16 | /// 17 | /// 上下文 18 | /// key 19 | /// 资源 20 | public static string R(this RpcContext context, string key) 21 | { 22 | key = key.Trim(); 23 | var user = context.GetUserContext(); 24 | 25 | string field = CacheTools.GetPublicResourceKey(context.Language); 26 | 27 | string res = string.Empty; 28 | if (user == null) 29 | { 30 | res = ResourceCache.Instance.GetHash(field, key); 31 | } 32 | else 33 | { 34 | // 从Redis先获取 租户级别的Key,如果没有 35 | var ttField = CacheTools.GetUdfResourceKey(user.UserInfo.TenantInfo.TTID.ToString(), context.Language); 36 | res = ResourceCache.Instance.GetHash(ttField, key); 37 | if (res == null) 38 | { 39 | // 否则拉初始资源到租户级别Key中 40 | var defaultRes = ResourceCache.Instance.GetHash(field, key); 41 | 42 | // 避免null 值建立多个key 43 | if (defaultRes != null) 44 | { 45 | ResourceCache.Instance.SetHash(ttField, new KeyValuePair(key, defaultRes)); 46 | var keyTtids = CacheTools.GetUdfTtidsKey(); 47 | ResourceCache.Instance.SetHash(keyTtids, new KeyValuePair($"{user.UserInfo.TenantInfo.TTID}.{context.Language}", string.Empty)); 48 | res = defaultRes; 49 | } 50 | } 51 | } 52 | 53 | return string.IsNullOrEmpty(res) ? key : res; // 没有取到资源文件把key原样返回; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/ClientItem.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Thrift.Client 5 | 文件名:ClientConfig 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/4/19 15:15:52 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using SuperGMS.Router; 15 | 16 | namespace SuperGMS.Rpc 17 | { 18 | /// 19 | /// 客户端配置 20 | /// 21 | public class ClientItem 22 | { 23 | /// 24 | /// Gets or sets ip 25 | /// 26 | public string Ip { get; set; } 27 | 28 | /// 29 | /// Gets or sets 端口 30 | /// 31 | public int Port { get; set; } 32 | 33 | /// 34 | /// Gets or sets 服务器发布类型 35 | /// 36 | public ServerType ServerType { get; set; } 37 | 38 | /// 39 | /// 负载的方式 40 | /// 41 | public RouterType RouterType { get; set; } 42 | 43 | /// 44 | /// Gets or sets 如果是Wcf配置到根路径 45 | /// 46 | public string Url { get; set; } 47 | 48 | /// 49 | /// Gets or sets 服务编号 50 | /// 51 | public int Pool { get; set; } 52 | 53 | /// 54 | /// Timeout 55 | /// 56 | public int TimeOut { get; set; } 57 | 58 | /// 59 | /// 是否被下线 60 | /// 61 | public bool Enable { get; set; } 62 | 63 | /// 64 | /// Gets or sets 所在的logic Server 65 | /// 66 | public ClientServer Server { get; set; } 67 | 68 | /// 69 | /// 拼接所有属性 70 | /// 71 | /// 所有属性 72 | public override string ToString() 73 | { 74 | return string.Format("Ip={0},Port={1},ServerType={2},Url={3},Server={4}", Ip, Port, ServerType, Url, Server.ToString()); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /SuperGMS/Redis/RedisServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.Redis 5 | 文件名:RedisServer 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/3/24 15:51:12 9 | 10 | 功能描述:redis服务器信息 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Redis 15 | { 16 | /// 17 | /// 定义一个redis服务器对象 18 | /// 19 | public class RedisServer 20 | { 21 | /// 22 | /// 所在业务节点 23 | /// 24 | public RedisNode Node { get; set; } 25 | 26 | /// 27 | /// 索引 28 | /// 29 | public int Pool { get; set; } 30 | 31 | /// 32 | /// 是否主 33 | /// 34 | public bool IsMaster { get; set; } 35 | 36 | /// 37 | /// 服务器名称或者ip 38 | /// 39 | public string Server { get; set; } 40 | 41 | /// 42 | /// 端口 43 | /// 44 | public int Port { get; set; } 45 | 46 | /// 47 | /// 是否可以执行带有风险性指令 48 | /// 49 | public bool AllowAdmin { get; set; } 50 | 51 | /// 52 | /// 链接超时时间,一般用默认(配置为0表示默认) 53 | /// 54 | public int ConnectTimeout { get; set; } 55 | 56 | /// 57 | /// 同步时间,这个会影响redis做get操作的是否会超时 58 | /// 59 | public int SyncTimeout { get; set; } 60 | 61 | /// 62 | /// 是否需要密码 63 | /// 64 | public bool Ssl { get; set; } 65 | 66 | /// 67 | /// 新加redis ssl配置,为了兼容老的ssl 默认是false 68 | /// 69 | public bool Ssl2 { get; set; } 70 | 71 | /// 72 | /// 密码 73 | /// 74 | public string Pwd { get; set; } 75 | 76 | /// 77 | /// redis 数据库索引 78 | /// 79 | public int DbIndex { get; set; } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /SuperGMS.Extend/BaseAppExtend/EditFormFieldHelper/EditFormApiArgs.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.AttributeEx 5 | 文件名: EditFormApiArgs 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/1/24 12:03:31 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | namespace SuperGMS.Extend.EditFormFieldHelper 15 | { 16 | using SuperGMS.Extend.BaseAppExtend.EditFormFieldHelper; 17 | 18 | /// 19 | /// EditFormApiArgs 20 | /// 21 | public class EditFormApiArgs 22 | { 23 | /// 24 | /// 编辑表单的接口名称 25 | /// 26 | public string ApiName { get; set; } 27 | } 28 | 29 | /// 30 | /// 编辑表单各个字段的属性 31 | /// 32 | public class EditFormApiResult 33 | { 34 | /// 35 | /// Gets or sets 字段名称 36 | /// 37 | public string FieldName { get; set; } 38 | 39 | /// 40 | /// Gets or sets 是否可以编辑,0,可以;1、不可用; 41 | /// 42 | public int IsEdit { get; set; } 43 | 44 | /// 45 | /// Gets or sets 是否必输,0、非必输,1、必输 46 | /// 47 | public int IsRequired { get; set; } 48 | 49 | /// 50 | /// Gets or sets 分组名称,当前字段对应得控件所在的分组,分组名称相同的控件会显示在一起 51 | /// 52 | public string GroupName { get; set; } 53 | 54 | /// 55 | /// Gets or sets 当前字段所对应的控件显示的Tab页,Tab页相同的将被显示在一起 56 | /// 57 | public string TabName { get; set; } 58 | 59 | /// 60 | /// Gets or sets 当前字段的长度,这个长度是数据库中的字段长度 61 | /// 62 | public int Length { get; set; } 63 | 64 | /// 65 | /// Gets or sets 当前字段类型,int\decimal\string\datetime 66 | /// 67 | public string DataType { get; set; } 68 | 69 | /// 70 | /// Gets or sets 显示的控件类型 71 | /// 72 | public ControlType CnType { get; set; } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /SuperGMS/ApiHelper/BaseGetApiHelp.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.ExceptionEx; 2 | using SuperGMS.Protocol.RpcProtocol; 3 | using SuperGMS.Rpc; 4 | using SuperGMS.Rpc.Server; 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Reflection; 9 | 10 | namespace SuperGMS.ApiHelper 11 | { 12 | /// 13 | /// 得到微服务接口列表帮助信息 14 | /// 15 | public abstract class BaseGetApiHelp : RpcBaseServer> 16 | { 17 | /// 18 | /// Gets 需实现的属性 19 | /// 20 | protected virtual Assembly Assembly { get; } 21 | 22 | public BaseGetApiHelp() 23 | { 24 | Assembly = Assembly.GetEntryAssembly(); 25 | } 26 | 27 | /// 28 | /// GetAddress接口实现 29 | /// 30 | /// 传入参数 31 | /// 传出状态码 32 | /// 接口返回值 33 | protected override List Process(Nullables valueArgs, out StatusCode code) 34 | { 35 | code = StatusCode.OK; 36 | try 37 | { 38 | var helper = new ApiHelper(this.Assembly); 39 | if (this.args.ct == "webapi") 40 | { 41 | var list = helper.GetAllInterfaceClass(this.args.lg); 42 | return list; 43 | } 44 | else 45 | { 46 | var list = helper.GetAllInterfaceClass(this.args.lg, true); 47 | return list; 48 | } 49 | } 50 | catch (Exception ex) 51 | { 52 | throw new BusinessException(ex.Message); 53 | } 54 | } 55 | 56 | /// 57 | /// Check 58 | /// 59 | /// args 60 | /// code 61 | /// bool 62 | protected override bool Check(Nullables args, out StatusCode code) 63 | { 64 | code = StatusCode.OK; 65 | return true; 66 | } 67 | } 68 | 69 | public class GetApiHelp : BaseGetApiHelp { } 70 | } 71 | -------------------------------------------------------------------------------- /SuperGMS.HttpProxy/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Hosting; 5 | using SuperGMS.Config; 6 | using SuperGMS.HttpProxy; 7 | using SuperGMS.Rpc; 8 | using Grant.HttpProxy.Middleware; 9 | using System; 10 | 11 | namespace SuperGMS.HttpProxy 12 | { 13 | public class Startup 14 | { 15 | public Startup(IWebHostEnvironment configuration) 16 | { 17 | } 18 | 19 | // This method gets called by the runtime. Use this method to add services to the container. 20 | public void ConfigureServices(IServiceCollection services) 21 | { 22 | services.AddCors(options => 23 | { 24 | options.AddPolicy("AllowAll", p => p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); 25 | }); 26 | 27 | // services.AddResponseCompression(); 28 | 29 | // services.AddMvc(); 30 | } 31 | 32 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 33 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 34 | { 35 | if (env.IsDevelopment()) 36 | { 37 | app.UseDeveloperExceptionPage(); 38 | } 39 | 40 | // app.UseResponseCompression(); 41 | //var server = ServerSetting.GetRpcServer(SuperGMS.HttpProxy.SuperHttpProxy.HttpProxyName); 42 | //if (server.ServerType == ServerType.HttpWebApi) 43 | //{ 44 | // ServerProxy.Register(typeof(Program)); 45 | //} 46 | //else 47 | //{ 48 | SuperGMS.HttpProxy.SuperHttpProxy.Register(); 49 | //} 50 | app.UseCors("AllowAll"); 51 | //WebSocketOptions socketOptions = new WebSocketOptions 52 | //{ 53 | // KeepAliveInterval = TimeSpan.FromSeconds(120), 54 | // ReceiveBufferSize=4*1024, 55 | //}; 56 | //app.UseWebSockets(socketOptions); 57 | app.UseMiddleware(); 58 | 59 | // app.UseMvc(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /SuperGMS.WebSocketService/Program.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Config; 2 | using SuperGMS.Log; 3 | using SuperGMS.Rpc; 4 | using SuperGMS.WebSocketEx; 5 | 6 | using WebSocketService; 7 | { 8 | ILogger _loger = LogFactory.CreateLogger(); 9 | var builder = WebApplication.CreateBuilder(args); 10 | var server = ServerSetting.GetRpcServer(SuperWebSocketProxy.WebSocketProxy); 11 | 12 | // 添加设置允许跨域的配置 13 | builder.Services.AddCors(options => 14 | { 15 | options.AddPolicy("AllowAll", p => p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); 16 | }); 17 | 18 | if (server == null || server.Port < 1) throw new Exception("请配置WebSocket的端口号"); 19 | var url = $"http://*:{server.Port}/"; 20 | _loger.LogInformation($"WebSocket监听地址:{url}"); 21 | 22 | // 设置监听端口和包体大小的配置 23 | builder.WebHost.UseUrls(url).UseKestrel(options => 24 | { 25 | //请求内容长度限制(单位B) 26 | int maxLength = 0; 27 | var maxBody = ServerSetting.Config.ConstKeyValue.Items.FirstOrDefault(i => i.Key == "MaxHttpBody")?.Value; 28 | if (!string.IsNullOrEmpty(maxBody)) 29 | { 30 | int.TryParse(maxBody, out maxLength); 31 | } 32 | if (maxLength < 4194304) maxLength = 4194304; // 最小4M 33 | if (maxLength > 104857600) maxLength = 104857600; // 最大100M 34 | options.Limits.MaxRequestBodySize = maxLength; 35 | options.AllowSynchronousIO = true; 36 | }); 37 | 38 | var app = builder.Build(); 39 | 40 | if (builder.Environment.IsDevelopment()) 41 | { 42 | app.UseDeveloperExceptionPage(); 43 | } 44 | 45 | app.UseCors("AllowAll"); 46 | 47 | //设置支持websocket 48 | app.UseWebSockets(new WebSocketOptions 49 | { 50 | KeepAliveInterval = TimeSpan.FromSeconds(120), 51 | }); 52 | 53 | // 注册WebSocket,接收前端消息,上行消息 54 | app.UseMiddleware(); 55 | 56 | SuperWebSocketManager.Initlize(); 57 | 58 | _=Task.Run(() => 59 | { 60 | // 注册WebSocket服务为内部服务提供发送消息的接口(本地Rpc端口注册),接收后端消息,下行消息 61 | ServerProxy.Register(typeof(Program)); 62 | // 作为代理层,需要注册拉取后端的所有服务的负载地址 63 | // Websocket只做后端推送,前端调用直接走接口,简化复杂度 64 | // SuperWebSocketProxy.Register(); 65 | }); 66 | 67 | app.Run(); 68 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/0.Thrift/Server/ThriftRpcServer.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.GrantRpc.Thrift.Server 5 | 文件名:ThriftServer 6 | 创建者:grant (巩建春 e-mail : nnn987@126.com ; QQ:406333743; Tel:+86 15619212255) 7 | CLR版本:4.0.30319.42000 8 | 时间:2017/5/16 18:07:38 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using Microsoft.Extensions.Logging; 15 | 16 | using System; 17 | using System.Threading; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Server; 21 | using Thrift.Transport; 22 | using Thrift.Transport.Server; 23 | 24 | using static SuperGMS.Rpc.Thrift.Server.ThriftService; 25 | 26 | namespace SuperGMS.Rpc.Thrift.Server 27 | { 28 | /// 29 | /// 30 | /// 31 | public class ThriftRpcServer : SuperGMSBaseServer 32 | { 33 | private TThreadPoolAsyncServer ts; 34 | private TServerSocketTransport serverTransport; 35 | 36 | protected override void Dispose() 37 | { 38 | ts.Stop(); 39 | serverTransport.Close(); 40 | } 41 | 42 | protected override void ServerRegister(SuperGMSServerConfig server, string[] args=null) 43 | { 44 | try 45 | { 46 | serverTransport = new TServerSocketTransport(server.Port,null); 47 | 48 | // 传输协议 49 | TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory(); 50 | AsyncProcessor processor = new ThriftService.AsyncProcessor(this); 51 | ts = new TThreadPoolAsyncServer(processor, serverTransport, new TTransportFactory(), factory); 52 | ts.ServeAsync(CancellationToken.None).Wait(); 53 | } 54 | catch (TTransportException tex) 55 | { 56 | logger.LogError(tex, "ThriftServer.ServerRegister.TTransportException.Error"); 57 | throw; 58 | } 59 | catch (Exception ex) 60 | { 61 | logger.LogError(ex, "ThriftServer.ServerRegister.Exception.Error"); 62 | throw; 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /SuperGMS/Config/RpcClient/RpcClients.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称: SuperGMS.Config 5 | 文件名: Configuration 6 | 创建者: grant(巩建春) nnn987@126.com 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2018/4/19 11:56:47 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using SuperGMS.Router; 15 | using SuperGMS.Rpc; 16 | 17 | using System.Collections.Generic; 18 | 19 | namespace SuperGMS.Config 20 | { 21 | public class RpcClients 22 | { 23 | /// 24 | /// 25 | /// 26 | public List Clients { get; set; } 27 | } 28 | public class Client 29 | { 30 | /// 31 | /// 32 | /// 33 | public string ServerName { get; set; } 34 | 35 | /// 36 | /// 37 | /// 38 | public RouterType RouterType { get; set; } 39 | 40 | /// 41 | /// 42 | /// 43 | public List Items { get; set; } 44 | } 45 | public class ClientItem 46 | { 47 | /// 48 | /// 这里冗余一个字段 49 | /// 50 | public RouterType RouterType { get; set; } 51 | /// 52 | /// 53 | /// 54 | public int Pool { get; set; } 55 | 56 | /// 57 | /// 58 | /// 59 | public string Ip { get; set; } 60 | 61 | /// 62 | /// 63 | /// 64 | public int Port { get; set; } 65 | 66 | /// 67 | /// TimeOut 68 | /// 69 | public int TimeOut { get; set; } 70 | 71 | /// 72 | /// ServerType 73 | /// 74 | public ServerType ServerType { get; set; } 75 | 76 | private bool enable = true; 77 | 78 | /// 79 | /// 是否启用 ,本地配置不用这个,缺省为true 80 | /// 81 | public bool Enable 82 | { 83 | get { return enable; } 84 | set { enable = value; } 85 | } 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DBInfo.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx 5 | 文件名: DBInfo 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/18 14:06:37 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Text; 17 | using Microsoft.EntityFrameworkCore; 18 | 19 | namespace SuperGMS.DB.EFEx 20 | { 21 | /// 22 | /// DBInfo 23 | /// 24 | public class DbInfo 25 | { 26 | /// 27 | /// Gets or sets 数据模型名称 28 | /// 29 | public string DbContextName { get; set; } 30 | 31 | /// 32 | /// Gets or sets Dbtype 33 | /// 34 | public DbType DbType { get; set; } 35 | 36 | /// 37 | /// Gets or sets 数据库名称 38 | /// 39 | public string DbName { get; set; } 40 | 41 | /// 42 | /// Gets or sets 数据库登录名 43 | /// 44 | public string UserName { get; set; } 45 | 46 | /// 47 | /// Gets or sets 登录密码 48 | /// 49 | public string Pwd { get; set; } 50 | 51 | /// 52 | /// Gets or sets 数据库Ip 53 | /// 54 | public string Ip { get; set; } 55 | 56 | /// 57 | /// Gets or sets 端口 58 | /// 59 | public int Port { get; set; } 60 | 61 | /// 62 | /// 数据执行时间 63 | /// 64 | public int CommandTimeout { get; set; } 65 | 66 | /// 67 | /// Gets or sets 其他特殊的附加信息 68 | /// 69 | public string Other { get; set; } 70 | 71 | /// 72 | /// tostring 73 | /// 74 | /// string 75 | public override string ToString() 76 | { 77 | return $"DbContextName:{DbContextName},DbName:{DbName},DbType:{DbType},UserName:{UserName},Pwd:{Pwd},Ip:{Ip},Port:{Port},Other:{Other}"; 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /SuperGMS/Rpc/AssemblyTools/ClassTemplate.txt: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 创建者:Create by GrantRpcProxyTools grant 4 | 说明:本工具生成的命名空间只是跟节点grant.RpcProxy,需要注意修改为具体项目的命名空间, 5 | 如:grant.RpcProxy.OMS 6 | 另外要注意为了最少改动所有Args和Result所在的命名空间必须跟项目的命名空间一致,不能出现目录名称 7 | 如:grant.RpcProxy.OMS下的所有类都是这个命名空间,但是你可以创建文件夹来便于管理 8 | 如果此文件已经存在,生成完毕将自己写的那个接口拷贝到已有文件,不能直接覆盖,防止覆盖别人的改动 9 | ----------------------------------------------------------------*/ 10 | using SuperGMS.Protocol.RpcProtocol; 11 | using SuperGMS.Rpc.Client; 12 | using SuperGMS.Rpc.Server; 13 | 14 | namespace grant.RpcProxy 15 | { 16 | internal class #assembly_name# : I#assembly_name# 17 | { 18 | #class_part# 19 | 20 | public void Initlize() 21 | { 22 | GrantRpcClientManager.Register(serviceName); 23 | } 24 | } 25 | 26 | 27 | public interface I#assembly_name# 28 | { 29 | #interface_part# 30 | 31 | void Initlize(); 32 | 33 | } 34 | 35 | [InitlizeMethod] 36 | public class #assembly_name#Manager 37 | { 38 | private static object root = new object(); 39 | private static I#assembly_name# _proxy; 40 | 41 | 42 | /// 43 | /// 主要用来让测试用的 44 | /// 45 | /// 46 | public static void Initlize(I#assembly_name# proxy) 47 | { 48 | if (_proxy == null) 49 | { 50 | lock (root) 51 | { 52 | if (_proxy == null) 53 | _proxy = proxy; 54 | } 55 | } 56 | _proxy.Initlize(); 57 | } 58 | 59 | 60 | #region 这里的东西是工具自动生成的,千万不能动 61 | 62 | /// 63 | /// 默认构造是用来注册的 64 | /// 用来自动注册当前调用的服务的配置路由,工具自动生成,千万不能动 65 | /// 66 | [InitlizeMethod] 67 | public static void Initlize() 68 | { 69 | I#assembly_name# p = new #assembly_name#(); 70 | Initlize(p); 71 | } 72 | 73 | public static I#assembly_name# Proxy 74 | { 75 | get { return _proxy; } 76 | } 77 | 78 | #endregion 79 | 80 | 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /SuperGMS/DB/EFEx/DbOptionBulider/MySqlDBContextOptionBuilder.cs: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2018 SuperGMS (Grant 巩建春) 本软件的所有源码都可以免费的进行学习交流,切勿用于商业用途 3 | 4 | 项目名称:SuperGMS.DB.EFEx 5 | 文件名: MySqlDBContextOptionBuilder 6 | 创建者: grant(巩建春) 7 | CLR版本: 4.0.30319.42000 8 | 时间: 2017/12/2 20:59:58 9 | 10 | 功能描述: 11 | 12 | ----------------------------------------------------------------*/ 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Text; 16 | using Microsoft.EntityFrameworkCore; 17 | 18 | namespace SuperGMS.DB.EFEx 19 | { 20 | /// 21 | /// MySqlDBContextOptionBuilder 22 | /// 23 | public class MySqlDBContextOptionBuilder : IContextOptionBuilderFactory 24 | { 25 | /// 26 | /// 根据数据类型获取连接字符串 27 | /// 28 | /// dbInfo 29 | /// string 30 | public static string GetDbConnectionString(DbInfo dbInfo) 31 | { 32 | return $"Data Source={dbInfo.Ip};port={(dbInfo.Port > 0 ? dbInfo.Port : 3306)};Initial Catalog={dbInfo.DbName};user id={dbInfo.UserName};password={dbInfo.Pwd};Character Set=utf8;pooling=true;MaximumPoolsize=1000;"; 33 | } 34 | 35 | /// 36 | /// CreateOptionsBuilder 37 | /// 38 | /// T 39 | /// connectionString 40 | /// DbContextOptionsBuilder 41 | public DbContextOptionsBuilder CreateOptionsBuilder(string connectionString) 42 | where T : DbContext 43 | { 44 | DbContextOptionsBuilder options = new DbContextOptionsBuilder(); 45 | options.UseMySql(connectionString,ServerVersion.AutoDetect(connectionString)); 46 | return options; 47 | } 48 | 49 | /// 50 | /// 获取数据库连接字符串 51 | /// 52 | /// dbInfo 53 | /// string 54 | public string GetConnectionString(DbInfo dbInfo) 55 | { 56 | return MySqlDBContextOptionBuilder.GetDbConnectionString(dbInfo); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SuperGMS.Extend/MicroServiceAssembly.cs: -------------------------------------------------------------------------------- 1 | using SuperGMS.Protocol.RpcProtocol; 2 | using SuperGMS.Rpc.Server; 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | 9 | namespace SuperGMS.Extend 10 | { 11 | /// 12 | /// 微服务术语类,封装部分操作,缓存类型 13 | /// 14 | public class MicroServiceAssembly 15 | { 16 | /// 17 | /// RPC 基类 18 | /// 19 | private static readonly string RpcBaseName = typeof(RpcBaseServer).GetGenericTypeDefinition().FullName; 20 | private static List ApiInterfaces; 21 | 22 | static MicroServiceAssembly() 23 | { 24 | var theAssembly = Assembly.GetEntryAssembly(); 25 | ApiInterfaces = theAssembly.GetTypes().Where(IsGrantRpcBaseServerChildClass).ToList(); 26 | } 27 | 28 | /// 29 | /// 根据指定的api类名,调用run方法执行api 30 | /// 31 | /// 类名 32 | /// 参数 33 | /// 状态码 34 | /// 对象参数 35 | /// 结果值 36 | public static object Run(string apiName, Args args, out StatusCode code, object objValue = null) 37 | { 38 | var t = ApiInterfaces.FirstOrDefault(x => x.Name.Equals(apiName)); 39 | if (t == null) 40 | { 41 | throw new NotImplementedException($"{apiName} class dont found."); 42 | } 43 | 44 | dynamic apiInstance = Activator.CreateInstance(t); 45 | return apiInstance.Run(args, out code, objValue); 46 | } 47 | 48 | /// 49 | /// 判断是否Rpc接口类 50 | /// 51 | /// 本微服务中的类型 52 | /// 是否Rpc接口类 53 | private static bool IsGrantRpcBaseServerChildClass(Type type) 54 | { 55 | if (type.IsGenericType && type.GetGenericTypeDefinition().FullName == RpcBaseName) 56 | { 57 | return true; 58 | } 59 | 60 | return (type.BaseType != null) && IsGrantRpcBaseServerChildClass(type.BaseType); 61 | } 62 | } 63 | } 64 | --------------------------------------------------------------------------------