Merge branch 'zhy_feat_dev_v10' into dev
This commit is contained in:
commit
52207a92fa
@ -1,5 +1,8 @@
|
||||
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -21,11 +24,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
{
|
||||
private readonly ILogger<AFN16_F1_Analysis> _logger;
|
||||
private readonly AnalysisStrategyContext _analysisStrategyContext;
|
||||
|
||||
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext)
|
||||
private readonly DataStorage _dataStorage;
|
||||
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_analysisStrategyContext = analysisStrategyContext;
|
||||
_dataStorage = dataStorage;
|
||||
}
|
||||
|
||||
public async Task<bool> ExecuteAsync(TB3761 input, Action<dynamic>? result = null)
|
||||
@ -52,6 +56,38 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
});
|
||||
else
|
||||
{
|
||||
//TODO: 写入1条日志
|
||||
var data = new AnalysisBaseDto<string?>()
|
||||
{
|
||||
FiledDesc = "透明转发",
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||
{
|
||||
Code = input.A.Code,
|
||||
AFN = input.AFN_FC.AFN,
|
||||
Fn = input.DT.Fn,
|
||||
Pn = input.DA.Pn,
|
||||
Data = data,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
ReceivedTime = input.ReceivedTime,
|
||||
DensityUnit = DensityUnit.None,
|
||||
TimeDensity = -1,
|
||||
DataType = IOTDBDataTypeConst.Log
|
||||
};
|
||||
await _dataStorage.SaveDataToIotDbAsync<string?>(dto);
|
||||
_logger.LogWarning($"未能找到透明传发解析方式:{input.BaseHexMessage.HexMessageString}");
|
||||
}
|
||||
}
|
||||
@ -60,7 +96,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"10_101解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
|
||||
_logger.LogError(ex, $"10_1解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
|
||||
|
||||
}
|
||||
return await Task.FromResult(false);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using DeviceDetectorNET.Parser.Device;
|
||||
using Confluent.Kafka;
|
||||
using DeviceDetectorNET.Parser.Device;
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using JiShe.CollectBus.Ammeters;
|
||||
using JiShe.CollectBus.Application.Contracts;
|
||||
@ -542,7 +543,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[KafkaSubscribe(ProtocolConst.TESTSENDTOPIC)]
|
||||
[KafkaSubscribe(ProtocolConst.TESTSENDTOPIC), ApiExplorerSettings(IgnoreApi = true)]
|
||||
|
||||
public async Task<ISubscribeAck> KafkaSubscribeTestSendAsync(KafkaSendDto dto)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user