增加苏州接口数据推送
This commit is contained in:
parent
6eee371cdf
commit
0ff57d952d
|
|
@ -1,9 +1,6 @@
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Waste.Application.SubscribeInfo;
|
||||||
|
|
||||||
namespace Waste.Application
|
namespace Waste.Application
|
||||||
{
|
{
|
||||||
|
|
@ -53,5 +50,12 @@ namespace Waste.Application
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PageParms<ResultListByEquS2CDto>> GetListByEquAsync(ResultListByEquC2SDto input);
|
Task<PageParms<ResultListByEquS2CDto>> GetListByEquAsync(ResultListByEquC2SDto input);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给第三方推送消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Furion;
|
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DistributedIDGenerator;
|
using Furion.DistributedIDGenerator;
|
||||||
using Furion.RemoteRequest.Extensions;
|
|
||||||
using Furion.TaskScheduler;
|
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
@ -449,7 +446,7 @@ namespace Waste.Application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input)
|
public async Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input)
|
||||||
{
|
{
|
||||||
if (input.Weight <= 0)
|
if (input.Weight <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Furion;
|
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DistributedIDGenerator;
|
using Furion.DistributedIDGenerator;
|
||||||
using Furion.Logging.Extensions;
|
|
||||||
using Furion.RemoteRequest.Extensions;
|
using Furion.RemoteRequest.Extensions;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
@ -10,8 +8,6 @@ using Newtonsoft.Json;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Waste.Application.ThirdApiInfo;
|
using Waste.Application.ThirdApiInfo;
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,17 @@ namespace Waste.Application.ThirdApiInfo
|
||||||
wastetype = type,
|
wastetype = type,
|
||||||
weight = weight
|
weight = weight
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//推送数据给第三方
|
||||||
|
await _resultService.SendMessageToThird(new SendThirdMessageSubscribeS2SDto
|
||||||
|
{
|
||||||
|
DeviceId = device.Id,
|
||||||
|
WasteSType = "",
|
||||||
|
Time = DateTime.Now,
|
||||||
|
TrashCode = returndata.trash,
|
||||||
|
WasteType = type,
|
||||||
|
Weight = weight.ToDecimal()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -238,38 +249,6 @@ namespace Waste.Application.ThirdApiInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 16进制转汉字
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hex"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private string GetChsFromHex(string hex)
|
|
||||||
{
|
|
||||||
if (hex == null)
|
|
||||||
return "";
|
|
||||||
if (hex.Length % 2 != 0)
|
|
||||||
{
|
|
||||||
hex += "20";//空格
|
|
||||||
}
|
|
||||||
// 需要将 hex 转换成 byte 数组。
|
|
||||||
byte[] bytes = new byte[hex.Length / 2];
|
|
||||||
for (int i = 0; i < bytes.Length; i++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// 每两个字符是一个 byte。
|
|
||||||
bytes[i] = byte.Parse(hex.Substring(i * 2, 2),
|
|
||||||
System.Globalization.NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 获得 GB2312,Chinese Simplified。
|
|
||||||
Encoding chs = Encoding.GetEncoding("gb2312");
|
|
||||||
return chs.GetString(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 16进制转10进制
|
/// 16进制转10进制
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -377,40 +356,6 @@ namespace Waste.Application.ThirdApiInfo
|
||||||
return new ResultInfo(ResultState.SUCCESS, "success", data);
|
return new ResultInfo(ResultState.SUCCESS, "success", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int TrashType(string type)
|
|
||||||
{
|
|
||||||
if (type == "厨余垃圾") return 1;
|
|
||||||
else if (type == "可回收物") return 2;
|
|
||||||
else if (type == "有害垃圾") return 3;
|
|
||||||
else if (type == "其他垃圾") return 4;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetTimestamp(DateTime time)
|
|
||||||
{
|
|
||||||
DateTime dateTimeStart = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1, 8, 0, 0));
|
|
||||||
int timestamp = Convert.ToInt32((time - dateTimeStart).TotalSeconds);
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 字节数组转16进制
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bt"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private string BytesToHexStr(byte[] bt)
|
|
||||||
{
|
|
||||||
string returnStr = "";
|
|
||||||
if (bt != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < bt.Length; i++)
|
|
||||||
{
|
|
||||||
returnStr += bt[i].ToString("X2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新设备版本信息
|
/// 更新设备版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -497,6 +442,72 @@ namespace Waste.Application.ThirdApiInfo
|
||||||
return returndata;
|
return returndata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 16进制转汉字
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hex"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string GetChsFromHex(string hex)
|
||||||
|
{
|
||||||
|
if (hex == null)
|
||||||
|
return "";
|
||||||
|
if (hex.Length % 2 != 0)
|
||||||
|
{
|
||||||
|
hex += "20";//空格
|
||||||
|
}
|
||||||
|
// 需要将 hex 转换成 byte 数组。
|
||||||
|
byte[] bytes = new byte[hex.Length / 2];
|
||||||
|
for (int i = 0; i < bytes.Length; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 每两个字符是一个 byte。
|
||||||
|
bytes[i] = byte.Parse(hex.Substring(i * 2, 2),
|
||||||
|
System.Globalization.NumberStyles.HexNumber);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获得 GB2312,Chinese Simplified。
|
||||||
|
Encoding chs = Encoding.GetEncoding("gb2312");
|
||||||
|
return chs.GetString(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int TrashType(string type)
|
||||||
|
{
|
||||||
|
if (type == "厨余垃圾") return 1;
|
||||||
|
else if (type == "可回收物") return 2;
|
||||||
|
else if (type == "有害垃圾") return 3;
|
||||||
|
else if (type == "其他垃圾") return 4;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetTimestamp(DateTime time)
|
||||||
|
{
|
||||||
|
DateTime dateTimeStart = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1, 8, 0, 0));
|
||||||
|
int timestamp = Convert.ToInt32((time - dateTimeStart).TotalSeconds);
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字节数组转16进制
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string BytesToHexStr(byte[] bt)
|
||||||
|
{
|
||||||
|
string returnStr = "";
|
||||||
|
if (bt != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < bt.Length; i++)
|
||||||
|
{
|
||||||
|
returnStr += bt[i].ToString("X2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnStr;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// wifi数据解析
|
/// wifi数据解析
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -2106,6 +2106,13 @@
|
||||||
<param name="input"></param>
|
<param name="input"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.IResultService.SendMessageToThird(Waste.Application.SubscribeInfo.SendThirdMessageSubscribeS2SDto)">
|
||||||
|
<summary>
|
||||||
|
给第三方推送消息
|
||||||
|
</summary>
|
||||||
|
<param name="input"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.ResultInfos.ResultAppService">
|
<member name="T:Waste.Application.ResultInfos.ResultAppService">
|
||||||
<summary>
|
<summary>
|
||||||
投放记录
|
投放记录
|
||||||
|
|
@ -3330,13 +3337,6 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Waste.Application.ThirdApiInfo.OpenService.GetChsFromHex(System.String)">
|
|
||||||
<summary>
|
|
||||||
16进制转汉字
|
|
||||||
</summary>
|
|
||||||
<param name="hex"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Waste.Application.ThirdApiInfo.OpenService.HextToDec(System.String)">
|
<member name="M:Waste.Application.ThirdApiInfo.OpenService.HextToDec(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
16进制转10进制
|
16进制转10进制
|
||||||
|
|
@ -3358,13 +3358,6 @@
|
||||||
<param name="ecode"></param>
|
<param name="ecode"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Waste.Application.ThirdApiInfo.OpenService.BytesToHexStr(System.Byte[])">
|
|
||||||
<summary>
|
|
||||||
字节数组转16进制
|
|
||||||
</summary>
|
|
||||||
<param name="bt"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Waste.Application.ThirdApiInfo.OpenService.UpdateVersionAsync(Waste.Application.SubscribeInfo.DeviceVerS2SDto)">
|
<member name="M:Waste.Application.ThirdApiInfo.OpenService.UpdateVersionAsync(Waste.Application.SubscribeInfo.DeviceVerS2SDto)">
|
||||||
<summary>
|
<summary>
|
||||||
更新设备版本信息
|
更新设备版本信息
|
||||||
|
|
@ -3379,6 +3372,20 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.ThirdApiInfo.OpenService.GetChsFromHex(System.String)">
|
||||||
|
<summary>
|
||||||
|
16进制转汉字
|
||||||
|
</summary>
|
||||||
|
<param name="hex"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.ThirdApiInfo.OpenService.BytesToHexStr(System.Byte[])">
|
||||||
|
<summary>
|
||||||
|
字节数组转16进制
|
||||||
|
</summary>
|
||||||
|
<param name="bt"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.ThirdApiInfo.OpenService.AnalyProto(Waste.Application.ThirdApiInfo.WifiRequestC2SDto)">
|
<member name="M:Waste.Application.ThirdApiInfo.OpenService.AnalyProto(Waste.Application.ThirdApiInfo.WifiRequestC2SDto)">
|
||||||
<summary>
|
<summary>
|
||||||
wifi数据解析
|
wifi数据解析
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -3,6 +3,6 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
||||||
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
||||||
<NameOfLastUsedPublishProfile>H:\liuzl_ybhdmob\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml</NameOfLastUsedPublishProfile>
|
<NameOfLastUsedPublishProfile>E:\liuzl_ybhdmob\巨天垃圾分类\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml</NameOfLastUsedPublishProfile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
Reference in New Issue