diff --git a/Sln.Iot.Business/DevControlBusiness.cs b/Sln.Iot.Business/DevControlBusiness.cs index 30b4701..4d53029 100644 --- a/Sln.Iot.Business/DevControlBusiness.cs +++ b/Sln.Iot.Business/DevControlBusiness.cs @@ -60,7 +60,7 @@ namespace Sln.Iot.Business /// /// [EnableCors("cors")] - [WebApi(HttpMethodType.POST)] + [WebApi(HttpMethodType.GET)] public ApiResInfo Unlock(string idStr,string password) { BufferRequestInfo bufferRequestInfo = new BufferRequestInfo(); @@ -95,7 +95,7 @@ namespace Sln.Iot.Business /// /// [EnableCors("cors")] - [WebApi(HttpMethodType.POST)] + [WebApi(HttpMethodType.GET)] public ApiResInfo LockUp(string idStr,string password) { BufferRequestInfo bufferRequestInfo = new BufferRequestInfo(); diff --git a/Sln.Iot.Business/RfidBusiness.cs b/Sln.Iot.Business/RfidBusiness.cs new file mode 100644 index 0000000..cbc0691 --- /dev/null +++ b/Sln.Iot.Business/RfidBusiness.cs @@ -0,0 +1,85 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2025 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Iot.Business +* 唯一标识:CF6CB45C-6484-468E-9853-31ADA6821183 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2025-05-27 11:14:04 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using System; +using Sln.Iot.Business.@base; +using Sln.Iot.Common; +using Sln.Iot.Config; +using Sln.Iot.Serilog; +using Sln.Iot.Socket.Adapter; +using TouchSocket.Core; +using TouchSocket.Sockets; + +namespace Sln.Iot.Business +{ + public class RfidBusiness:BaseBusiness + { + public RfidBusiness(SerilogHelper logger, AppConfig appConfig, StringChange stringChange) : base(logger, appConfig, stringChange) + { + } + + public override FilterResult BufferAnalysis(ISocketClient client, BufferRequestInfo requestInfo, int bodyLength) + { + ByteBlock byteBlock = new ByteBlock(requestInfo.Body); + + if (byteBlock.CanReadLen < 1) + { + return FilterResult.Cache; + } + int pos = byteBlock.Pos; + + try + { + var amount = requestInfo.BufferLength / bodyLength; + + _logger.Info($"收到{amount}个RFID数据,开始循环解析......"); + + for (int i = 0; i < amount; i++) + { + byte[] ids = new byte[3]; + Array.Copy(requestInfo.buffer, 1, ids, 0, ids.Length); + string idsStr = _stringChange.bytesToHexStr(ids,ids.Length); + + var status = _stringChange.bytesToHexStr(requestInfo.Body, requestInfo.Body.Length); + + _logger.Info($"设备编号:{idsStr};RFID:{status}"); + } + + return FilterResult.Success; + } + catch (Exception e) + { + base._logger.Error($"RFID数据解析异常:{e.Message}"); + } + + return FilterResult.Cache; + } + + public override void ResponseHandle(ISocketClient client, BufferRequestInfo requestInfo) + { + //throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Sln.Iot.Business/StatusBusiness.cs b/Sln.Iot.Business/StatusBusiness.cs new file mode 100644 index 0000000..d2330a4 --- /dev/null +++ b/Sln.Iot.Business/StatusBusiness.cs @@ -0,0 +1,103 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2025 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Iot.Business +* 唯一标识:A937102D-813C-4FB6-8ECE-BC01749B020F +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2025-05-27 10:57:06 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using System; +using System.Collections.Generic; +using Sln.Iot.Business.@base; +using Sln.Iot.Common; +using Sln.Iot.Config; +using Sln.Iot.Model.dao; +using Sln.Iot.Repository.service; +using Sln.Iot.Serilog; +using Sln.Iot.Socket.Adapter; +using TouchSocket.Core; +using TouchSocket.Sockets; + +namespace Sln.Iot.Business +{ + public class StatusBusiness:BaseBusiness + { + private readonly IDeviceRecordService _deviceRecordService; + public StatusBusiness(SerilogHelper logger, AppConfig appConfig, StringChange stringChange, IDeviceRecordService deviceRecordService) : base(logger, appConfig, stringChange) + { + _deviceRecordService = deviceRecordService; + } + + public override FilterResult BufferAnalysis(ISocketClient client, BufferRequestInfo requestInfo, int bodyLength) + { + ByteBlock byteBlock = new ByteBlock(requestInfo.Body); + + if (byteBlock.CanReadLen < 1) + { + return FilterResult.Cache; + } + int pos = byteBlock.Pos; + + try + { + var amount = requestInfo.BufferLength / bodyLength; + + _logger.Info($"收到{amount}个物联锁具状态,开始循环解析......"); + + for (int i = 0; i < amount; i++) + { + byte[] ids = new byte[3]; + Array.Copy(requestInfo.buffer, 1, ids, 0, ids.Length); + string idsStr = _stringChange.bytesToHexStr(ids,ids.Length); + + + var status = _stringChange.bytesToHexStr(requestInfo.Body, requestInfo.Body.Length); + + _logger.Info($"设备编号:{idsStr};状态:{status}"); + + if (status == "00") + { + //更新锁具信息 + DeviceRecord deviceRecord = new DeviceRecord() + { + deviceCode = idsStr, + closeTime = DateTime.Now, + useState = '0' + }; + var res = _deviceRecordService.UpdateCloseTime(deviceRecord,out List resIds); + } + } + + return FilterResult.Success; + } + catch (Exception e) + { + base._logger.Error($"物联网锁具状态解析异常:{e.Message}"); + } + + return FilterResult.Cache; + } + + public override void ResponseHandle(ISocketClient client, BufferRequestInfo requestInfo) + { + //throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.dll b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.dll index 5c14188..da308e7 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.dll and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.dll differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.pdb b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.pdb index 3d07534..2812110 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.pdb and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Business.pdb differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.dll b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.dll index 3d2e909..4ed424b 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.dll and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.dll differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb index bac0fdb..aff94b9 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll index be60876..7f424bd 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb index 857b619..007c2c0 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll index a6f4312..7fc0d27 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll differ diff --git a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb index 6ea3648..0e408fc 100644 Binary files a/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb and b/Sln.Iot.Business/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb differ diff --git a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.AssemblyReference.cache b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.AssemblyReference.cache index fd9c7d2..84b161e 100644 Binary files a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.AssemblyReference.cache and b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.AssemblyReference.cache differ diff --git a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.CoreCompileInputs.cache b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.CoreCompileInputs.cache index 57c153f..aae455e 100644 --- a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.CoreCompileInputs.cache +++ b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -aeff8618efbc09ca6762690d721ce79cb58971fc +968ac897ee046c2748b0f7b8bdf8e9f908c9423a diff --git a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.dll b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.dll index 5c14188..da308e7 100644 Binary files a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.dll and b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.dll differ diff --git a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.pdb b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.pdb index 3d07534..2812110 100644 Binary files a/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.pdb and b/Sln.Iot.Business/obj/Debug/netstandard2.1/Sln.Iot.Business.pdb differ diff --git a/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.dll b/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.dll index 3d2e909..4ed424b 100644 Binary files a/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.dll and b/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.dll differ diff --git a/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb b/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb index bac0fdb..aff94b9 100644 Binary files a/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb and b/Sln.Iot.Model/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb differ diff --git a/Sln.Iot.Model/dao/DeviceRecord.cs b/Sln.Iot.Model/dao/DeviceRecord.cs new file mode 100644 index 0000000..44cf0a6 --- /dev/null +++ b/Sln.Iot.Model/dao/DeviceRecord.cs @@ -0,0 +1,70 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2025 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Iot.Model.dao +* 唯一标识:0840C4D2-F080-4B20-AB87-CC968CD18BAC +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2025-05-27 11:28:05 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using System; +using SqlSugar; + +namespace Sln.Iot.Model.dao +{ + [SugarTable("device_record_use"), TenantAttribute("iot")] + public class DeviceRecord + { + /// + /// 编号 ,IsIdentity = true + /// + [SugarColumn(ColumnName="obj_id" ,IsPrimaryKey = true )] + public long objid { get; set; } + + /// + /// 设备编码 + /// + [SugarColumn(ColumnName="device_code" )] + public string deviceCode { get; set; } + + /// + /// 开锁时间 + /// + [SugarColumn(ColumnName="open_time" )] + public DateTime openTime { get; set; } + + /// + /// 关锁时间 + /// + [SugarColumn(ColumnName="close_time" )] + public DateTime closeTime { get; set; } + + /// + /// 使用时间 + /// + [SugarColumn(ColumnName="use_time" )] + public decimal useTime { get; set; } + + /// + /// 使用状态 + /// + [SugarColumn(ColumnName="use_state" )] + public char useState{get;set;} + } +} \ No newline at end of file diff --git a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.csproj.CoreCompileInputs.cache b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.csproj.CoreCompileInputs.cache index f0db173..3ef9573 100644 --- a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.csproj.CoreCompileInputs.cache +++ b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -e0d4ce9551bcb776d90e1f41c3b7f0bb972e7184 +a3b2a551f0af1bc0fe51e6e6d221d8e6b1d4e4b0 diff --git a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.dll b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.dll index 3d2e909..4ed424b 100644 Binary files a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.dll and b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.dll differ diff --git a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.pdb b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.pdb index bac0fdb..aff94b9 100644 Binary files a/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.pdb and b/Sln.Iot.Model/obj/Debug/netstandard2.1/Sln.Iot.Model.pdb differ diff --git a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.dll b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.dll index 3d2e909..4ed424b 100644 Binary files a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.dll and b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.dll differ diff --git a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb index bac0fdb..aff94b9 100644 Binary files a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb and b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Model.pdb differ diff --git a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll index be60876..7f424bd 100644 Binary files a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll and b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.dll differ diff --git a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb index 857b619..007c2c0 100644 Binary files a/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb and b/Sln.Iot.Repository/bin/Debug/netstandard2.1/Sln.Iot.Repository.pdb differ diff --git a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.AssemblyReference.cache b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.AssemblyReference.cache index a98cad8..64e4e9d 100644 Binary files a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.AssemblyReference.cache and b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.AssemblyReference.cache differ diff --git a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.CoreCompileInputs.cache b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.CoreCompileInputs.cache index 826418d..c1fbc01 100644 --- a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.CoreCompileInputs.cache +++ b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -ea2626c3e079c404cdc49d7821099424990bbe2c +1c4ccaf144c2819dd96d15f6185e36b4696b9541 diff --git a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.dll b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.dll index be60876..7f424bd 100644 Binary files a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.dll and b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.dll differ diff --git a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.pdb b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.pdb index 857b619..007c2c0 100644 Binary files a/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.pdb and b/Sln.Iot.Repository/obj/Debug/netstandard2.1/Sln.Iot.Repository.pdb differ diff --git a/Sln.Iot.Repository/service/IDeviceRecordService.cs b/Sln.Iot.Repository/service/IDeviceRecordService.cs new file mode 100644 index 0000000..f3454b7 --- /dev/null +++ b/Sln.Iot.Repository/service/IDeviceRecordService.cs @@ -0,0 +1,37 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2025 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Iot.Repository.service +* 唯一标识:4D26DFC3-EE8E-4335-983C-A5E1327C99A3 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2025-05-27 14:05:40 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using System.Collections.Generic; +using Sln.Iot.Model.dao; +using Sln.Iot.Repository.service.@base; + +namespace Sln.Iot.Repository.service +{ + public interface IDeviceRecordService:IBaseService + { + + bool UpdateCloseTime(DeviceRecord deviceRecord,out List resIds); + } +} \ No newline at end of file diff --git a/Sln.Iot.Repository/service/Impl/DeviceRecordServiceImpl.cs b/Sln.Iot.Repository/service/Impl/DeviceRecordServiceImpl.cs new file mode 100644 index 0000000..d99ff5c --- /dev/null +++ b/Sln.Iot.Repository/service/Impl/DeviceRecordServiceImpl.cs @@ -0,0 +1,63 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2025 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Iot.Repository.service.Impl +* 唯一标识:83CD1830-F4B4-49D3-A5A6-A5932F8AD185 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2025-05-27 14:06:04 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Sln.Iot.Model.dao; +using Sln.Iot.Repository.service.@base; + +namespace Sln.Iot.Repository.service.Impl +{ + public class DeviceRecordServiceImpl: BaseServiceImpl, IDeviceRecordService + { + public DeviceRecordServiceImpl(Repository rep) : base(rep) + { + } + + public bool UpdateCloseTime(DeviceRecord deviceRecord, out List resIds) + { + resIds = new List(); + + var info = _rep.GetList(x=> x.deviceCode == deviceRecord.deviceCode && x.useState == '1').FirstOrDefault(); + if (info != null) + { + resIds.Add(info.objid); + info.closeTime = deviceRecord.closeTime; + info.useState = deviceRecord.useState; + info.useTime = CalculateHoursDifference(info.openTime, deviceRecord.closeTime); + _rep.Update(info); + } + return false; + } + + private decimal CalculateHoursDifference(DateTime startTime, DateTime endTime) + { + TimeSpan duration = endTime - startTime; + return Convert.ToDecimal(duration.TotalHours); + } + } +} \ No newline at end of file diff --git a/Sln.Iot.Socket/Adapter/CustomDataHandlingAdapter.cs b/Sln.Iot.Socket/Adapter/CustomDataHandlingAdapter.cs index ffbbfbf..4767638 100644 --- a/Sln.Iot.Socket/Adapter/CustomDataHandlingAdapter.cs +++ b/Sln.Iot.Socket/Adapter/CustomDataHandlingAdapter.cs @@ -138,6 +138,10 @@ namespace Sln.Iot.Socket.Adapter { switch (dataType) { + + case 0x32: + length = 1; + break; case 0x33: length = 4; break; @@ -153,6 +157,9 @@ namespace Sln.Iot.Socket.Adapter case 0x37: length = 5; break; + case 0x39: + length = 8; + break; default: length = 1; break; diff --git a/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll b/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll index a6f4312..7fc0d27 100644 Binary files a/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll and b/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.dll differ diff --git a/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb b/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb index 6ea3648..0e408fc 100644 Binary files a/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb and b/Sln.Iot.Socket/bin/Debug/netstandard2.1/Sln.Iot.Socket.pdb differ diff --git a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.csproj.AssemblyReference.cache b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.csproj.AssemblyReference.cache index e62a001..9a8e885 100644 Binary files a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.csproj.AssemblyReference.cache and b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.csproj.AssemblyReference.cache differ diff --git a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.dll b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.dll index a6f4312..7fc0d27 100644 Binary files a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.dll and b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.dll differ diff --git a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.pdb b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.pdb index 6ea3648..0e408fc 100644 Binary files a/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.pdb and b/Sln.Iot.Socket/obj/Debug/netstandard2.1/Sln.Iot.Socket.pdb differ diff --git a/Sln.Iot/Program.cs b/Sln.Iot/Program.cs index dc6123b..1b9b4ef 100644 --- a/Sln.Iot/Program.cs +++ b/Sln.Iot/Program.cs @@ -43,6 +43,10 @@ class Program case 0x08: _business = ServiceProvider.GetService(); break; + case 0x32: + bodyLength = 1; + _business = ServiceProvider.GetService(); + break; case 0x33: //登录指令 _business = ServiceProvider.GetService(); break; @@ -53,6 +57,10 @@ class Program bodyLength = info.BufferLength; _business = ServiceProvider.GetService(); break; + case 0x39: + bodyLength = 8; + _business = ServiceProvider.GetService(); + break; default: break; } diff --git a/Sln.Iot/appsettings.json b/Sln.Iot/appsettings.json index 061e148..14dac26 100644 --- a/Sln.Iot/appsettings.json +++ b/Sln.Iot/appsettings.json @@ -6,11 +6,11 @@ "virtualValue": 99999, "SqlConfig": [ { - "configId": "tao_iot", //tao:青岛胶东机场简称 + "configId": "iot", //tao:青岛胶东机场简称 "dbType": 0, //tidb按照 mysql 去连接 "isFlag": true, //"connStr": "server=127.0.0.1;Port=4000;Database=tao_iot;Uid=root;" //Pwd=haiwei@123; - "connStr": "server=1.13.177.47;Port=3306;Database=tao_iot;Uid=root;Pwd=haiwei@123;" + "connStr": "server=119.45.202.115;Port=3306;Database=no_power_control;Uid=root;Pwd=haiwei@123;" } ] } diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.dll b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.dll index 5c14188..da308e7 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.dll and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.dll differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.pdb b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.pdb index 3d07534..2812110 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.pdb and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Business.pdb differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.dll b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.dll index 3d2e909..4ed424b 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.dll and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.dll differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.pdb b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.pdb index bac0fdb..aff94b9 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.pdb and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Model.pdb differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.dll b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.dll index be60876..7f424bd 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.dll and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.dll differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.pdb b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.pdb index 857b619..007c2c0 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.pdb and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Repository.pdb differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.dll b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.dll index a6f4312..7fc0d27 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.dll and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.dll differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.pdb b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.pdb index 6ea3648..0e408fc 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.pdb and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.Socket.pdb differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.dll b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.dll index 9fad5e4..489a3d4 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.dll and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.dll differ diff --git a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.pdb b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.pdb index 3e3c913..a7bd869 100644 Binary files a/Sln.Iot/bin/Debug/net6.0/Sln.Iot.pdb and b/Sln.Iot/bin/Debug/net6.0/Sln.Iot.pdb differ diff --git a/Sln.Iot/bin/Debug/net6.0/appsettings.json b/Sln.Iot/bin/Debug/net6.0/appsettings.json index 061e148..14dac26 100644 --- a/Sln.Iot/bin/Debug/net6.0/appsettings.json +++ b/Sln.Iot/bin/Debug/net6.0/appsettings.json @@ -6,11 +6,11 @@ "virtualValue": 99999, "SqlConfig": [ { - "configId": "tao_iot", //tao:青岛胶东机场简称 + "configId": "iot", //tao:青岛胶东机场简称 "dbType": 0, //tidb按照 mysql 去连接 "isFlag": true, //"connStr": "server=127.0.0.1;Port=4000;Database=tao_iot;Uid=root;" //Pwd=haiwei@123; - "connStr": "server=1.13.177.47;Port=3306;Database=tao_iot;Uid=root;Pwd=haiwei@123;" + "connStr": "server=119.45.202.115;Port=3306;Database=no_power_control;Uid=root;Pwd=haiwei@123;" } ] } diff --git a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.csproj.AssemblyReference.cache b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.csproj.AssemblyReference.cache index fb6f7a5..2d1ed55 100644 Binary files a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.csproj.AssemblyReference.cache and b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.csproj.AssemblyReference.cache differ diff --git a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.dll b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.dll index 9fad5e4..489a3d4 100644 Binary files a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.dll and b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.dll differ diff --git a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.pdb b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.pdb index 3e3c913..a7bd869 100644 Binary files a/Sln.Iot/obj/Debug/net6.0/Sln.Iot.pdb and b/Sln.Iot/obj/Debug/net6.0/Sln.Iot.pdb differ