Merge pull request 'dev_chen' (#20) from dev_chen into main

Reviewed-on: #20
pull/21/head
刘鑫 4 months ago
commit 58ef537b3f
  1. 2
      WeiCloud.Fusion/ParkingLotService/ParkLotInfoService/IParkingLotDataService.cs
  2. 59
      WeiCloud.Fusion/ParkingLotService/ParkLotInfoService/ParkingLotDataService.cs
  3. 58
      WeiCloud.Fusion/ParkingLotService/ParkingLotEntity/ParkingLotModelDto/ParkingAccessRecordDto.cs
  4. 2
      WeiCloud.Fusion/ParkingLotService/ParkingLotEntity/ParkingLotModels/WeiCloudFusionContext.cs
  5. 2
      WeiCloud.Fusion/ParkingLotService/ParkingLotService.API/Controllers/ParkLotInfoController.cs
  6. 18
      WeiCloud.Fusion/ParkingLotService/ParkingLotService.API/HostService/PingService .cs
  7. 10
      WeiCloud.Fusion/ParkingLotService/ParkingLotService.API/appsettings.json

@ -18,7 +18,7 @@ namespace ParkLotInfoService
Task<ApiResult<int>> DoorLockSendCommand(int doorId, string command); Task<ApiResult<int>> DoorLockSendCommand(int doorId, string command);
Task<TokenDto> PostDoorControlRecord(DoorStateRecordDto dto); Task<TokenDto> PostDoorControlRecord(DoorStateRecordDto dto);
Task<TokenDto> PostDoorEqState(DoorEqStateDto dto); Task<TokenDto> PostDoorEqState(DoorEqStateDto dto);
Task<ApiResult<TokenDto>> PushLifangDoorData(string tppic, string address); Task<ApiResult<TokenDto>> PushLifangDoorData(string tppic, string address,string token);
#endregion #endregion
} }
} }

