diff --git a/Waste.Application/Device/DeviceAppService.cs b/Waste.Application/Device/DeviceAppService.cs index 20ae37a..6a44632 100644 --- a/Waste.Application/Device/DeviceAppService.cs +++ b/Waste.Application/Device/DeviceAppService.cs @@ -1,13 +1,9 @@ using Furion.DynamicApiController; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Nirvana.Common; -using SqlSugar; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Waste.Domain; namespace Waste.Application { @@ -17,10 +13,12 @@ namespace Waste.Application public class DeviceAppService : IDynamicApiController { private readonly IDeviceService _deviceService; + public DeviceAppService(IDeviceService deviceService) { _deviceService = deviceService; } + /// /// 设备列表 /// @@ -31,6 +29,7 @@ namespace Waste.Application { return await _deviceService.GetListAsync(param); } + /// /// 信息提交 /// @@ -40,6 +39,7 @@ namespace Waste.Application { return await _deviceService.SubmitFormAsync(role); } + /// /// 批量操作 /// @@ -49,6 +49,7 @@ namespace Waste.Application { return await _deviceService.BatchSetAsync(deviceBatchModel); } + /// /// 设备状态修改 /// @@ -61,6 +62,7 @@ namespace Waste.Application { return await _deviceService.SetStatusAsync(id, status); } + /// /// 配置设备推送信息 /// @@ -70,5 +72,15 @@ namespace Waste.Application { return await _deviceService.SetConfigAsync(input); } + + /// + /// 批量配置千灯镇商户推送 + /// + /// + [AllowAnonymous] + public async Task SetQDConfig() + { + await _deviceService.SetQDConfig(); + } } -} +} \ No newline at end of file diff --git a/Waste.Application/Device/DeviceService.cs b/Waste.Application/Device/DeviceService.cs index f6dad4d..b43be3a 100644 --- a/Waste.Application/Device/DeviceService.cs +++ b/Waste.Application/Device/DeviceService.cs @@ -1,15 +1,11 @@ using Furion.DependencyInjection; using Furion.DistributedIDGenerator; -using Furion.DynamicApiController; using Mapster; -using Microsoft.AspNetCore.Mvc; using Nirvana.Common; -using Nirvana.Common.ApiBase; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using Waste.Domain; @@ -30,6 +26,7 @@ namespace Waste.Application.Device dbClient = repository.Context; _businessService = businessService; } + /// /// 设备批量操作 /// @@ -46,7 +43,6 @@ namespace Waste.Application.Device //如果是管理员分配 if (currentUser.AccountType == (int)AccountType.platform) { - await dbClient.Updateable().SetColumns(x => new W_Device { Businessid = deviceBatchModel.BusinessId, @@ -121,6 +117,7 @@ namespace Waste.Application.Device Id = devicedata.Id }; } + /// /// 设备详情数据 /// @@ -149,6 +146,7 @@ namespace Waste.Application.Device FacEcode = device.FacEcode }; } + /// /// 获取设备配置详情 /// @@ -156,10 +154,10 @@ namespace Waste.Application.Device /// public async Task GetConfigAsync(Guid id) { - var data= await dbClient.Queryable().FirstAsync(x => x.DeviceId == id); - if(data == null) + var data = await dbClient.Queryable().FirstAsync(x => x.DeviceId == id); + if (data == null) { - data= new W_DeviceConfig(); + data = new W_DeviceConfig(); } return data; } @@ -276,6 +274,7 @@ namespace Waste.Application.Device limit = param.limit }; } + /// /// 配置设备推送信息 /// @@ -307,6 +306,44 @@ namespace Waste.Application.Device return new ResultInfo(ResultState.SUCCESS, "配置成功"); } + /// + /// 批量配置千灯镇商户推送 + /// + /// + public async Task SetQDConfig() + { + string Body = string.Empty; + string Url = "http://36.154.126.138:8817/api/third/postdata"; + var bid = Guid.Parse("08D99B4B-B02D-4E65-8D56-2FD16EC1716F"); + var alldevice = await dbClient.Queryable().Where(x => x.Businessid == bid).Select(x => new W_Device + { + Id = x.Id, + FacEcode=x.FacEcode + }).ToListAsync(); + foreach (var item in alldevice) + { + if (await dbClient.Queryable().AnyAsync(x => x.DeviceId == item.Id)) + { + await dbClient.Updateable().SetColumns(x => new W_DeviceConfig + { + Url = Url, + Body = Body + }).Where(x => x.DeviceId == item.Id).ExecuteCommandAsync(); + } + else + { + var insertdata = new W_DeviceConfig + { + DeviceId = item.Id, + Body = Body, + CreateTime = DateTime.Now, + Url = Url + }; + await dbClient.Insertable(insertdata).ExecuteCommandAsync(); + } + } + } + /// /// 设备状态修改 /// @@ -449,4 +486,4 @@ namespace Waste.Application.Device } } } -} +} \ No newline at end of file diff --git a/Waste.Application/Device/IDeviceService.cs b/Waste.Application/Device/IDeviceService.cs index 7a30171..ced4353 100644 --- a/Waste.Application/Device/IDeviceService.cs +++ b/Waste.Application/Device/IDeviceService.cs @@ -1,9 +1,5 @@ using Nirvana.Common; -using Nirvana.Common.ApiBase; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Waste.Domain; @@ -20,43 +16,56 @@ namespace Waste.Application /// /// Task> GetListAsync(QueryParams param); + /// /// 设备信息提交 /// /// /// Task SubmitFormAsync(DeviceSubmit role); + /// /// 详情 /// /// /// Task DetailAsync(Guid id); + /// /// 设备批量操作 /// /// /// Task BatchSetAsync(DeviceBatchModel deviceBatchModel); + /// /// 设备详情数据 /// /// /// Task DeviceDetailAsync(Guid id); + /// /// 设备状态修改 /// /// 设备ID /// 设备状态,0-停用,1-正常,2-激活 /// - Task SetStatusAsync(Guid id,int status); + Task SetStatusAsync(Guid id, int status); + /// /// 配置设备推送信息 /// /// /// Task SetConfigAsync(DeviceConfigC2SDto input); + + /// + /// 批量配置千灯镇商户推送 + /// + /// + Task SetQDConfig(); + /// /// 获取设备配置详情 /// @@ -64,4 +73,4 @@ namespace Waste.Application /// Task GetConfigAsync(Guid id); } -} +} \ No newline at end of file diff --git a/Waste.Application/Waste.Application.xml b/Waste.Application/Waste.Application.xml index d7c3c67..28d2ba2 100644 --- a/Waste.Application/Waste.Application.xml +++ b/Waste.Application/Waste.Application.xml @@ -589,6 +589,12 @@ + + + 批量配置千灯镇商户推送 + + + 设备管理 @@ -636,6 +642,12 @@ + + + 批量配置千灯镇商户推送 + + + 设备状态修改 @@ -868,6 +880,12 @@ + + + 批量配置千灯镇商户推送 + + + 获取设备配置详情 diff --git a/Waste.Web.Entry/DataProtection/key-80becbe4-b8da-478f-8e04-2ee72229ce40.xml b/Waste.Web.Entry/DataProtection/key-80becbe4-b8da-478f-8e04-2ee72229ce40.xml new file mode 100644 index 0000000..2690c0a --- /dev/null +++ b/Waste.Web.Entry/DataProtection/key-80becbe4-b8da-478f-8e04-2ee72229ce40.xml @@ -0,0 +1,16 @@ + + + 2023-06-26T04:03:32.1101352Z + 2023-06-26T04:03:32.0644029Z + 2023-09-24T04:03:32.0644029Z + + + + + + + ANfcQR1Xd4K1vIjHAszafBN+8YUKKjIPVRAtivcWhALy3lpclGIiHHZo0Ya4u2hcIV+3+1yfaeqrBBnIxtzQ6A== + + + + \ No newline at end of file