From f6a79017cd2c7049ef135c762169255228d30364 Mon Sep 17 00:00:00 2001 From: H Vs Date: Mon, 17 Jul 2023 11:39:34 +0800 Subject: [PATCH] orm --- .../Taos/HealthMonitorTaosDataContext.cs | 109 ++++++----- .../Dal/EfCoreImpl/EfCoreDataAccessor.cs | 3 +- .../Dal/Factory/GpsCardAccessorFactory.cs | 88 ++++----- .../Factory/HealthMonitorAccessorFactory.cs | 96 ++++----- .../HealthMonitorTDengineAccessorFactory.cs | 84 ++++---- .../Taos/IHealthMonitorTaosDataAccessor.cs | 13 ++ HealthMonitor.Core/HealthMonitor.Core.csproj | 1 - .../Map/HealthMonitor/Taos/HmBloodPressMap.cs | 141 +++++++++++++ .../Taos/HmBloodPressStatsIncMap.cs | 185 ++++++++++++++++++ .../HealthMonitor/Taos/HmBloodPress.cs | 33 ++++ .../Taos/HmBloodPressStatsInc.cs | 101 ++++++++++ .../HealthMonitor/Taos/StbHmBloodPress.cs | 36 ---- .../Base/HealthMonitorControllerBase.cs | 5 +- .../HealthMonitor/HmBloodPressController.cs | 127 +++++++++++- HealthMonitor.WebApi/Program.cs | 41 ++-- .../appsettings.Development.json | 5 +- .../appsettings.production.json | 4 +- HealthMonitor.WebApi/appsettings.test.json | 8 +- 18 files changed, 828 insertions(+), 252 deletions(-) create mode 100644 HealthMonitor.Core/Dal/Taos/IHealthMonitorTaosDataAccessor.cs create mode 100644 HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressMap.cs create mode 100644 HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressStatsIncMap.cs create mode 100644 HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPress.cs create mode 100644 HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPressStatsInc.cs delete mode 100644 HealthMonitor.Util/Entities/HealthMonitor/Taos/StbHmBloodPress.cs diff --git a/HealthMonitor.Core/Context/Taos/HealthMonitorTaosDataContext.cs b/HealthMonitor.Core/Context/Taos/HealthMonitorTaosDataContext.cs index f40dee6..363b152 100644 --- a/HealthMonitor.Core/Context/Taos/HealthMonitorTaosDataContext.cs +++ b/HealthMonitor.Core/Context/Taos/HealthMonitorTaosDataContext.cs @@ -15,7 +15,7 @@ namespace HealthMonitor.Core.Context.Taos public class HealthMonitorTaosDataContext : DbContext, IWithDataSchema { - public DbSet StbHmBloodPress { get; set; } = default!; + public DbSet HmBloodPress { get; set; } = default!; public string DataSchema { get; } public HealthMonitorTaosDataContext(DbContextOptions options) : base(options) @@ -25,78 +25,89 @@ namespace HealthMonitor.Core.Context.Taos protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - // base.OnConfiguring(optionsBuilder); - optionsBuilder.UseTaos(@"Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native"); + base.OnConfiguring(optionsBuilder); + //optionsBuilder.UseTaos(@"Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { - //modelBuilder.HasDefaultSchema(DataSchema); + // modelBuilder.HasDefaultSchema(DataSchema); - //var typesToRegister = Assembly.GetExecutingAssembly().GetTypes() - // .Where(type => !string.IsNullOrEmpty(type.Namespace) && type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")) - // .Where(type => type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(GenericEntityTypeConfiguration<>)); + var typesToRegister1 = Assembly.GetExecutingAssembly().GetTypes() + .Where(type => !string.IsNullOrEmpty(type.Namespace) + && type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")); - //foreach (var t in typesToRegister) - //{ - // dynamic configurationInstance = Activator.CreateInstance(t)!; - // modelBuilder.ApplyConfiguration(configurationInstance); - //} + var typesToRegister = Assembly.GetExecutingAssembly().GetTypes() + .Where(type => !string.IsNullOrEmpty(type.Namespace) && type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")) + .Where(type => type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(GenericEntityTypeConfiguration<>)); - //base.OnModelCreating(modelBuilder); + foreach (var t in typesToRegister) + { + dynamic configurationInstance = Activator.CreateInstance(t)!; + modelBuilder.ApplyConfiguration(configurationInstance); + } + base.OnModelCreating(modelBuilder); - modelBuilder.Entity().HasKey(e => e.Ts) - .HasName("PRIMARY"); + //var a1 = typesToRegister1; + //var a2 = typesToRegister; - modelBuilder.Entity().ToTable("stb_hm_bloodpress"); + //modelBuilder.Entity().HasKey(e => e.Ts) + // .HasName("PRIMARY"); - modelBuilder.Entity().Property(e => e.Ts) - .HasColumnName("ts") - .HasColumnType("timestamp"); + //modelBuilder.Entity().ToTable("stb_hm_bloodpress"); - modelBuilder.Entity() - .Property(e => e.Serialno) - .HasColumnName("serialno"); + //modelBuilder.Entity().Property(e => e.Ts) + // .HasColumnName("ts") + // .HasColumnType("timestamp"); - modelBuilder.Entity() - .Property(e => e.BloodPressId) - .HasColumnName("bloodpress_id"); + //modelBuilder.Entity() + // .Property(e => e.Serialno) + // .HasColumnName("serialno"); - modelBuilder.Entity() - .Property(e => e.MessageId) - .HasColumnName("message_id"); + //modelBuilder.Entity() + // .Property(e => e.BloodPressId) + // .HasColumnName("bloodpress_id"); - modelBuilder.Entity() - .Property(e => e.SystolicValue) - .HasColumnName("systolic_value"); + //modelBuilder.Entity() + // .Property(e => e.MessageId) + // .HasColumnName("message_id"); - modelBuilder.Entity() - .Property(e => e.DiastolicValue) - .HasColumnName("diastolic_value"); + //modelBuilder.Entity() + // .Property(e => e.SystolicValue) + // .HasColumnName("systolic_value"); + //modelBuilder.Entity() + // .Property(e => e.DiastolicValue) + // .HasColumnName("diastolic_value"); - modelBuilder.Entity() - .Property(e => e.LastUpdate) - .HasColumnName("last_update"); + //modelBuilder.Entity() + // .Property(e => e.LastUpdate) + // .HasColumnName("last_update"); - modelBuilder.Entity() - .Property(e => e.CreateTime) - .HasColumnName("create_time"); + + //modelBuilder.Entity() + // .Property(e => e.CreateTime) + // .HasColumnName("create_time"); + + + //modelBuilder.Entity() + // .Property(e => e.Method) + // .HasColumnName("method"); + + + //modelBuilder.Entity() + // .Property(e => e.IsDisplay) + // .HasColumnName("is_display"); + + //modelBuilder.Entity() + // .Property(e => e.TailNo) + // .HasColumnName("serial_tail_no"); - modelBuilder.Entity() - .Property(e => e.Method) - .HasColumnName("method"); - modelBuilder.Entity() - .Property(e => e.IsDisplay) - .HasColumnName("is_display"); - modelBuilder.Entity() - .Property(e => e.TailNo) - .HasColumnName("serial_tail_no"); } } } diff --git a/HealthMonitor.Core/Dal/EfCoreImpl/EfCoreDataAccessor.cs b/HealthMonitor.Core/Dal/EfCoreImpl/EfCoreDataAccessor.cs index 9af1ffd..08eed14 100644 --- a/HealthMonitor.Core/Dal/EfCoreImpl/EfCoreDataAccessor.cs +++ b/HealthMonitor.Core/Dal/EfCoreImpl/EfCoreDataAccessor.cs @@ -4,10 +4,11 @@ using System.Data; using System.Data.Common; using System.Linq.Expressions; using HealthMonitor.Core.Common; +using HealthMonitor.Core.Dal.Taos; namespace HealthMonitor.Core.Dal.EfCoreImpl { - public class EfCoreDataAccessor : IGpsCardDataAccessor,IHealthMonitorDataAccessor + public class EfCoreDataAccessor : IGpsCardDataAccessor,IHealthMonitorDataAccessor, IHealthMonitorTaosDataAccessor { private DbContext? _context; diff --git a/HealthMonitor.Core/Dal/Factory/GpsCardAccessorFactory.cs b/HealthMonitor.Core/Dal/Factory/GpsCardAccessorFactory.cs index 3361540..8cdc5ef 100644 --- a/HealthMonitor.Core/Dal/Factory/GpsCardAccessorFactory.cs +++ b/HealthMonitor.Core/Dal/Factory/GpsCardAccessorFactory.cs @@ -1,50 +1,50 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using HealthMonitor.Core.Context; -using HealthMonitor.Core.DbLog; -using HealthMonitor.Core.Dal.EfCoreImpl; +//using Microsoft.EntityFrameworkCore; +//using Microsoft.Extensions.Configuration; +//using Microsoft.Extensions.Logging; +//using HealthMonitor.Core.Context; +//using HealthMonitor.Core.DbLog; +//using HealthMonitor.Core.Dal.EfCoreImpl; -namespace HealthMonitor.Core.Dal.Factory -{ - /// - /// 瞬态GpsCardContext构建帮助类 - /// - public class GpsCardAccessorFactory - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly ILoggerFactory _loggerFactory; +//namespace HealthMonitor.Core.Dal.Factory +//{ +// /// +// /// 瞬态GpsCardContext构建帮助类 +// /// +// public class GpsCardAccessorFactory +// { +// private readonly IConfiguration _configuration; +// private readonly ILogger _logger; +// private readonly ILoggerFactory _loggerFactory; - public GpsCardAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) - { - _configuration = configuration; - _logger = logger; - _loggerFactory = new LoggerFactory(new[] { loggerProvider }); - } +// public GpsCardAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) +// { +// _configuration = configuration; +// _logger = logger; +// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); +// } - public virtual IGpsCardDataAccessor GetDbContext() - { - var mySqlCon = _configuration.GetConnectionString("GpsCard_Connection_String"); - var serverVersion = ServerVersion.AutoDetect(mySqlCon); - var options = new DbContextOptionsBuilder() - .UseMySql(mySqlCon,serverVersion) - .UseLoggerFactory(_loggerFactory) - .Options; +// public virtual IGpsCardDataAccessor GetDbContext() +// { +// var mySqlCon = _configuration.GetConnectionString("GpsCard_Connection_String"); +// var serverVersion = ServerVersion.AutoDetect(mySqlCon); +// var options = new DbContextOptionsBuilder() +// .UseMySql(mySqlCon,serverVersion) +// .UseLoggerFactory(_loggerFactory) +// .Options; - var context = new GpsCardContext(options); - return new EfCoreDataAccessor(context); +// var context = new GpsCardContext(options); +// return new EfCoreDataAccessor(context); - ////AOP需要依赖DI - //var services = new ServiceCollection(); - //services.AddTransient(sp => - //{ - // var context = new GpsCardContext(options); - // return new EfCoreDataAccessor(context); - //}); +// ////AOP需要依赖DI +// //var services = new ServiceCollection(); +// //services.AddTransient(sp => +// //{ +// // var context = new GpsCardContext(options); +// // return new EfCoreDataAccessor(context); +// //}); - //var provider = services.BuildDynamicProxyProvider(); - //return provider.GetRequiredService(); - } - } -} +// //var provider = services.BuildDynamicProxyProvider(); +// //return provider.GetRequiredService(); +// } +// } +//} diff --git a/HealthMonitor.Core/Dal/Factory/HealthMonitorAccessorFactory.cs b/HealthMonitor.Core/Dal/Factory/HealthMonitorAccessorFactory.cs index 11e0740..dc1fddb 100644 --- a/HealthMonitor.Core/Dal/Factory/HealthMonitorAccessorFactory.cs +++ b/HealthMonitor.Core/Dal/Factory/HealthMonitorAccessorFactory.cs @@ -1,55 +1,55 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using HealthMonitor.Core.Context; -using HealthMonitor.Core.DbLog; -using HealthMonitor.Core.Dal.EfCoreImpl; +//using Microsoft.EntityFrameworkCore; +//using Microsoft.Extensions.Configuration; +//using Microsoft.Extensions.Logging; +//using HealthMonitor.Core.Context; +//using HealthMonitor.Core.DbLog; +//using HealthMonitor.Core.Dal.EfCoreImpl; -namespace HealthMonitor.Core.Dal.Factory -{ - /// - /// 瞬态HealthMonitorContext构建帮助类 - /// - public class HealthMonitorAccessorFactory - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly ILoggerFactory _loggerFactory; +//namespace HealthMonitor.Core.Dal.Factory +//{ +// /// +// /// 瞬态HealthMonitorContext构建帮助类 +// /// +// public class HealthMonitorAccessorFactory +// { +// private readonly IConfiguration _configuration; +// private readonly ILogger _logger; +// private readonly ILoggerFactory _loggerFactory; - public HealthMonitorAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) - { - _configuration = configuration; - _logger = logger; - _loggerFactory = new LoggerFactory(new[] { loggerProvider }); - } +// public HealthMonitorAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) +// { +// _configuration = configuration; +// _logger = logger; +// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); +// } - public virtual IHealthMonitorDataAccessor GetDbContext() - { - //var options = new DbContextOptionsBuilder() - // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) - // .UseLoggerFactory(_loggerFactory) - // .Options; +// public virtual IHealthMonitorDataAccessor GetDbContext() +// { +// //var options = new DbContextOptionsBuilder() +// // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) +// // .UseLoggerFactory(_loggerFactory) +// // .Options; - var mySqlCon = _configuration.GetConnectionString("HealthMonitor_Connection_String"); - var serverVersion = ServerVersion.AutoDetect(mySqlCon); - var options = new DbContextOptionsBuilder() - .UseMySql(mySqlCon, serverVersion) - .UseLoggerFactory(_loggerFactory) - .Options; +// var mySqlCon = _configuration.GetConnectionString("HealthMonitor_Connection_String"); +// var serverVersion = ServerVersion.AutoDetect(mySqlCon); +// var options = new DbContextOptionsBuilder() +// .UseMySql(mySqlCon, serverVersion) +// .UseLoggerFactory(_loggerFactory) +// .Options; - var context = new HealthMonitorContext(options); - return new EfCoreDataAccessor(context); +// var context = new HealthMonitorContext(options); +// return new EfCoreDataAccessor(context); - ////AOP需要依赖DI - //var services = new ServiceCollection(); - //services.AddTransient(sp => - //{ - // var context = new GpsCardContext(options); - // return new EfCoreDataAccessor(context); - //}); +// ////AOP需要依赖DI +// //var services = new ServiceCollection(); +// //services.AddTransient(sp => +// //{ +// // var context = new GpsCardContext(options); +// // return new EfCoreDataAccessor(context); +// //}); - //var provider = services.BuildDynamicProxyProvider(); - //return provider.GetRequiredService(); - } - } -} +// //var provider = services.BuildDynamicProxyProvider(); +// //return provider.GetRequiredService(); +// } +// } +//} diff --git a/HealthMonitor.Core/Dal/Factory/HealthMonitorTDengineAccessorFactory.cs b/HealthMonitor.Core/Dal/Factory/HealthMonitorTDengineAccessorFactory.cs index 0cd271b..a201ffb 100644 --- a/HealthMonitor.Core/Dal/Factory/HealthMonitorTDengineAccessorFactory.cs +++ b/HealthMonitor.Core/Dal/Factory/HealthMonitorTDengineAccessorFactory.cs @@ -1,48 +1,48 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using HealthMonitor.Core.Context; -using HealthMonitor.Core.DbLog; -using HealthMonitor.Core.Dal.EfCoreImpl; +//using Microsoft.EntityFrameworkCore; +//using Microsoft.Extensions.Configuration; +//using Microsoft.Extensions.Logging; +//using HealthMonitor.Core.Context; +//using HealthMonitor.Core.DbLog; +//using HealthMonitor.Core.Dal.EfCoreImpl; -namespace HealthMonitor.Core.Dal.Factory -{ - /// - /// 瞬态HealthMonitorContext构建帮助类 - /// - public class HealthMonitorTDengineAccessorFactory - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly ILoggerFactory _loggerFactory; +//namespace HealthMonitor.Core.Dal.Factory +//{ +// /// +// /// 瞬态HealthMonitorContext构建帮助类 +// /// +// public class HealthMonitorTDengineAccessorFactory +// { +// private readonly IConfiguration _configuration; +// private readonly ILogger _logger; +// private readonly ILoggerFactory _loggerFactory; - public HealthMonitorTDengineAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) - { - _configuration = configuration; - _logger = logger; - _loggerFactory = new LoggerFactory(new[] { loggerProvider }); - } +// public HealthMonitorTDengineAccessorFactory(IConfiguration configuration, ILogger logger, IEfCoreLoggerProvider loggerProvider) +// { +// _configuration = configuration; +// _logger = logger; +// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); +// } - //public virtual IHealthMonitorDataAccessor GetDbContext() - //{ - // //var options = new DbContextOptionsBuilder() - // // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) - // // .UseLoggerFactory(_loggerFactory) - // // .Options; +// //public virtual IHealthMonitorDataAccessor GetDbContext() +// //{ +// // //var options = new DbContextOptionsBuilder() +// // // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) +// // // .UseLoggerFactory(_loggerFactory) +// // // .Options; - // //var context = new HealthMonitorContext(options); - // //return new EfCoreDataAccessor(context); +// // //var context = new HealthMonitorContext(options); +// // //return new EfCoreDataAccessor(context); - // ////AOP需要依赖DI - // //var services = new ServiceCollection(); - // //services.AddTransient(sp => - // //{ - // // var context = new GpsCardContext(options); - // // return new EfCoreDataAccessor(context); - // //}); +// // ////AOP需要依赖DI +// // //var services = new ServiceCollection(); +// // //services.AddTransient(sp => +// // //{ +// // // var context = new GpsCardContext(options); +// // // return new EfCoreDataAccessor(context); +// // //}); - // //var provider = services.BuildDynamicProxyProvider(); - // //return provider.GetRequiredService(); - //} - } -} +// // //var provider = services.BuildDynamicProxyProvider(); +// // //return provider.GetRequiredService(); +// //} +// } +//} diff --git a/HealthMonitor.Core/Dal/Taos/IHealthMonitorTaosDataAccessor.cs b/HealthMonitor.Core/Dal/Taos/IHealthMonitorTaosDataAccessor.cs new file mode 100644 index 0000000..72b71a2 --- /dev/null +++ b/HealthMonitor.Core/Dal/Taos/IHealthMonitorTaosDataAccessor.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HealthMonitor.Core.Dal.Taos +{ + public interface IHealthMonitorTaosDataAccessor : IDataAccessor + { + + } +} diff --git a/HealthMonitor.Core/HealthMonitor.Core.csproj b/HealthMonitor.Core/HealthMonitor.Core.csproj index 95d3e0c..24a11a6 100644 --- a/HealthMonitor.Core/HealthMonitor.Core.csproj +++ b/HealthMonitor.Core/HealthMonitor.Core.csproj @@ -15,7 +15,6 @@ - diff --git a/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressMap.cs b/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressMap.cs new file mode 100644 index 0000000..38bcc95 --- /dev/null +++ b/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressMap.cs @@ -0,0 +1,141 @@ +using HealthMonitor.Util.Entities.HealthMonitor; +using HealthMonitor.Util.Entities.HealthMonitor.Taos; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HealthMonitor.Core.Map.HealthMonitor.Taos +{ + public class HmBloodPressMap : GenericEntityTypeConfiguration + { + //public override void Configure(EntityTypeBuilder entity) + //{ + + + + // entity.HasKey(e => e.Ts) + // .HasName("PRIMARY"); + + // entity.ToTable("stb_hm_bloodpress"); + + // entity.Property(e => e.Ts) + // .HasColumnName("ts") + // .HasColumnType("timestamp"); + + // entity + // .Property(e => e.Serialno) + // .HasColumnName("serialno"); + + // entity + // .Property(e => e.BloodPressId) + // .HasColumnName("bloodpress_id") + + + + // entity + // .Property(e => e.MessageId) + // .HasColumnName("message_id"); + + // entity + // .Property(e => e.SystolicValue) + // .HasColumnName("systolic_value"); + + // entity + // .Property(e => e.DiastolicValue) + // .HasColumnName("diastolic_value"); + + + // entity + // .Property(e => e.LastUpdate) + // .HasColumnName("last_update"); + + + // entity + // .Property(e => e.CreateTime) + // .HasColumnName("create_time"); + + + // entity + // .Property(e => e.Method) + // .HasColumnName("method"); + + + // entity + // .Property(e => e.IsDisplay) + // .HasColumnName("is_display"); + + // entity + // .Property(e => e.TailNo) + // .HasColumnName("serial_tail_no"); + //} + + + public override void Configure(EntityTypeBuilder entity) + { + + + + entity.HasKey(e => e.Ts) + .HasName("PRIMARY"); + + entity.ToTable("stb_hm_bloodpress"); + + entity.Property(e => e.Ts) + .HasColumnName("ts") + .HasColumnType("timestamp"); + + entity + .Property(e => e.Serialno) + .HasColumnName("serialno") + .HasDefaultValueSql("''"); + + entity + .Property(e => e.BloodPressId) + .HasColumnName("bloodpress_id") + .HasDefaultValueSql("''"); + + + + + entity + .Property(e => e.MessageId) + .HasColumnName("message_id").HasColumnType("VARCHAR").HasDefaultValueSql("''"); + + entity + .Property(e => e.SystolicValue) + .HasColumnName("systolic_value"); + + entity + .Property(e => e.DiastolicValue) + .HasColumnName("diastolic_value"); + + + entity + .Property(e => e.LastUpdate) + .HasColumnName("last_update"); + + + entity + .Property(e => e.CreateTime) + .HasColumnName("create_time"); + + + entity + .Property(e => e.Method) + .HasColumnName("method"); + + + entity + .Property(e => e.IsDisplay) + .HasColumnName("is_display"); + + entity + .Property(e => e.TailNo) + .HasColumnName("serial_tail_no"); + } + } +} diff --git a/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressStatsIncMap.cs b/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressStatsIncMap.cs new file mode 100644 index 0000000..59337ab --- /dev/null +++ b/HealthMonitor.Core/Map/HealthMonitor/Taos/HmBloodPressStatsIncMap.cs @@ -0,0 +1,185 @@ +using HealthMonitor.Util.Entities.HealthMonitor.Taos; +using IoTSharp.Data.Taos; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HealthMonitor.Core.Map.HealthMonitor.Taos +{ + public class HmBloodPressStatsIncMap : GenericEntityTypeConfiguration + { + public override void Configure(EntityTypeBuilder entity) + { + entity.HasKey(e => e.Ts) + .HasName("PRIMARY"); + + entity.ToTable("stb_hm_bloodpress_stats_inc"); + + entity.Property(e => e.Ts) + .HasColumnName("ts") + .HasColumnType("timestamp"); + + entity + .Property(e => e.Serialno) + .HasColumnName("serialno") + .HasColumnType("NCHAR"); + //.HasConversion(typeof(string)) + //.HasCharSet("utf8"); + + //.HasCollation("utf8_general_ci"); + + + entity + .Property(e => e.BloodPressId) + .HasColumnName("bloodpress_id") + .HasColumnType("NCHAR"); + //.HasConversion(typeof(string)) + //.HasCharSet("utf8"); + + + + entity + .Property(e => e.MessageId) + .HasColumnName("message_id") + .HasColumnType("NCHAR"); + //.HasConversion(typeof(string)) + //.HasCharSet("utf8"); + + entity + .Property(e => e.SystolicValue) + .HasColumnName("systolic_value") + .HasColumnType("INT"); + + entity + .Property(e => e.SystolicRefValue) + .HasColumnName("systolic_ref_value") + .HasColumnType("INT"); + + entity + .Property(e => e.SystolicAvgValue) + .HasColumnName("systolic_avg_value") + .HasColumnType("FLOAT"); + + entity + .Property(e => e.SystolicMaxValue) + .HasColumnName("systolic_max_value") + .HasColumnType("INT"); + + entity + .Property(e => e.SystolicMinValue) + .HasColumnName("systolic_min_value") + .HasColumnType("INT"); + + entity + .Property(e => e.SystolicAvgOffset) + .HasColumnName("systolic_avg_offset") + .HasColumnType("FLOAT"); + + entity + .Property(e => e.SystolicIncValue) + .HasColumnName("systolic_inc_value") + .HasColumnType("INT"); + + entity + .Property(e => e.DiastolicValue) + .HasColumnName("diastolic_value") + .HasColumnType("INT"); + + entity + .Property(e => e.DiastolicRefValue) + .HasColumnName("diastolic_ref_value") + .HasColumnType("INT"); + + entity + .Property(e => e.DiastolicAvgValue) + .HasColumnName("diastolic_avg_value") + .HasColumnType("FLOAT"); + + entity + .Property(e => e.DiastolicMaxValue) + .HasColumnName("diastolic_max_value") + .HasColumnType("INT"); + + entity + .Property(e => e.DiastolicMinValue) + .HasColumnName("diastolic_min_value") + .HasColumnType("INT"); + + entity + .Property(e => e.DiastolicAvgOffset) + .HasColumnName("diastolic_avg_offset") + .HasColumnType("FLOAT"); + + entity + .Property(e => e.DiastolicIncValue) + .HasColumnName("diastolic_inc_value") + .HasColumnType("INT"); + + entity + .Property(e => e.Gender) + .HasColumnName("gender") + .HasColumnType("TINYINT"); + + + entity + .Property(e => e.Age) + .HasColumnName("age") + .HasColumnType("INT"); + + + //entity + // .Property(e => e.Hypertension) + // .HasColumnName("hypertension"); + + entity + .Property(e => e.Height) + .HasColumnName("height") + .HasColumnType("FLOAT"); + + entity + .Property(e => e.Weight) + .HasColumnName("weight") + .HasColumnType("FLOAT"); + + + entity + .Property(e => e.LastUpdate) + .HasColumnName("last_update") + .HasColumnType("timestamp"); + + + entity + .Property(e => e.StatDuration) + .HasColumnName("stat_duration") + .HasColumnType("INT"); + + entity + .Property(e => e.StatStartTime) + .HasColumnName("stat_start_time") + .HasColumnType("timestamp"); + + entity + .Property(e => e.StatEndTime) + .HasColumnName("stat_end_time") + .HasColumnType("timestamp"); + + entity + .Property(e => e.Remark) + .HasColumnName("remark") + .HasColumnType("NCHAR"); + // .HasConversion(typeof(string)) + // .HasCharSet("utf8"); + + entity + .Property(e => e.TailNo) + .HasColumnName("serial_tail_no") + .HasColumnType("NCHAR"); + // .HasConversion(typeof(string)) + // .HasCharSet("utf8"); + } + } +} diff --git a/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPress.cs b/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPress.cs new file mode 100644 index 0000000..9f2a550 --- /dev/null +++ b/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPress.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations.Schema; + +namespace HealthMonitor.Util.Entities.HealthMonitor.Taos +{ + public class HmBloodPress + { + [Column("ts")] + public DateTime Ts { get; set; } = default!; + //[JsonProperty("bloodpress_id")] + [Column("bloodpress_id")] + public string BloodPressId { get; set; } ="aaaaa"; + [Column("message_id")] + public string MessageId { get; set; } = default!; + [Column("serialno")] + public string Serialno { get; set; } = default!; + [Column("systolic_value")] + public int SystolicValue { get; set; } + [Column("diastolic_value")] + public int DiastolicValue { get; set; } + [Column("last_update")] + public DateTime LastUpdate { get; set; } + [Column("create_time")] + public DateTime CreateTime { get; set; } + [Column("method")] + public sbyte Method { get; set; } + [Column("is_display")] + public bool IsDisplay { get; set; } + + [Column("serial_tail_no")] + public string TailNo { get; set; }=string.Empty; + } +} diff --git a/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPressStatsInc.cs b/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPressStatsInc.cs new file mode 100644 index 0000000..2ea3382 --- /dev/null +++ b/HealthMonitor.Util/Entities/HealthMonitor/Taos/HmBloodPressStatsInc.cs @@ -0,0 +1,101 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HealthMonitor.Util.Entities.HealthMonitor.Taos +{ + public class HmBloodPressStatsInc + { + [JsonProperty("ts")] + public DateTime Ts { get; set; } = default!; + + [JsonProperty("bloodpress_id")] + [Column(TypeName = "varchar(36)")] + public string BloodPressId { get; set; } = string.Empty; + + [JsonProperty("message_id")] + public string MessageId { get; set; } = default!; + + [JsonProperty("serialno")] + public string Serialno { get; set; } = default!; + + [JsonProperty("systolic_value")] + public int SystolicValue { get; set; } + + [JsonProperty("systolic_ref_value")] + public int SystolicRefValue { get; set; } + + [JsonProperty("systolic_avg_value")] + public float SystolicAvgValue { get; set; } + + [JsonProperty("systolic_max_value")] + public int SystolicMaxValue { get; set; } + + [JsonProperty("systolic_min_value")] + public int SystolicMinValue { get; set; } + + [JsonProperty("systolic_avg_offset")] + public float SystolicAvgOffset { get; set; } + + [JsonProperty("systolic_inc_value")] + public int SystolicIncValue { get; set; } + + [JsonProperty("diastolic_value")] + public int DiastolicValue { get; set; } + + [JsonProperty("diastolic_ref_value")] + public int DiastolicRefValue { get; set; } + + [JsonProperty("diastolic_avg_value")] + public float DiastolicAvgValue { get; set; } + + [JsonProperty("diastolic_max_value")] + public int DiastolicMaxValue { get; set; } + + [JsonProperty("diastolic_min_value")] + public int DiastolicMinValue { get; set; } + + [JsonProperty("diastolic_avg_offset")] + public float DiastolicAvgOffset { get; set; } + + [JsonProperty("diastolic_inc_value")] + public int DiastolicIncValue { get; set; } + + [JsonProperty("gender")] + public sbyte Gender { get; set; } + + [JsonProperty("age")] + public int Age { get; set; } + + [JsonProperty("height")] + public float Height { get; set; } + + [JsonProperty("weight")] + public float Weight { get; set; } + + [JsonProperty("last_update")] + public DateTime LastUpdate { get; set; } + + [JsonProperty("stat_duration")] + public int StatDuration { get; set; } + + [JsonProperty("stat_start_time")] + public DateTime StatStartTime { get; set; } + + [JsonProperty("stat_end_time")] + public DateTime StatEndTime { get; set; } + + [JsonProperty("remark")] + public string? Remark { get; set; } = string.Empty; + + //[JsonProperty("hypertension")] + //public bool? Hypertension { get; set; } + + [JsonProperty("serial_tail_no")] + public string? TailNo { get; set; } = string.Empty; + } +} diff --git a/HealthMonitor.Util/Entities/HealthMonitor/Taos/StbHmBloodPress.cs b/HealthMonitor.Util/Entities/HealthMonitor/Taos/StbHmBloodPress.cs deleted file mode 100644 index 3e2af44..0000000 --- a/HealthMonitor.Util/Entities/HealthMonitor/Taos/StbHmBloodPress.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HealthMonitor.Util.Entities.HealthMonitor.Taos -{ - public class StbHmBloodPress - { - [JsonProperty("ts")] - public DateTime Ts { get; set; } = default!; - [JsonProperty("bloodpress_id")] - public string BloodPressId { get; set; } = default!; - [JsonProperty("message_id")] - public string MessageId { get; set; } = default!; - [JsonProperty("serialno")] - public string Serialno { get; set; } = default!; - [JsonProperty("systolic_value")] - public int SystolicValue { get; set; } - [JsonProperty("diastolic_value")] - public int DiastolicValue { get; set; } - [JsonProperty("last_update")] - public DateTime LastUpdate { get; set; } - [JsonProperty("create_time")] - public DateTime CreateTime { get; set; } - [JsonProperty("method")] - public sbyte Method { get; set; } - [JsonProperty("is_display")] - public bool IsDisplay { get; set; } - - [JsonProperty("serial_tail_no")] - public string TailNo { get; set; }=string.Empty; - } -} diff --git a/HealthMonitor.WebApi/Controllers/Base/HealthMonitorControllerBase.cs b/HealthMonitor.WebApi/Controllers/Base/HealthMonitorControllerBase.cs index f82c681..be0dc9d 100644 --- a/HealthMonitor.WebApi/Controllers/Base/HealthMonitorControllerBase.cs +++ b/HealthMonitor.WebApi/Controllers/Base/HealthMonitorControllerBase.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using HealthMonitor.Core.Aop; using HealthMonitor.Core.Cache; using HealthMonitor.Core.Dal; -using HealthMonitor.Core.Dal.Factory; +//using HealthMonitor.Core.Dal.Factory; using HealthMonitor.Core.Operator; using HealthMonitor.Core.Query; using HealthMonitor.Core.Query.Extensions; @@ -21,6 +21,7 @@ using HealthMonitor.Util.Entities.Base; using HealthMonitor.Util.Models; using HealthMonitor.Util.QueryObjects; using HealthMonitor.WebApi.Filters; +using IoTSharp.Data.Taos; namespace HealthMonitor.WebApi.Controllers.Base { @@ -147,7 +148,7 @@ namespace HealthMonitor.WebApi.Controllers.Base public virtual void Add([FromBody] T model, [FromHeader] string requestId) { AssertModelStateIsValid(model); - + _dataAccessor.Add(model); _dataAccessor.Save(); } diff --git a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressController.cs b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressController.cs index d88e76c..1149d74 100644 --- a/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressController.cs +++ b/HealthMonitor.WebApi/Controllers/HealthMonitor/HmBloodPressController.cs @@ -1,17 +1,22 @@ using HealthMonitor.Common; using HealthMonitor.Core.Context.Taos; using HealthMonitor.Core.Dal; +using HealthMonitor.Core.Dal.Taos; using HealthMonitor.Model.Cache; using HealthMonitor.Service.Biz.db; using HealthMonitor.Service.Cache; using HealthMonitor.Util.Entities.HealthMonitor; +using HealthMonitor.Util.Entities.HealthMonitor.Taos; using HealthMonitor.WebApi.Configs; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Data; using System.Linq; +using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; @@ -33,6 +38,7 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor private readonly PersonCacheManager _personCacheMgr; private readonly BloodPressReferenceValueCacheManager _bpRefValCacheManager; protected readonly IHealthMonitorDataAccessor _dataAccessor; + protected readonly IHealthMonitorTaosDataAccessor _dataTaosAccessor; private readonly HealthMonitorTaosDataContext _db; @@ -43,7 +49,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor PersonCacheManager personCacheMgr, BloodPressReferenceValueCacheManager bpRefValCacheManager, IHealthMonitorDataAccessor dataAccessor, - HealthMonitorTaosDataContext db + HealthMonitorTaosDataContext db, + IHealthMonitorTaosDataAccessor dataTaosAccessor ) { @@ -53,12 +60,128 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor _dataAccessor = dataAccessor; _bpRefValCacheManager = bpRefValCacheManager; _db = db; + _dataTaosAccessor = dataTaosAccessor; } [HttpGet] public async Task GetAsync([FromHeader] string requestId) { - var aa = await _db.StbHmBloodPress.FirstOrDefaultAsync(); + //var aa = await _db.StbHmBloodPress.FirstOrDefaultAsync();HmBloodPressStatsInc + //var aa = await _dataTaosAccessor.GetFirstOrDefaultAsync(i => i.BloodPressId != ""); + //var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} USING health_monitor.stb_hm_bloodpress_stats_inc TAGS ('{bp.Serialno.Substring(bp.Serialno.Length - 2)}') VALUES(" + + // $"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + + // $"'{bp.BloodPressId}'," + + // $"'{bp.MessageId}'," + + // $"'{bp.Serialno}'," + + // $"{bp.SystolicValue}," + + // $"{systolicRefValue}," + + // $"{systolicAvg}," + + // $"{systolicMax}," + + // $"{systolicMin}," + + // $"{systolicAvgOffset}," + + // $"{systolicInc}," + + // $"{bp.DiastolicValue}," + + // $"{diastolicRefValue}," + + // $"{diastolicAvg}," + + // $"{diastolicMax}," + + // $"{diastolicMin}," + + // $"{diastolicAvgOffset}," + + //$"{diastolicInc}," + + // $"{gender}," + + // $"{age}," + + // $"{height}," + + // $"{weight}," + + // $"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + + // $"{duration}," + + // $"'{startTime:yyyy-MM-dd HH:mm:ss.fff}'," + + // $"'{endTime:yyyy-MM-dd HH:mm:ss.fff}'," + + // $"'{string.Empty}')"; + //var aab = await _dataTaosAccessor.GetFirstOrDefaultAsync(i => i.BloodPressId != ""); + var aa = "OK"; + //_dataTaosAccessor.Add(new HmBloodPressStatsInc + //{ + // Ts = DateTime.Now, + // BloodPressId = "12", + // MessageId = "1111111111111111", + // Serialno = "1111111111111111", + // SystolicValue = 1, + // SystolicRefValue = 1, + // SystolicAvgValue = 1, + // SystolicMaxValue = 1, + // SystolicMinValue = 1, + // SystolicAvgOffset = 1, + // SystolicIncValue = 1, + // DiastolicValue = 1, + // DiastolicRefValue = 1, + // DiastolicAvgValue = 1, + // DiastolicMaxValue = 1, + // DiastolicMinValue = 1, + // DiastolicAvgOffset = 1, + // DiastolicIncValue = 1, + // Gender = 1, + // Age = 1, + // Height = 1, + // Weight = 1, + // LastUpdate = DateTime.Now, + // StatDuration = 1, + // StatStartTime = DateTime.Now, + // StatEndTime = DateTime.Now, + // Remark = "", + // TailNo = "00" + //}); + + try + { + var model = + new HmBloodPress + { + TailNo = "27", + BloodPressId = "111", + CreateTime = DateTime.Now, + DiastolicValue = 0, + IsDisplay = false, + LastUpdate = DateTime.Now, + MessageId = "asdsdsd", + Method = 1, + Serialno = "00000", + SystolicValue = 0, + Ts = DateTime.Now, + }; + _dataTaosAccessor.Add + ( + new HmBloodPress + { + TailNo = "27", + BloodPressId = "111", + CreateTime = DateTime.Now, + DiastolicValue = 0, + IsDisplay = false, + LastUpdate = DateTime.Now, + MessageId = "asdsdsd", + Method = 1, + Serialno = "00000", + SystolicValue = 0, + Ts = DateTime.Now, + } + + ); + //// var aaa= _dataTaosAccessor.GetAll(); + + + // _db.Database.EnsureCreated(); + await _dataTaosAccessor.SaveAsync(); + // _db.HmBloodPress.Add(model); + //_db.SaveChanges(); + + } + catch (Exception ex) + { + + Console.WriteLine(ex.Message + ex.StackTrace); + } + + + return Ok(aa); } diff --git a/HealthMonitor.WebApi/Program.cs b/HealthMonitor.WebApi/Program.cs index 42c7e10..5fdf065 100644 --- a/HealthMonitor.WebApi/Program.cs +++ b/HealthMonitor.WebApi/Program.cs @@ -5,7 +5,7 @@ using HealthMonitor.Core.Cache; using HealthMonitor.Core.Context; using HealthMonitor.Core.Dal.EfCoreImpl; using HealthMonitor.Core.Dal; -using HealthMonitor.Core.Dal.Factory; +//using HealthMonitor.Core.Dal.Factory; using HealthMonitor.Core.DbLog; using HealthMonitor.Core.Operator; using HealthMonitor.Core.Operator.Redis; @@ -32,6 +32,7 @@ using HealthMonitor.WebApi.HttpLog; using Microsoft.Extensions.Http; using Microsoft.Extensions.DependencyInjection.Extensions; using HealthMonitor.Core.Context.Taos; +using HealthMonitor.Core.Dal.Taos; namespace HealthMonitor.WebApi { @@ -91,7 +92,7 @@ namespace HealthMonitor.WebApi var serverVersion = ServerVersion.AutoDetect(mySqlCon); options.UseMySql(mySqlCon, serverVersion) .UseLoggerFactory(loggerFactory); - }, poolSize: 64); ; + }, poolSize: 64) ; builder.Services .AddScoped(sp => @@ -105,24 +106,26 @@ namespace HealthMonitor.WebApi return new EfCoreDataAccessor(context); }); + #endregion - //builder.Services.AddDbContextPool((sp, options) => - //{ - // var loggerFactory = sp.GetRequiredService(); - // options.UseMySql(builder.Configuration.GetConnectionString("GpsCard_Connection_String")) - // .UseLoggerFactory(loggerFactory); - //}, poolSize: 64); - - //builder.Services.AddScoped(sp => - //{ - // var context = sp.GetRequiredService(); - // return new EfCoreDataAccessor(context); - //}); + #region Taos TDengine 数据库 + builder.Services // td healthmonitor + .AddDbContextPool((sp, options) => + { + var loggerFactory = sp.GetRequiredService(); + var connStr = builder.Configuration.GetConnectionString("HealthMonitor_Taos_Connection_String"); + options.UseTaos(connStr) + .UseLoggerFactory(loggerFactory); + }, poolSize: 64); + builder.Services.AddScoped(sp => + { + var context = sp.GetRequiredService(); + return new EfCoreDataAccessor(context); + }); #endregion - #region AOP //builder.Services.Configure(builder.Configuration.GetSection("Redis")); @@ -153,9 +156,9 @@ namespace HealthMonitor.WebApi //}); - builder.Services - .AddSingleton() - .AddSingleton(); + //builder.Services + // .AddSingleton() + // .AddSingleton(); //builder.Services.AddSingleton(); builder.Services @@ -193,7 +196,7 @@ namespace HealthMonitor.WebApi .AddSingleton() .AddHostedService(); #endregion - builder.Services.AddDbContext(); + builder.Host.UseSerilog(); diff --git a/HealthMonitor.WebApi/appsettings.Development.json b/HealthMonitor.WebApi/appsettings.Development.json index 34d3082..c82b70a 100644 --- a/HealthMonitor.WebApi/appsettings.Development.json +++ b/HealthMonitor.WebApi/appsettings.Development.json @@ -28,9 +28,8 @@ "TelpoDataUrl": "https://id.ssjlai.com/data/" }, "ConnectionStrings": { - //"GpsCard_Connection_String": "server=172.16.192.26;port=3304;database=user_operation_platform;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", "GpsCard_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", - "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" - + "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", + "HealthMonitor_Taos_Connection_String": "Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" } } diff --git a/HealthMonitor.WebApi/appsettings.production.json b/HealthMonitor.WebApi/appsettings.production.json index dbe55f0..226f6cf 100644 --- a/HealthMonitor.WebApi/appsettings.production.json +++ b/HealthMonitor.WebApi/appsettings.production.json @@ -26,7 +26,7 @@ }, "ConnectionStrings": { "GpsCard_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", - "HealthMonitor_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" - + "HealthMonitor_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", + "HealthMonitor_Taos_Connection_String": "Data Source=172.19.42.48;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" } } diff --git a/HealthMonitor.WebApi/appsettings.test.json b/HealthMonitor.WebApi/appsettings.test.json index 4b13777..b499ceb 100644 --- a/HealthMonitor.WebApi/appsettings.test.json +++ b/HealthMonitor.WebApi/appsettings.test.json @@ -34,10 +34,12 @@ }, "ConnectionStrings": { // 测试环境内网 - "GpsCard_Connection_String": "server=172.19.42.40;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", - "HealthMonitor_Connection_String": "server=172.19.42.40;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" + "GpsCard_Connection_String": "server=172.19.42.40;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", + "HealthMonitor_Connection_String": "server=172.19.42.40;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", + "HealthMonitor_Taos_Connection_String": "Data Source=172.19.42.44;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" + // 测试环境公网 //"GpsCard_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", - // "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" + // "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" } }