@ -26,6 +26,7 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Pipelines.Sockets.Unofficial.Arenas; using Pipelines.Sockets.Unofficial.Arenas;
using System.Threading; using System.Threading;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NewLife.IP;
namespace ParkLotInfoService namespace ParkLotInfoService
@ -62,9 +63,11 @@ namespace ParkLotInfoService
{ {
ApiResult<int> result = new ApiResult<int>() { Code = RequestBackStatuEnum.success.Value, Msg = "接口请求成功" }; ApiResult<int> result = new ApiResult<int>() { Code = RequestBackStatuEnum.success.Value, Msg = "接口请求成功" };
//ParkingAccessRecordDto dto=new ParkingAccessRecordDto(); //ParkingAccessRecordDto dto=new ParkingAccessRecordDto();
long projectId = 0;
try try
{ {
var projectIdStr = _configuration["PorjectId"];
long.TryParse(projectIdStr, out projectId);
////ParkingAccessRecord record = new ParkingAccessRecord() { Id=1,CarCode="001"}; ////ParkingAccessRecord record = new ParkingAccessRecord() { Id=1,CarCode="001"};
////_context.ParkingAccessRecords.Add(record); ////_context.ParkingAccessRecords.Add(record);
////var res = await _context.SaveChangesAsync(); ////var res = await _context.SaveChangesAsync();
@ -77,7 +80,7 @@ namespace ParkLotInfoService
result.Msg = "上传数据为空"; result.Msg = "上传数据为空";
return result; return result;
} }
ParkingAccessRecord record = new ParkingAccessRecord() { Id = UidGenerator.Uid(), CarCode = model.CarCode, ChannelId = model.ChannelId, ChannelName = model.ChannelName, Guid = model.GUID, ImagePath = model.ImagePath, InOrOut = model.InOrOut, InTime = model.InTime, ParkId = model.ParkId, PassTime = model.PassTime, ProjectId = model.ProjectId, CreateTime = DateTime.Now }; ParkingAccessRecord record = new ParkingAccessRecord() { Id = UidGenerator.Uid(), CarCode = model.carCode, ChannelId = model.channelId, ChannelName = model.channelName, Guid = model.GUID, ImagePath = model.imagePath, InOrOut = model.inOrOut, InTime = model.inTime, ParkId = model.parkId, PassTime = model.passTime, ProjectId = projectId, CreateTime = DateTime.Now };
_context.ParkingAccessRecords.Add(record); _context.ParkingAccessRecords.Add(record);
var res = await _context.SaveChangesAsync(); var res = await _context.SaveChangesAsync();
_logger.LogInformation($"停车记录插入成功{record.Id}"); _logger.LogInformation($"停车记录插入成功{record.Id}");
@ -152,8 +155,8 @@ namespace ParkLotInfoService
string json = System.Text.Json.JsonSerializer.Serialize(parmJson, options); string json = System.Text.Json.JsonSerializer.Serialize(parmJson, options);
var content = new StringContent(json, Encoding.UTF8, "application/json"); var content = new StringContent(json, Encoding.UTF8, "application/json");
_ = Task.Run(async () => //_ = Task.Run(async () =>
{ //{
try try
{ {
var httpResponse = client.PostAsync(url, content); var httpResponse = client.PostAsync(url, content);
@ -173,7 +176,7 @@ namespace ParkLotInfoService
{ {
_logger.LogError(this.GetType().FullName + " PostSearchResult", string.Format("抛出了异常信息: 请求超时,请求失败;{0}", ex.Message)); _logger.LogError(this.GetType().FullName + " PostSearchResult", string.Format("抛出了异常信息: 请求超时,请求失败;{0}", ex.Message));
} }
}); // });
return resStr; return resStr;
} }
public async Task<ApiResult<string>> GetIpPing() public async Task<ApiResult<string>> GetIpPing()
@ -246,7 +249,7 @@ namespace ParkLotInfoService
/// <returns></returns> /// <returns></returns>
public async Task<TokenDto> PostDoorControlRecord(DoorStateRecordDto dto) public async Task<TokenDto> PostDoorControlRecord(DoorStateRecordDto dto)
{ {
TokenDto result = new TokenDto() { Ret = "SUCCESS", Suc = 200 }; TokenDto result = new TokenDto() { Ret = "FAIL", Suc = 2005 };
long projectId = 0; long projectId = 0;
try try
{ {
@ -256,11 +259,15 @@ namespace ParkLotInfoService
{ {
projectId = long.Parse(proStr); projectId = long.Parse(proStr);
} }
DoorStateRecord door = new DoorStateRecord() { DoorId = dto.DoorId, State =(short) dto.TypeId, StateTime =DateTime.Parse(dto.Date) , DoorName = dto.DoorName, StateDesc = dto.TypeName,CreateTime = DateTime.Now , ProjectId = projectId,Id = UidGenerator.Uid() };
DoorStateRecord door = new DoorStateRecord() { Id = UidGenerator.Uid(),DoorId = dto.doorId, State =(short) dto.typeId, StateTime =DateTime.Parse(dto.date) , DoorName = dto.doorName, StateDesc = dto.typeName,CreateTime = DateTime.Now , ProjectId = projectId };
_context.DoorStateRecords.Add(door); _context.DoorStateRecords.Add(door);
_logger.LogError(this.GetType().FullName + " PostDoorControlRecord 入库前", string.Format("入库请求;{0}",_context.DoorStateRecords.Count()));
var res= await _context.SaveChangesAsync(); var res= await _context.SaveChangesAsync();
if (res > 0) if (res > 0)
{ {
_logger.LogError(this.GetType().FullName + " PostDoorControlRecord 入库后", string.Format("入库成功息: 请求超时,请求失败;{0}", door.Id));
result.Object = door.Id.ToString();
result.Ret = "SUCCESS"; result.Ret = "SUCCESS";
result.Suc = 200; result.Suc = 200;
} }
@ -272,7 +279,7 @@ namespace ParkLotInfoService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(this.GetType().FullName + " PostDoorControlRecord", string.Format("抛出了异常信息: 请求超时,请求失败;{0}", ex.Message)); _logger.LogError(this.GetType().FullName + " PostDoorControlRecord 保存记录--", string.Format("抛出了异常信息: 请求超时,请求失败;{0}", ex.Message));
} }
return result; return result;
@ -312,7 +319,7 @@ namespace ParkLotInfoService
return result; return result;
} }
//找出当前订阅推送的门禁id对应的设备 //找出当前订阅推送的门禁id对应的设备
var doorLock=doorlocks.Where(a => a.DeciveId == dto.Deviceld).FirstOrDefault(); var doorLock=doorlocks.Where(a => a.DeciveId == dto.deviceld).FirstOrDefault();
if (doorLock == null) if (doorLock == null)
{ {
return result; return result;
@ -324,7 +331,7 @@ namespace ParkLotInfoService
return result; return result;
} }
//redis中门禁状态的点位对象封装 //redis中门禁状态的点位对象封装
RealDataOnlyValueBo real = new RealDataOnlyValueBo() { Id = realId.GetValueOrDefault(), Realvalue = dto.Type.ToString(), Updatetime = DateTime.Now }; RealDataOnlyValueBo real = new RealDataOnlyValueBo() { Id = realId.GetValueOrDefault(), Realvalue = dto.type.ToString(), Updatetime = DateTime.Now };
_dictionaryService.PushValue<RealDataOnlyValueBo>("ProOnlyValue" + projectId, realId.ToString(), real, 1); _dictionaryService.PushValue<RealDataOnlyValueBo>("ProOnlyValue" + projectId, realId.ToString(), real, 1);
} }
catch (Exception ex) catch (Exception ex)
@ -347,7 +354,8 @@ namespace ParkLotInfoService
string api = $"custom/v1/sendCommand?doorId={doorId}&command={command}"; string api = $"custom/v1/sendCommand?doorId={doorId}&command={command}";
try try
{ {
var str = await GetLifangDoorLockPostData(api, null); string token =await GetLifangDoorLockToken();
var str = await GetLifangDoorLockPostData(api, null,token);
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
{ {
result.Code = RequestBackStatuEnum.diy.Value; result.Code = RequestBackStatuEnum.diy.Value;
@ -391,7 +399,16 @@ namespace ParkLotInfoService
var clientSecret = _configuration["ThirdApi:DoorLockClientSecret"]; var clientSecret = _configuration["ThirdApi:DoorLockClientSecret"];
var grantType = _configuration["ThirdApi:DoorLockGrantType"]; var grantType = _configuration["ThirdApi:DoorLockGrantType"];
var apiUrl = $"{url}token/v1/oauth/token?client_id={clientId}&client_secret={clientSecret}&grant_type={grantType}"; var apiUrl = $"{url}token/v1/oauth/token?client_id={clientId}&client_secret={clientSecret}&grant_type={grantType}";
var client = _httpClientFactory.CreateClient();
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
};
using var client = new HttpClient(handler);
//var client = _httpClientFactory.CreateClient();
client.Timeout = TimeSpan.FromMinutes(1);//设置超时时间 client.Timeout = TimeSpan.FromMinutes(1);//设置超时时间
try try
{ {
@ -404,8 +421,8 @@ namespace ParkLotInfoService
{ {
return token; return token;
} }
var tokenModel = JsonConvert.DeserializeObject<TokenDto>(resStr); var tokenModel = JsonConvert.DeserializeObject<DoorRecordResponse>(resStr);
token = tokenModel == null ? string.Empty : tokenModel.Object; token = tokenModel == null ? string.Empty : tokenModel.obj;
} }
// 处理响应... // 处理响应...
} }
@ -426,11 +443,11 @@ namespace ParkLotInfoService
/// <param name="apiName"></param> /// <param name="apiName"></param>
/// <param name="parmJson"></param> /// <param name="parmJson"></param>
/// <returns></returns> /// <returns></returns>
private async Task<string> GetLifangDoorLockPostData(string apiName, object parmJson) private async Task<string> GetLifangDoorLockPostData(string apiName, object parmJson,string token)
{ {
string json = string.Empty; string json = string.Empty;
//获取token ////获取token
var token = await GetLifangDoorLockToken(); //var token = await GetLifangDoorLockToken();
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token))
{ {
return string.Empty; return string.Empty;
@ -444,7 +461,7 @@ namespace ParkLotInfoService
// 添加 Header token参数 // 添加 Header token参数
client.DefaultRequestHeaders.Add("TOKEN", token); client.DefaultRequestHeaders.Add("TOKEN", token);
// 添加 Header Content-Type // 添加 Header Content-Type
client.DefaultRequestHeaders.Add("Content-Type", "application/json"); //client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.Timeout = TimeSpan.FromMinutes(1);//设置超时时间 client.Timeout = TimeSpan.FromMinutes(1);//设置超时时间
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
@ -490,7 +507,7 @@ namespace ParkLotInfoService
/// <param name="obj"></param> /// <param name="obj"></param>
/// <returns></returns> /// <returns></returns>
public async Task<ApiResult<TokenDto>> PushLifangDoorData(string tppic, string address) public async Task<ApiResult<TokenDto>> PushLifangDoorData(string tppic, string address,string token)
{ {
ApiResult <TokenDto> result = new ApiResult<TokenDto>() { Code=RequestBackStatuEnum.success.Value,Msg="接口请求成功!"}; ApiResult <TokenDto> result = new ApiResult<TokenDto>() { Code=RequestBackStatuEnum.success.Value,Msg="接口请求成功!"};
TokenDto resDto = new TokenDto() { Ret= "SUCESS",Suc= 200 }; TokenDto resDto = new TokenDto() { Ret= "SUCESS",Suc= 200 };
@ -508,8 +525,8 @@ namespace ParkLotInfoService
result.Msg = "获取订阅信息订阅失败!"; result.Msg = "获取订阅信息订阅失败!";
return result; return result;
} }
PushDoorDto dto = new PushDoorDto() { Uuid = uuid, Expire = expire, Address = address, Topic = tppic }; PushDoorDto dto = new PushDoorDto() { uuid = uuid, expire = expire, address = address, topic = tppic };
var res = await GetLifangDoorLockPostData(api, dto); var res = await GetLifangDoorLockPostData(api, dto,token);
if (string.IsNullOrEmpty(res)) if (string.IsNullOrEmpty(res))
{ {
result.Code = RequestBackStatuEnum.fail.Value; result.Code = RequestBackStatuEnum.fail.Value;

@ -12,35 +12,35 @@ namespace ParkingLotEntity.ParkingLotModelDto
#region 停车场 #region 停车场
public class ParkingAccessRecordDto public class ParkingAccessRecordDto
{ {
/// <summary> ///// <summary>
/// 项目id ///// 项目id
/// </summary> ///// </summary>
public long ProjectId { get; set; } //public long ProjectId { get; set; }
/// <summary> /// <summary>
/// 车牌号码 /// 车牌号码
/// </summary> /// </summary>
public string? CarCode { get; set; } public string? carCode { get; set; }
/// <summary> /// <summary>
/// 进场时间(出场时若找不到场内车辆信息,则为空) /// 进场时间(出场时若找不到场内车辆信息,则为空)
/// </summary> /// </summary>
public DateTime? InTime { get; set; } public DateTime? inTime { get; set; }
/// <summary> /// <summary>
/// 过场时间(进场时等于进场时间,出场时为出场时间) /// 过场时间(进场时等于进场时间,出场时为出场时间)
/// </summary> /// </summary>
public DateTime? PassTime { get; set; } public DateTime? passTime { get; set; }
/// <summary> /// <summary>
/// 车场 ID /// 车场 ID
/// </summary> /// </summary>
public string? ParkId { get; set; } public string? parkId { get; set; }
/// <summary> /// <summary>
/// 0:进场,1:出场 /// 0:进场,1:出场
/// </summary> /// </summary>
public string? InOrOut { get; set; } public string? inOrOut { get; set; }
/// <summary> /// <summary>
/// 车辆本次进场出场标识 /// 车辆本次进场出场标识
@ -50,17 +50,17 @@ namespace ParkingLotEntity.ParkingLotModelDto
/// <summary> /// <summary>
/// 通道 ID /// 通道 ID
/// </summary> /// </summary>
public string? ChannelId { get; set; } public string? channelId { get; set; }
/// <summary> /// <summary>
/// 通道名称 /// 通道名称
/// </summary> /// </summary>
public string? ChannelName { get; set; } public string? channelName { get; set; }
/// <summary> /// <summary>
/// 图片路径地址 /// 图片路径地址
/// </summary> /// </summary>
public string? ImagePath { get; set; } public string? imagePath { get; set; }
} }
public class ParkingAccessRecord2Dto public class ParkingAccessRecord2Dto
@ -270,27 +270,33 @@ namespace ParkingLotEntity.ParkingLotModelDto
/// <summary> /// <summary>
/// 门名称 /// 门名称
/// </summary> /// </summary>
public string DoorName { get; set; } public string doorName { get; set; }
/// <summary> /// <summary>
/// 门Id /// 门Id
/// </summary> /// </summary>
public int DoorId { get; set; } public int doorId { get; set; }
/// <summary> /// <summary>
/// 门状态 /// 门状态
/// 0关 1进开门 2出开门 3报警开门 4报警关门 5进出开门 6门未关 7关(出) 8关(进) 9按钮开门 10紧急关门 11紧急开门 12遥控开门 13遥控关门 14布防关(出) 15布防关(进) 16紧急关(出) 17紧急关(进) 18常闭关(出) 19常闭关(进) 20防撬关(出) 21防撬关(进) 22门开(遥控关) 23门开(紧急关) 24常开 25常闭 26布防 27自动布防 28手动布防 29权限不足 33自控 99未知状态 /// 0关 1进开门 2出开门 3报警开门 4报警关门 5进出开门 6门未关 7关(出) 8关(进) 9按钮开门 10紧急关门 11紧急开门 12遥控开门 13遥控关门 14布防关(出) 15布防关(进) 16紧急关(出) 17紧急关(进) 18常闭关(出) 19常闭关(进) 20防撬关(出) 21防撬关(进) 22门开(遥控关) 23门开(紧急关) 24常开 25常闭 26布防 27自动布防 28手动布防 29权限不足 33自控 99未知状态
/// </summary> /// </summary>
public int TypeId { get; set; } public int typeId { get; set; }
/// <summary> /// <summary>
/// 门状态名称 /// 门状态名称
/// </summary> /// </summary>
public string TypeName { get; set; } public string typeName { get; set; }
/// <summary> /// <summary>
/// 门态时间 /// 门态时间
/// </summary> /// </summary>
public string Date { get; set; } public string date { get; set; }
} }
public class DoorRecordResponse
{
public string obj { get; set; }
public string ret { get; set; }
public int suc { get; set; }
}
/// <summary> /// <summary>
/// 门禁设备在线状态 /// 门禁设备在线状态
/// </summary> /// </summary>
@ -299,23 +305,23 @@ namespace ParkingLotEntity.ParkingLotModelDto
/// <summary> /// <summary>
/// 门禁名称 /// 门禁名称
/// </summary> /// </summary>
public string DeviceName { get; set; } = string.Empty; public string deviceName { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 门禁Id /// 门禁Id
/// </summary> /// </summary>
public int Deviceld { get; set; } public int deviceld { get; set; }
/// <summary> /// <summary>
/// 门禁状态 1上线 2掉线 /// 门禁状态 1上线 2掉线
/// </summary> /// </summary>
public int Type { get; set; } public int type { get; set; }
/// <summary> /// <summary>
///门禁状态名称 ///门禁状态名称
/// </summary> /// </summary>
public string TypeName { get; set; } = string.Empty; public string typeName { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 门状态时间 /// 门状态时间
/// </summary> /// </summary>
public string Date { get; set; } public string date { get; set; }
} }
/// <summary> /// <summary>
@ -323,10 +329,10 @@ namespace ParkingLotEntity.ParkingLotModelDto
/// </summary> /// </summary>
public class PushDoorDto public class PushDoorDto
{ {
public string Uuid { get; set; } = string.Empty; public string uuid { get; set; } = string.Empty;
public string Topic { get; set; } = string.Empty; public string topic { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty; public string address { get; set; } = string.Empty;
public int Expire { get; set; } public int expire { get; set; }
} }
#endregion #endregion
} }

@ -22,7 +22,7 @@ public partial class WeiCloudFusionContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseMySql("server=v4.weienergy.cn;database=WeiCloud.Fusion;user=root;password=Zrhdb#2019;port=3307", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.18-mysql")); => optionsBuilder.UseMySql("server=172.17.76.210;database=WeiCloud.Fusion;user=root;password=Zrhdb##2022;port=3306;default command timeout=100;CharSet=utf8;SslMode=None;allowPublicKeyRetrieval=true", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.18-mysql"));
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {

@ -45,7 +45,7 @@ namespace ParkingLotService.API.Controllers
/// <param name="doorId"></param> /// <param name="doorId"></param>
/// <param name="command"></param> /// <param name="command"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpGet]
public async Task<ApiResult<int>> DoorLockSendCommand(int doorId, string command) public async Task<ApiResult<int>> DoorLockSendCommand(int doorId, string command)
{ {
return await _parkingLotDataService.DoorLockSendCommand(doorId, command); return await _parkingLotDataService.DoorLockSendCommand(doorId, command);

@ -11,15 +11,15 @@ namespace ParkingLotService.API.HostService
{ {
private readonly ILogger<PingService> _logger; private readonly ILogger<PingService> _logger;
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly string _ipAddress; // private readonly string _ipAddress;
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
private Timer _timer; private Timer _timer;
private bool _isTaskRunning; private bool _isTaskRunning;
private readonly int _interval = 60000;//1分钟 private readonly int _interval = 300000;//5分钟
public PingService(ILogger<PingService> logger, IServiceScopeFactory serviceScopeFactory, IConfiguration configuration) public PingService(ILogger<PingService> logger, IServiceScopeFactory serviceScopeFactory, IConfiguration configuration)
{ {
_logger = logger; _logger = logger;
_ipAddress = "8.8.8.8"; // 替换为你要ping的IP //_ipAddress = "8.8.8.8"; // 替换为你要ping的IP
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
_timer = new Timer(DoWork, null, Timeout.Infinite, Timeout.Infinite); _timer = new Timer(DoWork, null, Timeout.Infinite, Timeout.Infinite);
_configuration = configuration; _configuration = configuration;
@ -43,14 +43,16 @@ namespace ParkingLotService.API.HostService
using var scope = _serviceScopeFactory.CreateScope(); using var scope = _serviceScopeFactory.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<IParkingLotDataService>(); var service = scope.ServiceProvider.GetRequiredService<IParkingLotDataService>();
//停车识别仪状态获取 //停车识别仪状态获取
await service.GetIpPing(); //await service.GetIpPing();
#region 门禁
var tokenStr= await service.GetLifangDoorLockToken();
//门禁的门开关等状态 //门禁的门开关等状态
var myAddress = _configuration["MyApiAddress"];//本地地址,第三方需要回调的地址 var myAddress = _configuration["MyApiAddress"];//本地地址,第三方需要回调的地址
//门的开关记录 //门的开关记录
await service.PushLifangDoorData("SUBSCRIBE:MJ_DOOR_STATUS_EVENT", $"{myAddress}/api/ParkLotInfo/PostDoorControlRecord"); await service.PushLifangDoorData("SUBSCRIBE:MJ_DOOR_STATUS_EVENT", $"{myAddress}/api/ParkLotInfo/PostDoorControlRecord", tokenStr);
//门禁设备在线状态 //门禁设备在线状态
await service.PushLifangDoorData("SUBSCRIBE:DEVICE_ONLINE_EVENT", $"{myAddress}/api/ParkLotInfo/PostDoorEqState"); await service.PushLifangDoorData("SUBSCRIBE:DEVICE_ONLINE_EVENT", $"{myAddress}/api/ParkLotInfo/PostDoorEqState", tokenStr);
//await service.CreateAbnormalEnergyAlarm(); //用能异动告警轮询 #endregion
// 任务完成后,重新启动 Timer 计时 // 任务完成后,重新启动 Timer 计时
_timer.Change(_interval, Timeout.Infinite); // 每隔 1分钟触发一次 _timer.Change(_interval, Timeout.Infinite); // 每隔 1分钟触发一次
} }
@ -67,7 +69,7 @@ namespace ParkingLotService.API.HostService
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
public Task StartAsync(CancellationToken cancellationToken) public Task StartAsync(CancellationToken cancellationToken)
{ // 启动 Timer,每隔 5 触发一次 { // 启动 Timer,每隔 5分钟 触发一次
_timer.Change(0, _interval); _timer.Change(0, _interval);
_logger.LogInformation("Timed Hosted Service started."); _logger.LogInformation("Timed Hosted Service started.");

@ -8,13 +8,13 @@
"RedisPrefix": "AXYJPT_", // "XX.V6_", // //, "RedisPrefix": "AXYJPT_", // "XX.V6_", // //,
"TenantType": "false", "TenantType": "false",
"RedisNodes": "Zrhredis#2019@v4.weienergy.cn:6380", "RedisNodes": "Zrhredis#2019@v4.weienergy.cn:6380",
"WeiCloudFusionDBConn": "server=v4.weienergy.cn;uid=root;pwd=Zrhdb#2019;port=3307;database=WeiCloud.Fusion;default command timeout=100;CharSet=utf8;SslMode=None;allowPublicKeyRetrieval=true", "WeiCloudFusionDBConn": "demo.weienergy.cn;uid=root;pwd=Zrhdb##2022;port=3306;database=WeiCloud.Fusion;default command timeout=100;CharSet=utf8;SslMode=None;allowPublicKeyRetrieval=true",
"WeiCloudDBConn": "server=v4.weienergy.cn;uid=root;pwd=Zrhdb#2019;port=3307;database=WeiCloudDB.AXYJPT;default command timeout=100;CharSet=utf8;SslMode=None;allowPublicKeyRetrieval=true", "WeiCloudDBConn": "server=demo.weienergy.cn;uid=root;pwd=Zrhdb##2022;port=3306;database=WeiCloudDB.AXYJPT;default command timeout=100;CharSet=utf8;SslMode=None;allowPublicKeyRetrieval=true",
"AllowedHosts": "*", "AllowedHosts": "*",
"ThirdApi": { "ThirdApi": {
"LifangParkLotApiAddress": "192.168.21.22:9988/Parking/Handheld/", "LifangParkLotApiAddress": "http://demo.weienergy.cn:15231/Parking/Handheld/", //"192.168.21.22:9988/Parking/Handheld/",
"LifangParkLotViewIps": "192.168.5.93,192.168.5.95,192.168.5.102,192.168.5.104", "LifangParkLotViewIps": "192.168.5.93,192.168.5.95,192.168.5.102,192.168.5.104",
"DoorLockApi": "http://192.168.21.21:8080/open-api/", "DoorLockApi": "http://demo.weienergy.cn:15230/open-api/", //"http://192.168.21.21:8080/open-api/",
"DoorLockClientId": 69591850, "DoorLockClientId": 69591850,
"DoorLockClientSecret": "WHcpAryKFc28suzL", "DoorLockClientSecret": "WHcpAryKFc28suzL",
"DoorLockGrantType": "client_credentials", "DoorLockGrantType": "client_credentials",
@ -22,5 +22,5 @@
"Expire": 7200 // "Expire": 7200 //
}, },
"PorjectId": "530522108656160", "PorjectId": "530522108656160",
"MyApiAddress": "http://192.168.21.22:9988/Parking/Handheld/"// "MyApiAddress": "https://demo.weienergy.cn/axparting" // "http://192.168.21.22:9988/Parking/Handheld/"//
} }

Loading…
Cancel
Save