发送第三方消息全部小写化
This commit is contained in:
parent
a9634a443b
commit
dcc81ba6fc
|
|
@ -17,12 +17,16 @@ namespace Waste.Application
|
|||
config.ForType<ApiReportBaseDataItem, ApiReportBaseData>()
|
||||
.Map(dest => dest.weight, src => src.DayWeight.ToString("f2"))
|
||||
.Map(dest => dest.pweight, src => src.DayPureWeight.ToString("f2"))
|
||||
.Map(dest=>dest.time,src=>src.CreateTime.ToString("yyyy-MM-dd"))
|
||||
.Map(dest=>dest.type,src=>src.WasteType)
|
||||
.Map(dest => dest.time, src => src.CreateTime.ToString("yyyy-MM-dd"))
|
||||
.Map(dest => dest.type, src => src.WasteType)
|
||||
;
|
||||
config.ForType<SendThirdMessageSubscribeS2SDto, SendThirdMessageSubscriDto>()
|
||||
.Map(dest => dest.Time, src => src.Time.GetTimeStamp())
|
||||
.Map(dest => dest.time, src => src.Time.GetTimeStamp())
|
||||
;
|
||||
config.ForType<SendThirdMessageSubscriDto, SendMessageToThirdS2CDto>()
|
||||
.Map(dest => dest.trashcode, src => src.trashcode.ToStr())
|
||||
.Map(dest => dest.wastestype, src => src.wastestype.ToStr())
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,10 +12,12 @@ namespace Waste.Application.ResultInfos
|
|||
public class ResultAppService : IDynamicApiController
|
||||
{
|
||||
private readonly IResultService _resultService;
|
||||
|
||||
public ResultAppService(IResultService resultService)
|
||||
{
|
||||
_resultService = resultService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 投放记录列表
|
||||
/// </summary>
|
||||
|
|
@ -26,6 +28,7 @@ namespace Waste.Application.ResultInfos
|
|||
{
|
||||
return await _resultService.GetListAsync(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加记录
|
||||
/// </summary>
|
||||
|
|
@ -45,11 +48,5 @@ namespace Waste.Application.ResultInfos
|
|||
{
|
||||
await _resultService.InsertResultByWifiAsync(data);
|
||||
}
|
||||
|
||||
public async Task<string> RecvResult(SendMessageToThirdS2CDto data)
|
||||
{
|
||||
var getdata = data;
|
||||
return await Task.FromResult("success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ namespace Waste.Application
|
|||
_loggerService = loggerService;
|
||||
_capBus = capPublisher;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取投放记录
|
||||
/// </summary>
|
||||
|
|
@ -127,7 +128,8 @@ namespace Waste.Application
|
|||
{
|
||||
it.PostStatus = res.Status;
|
||||
}
|
||||
var allext = cache.Get(list => {
|
||||
var allext = cache.Get(list =>
|
||||
{
|
||||
var ids = list.Select(e => e.Id).ToList();
|
||||
return dbClient.Queryable<W_MeasureResult>().Where(e => ids.Contains(e.ResultId)).ToList();
|
||||
});
|
||||
|
|
@ -143,6 +145,7 @@ namespace Waste.Application
|
|||
limit = param.limit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// wifi模块测量结果增加
|
||||
/// </summary>
|
||||
|
|
@ -285,6 +288,7 @@ namespace Waste.Application
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新的A8 4G模块测量结果增加
|
||||
/// </summary>
|
||||
|
|
@ -382,6 +386,7 @@ namespace Waste.Application
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给第三方推送消息
|
||||
/// </summary>
|
||||
|
|
@ -401,11 +406,12 @@ namespace Waste.Application
|
|||
if (configdata != null && !configdata.Url.IsEmpty())
|
||||
{
|
||||
var senddata = input.Adapt<SendThirdMessageSubscriDto>();
|
||||
senddata.Body = configdata.Body.ToStr();
|
||||
senddata.body = configdata.Body.ToStr();
|
||||
senddata.Url = configdata.Url.ToStr();
|
||||
await _capBus.PublishAsync("third.service.sendmessage", senddata);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加测量记录
|
||||
/// </summary>
|
||||
|
|
@ -464,7 +470,6 @@ namespace Waste.Application
|
|||
}
|
||||
//000F000002.16进制
|
||||
// var areaHex = Convert.ToHexString(areaBytes);
|
||||
|
||||
}
|
||||
decimal weight = myPackage.Weight.IsEmpty() ? 0 : myPackage.Weight.ToDecimal();
|
||||
//记录数据
|
||||
|
|
@ -533,6 +538,7 @@ namespace Waste.Application
|
|||
{
|
||||
return Convert.ToInt32(((int)bt).ToString("X2"), 16);
|
||||
}
|
||||
|
||||
private static int GetTimestamp(DateTime time)
|
||||
{
|
||||
DateTime dateTimeStart = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1, 8, 0, 0));
|
||||
|
|
|
|||
|
|
@ -15,59 +15,73 @@ namespace Waste.Application.SubscribeInfo
|
|||
/// 设备ID
|
||||
/// </summary>
|
||||
public Guid DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最近使用时间
|
||||
/// </summary>
|
||||
public DateTime? LastHeartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 记录ID
|
||||
/// </summary>
|
||||
public Guid ResultId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备服务商ID
|
||||
/// </summary>
|
||||
public Guid BusinessId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备的IMEI
|
||||
/// </summary>
|
||||
public string imei { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ICCID
|
||||
/// </summary>
|
||||
public string iccid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IMSI
|
||||
/// </summary>
|
||||
public string imsi { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纬度
|
||||
/// </summary>
|
||||
public decimal latitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经度
|
||||
/// </summary>
|
||||
public decimal longtitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号强度
|
||||
/// </summary>
|
||||
public int gslq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 垃圾类型
|
||||
/// </summary>
|
||||
public string wastetype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 垃圾桶编号
|
||||
/// </summary>
|
||||
public string trash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 毛重
|
||||
/// </summary>
|
||||
public string weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 皮重
|
||||
/// </summary>
|
||||
public decimal Tare { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备版本信息
|
||||
/// </summary>
|
||||
|
|
@ -77,11 +91,13 @@ namespace Waste.Application.SubscribeInfo
|
|||
/// 设备机器码
|
||||
/// </summary>
|
||||
public string ecode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
public string ver { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送第三方消息
|
||||
/// </summary>
|
||||
|
|
@ -96,18 +112,22 @@ namespace Waste.Application.SubscribeInfo
|
|||
/// 垃圾类别
|
||||
/// </summary>
|
||||
public string WasteType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物品小类别
|
||||
/// </summary>
|
||||
public string WasteSType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 重量,单位KG
|
||||
/// </summary>
|
||||
public decimal Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 垃圾桶编号
|
||||
/// </summary>s
|
||||
public string TrashCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报时间
|
||||
/// </summary>
|
||||
|
|
@ -124,6 +144,7 @@ namespace Waste.Application.SubscribeInfo
|
|||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送给第三方的信息
|
||||
/// </summary>
|
||||
|
|
@ -132,33 +153,36 @@ namespace Waste.Application.SubscribeInfo
|
|||
/// <summary>
|
||||
/// 垃圾类别
|
||||
/// </summary>
|
||||
public string WasteType { get; set; }
|
||||
public string wastetype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物品小类别
|
||||
/// </summary>
|
||||
public string WasteSType { get; set; } = "";
|
||||
public string wastestype { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 重量,单位KG
|
||||
/// </summary>
|
||||
public string Weight { get; set; }
|
||||
public string weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 垃圾桶编号
|
||||
/// </summary>
|
||||
public string TrashCode { get; set; }
|
||||
public string trashcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报时间
|
||||
/// </summary>
|
||||
public long Time { get; set; }
|
||||
public long time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 额外信息
|
||||
/// </summary>
|
||||
public string Body { get; set; }
|
||||
public string body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备ID
|
||||
/// </summary>
|
||||
public Guid DeviceId { get; set; }
|
||||
public Guid deviceid { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,14 @@ namespace Waste.Application
|
|||
private readonly IHttpClientFactory _clientFactory;
|
||||
private readonly ILoggerService _loggerService;
|
||||
private readonly ISubscribeService _subscribeService;
|
||||
|
||||
public TestAppService(ILoggerService loggerService, IHttpClientFactory clientFactory, ISubscribeService subscribeService)
|
||||
{
|
||||
_loggerService = loggerService;
|
||||
_clientFactory = clientFactory;
|
||||
_subscribeService = subscribeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接收测试
|
||||
/// </summary>
|
||||
|
|
@ -48,8 +50,8 @@ namespace Waste.Application
|
|||
[HttpGet]
|
||||
public void ConnectServer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
@ -57,14 +59,15 @@ namespace Waste.Application
|
|||
[HttpGet]
|
||||
public async Task TestThirdSendAsync()
|
||||
{
|
||||
await _subscribeService.SeedThirdMessageAsync(new SendThirdMessageSubscriDto {
|
||||
Url= "https://localhost:44335/api/test/recv",
|
||||
WasteType= "\u0000\u0000\u0000\u0000纸壳",
|
||||
Weight="20.9",
|
||||
TrashCode="0",
|
||||
Time= 1653033312,
|
||||
Body="",
|
||||
DeviceId= Guid.Parse("39fcdce8-9e54-b87f-fc8e-616a9072c224")
|
||||
await _subscribeService.SeedThirdMessageAsync(new SendThirdMessageSubscriDto
|
||||
{
|
||||
Url = "https://localhost:44335/api/test/recv",
|
||||
wastetype = "\u0000\u0000\u0000\u0000纸壳",
|
||||
weight = "20.9",
|
||||
trashcode = "0",
|
||||
time = 1653033312,
|
||||
body = "",
|
||||
deviceid = Guid.Parse("39fcdce8-9e54-b87f-fc8e-616a9072c224")
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -77,17 +80,18 @@ namespace Waste.Application
|
|||
[HttpGet]
|
||||
public async Task TestSendAsync()
|
||||
{
|
||||
GarbagePltC2SDto garbageC2SDto = new GarbagePltC2SDto {
|
||||
Weight=10.1,
|
||||
GarbagePltC2SDto garbageC2SDto = new GarbagePltC2SDto
|
||||
{
|
||||
Weight = 10.1,
|
||||
secret = "6Vxkfkg3kxqkkzgT",
|
||||
secrethash = "51fb893bccc1395e",
|
||||
ScanningTime= 1627917492,
|
||||
DStatus=0,
|
||||
ScanningTime = 1627917492,
|
||||
DStatus = 0,
|
||||
deviceid = "08d954b6-df45-4de1-8fde-f5109798b855",
|
||||
Trash = "000F000002",
|
||||
Type = 4
|
||||
};
|
||||
if(garbageC2SDto.Weight == ((int)garbageC2SDto.Weight).ToDouble())
|
||||
if (garbageC2SDto.Weight == ((int)garbageC2SDto.Weight).ToDouble())
|
||||
{
|
||||
garbageC2SDto.Weight = garbageC2SDto.Weight.ToDouble(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Waste.Application.ThirdApiInfo.Message
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备消息推送给第三方处理
|
||||
/// </summary>
|
||||
public interface IMessageService
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task SeedMessageAsync(SendMessageS2SDto input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
using DotNetCore.CAP;
|
||||
using Furion.DependencyInjection;
|
||||
using Nirvana.Common;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Waste.Application.SubscribeInfo;
|
||||
using Waste.Domain;
|
||||
|
||||
namespace Waste.Application.ThirdApiInfo.Message
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备消息推送给第三方处理
|
||||
/// </summary>
|
||||
public class MessageService : IMessageService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<W_DeviceConfig> repository;
|
||||
private readonly ICapPublisher _capBus;
|
||||
private readonly SqlSugarClient dbClient;
|
||||
public MessageService(ISqlSugarRepository<W_DeviceConfig> sqlSugarRepository, ICapPublisher capBus)
|
||||
{
|
||||
repository = sqlSugarRepository;
|
||||
dbClient = repository.Context;
|
||||
_capBus = capBus;
|
||||
}
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SeedMessageAsync(SendMessageS2SDto input)
|
||||
{
|
||||
if (!await dbClient.Queryable<W_DeviceConfig>().AnyAsync(x => x.DeviceId == input.DeviceId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var config = await dbClient.Queryable<W_DeviceConfig>().Where(x => x.DeviceId == input.DeviceId).Select(x => new W_DeviceConfig
|
||||
{
|
||||
Body = x.Body,
|
||||
Url = x.Url
|
||||
}).FirstAsync();
|
||||
|
||||
var time = input.Time.GetTimeStamp();
|
||||
await _capBus.PublishAsync("third.service.sendmessage", new SendThirdMessageSubscriDto
|
||||
{
|
||||
WasteType = input.WasteType,
|
||||
Body = config.Body,
|
||||
Time = time,
|
||||
TrashCode = input.TrashCode,
|
||||
Url = config.Url,
|
||||
Weight = input.Weight
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2287,37 +2287,37 @@
|
|||
推送给第三方的信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.WasteType">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.wastetype">
|
||||
<summary>
|
||||
垃圾类别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.WasteSType">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.wastestype">
|
||||
<summary>
|
||||
物品小类别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.Weight">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.weight">
|
||||
<summary>
|
||||
重量,单位KG
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.TrashCode">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.trashcode">
|
||||
<summary>
|
||||
垃圾桶编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.Time">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.time">
|
||||
<summary>
|
||||
上报时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.Body">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.body">
|
||||
<summary>
|
||||
额外信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.DeviceId">
|
||||
<member name="P:Waste.Application.SubscribeInfo.SendMessageToThirdS2CDto.deviceid">
|
||||
<summary>
|
||||
设备ID
|
||||
</summary>
|
||||
|
|
@ -2730,10 +2730,10 @@
|
|||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.TestAppService.TestThirdSendAsync">
|
||||
<summary>
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.ThirdApiInfo.DevHeartRequestDto">
|
||||
<summary>
|
||||
|
|
@ -3092,30 +3092,6 @@
|
|||
<param name="data"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.ThirdApiInfo.Message.IMessageService">
|
||||
<summary>
|
||||
设备消息推送给第三方处理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Waste.Application.ThirdApiInfo.Message.IMessageService.SeedMessageAsync(Waste.Application.ThirdApiInfo.SendMessageS2SDto)">
|
||||
<summary>
|
||||
消息发送
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.ThirdApiInfo.Message.MessageService">
|
||||
<summary>
|
||||
设备消息推送给第三方处理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Waste.Application.ThirdApiInfo.Message.MessageService.SeedMessageAsync(Waste.Application.ThirdApiInfo.SendMessageS2SDto)">
|
||||
<summary>
|
||||
消息发送
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.ThirdApiInfo.OpenAppService">
|
||||
<summary>
|
||||
开放数据
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue