dev #2
@ -17,7 +17,7 @@
|
|||||||
- V4 → V5核心升级:
|
- V4 → V5核心升级:
|
||||||
- 微服务化架构改造
|
- 微服务化架构改造
|
||||||
- 统一配置管理中心
|
- 统一配置管理中心
|
||||||
- 支持Kafka/RabbitMQ双引擎
|
- 支持Kafka引擎
|
||||||
- 新增边缘计算能力
|
- 新增边缘计算能力
|
||||||
- 资源利用率提升40%
|
- 资源利用率提升40%
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ Body:
|
|||||||
|----------------|------------|--------------|
|
|----------------|------------|--------------|
|
||||||
| 最大连接数 | 10,000 | 线性扩展 |
|
| 最大连接数 | 10,000 | 线性扩展 |
|
||||||
| 数据处理延迟 | <50ms(p99) | - |
|
| 数据处理延迟 | <50ms(p99) | - |
|
||||||
| 吞吐量 | 20,000 TPS | 百万级TPS |
|
| 吞吐量 | 20,000 TPS | 十万级TPS |
|
||||||
| CPU利用率 | ≤70%@峰值 | 自动负载均衡 |
|
| CPU利用率 | ≤70%@峰值 | 自动负载均衡 |
|
||||||
|
|
||||||
## 6. 高可用设计
|
## 6. 高可用设计
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.Application.Services;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.EnergySystem
|
||||||
|
{
|
||||||
|
public interface ICacheAppService : IApplicationService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,7 +14,7 @@ namespace JiShe.CollectBus;
|
|||||||
public abstract class CollectBusAppService : ApplicationService
|
public abstract class CollectBusAppService : ApplicationService
|
||||||
{
|
{
|
||||||
public IFreeSqlProvider SqlProvider => LazyServiceProvider.LazyGetRequiredService<IFreeSqlProvider>();
|
public IFreeSqlProvider SqlProvider => LazyServiceProvider.LazyGetRequiredService<IFreeSqlProvider>();
|
||||||
protected IFreeRedisProviderService FreeRedisProvider => LazyServiceProvider.LazyGetService<IFreeRedisProviderService>()!;
|
protected IFreeRedisProvider FreeRedisProvider => LazyServiceProvider.LazyGetService<IFreeRedisProvider>()!;
|
||||||
|
|
||||||
protected CollectBusAppService()
|
protected CollectBusAppService()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,7 +22,7 @@ namespace JiShe.CollectBus;
|
|||||||
typeof(AbpDddApplicationModule),
|
typeof(AbpDddApplicationModule),
|
||||||
typeof(AbpAutoMapperModule),
|
typeof(AbpAutoMapperModule),
|
||||||
typeof(AbpBackgroundWorkersHangfireModule),
|
typeof(AbpBackgroundWorkersHangfireModule),
|
||||||
typeof(FreeRedisProviderModule),
|
typeof(CollectBusFreeRedisModule),
|
||||||
typeof(CollectBusFreeSqlModule)
|
typeof(CollectBusFreeSqlModule)
|
||||||
)]
|
)]
|
||||||
public class CollectBusApplicationModule : AbpModule
|
public class CollectBusApplicationModule : AbpModule
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
using JiShe.CollectBus.IotSystems.Records;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.Domain.Repositories;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.EnergySystem
|
||||||
|
{
|
||||||
|
public class CacheAppService: CollectBusAppService,ICacheAppService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -143,7 +143,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
keyValuePairs.TryAdd($"{ammeter.ID}", ammeter);
|
keyValuePairs.TryAdd($"{ammeter.ID}", ammeter);
|
||||||
}
|
}
|
||||||
await FreeRedisProvider.FreeRedis.HSetAsync(redisCacheKey, keyValuePairs);
|
await FreeRedisProvider.Instance.HSetAsync(redisCacheKey, keyValuePairs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
//获取缓存中的电表信息
|
//获取缓存中的电表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 1)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 1)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(AmmeterScheduledMeterOneMinuteReading)} 1分钟采集电表数据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(AmmeterScheduledMeterOneMinuteReading)} 1分钟采集电表数据处理时没有获取到缓存信息,-101");
|
||||||
@ -187,7 +187,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
//获取缓存中的电表信息
|
//获取缓存中的电表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 5)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 5)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(AmmeterScheduledMeterFiveMinuteReading)} 5分钟采集电表数据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(AmmeterScheduledMeterFiveMinuteReading)} 5分钟采集电表数据处理时没有获取到缓存信息,-101");
|
||||||
@ -214,7 +214,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
//获取缓存中的电表信息
|
//获取缓存中的电表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 15)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheAmmeterInfoKey, SystemTypeConst.Energy, 15)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(AmmeterScheduledMeterFifteenMinuteReading)} 15分钟采集电表数据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(AmmeterScheduledMeterFifteenMinuteReading)} 15分钟采集电表数据处理时没有获取到缓存信息,-101");
|
||||||
@ -287,7 +287,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
keyValuePairs.TryAdd($"{subItem.ID}", subItem);
|
keyValuePairs.TryAdd($"{subItem.ID}", subItem);
|
||||||
}
|
}
|
||||||
await FreeRedisProvider.FreeRedis.HSetAsync(redisCacheKey, keyValuePairs);
|
await FreeRedisProvider.Instance.HSetAsync(redisCacheKey, keyValuePairs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.LogInformation($"{nameof(InitAmmeterCacheData)} 初始化水表缓存数据完成");
|
_logger.LogInformation($"{nameof(InitAmmeterCacheData)} 初始化水表缓存数据完成");
|
||||||
@ -301,7 +301,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
//获取缓存中的水表信息
|
//获取缓存中的水表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 1)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 1)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(WatermeterScheduledMeterOneMinuteReading)} 1分钟采集水表据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(WatermeterScheduledMeterOneMinuteReading)} 1分钟采集水表据处理时没有获取到缓存信息,-101");
|
||||||
@ -328,7 +328,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
//获取缓存中的水表信息
|
//获取缓存中的水表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 5)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 5)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(WatermeterScheduledMeterFiveMinuteReading)} 5分钟采集水表据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(WatermeterScheduledMeterFiveMinuteReading)} 5分钟采集水表据处理时没有获取到缓存信息,-101");
|
||||||
@ -354,7 +354,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
//获取缓存中的水表信息
|
//获取缓存中的水表信息
|
||||||
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 15)}*";
|
var redisKeyList = $"{string.Format(FreeRedisConst.CacheWatermeterInfoKey, SystemTypeConst.Energy, 15)}*";
|
||||||
var oneMinutekeyList = await FreeRedisProvider.FreeRedis.KeysAsync(redisKeyList);
|
var oneMinutekeyList = await FreeRedisProvider.Instance.KeysAsync(redisKeyList);
|
||||||
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
if (oneMinutekeyList == null || oneMinutekeyList.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(WatermeterScheduledMeterFifteenMinuteReading)} 15分钟采集水表据处理时没有获取到缓存信息,-101");
|
_logger.LogError($"{nameof(WatermeterScheduledMeterFifteenMinuteReading)} 15分钟采集水表据处理时没有获取到缓存信息,-101");
|
||||||
@ -392,7 +392,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
results[i] = {key, data}
|
results[i] = {key, data}
|
||||||
end
|
end
|
||||||
return results";
|
return results";
|
||||||
var oneMinuteAmmerterResult = await FreeRedisProvider.FreeRedis.EvalAsync(luaScript, redisKeys); //传递 KEYS
|
var oneMinuteAmmerterResult = await FreeRedisProvider.Instance.EvalAsync(luaScript, redisKeys); //传递 KEYS
|
||||||
if (oneMinuteAmmerterResult == null)
|
if (oneMinuteAmmerterResult == null)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(WatermeterScheduledMeterOneMinuteReading)} 定时任务采集表数据处理时没有获取到缓存信息,-102");
|
_logger.LogError($"{nameof(WatermeterScheduledMeterOneMinuteReading)} 定时任务采集表数据处理时没有获取到缓存信息,-102");
|
||||||
|
|||||||
@ -0,0 +1,259 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.EnergySystems.Entities
|
||||||
|
{
|
||||||
|
public class TB_AmmeterInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表信息
|
||||||
|
/// </summary>
|
||||||
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表编号、电表型号
|
||||||
|
/// </summary>
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 区域信息外键
|
||||||
|
/// </summary>
|
||||||
|
public int AreaID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 区域名
|
||||||
|
/// </summary>
|
||||||
|
public string AreaName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表别名
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表类别 (1单相、2三相三线、3三相四线)
|
||||||
|
/// </summary>
|
||||||
|
public int TypeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表安装地址
|
||||||
|
/// </summary>
|
||||||
|
public string Location { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 电表安装时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? InstallTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表密码
|
||||||
|
/// </summary>
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电表通信地址
|
||||||
|
/// </summary>
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集器地址
|
||||||
|
/// </summary>
|
||||||
|
public string CollectorAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电压变比
|
||||||
|
/// 电压互感器(PT)
|
||||||
|
/// </summary>
|
||||||
|
public double TimesV { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电流变比
|
||||||
|
/// 电流互感器(CT)
|
||||||
|
/// </summary>
|
||||||
|
public double TimesA { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否总表
|
||||||
|
/// </summary>
|
||||||
|
public int IsSum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 总表ID
|
||||||
|
/// </summary>
|
||||||
|
public int ParentID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Explain
|
||||||
|
/// </summary>
|
||||||
|
public string Explain { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AddDate
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// State表状态: (对应枚举 MeterStateEnum)
|
||||||
|
/// 0新装(未下发),1运行(档案下发成功时设置状态值1), 2暂停, 100销表(销表后是否重新启用);
|
||||||
|
/// 特定State: -1 已删除
|
||||||
|
/// </summary>
|
||||||
|
public int State { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 费率类型,单、多 (SingleRate :单费率(单相表1),多费率(其他0) ,与TypeName字段无关)
|
||||||
|
/// SingleRate ? "单" : "复"
|
||||||
|
/// [SingleRate] --0 复费率 false , 1 单费率 true (与PayPlanID保持一致)
|
||||||
|
///对应 TB_PayPlan.Type: 1复费率,2单费率
|
||||||
|
/// </summary>
|
||||||
|
public bool SingleRate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0 未下发 (false), 1 已下发 (true)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSend { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人ID
|
||||||
|
/// </summary>
|
||||||
|
public int CreateUserID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 波特率 default(2400)
|
||||||
|
/// </summary>
|
||||||
|
public int Baudrate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 规约 -电表default(30)
|
||||||
|
/// </summary>
|
||||||
|
public int? Protocol { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 一个集中器下的[MeteringCode]必须唯一。
|
||||||
|
/// </summary>
|
||||||
|
public int MeteringCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// MeteringPort 端口就几个可以枚举。
|
||||||
|
/// </summary>
|
||||||
|
public int MeteringPort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 对应[TB_PayPlan]
|
||||||
|
/// </summary>
|
||||||
|
public int PayPlanID { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public int ProjectID { get; set; }
|
||||||
|
|
||||||
|
public int FocusID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 集中器名称(扩展字段)
|
||||||
|
/// </summary>
|
||||||
|
public string FocusName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 跳合闸状态字段: 0 合闸,1 跳闸
|
||||||
|
/// 电表:TripState (0 合闸-通电, 1 断开、跳闸);
|
||||||
|
/// </summary>
|
||||||
|
public int TripState { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 最近阀控时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? TripTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序字段
|
||||||
|
/// </summary>
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子表0 ,
|
||||||
|
/// 机械表1(德力西机械电表-Code)
|
||||||
|
/// (原有数据都默认:电子电表)
|
||||||
|
/// </summary>
|
||||||
|
public int MeterKind { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集方案ID
|
||||||
|
/// </summary>
|
||||||
|
public int GatherPlanID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集项
|
||||||
|
/// </summary>
|
||||||
|
public string ReadClass { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? EditDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用ID
|
||||||
|
/// </summary>
|
||||||
|
public int? EditUserID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? RemoveDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除用户ID
|
||||||
|
/// </summary>
|
||||||
|
public int? RemoveUserID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 掉电状态 (未上电=1,上电掉电中=2)
|
||||||
|
/// </summary>
|
||||||
|
public int? PowerDownStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电流规格
|
||||||
|
/// </summary>
|
||||||
|
public string CurrentSpec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电压规格
|
||||||
|
/// </summary>
|
||||||
|
public string VoltageSpec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯状态 1:在线 0:离线
|
||||||
|
/// </summary>
|
||||||
|
public int LineState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 特殊表 1:是 0:否
|
||||||
|
/// </summary>
|
||||||
|
public int Special { get; set; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
/// <summary>
|
||||||
|
/// 采集项总数
|
||||||
|
/// </summary>
|
||||||
|
public int GatherTotal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集项
|
||||||
|
/// </summary>
|
||||||
|
public string GatherDataTypes { get; set; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复费率类型(四费率=4,八费率=8)
|
||||||
|
/// </summary>
|
||||||
|
public int? MultipleRateType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VMAmmeterInfo : TB_AmmeterInfo
|
||||||
|
{
|
||||||
|
public decimal? Rate { get; set; }
|
||||||
|
public decimal? Rate1 { get; set; }
|
||||||
|
public decimal? Rate2 { get; set; }
|
||||||
|
public decimal? Rate3 { get; set; }
|
||||||
|
|
||||||
|
public decimal? Rate4 { get; set; }
|
||||||
|
|
||||||
|
public decimal? Rate5 { get; set; }
|
||||||
|
|
||||||
|
public decimal? Rate6 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using JiShe.CollectBus.EnergySystems.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,8 +7,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace JiShe.CollectBus.EnergySystems.TableViews
|
namespace JiShe.CollectBus.EnergySystems.TableViews
|
||||||
{
|
{
|
||||||
public class V_FocusAmmeter
|
public class V_FocusAmmeter: TB_AmmeterInfo
|
||||||
{
|
{
|
||||||
|
public string FocusAddress { get; set; }
|
||||||
|
|
||||||
|
public string FocusAreaCode { get; set; }
|
||||||
|
|
||||||
|
public string FocusCode { get; set; }
|
||||||
|
|
||||||
|
public string FocusState { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,8 +33,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="EnergySystems\Entitys\" />
|
<Folder Include="PrepaymentSystems\Entities\" />
|
||||||
<Folder Include="PrepaymentSystems\Entitys\" />
|
|
||||||
<Folder Include="PrepaymentSystems\TableViews\" />
|
<Folder Include="PrepaymentSystems\TableViews\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,11 @@
|
|||||||
using JiShe.CollectBus.FreeRedisProvider.Options;
|
using JiShe.CollectBus.FreeRedisProvider.Options;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.FreeRedisProvider
|
namespace JiShe.CollectBus.FreeRedisProvider
|
||||||
{
|
{
|
||||||
public class FreeRedisProviderModule : AbpModule
|
public class CollectBusFreeRedisModule : AbpModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
47
src/JiShe.CollectBus.FreeRedisProvider/FreeRedisProvider.cs
Normal file
47
src/JiShe.CollectBus.FreeRedisProvider/FreeRedisProvider.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using FreeRedis;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using JiShe.CollectBus.FreeRedisProvider.Options;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.FreeRedisProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
public class FreeRedisProvider : IFreeRedisProvider, ISingletonDependency
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly FreeRedisOptions _option;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// FreeRedis
|
||||||
|
/// </summary>
|
||||||
|
public FreeRedisProvider(IOptions<FreeRedisOptions> options)
|
||||||
|
{
|
||||||
|
_option = options.Value;
|
||||||
|
GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RedisClient Instance { get; set; } = new (string.Empty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取 FreeRedis 客户端
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IRedisClient GetInstance()
|
||||||
|
{
|
||||||
|
var connectionString = $"{_option.Configuration},defaultdatabase={_option.DefaultDB}";
|
||||||
|
Instance = new RedisClient(connectionString);
|
||||||
|
Instance.Serialize = obj => JsonSerializer.Serialize(obj);
|
||||||
|
Instance.Deserialize = (json, type) => JsonSerializer.Deserialize(json, type);
|
||||||
|
Instance.Notice += (s, e) => Trace.WriteLine(e.Log);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,65 +0,0 @@
|
|||||||
using FreeRedis;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using JiShe.CollectBus.FreeRedisProvider.Options;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.FreeRedisProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public class FreeRedisProviderService : IFreeRedisProviderService, ISingletonDependency
|
|
||||||
{
|
|
||||||
private FreeRedisOptions _freeRedisOptions;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FreeRedis
|
|
||||||
/// </summary>
|
|
||||||
public FreeRedisProviderService(IOptions<FreeRedisOptions> options)
|
|
||||||
{
|
|
||||||
_freeRedisOptions = options.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[NotNull]
|
|
||||||
public IRedisClient FreeRedis
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetClient();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取 FreeRedis 客户端
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IRedisClient GetClient()
|
|
||||||
{
|
|
||||||
string connectionString = $"{_freeRedisOptions.Configuration},defaultdatabase={_freeRedisOptions.DefaultDB}";
|
|
||||||
var redisClient = new RedisClient(connectionString);
|
|
||||||
redisClient.Serialize = obj => JsonSerializer.Serialize(obj);
|
|
||||||
redisClient.Deserialize = (json, type) => JsonSerializer.Deserialize(json, type);
|
|
||||||
redisClient.Notice += (s, e) => Trace.WriteLine(e.Log);
|
|
||||||
|
|
||||||
return redisClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 切换Redis数据库
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IRedisClient GetDatabase(int index = 0)
|
|
||||||
{
|
|
||||||
var redisClient = GetClient();
|
|
||||||
redisClient.GetDatabase(index);
|
|
||||||
return redisClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
14
src/JiShe.CollectBus.FreeRedisProvider/IFreeRedisProvider.cs
Normal file
14
src/JiShe.CollectBus.FreeRedisProvider/IFreeRedisProvider.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using FreeRedis;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.FreeRedisProvider
|
||||||
|
{
|
||||||
|
public interface IFreeRedisProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取客户端
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
RedisClient Instance { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
using FreeRedis;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.FreeRedisProvider
|
|
||||||
{
|
|
||||||
public interface IFreeRedisProviderService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 默认客户端
|
|
||||||
/// </summary>
|
|
||||||
IRedisClient FreeRedis { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取客户端
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
IRedisClient GetClient();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 切换Redis数据库
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
IRedisClient GetDatabase(int index = 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user