千灯镇批量修改
This commit is contained in:
parent
0ff57d952d
commit
a50b3d7dff
|
|
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备列表
|
||||
/// </summary>
|
||||
|
|
@ -31,6 +29,7 @@ namespace Waste.Application
|
|||
{
|
||||
return await _deviceService.GetListAsync(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 信息提交
|
||||
/// </summary>
|
||||
|
|
@ -40,6 +39,7 @@ namespace Waste.Application
|
|||
{
|
||||
return await _deviceService.SubmitFormAsync(role);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量操作
|
||||
/// </summary>
|
||||
|
|
@ -49,6 +49,7 @@ namespace Waste.Application
|
|||
{
|
||||
return await _deviceService.BatchSetAsync(deviceBatchModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态修改
|
||||
/// </summary>
|
||||
|
|
@ -61,6 +62,7 @@ namespace Waste.Application
|
|||
{
|
||||
return await _deviceService.SetStatusAsync(id, status);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置设备推送信息
|
||||
/// </summary>
|
||||
|
|
@ -70,5 +72,15 @@ namespace Waste.Application
|
|||
{
|
||||
return await _deviceService.SetConfigAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量配置千灯镇商户推送
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task SetQDConfig()
|
||||
{
|
||||
await _deviceService.SetQDConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备批量操作
|
||||
/// </summary>
|
||||
|
|
@ -46,7 +43,6 @@ namespace Waste.Application.Device
|
|||
//如果是管理员分配
|
||||
if (currentUser.AccountType == (int)AccountType.platform)
|
||||
{
|
||||
|
||||
await dbClient.Updateable<W_Device>().SetColumns(x => new W_Device
|
||||
{
|
||||
Businessid = deviceBatchModel.BusinessId,
|
||||
|
|
@ -121,6 +117,7 @@ namespace Waste.Application.Device
|
|||
Id = devicedata.Id
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备详情数据
|
||||
/// </summary>
|
||||
|
|
@ -149,6 +146,7 @@ namespace Waste.Application.Device
|
|||
FacEcode = device.FacEcode
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备配置详情
|
||||
/// </summary>
|
||||
|
|
@ -156,10 +154,10 @@ namespace Waste.Application.Device
|
|||
/// <returns></returns>
|
||||
public async Task<W_DeviceConfig> GetConfigAsync(Guid id)
|
||||
{
|
||||
var data= await dbClient.Queryable<W_DeviceConfig>().FirstAsync(x => x.DeviceId == id);
|
||||
if(data == null)
|
||||
var data = await dbClient.Queryable<W_DeviceConfig>().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
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置设备推送信息
|
||||
/// </summary>
|
||||
|
|
@ -307,6 +306,44 @@ namespace Waste.Application.Device
|
|||
return new ResultInfo(ResultState.SUCCESS, "配置成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量配置千灯镇商户推送
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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<W_Device>().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<W_DeviceConfig>().AnyAsync(x => x.DeviceId == item.Id))
|
||||
{
|
||||
await dbClient.Updateable<W_DeviceConfig>().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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态修改
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageParms<DeviceList>> GetListAsync(QueryParams param);
|
||||
|
||||
/// <summary>
|
||||
/// 设备信息提交
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultInfo> SubmitFormAsync(DeviceSubmit role);
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<DeviceSubmit> DetailAsync(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// 设备批量操作
|
||||
/// </summary>
|
||||
/// <param name="deviceBatchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultInfo> BatchSetAsync(DeviceBatchModel deviceBatchModel);
|
||||
|
||||
/// <summary>
|
||||
/// 设备详情数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<DeviceDetailS2Dto> DeviceDetailAsync(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态修改
|
||||
/// </summary>
|
||||
/// <param name="id">设备ID</param>
|
||||
/// <param name="status">设备状态,0-停用,1-正常,2-激活</param>
|
||||
/// <returns></returns>
|
||||
Task<ResultInfo> SetStatusAsync(Guid id,int status);
|
||||
Task<ResultInfo> SetStatusAsync(Guid id, int status);
|
||||
|
||||
/// <summary>
|
||||
/// 配置设备推送信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultInfo> SetConfigAsync(DeviceConfigC2SDto input);
|
||||
|
||||
/// <summary>
|
||||
/// 批量配置千灯镇商户推送
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SetQDConfig();
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备配置详情
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -589,6 +589,12 @@
|
|||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.DeviceAppService.SetQDConfig">
|
||||
<summary>
|
||||
批量配置千灯镇商户推送
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.Device.DeviceService">
|
||||
<summary>
|
||||
设备管理
|
||||
|
|
@ -636,6 +642,12 @@
|
|||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.Device.DeviceService.SetQDConfig">
|
||||
<summary>
|
||||
批量配置千灯镇商户推送
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.Device.DeviceService.SetStatusAsync(System.Guid,System.Int32)">
|
||||
<summary>
|
||||
设备状态修改
|
||||
|
|
@ -868,6 +880,12 @@
|
|||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.IDeviceService.SetQDConfig">
|
||||
<summary>
|
||||
批量配置千灯镇商户推送
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.IDeviceService.GetConfigAsync(System.Guid)">
|
||||
<summary>
|
||||
获取设备配置详情
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<key id="80becbe4-b8da-478f-8e04-2ee72229ce40" version="1">
|
||||
<creationDate>2023-06-26T04:03:32.1101352Z</creationDate>
|
||||
<activationDate>2023-06-26T04:03:32.0644029Z</activationDate>
|
||||
<expirationDate>2023-09-24T04:03:32.0644029Z</expirationDate>
|
||||
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
|
||||
<descriptor>
|
||||
<encryption algorithm="AES_256_CBC" />
|
||||
<validation algorithm="HMACSHA256" />
|
||||
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
|
||||
<!-- Warning: the key below is in an unencrypted form. -->
|
||||
<value>ANfcQR1Xd4K1vIjHAszafBN+8YUKKjIPVRAtivcWhALy3lpclGIiHHZo0Ya4u2hcIV+3+1yfaeqrBBnIxtzQ6A==</value>
|
||||
</masterKey>
|
||||
</descriptor>
|
||||
</descriptor>
|
||||
</key>
|
||||
Loading…
Reference in New Issue