using HybirdFrameworkCore.Autofac.Attribute; using log4net; using Newtonsoft.Json; using Repository.Station; using Service.Cloud.Client; using Service.Cloud.Common; using Service.Cloud.Msg.Cloud.Resp; namespace Service.Cloud.Handler; [Scope("InstancePerDependency")] public class UploadSwapOrderResHandler : IBaseHandler { private static readonly ILog Log = LogManager.GetLogger(typeof(UploadSwapOrderResHandler)); public SwapOrderRepository SwapOrderRepository { get; set; } public void Handle(string t) { StaSwapRecordRes? resp = JsonConvert.DeserializeObject(t); if (resp != null) { if (CloudClientMgr.CloudClient != null) { CloudClientMgr.CloudClient.UploadPowerChange.SetResp(resp); string? reqSon = CloudClientMgr.CloudClient.UploadPowerChange.Req?.son; Log.Info($"receive UploadSwapOrderRes swapOrderNo={reqSon} {JsonConvert.SerializeObject(resp)}"); if (!string.IsNullOrWhiteSpace(reqSon) && resp.re == 0) { SwapOrderRepository.Update(it => it.CloudReportStatus == 1, it => it.Sn == reqSon); } } } } public bool CanHandle(string cmd) { return CloudConst.staSwapRecordRes == cmd; } }