From 0ff57d952d4ad982d3e020a0f1621bb3ebcd5915 Mon Sep 17 00:00:00 2001 From: liuzl Date: Mon, 9 Jan 2023 15:14:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8B=8F=E5=B7=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResultInfos/IResultService.cs | 12 +- .../ResultInfos/ResultService.cs | 5 +- .../SubscribeInfo/SubscribeService.cs | 4 - Waste.Application/ThirdApiInfo/OpenService.cs | 143 ++++++++++-------- Waste.Application/Waste.Application.xml | 35 +++-- .../waste.ybhdmob.com.pubxml.user | 3 +- Waste.Web.Entry/Waste.Web.Entry.csproj.user | 2 +- 7 files changed, 110 insertions(+), 94 deletions(-) diff --git a/Waste.Application/ResultInfos/IResultService.cs b/Waste.Application/ResultInfos/IResultService.cs index 30220d7..b72d502 100644 --- a/Waste.Application/ResultInfos/IResultService.cs +++ b/Waste.Application/ResultInfos/IResultService.cs @@ -1,9 +1,6 @@ using Nirvana.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; +using Waste.Application.SubscribeInfo; namespace Waste.Application { @@ -53,5 +50,12 @@ namespace Waste.Application /// /// Task> GetListByEquAsync(ResultListByEquC2SDto input); + + /// + /// 给第三方推送消息 + /// + /// + /// + Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input); } } \ No newline at end of file diff --git a/Waste.Application/ResultInfos/ResultService.cs b/Waste.Application/ResultInfos/ResultService.cs index db97437..3c1f278 100644 --- a/Waste.Application/ResultInfos/ResultService.cs +++ b/Waste.Application/ResultInfos/ResultService.cs @@ -1,9 +1,6 @@ using DotNetCore.CAP; -using Furion; using Furion.DependencyInjection; using Furion.DistributedIDGenerator; -using Furion.RemoteRequest.Extensions; -using Furion.TaskScheduler; using Mapster; using Nirvana.Common; using SqlSugar; @@ -449,7 +446,7 @@ namespace Waste.Application /// /// /// - private async Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input) + public async Task SendMessageToThird(SendThirdMessageSubscribeS2SDto input) { if (input.Weight <= 0) { diff --git a/Waste.Application/SubscribeInfo/SubscribeService.cs b/Waste.Application/SubscribeInfo/SubscribeService.cs index 818fedb..5e338a7 100644 --- a/Waste.Application/SubscribeInfo/SubscribeService.cs +++ b/Waste.Application/SubscribeInfo/SubscribeService.cs @@ -1,8 +1,6 @@ using DotNetCore.CAP; -using Furion; using Furion.DependencyInjection; using Furion.DistributedIDGenerator; -using Furion.Logging.Extensions; using Furion.RemoteRequest.Extensions; using Mapster; using Microsoft.Extensions.DependencyInjection; @@ -10,8 +8,6 @@ using Newtonsoft.Json; using Nirvana.Common; using SqlSugar; using System; -using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; using Waste.Application.ThirdApiInfo; diff --git a/Waste.Application/ThirdApiInfo/OpenService.cs b/Waste.Application/ThirdApiInfo/OpenService.cs index ac5ba28..9441ccf 100644 --- a/Waste.Application/ThirdApiInfo/OpenService.cs +++ b/Waste.Application/ThirdApiInfo/OpenService.cs @@ -215,6 +215,17 @@ namespace Waste.Application.ThirdApiInfo wastetype = type, weight = weight }); + + //推送数据给第三方 + await _resultService.SendMessageToThird(new SendThirdMessageSubscribeS2SDto + { + DeviceId = device.Id, + WasteSType = "", + Time = DateTime.Now, + TrashCode = returndata.trash, + WasteType = type, + Weight = weight.ToDecimal() + }); } else { @@ -238,38 +249,6 @@ namespace Waste.Application.ThirdApiInfo } } - /// - /// 16进制转汉字 - /// - /// - /// - 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); - } - /// /// 16进制转10进制 /// @@ -377,40 +356,6 @@ namespace Waste.Application.ThirdApiInfo 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; - } - - /// - /// 字节数组转16进制 - /// - /// - /// - 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; - } - /// /// 更新设备版本信息 /// @@ -497,6 +442,72 @@ namespace Waste.Application.ThirdApiInfo return returndata; } + /// + /// 16进制转汉字 + /// + /// + /// + 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; + } + + /// + /// 字节数组转16进制 + /// + /// + /// + 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; + } + /// /// wifi数据解析 /// diff --git a/Waste.Application/Waste.Application.xml b/Waste.Application/Waste.Application.xml index 4e94821..d7c3c67 100644 --- a/Waste.Application/Waste.Application.xml +++ b/Waste.Application/Waste.Application.xml @@ -2106,6 +2106,13 @@ + + + 给第三方推送消息 + + + + 投放记录 @@ -3330,13 +3337,6 @@ - - - 16进制转汉字 - - - - 16进制转10进制 @@ -3358,13 +3358,6 @@ - - - 字节数组转16进制 - - - - 更新设备版本信息 @@ -3379,6 +3372,20 @@ + + + 16进制转汉字 + + + + + + + 字节数组转16进制 + + + + wifi数据解析 diff --git a/Waste.Web.Entry/Properties/PublishProfiles/waste.ybhdmob.com.pubxml.user b/Waste.Web.Entry/Properties/PublishProfiles/waste.ybhdmob.com.pubxml.user index e68ee1f..f786698 100644 --- a/Waste.Web.Entry/Properties/PublishProfiles/waste.ybhdmob.com.pubxml.user +++ b/Waste.Web.Entry/Properties/PublishProfiles/waste.ybhdmob.com.pubxml.user @@ -5,6 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\webpublish\waste.ybhdmob.com - True|2022-09-14T02:54:14.3430113Z;True|2022-08-24T10:11:56.9315738+08:00;True|2022-07-28T16:27:26.4646475+08:00;True|2022-07-26T18:02:16.8734313+08:00;True|2022-07-26T17:47:48.4802128+08:00;True|2022-07-26T10:16:29.8933802+08:00;True|2022-07-26T09:36:14.5292489+08:00;True|2022-07-12T17:26:37.8289741+08:00;True|2022-07-07T15:15:35.7942932+08:00;True|2022-07-07T14:38:14.6580938+08:00;True|2022-07-07T14:32:33.3480279+08:00;True|2022-07-06T08:59:01.5108509+08:00;True|2022-06-21T14:41:45.3390865+08:00;False|2022-06-21T14:31:42.6318272+08:00;True|2022-06-21T14:07:42.4016410+08:00;True|2022-06-20T15:37:14.0002383+08:00;True|2022-06-20T08:32:15.3735483+08:00;True|2022-06-18T10:39:25.0997617+08:00;True|2022-06-15T11:23:32.6444305+08:00;True|2022-06-07T10:26:48.8057155+08:00;True|2022-05-19T14:38:58.4564787+08:00;True|2022-05-19T10:00:43.2712891+08:00;True|2022-05-17T18:00:53.2618269+08:00;True|2022-05-17T17:55:33.2053115+08:00;True|2022-05-17T17:38:48.8279756+08:00;True|2022-05-16T16:44:49.1758100+08:00;True|2022-03-30T10:54:32.5565057+08:00;True|2022-03-30T10:53:48.9972377+08:00;True|2022-03-30T10:50:31.5745775+08:00;True|2022-03-30T10:47:50.1605527+08:00;True|2022-03-30T10:15:59.9812921+08:00;True|2022-03-29T09:29:45.1039655+08:00;True|2022-03-29T09:21:47.0149226+08:00;True|2022-03-28T10:33:44.7419612+08:00;True|2022-03-28T10:22:40.9448563+08:00;True|2022-03-28T10:19:15.1438519+08:00;True|2022-01-20T10:39:53.2000547+08:00;True|2021-11-23T17:45:59.0399234+08:00;True|2021-11-23T14:52:52.6108389+08:00;True|2021-11-23T13:47:55.8909321+08:00;True|2021-11-23T13:46:38.7796888+08:00;True|2021-11-23T13:42:14.9551976+08:00;True|2021-11-23T13:40:54.9093258+08:00;True|2021-11-23T13:31:49.0003794+08:00;True|2021-11-23T13:29:43.7414639+08:00;True|2021-10-12T15:18:06.6012215+08:00;True|2021-10-12T15:11:17.7752651+08:00;True|2021-10-12T14:54:39.0578509+08:00;True|2021-10-12T11:25:18.7098128+08:00;True|2021-09-18T15:34:20.7386778+08:00;True|2021-09-15T11:09:28.0068993+08:00;True|2021-09-07T12:19:33.4635211+08:00;True|2021-09-07T11:36:13.4563799+08:00;True|2021-09-03T15:41:46.2819586+08:00;True|2021-08-31T17:16:16.0336390+08:00;True|2021-08-31T16:05:30.7224440+08:00;True|2021-08-23T09:44:46.2114418+08:00;True|2021-08-19T20:32:56.2854974+08:00;True|2021-08-18T14:01:33.0411246+08:00;True|2021-08-17T10:05:15.4299188+08:00;True|2021-08-13T19:32:53.6307075+08:00;True|2021-08-13T19:29:50.5876782+08:00;True|2021-08-13T19:14:14.2545106+08:00;True|2021-08-13T15:24:09.4521125+08:00;True|2021-08-13T14:59:40.4579407+08:00;True|2021-08-13T10:02:29.7650246+08:00;True|2021-08-13T09:45:10.6245894+08:00;True|2021-08-12T20:11:21.5851106+08:00;True|2021-08-12T20:00:42.4820498+08:00;True|2021-08-12T18:44:08.3079650+08:00;True|2021-08-12T18:35:47.4730766+08:00;True|2021-08-12T18:32:10.9361388+08:00;True|2021-08-12T18:30:21.4006961+08:00;True|2021-08-12T18:13:00.9624470+08:00;True|2021-08-12T18:10:12.3459311+08:00;True|2021-08-12T18:09:18.8656414+08:00;True|2021-08-12T17:35:24.7213607+08:00;True|2021-08-11T07:54:57.1322848+08:00;True|2021-08-10T10:16:40.7495389+08:00;True|2021-08-03T11:16:02.7897282+08:00;True|2021-08-02T16:39:27.2332369+08:00;True|2021-08-02T15:07:40.7995318+08:00;True|2021-08-02T14:32:29.6885424+08:00;True|2021-08-02T14:31:18.6578543+08:00;True|2021-08-02T14:27:57.1301002+08:00;True|2021-08-02T10:55:40.3542370+08:00;True|2021-08-02T09:44:28.0994056+08:00;True|2021-08-01T13:49:38.4071985+08:00;True|2021-08-01T13:36:45.5372120+08:00;True|2021-08-01T11:00:19.6165520+08:00;True|2021-08-01T10:38:51.4029710+08:00;True|2021-07-31T20:27:53.6583811+08:00;True|2021-07-31T18:35:23.4214441+08:00;True|2021-07-31T17:34:14.0712243+08:00;True|2021-07-31T14:50:43.2065556+08:00;True|2021-07-30T17:59:30.2223340+08:00;True|2021-07-30T17:57:35.9412910+08:00;True|2021-07-30T17:07:58.3305971+08:00;True|2021-07-30T17:04:10.9244859+08:00;True|2021-07-30T17:02:12.1943634+08:00;True|2021-07-30T16:16:22.2838331+08:00;True|2021-07-30T15:05:26.5664155+08:00;True|2021-07-30T14:57:59.1966108+08:00;True|2021-07-30T14:54:25.8172908+08:00;True|2021-07-30T14:52:20.9209995+08:00;True|2021-07-30T14:35:29.5239463+08:00;True|2021-07-30T09:32:38.2676032+08:00;True|2021-07-30T09:14:42.6170851+08:00;True|2021-07-29T19:06:09.1449349+08:00;True|2021-06-11T08:16:29.9542894+08:00;True|2021-06-04T14:46:02.2707457+08:00;True|2021-06-02T15:08:52.8245632+08:00;True|2021-06-02T15:05:50.3614099+08:00;True|2021-06-02T14:59:32.3690948+08:00;True|2021-06-02T14:10:25.1182836+08:00;True|2021-06-02T14:09:54.9215833+08:00;True|2021-06-01T10:41:54.9488501+08:00;True|2021-06-01T10:38:56.0283198+08:00;True|2021-05-28T13:59:02.2308877+08:00;True|2021-05-28T11:56:26.6796406+08:00;True|2021-05-28T11:28:00.4087907+08:00;True|2021-05-27T16:18:09.5993838+08:00;True|2021-05-27T16:07:31.3484951+08:00;True|2021-05-27T11:30:37.9119310+08:00;True|2021-05-27T11:28:35.5374674+08:00;True|2021-05-27T08:00:09.1625592+08:00;True|2021-05-26T20:42:17.0852150+08:00;True|2021-05-26T20:36:49.7527415+08:00;True|2021-05-25T17:57:31.8791293+08:00;True|2021-05-25T13:49:29.6488978+08:00;True|2021-05-25T13:48:24.6686105+08:00;True|2021-05-25T13:25:41.2512493+08:00;True|2021-05-24T17:55:33.3800078+08:00;True|2021-05-20T14:35:30.6957985+08:00;True|2021-05-20T13:17:22.6192995+08:00;True|2021-05-20T10:51:38.1268169+08:00;True|2021-05-19T19:50:03.7000224+08:00;True|2021-05-19T19:44:27.2518811+08:00;True|2021-05-19T19:43:26.5916681+08:00;True|2021-05-19T19:36:29.3197365+08:00;True|2021-05-19T19:30:00.3802430+08:00;True|2021-05-19T17:55:23.7939835+08:00;True|2021-05-19T11:05:17.9043392+08:00;True|2021-05-19T10:19:38.4839988+08:00;True|2021-05-19T10:17:19.7430612+08:00;True|2021-05-19T10:13:23.0031721+08:00;True|2021-05-19T10:06:03.9881599+08:00;True|2021-05-18T14:39:03.8876574+08:00;True|2021-05-18T14:23:46.9818836+08:00;True|2021-05-18T14:19:56.2382079+08:00;True|2021-05-18T11:29:53.5497590+08:00;True|2021-05-18T11:16:18.0123853+08:00;True|2021-05-17T18:59:52.4159105+08:00;True|2021-05-17T18:53:37.9438984+08:00;True|2021-05-17T18:48:14.9625161+08:00;True|2021-05-17T17:46:03.7723404+08:00;True|2021-05-17T17:14:20.2312990+08:00;True|2021-05-17T16:44:34.5837616+08:00;True|2021-05-17T16:25:20.1087804+08:00;True|2021-05-17T11:35:27.9388562+08:00; + True|2023-01-09T06:37:17.3219940Z;False|2023-01-09T14:36:37.2025779+08:00;True|2022-09-14T10:54:14.3430113+08:00;True|2022-08-24T10:11:56.9315738+08:00;True|2022-07-28T16:27:26.4646475+08:00;True|2022-07-26T18:02:16.8734313+08:00;True|2022-07-26T17:47:48.4802128+08:00;True|2022-07-26T10:16:29.8933802+08:00;True|2022-07-26T09:36:14.5292489+08:00;True|2022-07-12T17:26:37.8289741+08:00;True|2022-07-07T15:15:35.7942932+08:00;True|2022-07-07T14:38:14.6580938+08:00;True|2022-07-07T14:32:33.3480279+08:00;True|2022-07-06T08:59:01.5108509+08:00;True|2022-06-21T14:41:45.3390865+08:00;False|2022-06-21T14:31:42.6318272+08:00;True|2022-06-21T14:07:42.4016410+08:00;True|2022-06-20T15:37:14.0002383+08:00;True|2022-06-20T08:32:15.3735483+08:00;True|2022-06-18T10:39:25.0997617+08:00;True|2022-06-15T11:23:32.6444305+08:00;True|2022-06-07T10:26:48.8057155+08:00;True|2022-05-19T14:38:58.4564787+08:00;True|2022-05-19T10:00:43.2712891+08:00;True|2022-05-17T18:00:53.2618269+08:00;True|2022-05-17T17:55:33.2053115+08:00;True|2022-05-17T17:38:48.8279756+08:00;True|2022-05-16T16:44:49.1758100+08:00;True|2022-03-30T10:54:32.5565057+08:00;True|2022-03-30T10:53:48.9972377+08:00;True|2022-03-30T10:50:31.5745775+08:00;True|2022-03-30T10:47:50.1605527+08:00;True|2022-03-30T10:15:59.9812921+08:00;True|2022-03-29T09:29:45.1039655+08:00;True|2022-03-29T09:21:47.0149226+08:00;True|2022-03-28T10:33:44.7419612+08:00;True|2022-03-28T10:22:40.9448563+08:00;True|2022-03-28T10:19:15.1438519+08:00;True|2022-01-20T10:39:53.2000547+08:00;True|2021-11-23T17:45:59.0399234+08:00;True|2021-11-23T14:52:52.6108389+08:00;True|2021-11-23T13:47:55.8909321+08:00;True|2021-11-23T13:46:38.7796888+08:00;True|2021-11-23T13:42:14.9551976+08:00;True|2021-11-23T13:40:54.9093258+08:00;True|2021-11-23T13:31:49.0003794+08:00;True|2021-11-23T13:29:43.7414639+08:00;True|2021-10-12T15:18:06.6012215+08:00;True|2021-10-12T15:11:17.7752651+08:00;True|2021-10-12T14:54:39.0578509+08:00;True|2021-10-12T11:25:18.7098128+08:00;True|2021-09-18T15:34:20.7386778+08:00;True|2021-09-15T11:09:28.0068993+08:00;True|2021-09-07T12:19:33.4635211+08:00;True|2021-09-07T11:36:13.4563799+08:00;True|2021-09-03T15:41:46.2819586+08:00;True|2021-08-31T17:16:16.0336390+08:00;True|2021-08-31T16:05:30.7224440+08:00;True|2021-08-23T09:44:46.2114418+08:00;True|2021-08-19T20:32:56.2854974+08:00;True|2021-08-18T14:01:33.0411246+08:00;True|2021-08-17T10:05:15.4299188+08:00;True|2021-08-13T19:32:53.6307075+08:00;True|2021-08-13T19:29:50.5876782+08:00;True|2021-08-13T19:14:14.2545106+08:00;True|2021-08-13T15:24:09.4521125+08:00;True|2021-08-13T14:59:40.4579407+08:00;True|2021-08-13T10:02:29.7650246+08:00;True|2021-08-13T09:45:10.6245894+08:00;True|2021-08-12T20:11:21.5851106+08:00;True|2021-08-12T20:00:42.4820498+08:00;True|2021-08-12T18:44:08.3079650+08:00;True|2021-08-12T18:35:47.4730766+08:00;True|2021-08-12T18:32:10.9361388+08:00;True|2021-08-12T18:30:21.4006961+08:00;True|2021-08-12T18:13:00.9624470+08:00;True|2021-08-12T18:10:12.3459311+08:00;True|2021-08-12T18:09:18.8656414+08:00;True|2021-08-12T17:35:24.7213607+08:00;True|2021-08-11T07:54:57.1322848+08:00;True|2021-08-10T10:16:40.7495389+08:00;True|2021-08-03T11:16:02.7897282+08:00;True|2021-08-02T16:39:27.2332369+08:00;True|2021-08-02T15:07:40.7995318+08:00;True|2021-08-02T14:32:29.6885424+08:00;True|2021-08-02T14:31:18.6578543+08:00;True|2021-08-02T14:27:57.1301002+08:00;True|2021-08-02T10:55:40.3542370+08:00;True|2021-08-02T09:44:28.0994056+08:00;True|2021-08-01T13:49:38.4071985+08:00;True|2021-08-01T13:36:45.5372120+08:00;True|2021-08-01T11:00:19.6165520+08:00;True|2021-08-01T10:38:51.4029710+08:00;True|2021-07-31T20:27:53.6583811+08:00;True|2021-07-31T18:35:23.4214441+08:00;True|2021-07-31T17:34:14.0712243+08:00;True|2021-07-31T14:50:43.2065556+08:00;True|2021-07-30T17:59:30.2223340+08:00;True|2021-07-30T17:57:35.9412910+08:00;True|2021-07-30T17:07:58.3305971+08:00; + \ No newline at end of file diff --git a/Waste.Web.Entry/Waste.Web.Entry.csproj.user b/Waste.Web.Entry/Waste.Web.Entry.csproj.user index f9a02f1..59133b9 100644 --- a/Waste.Web.Entry/Waste.Web.Entry.csproj.user +++ b/Waste.Web.Entry/Waste.Web.Entry.csproj.user @@ -3,6 +3,6 @@ RazorPageScaffolder root/Common/RazorPage - H:\liuzl_ybhdmob\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml + E:\liuzl_ybhdmob\巨天垃圾分类\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml \ No newline at end of file