diff --git a/Waste.Application/ResultInfos/Dtos/ResultDto.cs b/Waste.Application/ResultInfos/Dtos/ResultDto.cs index 349eedb..cb96ad4 100644 --- a/Waste.Application/ResultInfos/Dtos/ResultDto.cs +++ b/Waste.Application/ResultInfos/Dtos/ResultDto.cs @@ -29,6 +29,10 @@ namespace Waste.Application /// 设备编号 /// public string DeviceEcode { get; set; } + /// + /// 上报是否成功,1-成功,0-失败 + /// + public int PostStatus { get; set; } } /// /// 上传的数据包体 diff --git a/Waste.Application/ResultInfos/ResultService.cs b/Waste.Application/ResultInfos/ResultService.cs index 96f7b5e..c86b22b 100644 --- a/Waste.Application/ResultInfos/ResultService.cs +++ b/Waste.Application/ResultInfos/ResultService.cs @@ -92,20 +92,21 @@ namespace Waste.Application GrossWeight = x.GrossWeight, NetWeight = x.NetWeight, Registration = x.Registration, - CreateTime = x.CreateTime + CreateTime = x.CreateTime, + PostStatus= -1 }) .Mapper((it, cache) => { var allbus = cache.Get(list => { var ids = list.Where(e => e.BusinessId != Guid.Empty).Select(e => e.BusinessId).ToList(); - return repository.Change().Context.Queryable().Where(e => ids.Contains(e.Id)).ToList(); + return dbClient.Queryable().Where(e => ids.Contains(e.Id)).ToList(); }); it.BusinessName = allbus.FirstOrDefault(e => e.Id == it.BusinessId)?.Name; var alldev = cache.Get(list => { var ids = list.Where(e => e.DeviceId != Guid.Empty).Select(e => e.DeviceId).ToList(); - return repository.Change().Context.Queryable().Where(e => ids.Contains(e.Id)).ToList(); + return dbClient.Queryable().Where(e => ids.Contains(e.Id)).ToList(); }); var dev = alldev.FirstOrDefault(e => e.Id == it.DeviceId); if (dev != null) @@ -115,6 +116,16 @@ namespace Waste.Application it.DeviceEcode = dev.Ecode; it.DeviceAddress = dev.Address; } + var allres = cache.Get(list => + { + var ids = list.Select(e => e.Id).ToList(); + return dbClient.Queryable().Where(e => ids.Contains(e.ResultId)).ToList(); + }); + var res = allres.FirstOrDefault(e => e.ResultId == it.Id); + if(res != null) + { + it.PostStatus = res.Status; + } }) .ToPageListAsync(param.offset, param.limit, totalnum); return new PageParms diff --git a/Waste.Application/ThirdApiInfo/OpenService.cs b/Waste.Application/ThirdApiInfo/OpenService.cs index 08ccbac..07efb75 100644 --- a/Waste.Application/ThirdApiInfo/OpenService.cs +++ b/Waste.Application/ThirdApiInfo/OpenService.cs @@ -41,7 +41,7 @@ namespace Waste.Application.ThirdApiInfo Guid resultid=Guid.Empty; if (!string.IsNullOrEmpty(data.ResultId) && Guid.TryParse(data.ResultId,out resultid)) { - int status = data.data.ToInt();//0-成功,1-失败 + int status = data.data.ToInt();//1-成功,0-失败 if (await dbClient.Queryable().AnyAsync(x => x.ResultId == resultid)) { await dbClient.Updateable().SetColumns(x => new W_ResultExt @@ -87,7 +87,7 @@ namespace Waste.Application.ThirdApiInfo SecretHash = devicesecret.SecretHash, UserId = UserId, PostUrl = ApiUrl, - ScanningTime = GetTimestamp(DateTime.Now), + ScanningTime = timestamp, ResultId = IDGen.NextID() }; //解析协议,IC卡数据@垃圾桶编号@厨余垃圾@7.91 @@ -284,7 +284,7 @@ namespace Waste.Application.ThirdApiInfo && !string.IsNullOrEmpty(devicesecret.SecretHash) && !string.IsNullOrEmpty(devicesecret.DevId)) { - data.timestamp = _suZhouService.GetTimestamp(); + data.timestamp = _suZhouService.GetUTCTimestamp(); data.noncestr = _suZhouService.GetNonce(); data.UserId = UserId; data.Secret = devicesecret.Secret; diff --git a/Waste.Application/Waste.Application.xml b/Waste.Application/Waste.Application.xml index b760e86..d3f0b56 100644 --- a/Waste.Application/Waste.Application.xml +++ b/Waste.Application/Waste.Application.xml @@ -1118,6 +1118,12 @@ + + + 获取UTC时间戳 + + + 获取签名 @@ -1181,6 +1187,12 @@ + + + 获取UTC时间戳 + + + 获取随机数 @@ -1467,6 +1479,11 @@ 设备编号 + + + 上报是否成功,1-成功,0-失败 + + 上传的数据包体 diff --git a/Waste.Domain/DataModel/W_ResultExt.cs b/Waste.Domain/DataModel/W_ResultExt.cs index 42b5645..11ad6e6 100644 --- a/Waste.Domain/DataModel/W_ResultExt.cs +++ b/Waste.Domain/DataModel/W_ResultExt.cs @@ -17,7 +17,7 @@ namespace Waste.Domain /// public Guid ResultId { get; set; } /// - /// 状态,0-成功,1-失败 + /// 状态,1-成功,0-失败 /// public int Status { get; set; } /// diff --git a/Waste.Web.Entry/Pages/Result/Index.cshtml b/Waste.Web.Entry/Pages/Result/Index.cshtml index 407850c..324069b 100644 --- a/Waste.Web.Entry/Pages/Result/Index.cshtml +++ b/Waste.Web.Entry/Pages/Result/Index.cshtml @@ -36,6 +36,15 @@ 编辑  @*删除 *@ + @section Scripts {