Merge branch 'master' of http://git.ybhdmob.com:3000/liuzl/Waste
This commit is contained in:
commit
2e9c154cce
|
|
@ -1,13 +1,9 @@
|
||||||
using Furion.DynamicApiController;
|
using Furion.DynamicApiController;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using SqlSugar;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Waste.Domain;
|
|
||||||
|
|
||||||
namespace Waste.Application
|
namespace Waste.Application
|
||||||
{
|
{
|
||||||
|
|
@ -17,10 +13,12 @@ namespace Waste.Application
|
||||||
public class DeviceAppService : IDynamicApiController
|
public class DeviceAppService : IDynamicApiController
|
||||||
{
|
{
|
||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
|
|
||||||
public DeviceAppService(IDeviceService deviceService)
|
public DeviceAppService(IDeviceService deviceService)
|
||||||
{
|
{
|
||||||
_deviceService = deviceService;
|
_deviceService = deviceService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备列表
|
/// 设备列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -31,6 +29,7 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
return await _deviceService.GetListAsync(param);
|
return await _deviceService.GetListAsync(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 信息提交
|
/// 信息提交
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -40,6 +39,7 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
return await _deviceService.SubmitFormAsync(role);
|
return await _deviceService.SubmitFormAsync(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批量操作
|
/// 批量操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -49,6 +49,7 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
return await _deviceService.BatchSetAsync(deviceBatchModel);
|
return await _deviceService.BatchSetAsync(deviceBatchModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备状态修改
|
/// 设备状态修改
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -61,6 +62,7 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
return await _deviceService.SetStatusAsync(id, status);
|
return await _deviceService.SetStatusAsync(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置设备推送信息
|
/// 配置设备推送信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -70,5 +72,15 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
return await _deviceService.SetConfigAsync(input);
|
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.DependencyInjection;
|
||||||
using Furion.DistributedIDGenerator;
|
using Furion.DistributedIDGenerator;
|
||||||
using Furion.DynamicApiController;
|
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using Nirvana.Common.ApiBase;
|
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Waste.Domain;
|
using Waste.Domain;
|
||||||
|
|
||||||
|
|
@ -30,6 +26,7 @@ namespace Waste.Application.Device
|
||||||
dbClient = repository.Context;
|
dbClient = repository.Context;
|
||||||
_businessService = businessService;
|
_businessService = businessService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备批量操作
|
/// 设备批量操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -46,7 +43,6 @@ namespace Waste.Application.Device
|
||||||
//如果是管理员分配
|
//如果是管理员分配
|
||||||
if (currentUser.AccountType == (int)AccountType.platform)
|
if (currentUser.AccountType == (int)AccountType.platform)
|
||||||
{
|
{
|
||||||
|
|
||||||
await dbClient.Updateable<W_Device>().SetColumns(x => new W_Device
|
await dbClient.Updateable<W_Device>().SetColumns(x => new W_Device
|
||||||
{
|
{
|
||||||
Businessid = deviceBatchModel.BusinessId,
|
Businessid = deviceBatchModel.BusinessId,
|
||||||
|
|
@ -121,6 +117,7 @@ namespace Waste.Application.Device
|
||||||
Id = devicedata.Id
|
Id = devicedata.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备详情数据
|
/// 设备详情数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -149,6 +146,7 @@ namespace Waste.Application.Device
|
||||||
FacEcode = device.FacEcode
|
FacEcode = device.FacEcode
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取设备配置详情
|
/// 获取设备配置详情
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -276,6 +274,7 @@ namespace Waste.Application.Device
|
||||||
limit = param.limit
|
limit = param.limit
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置设备推送信息
|
/// 配置设备推送信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -307,6 +306,44 @@ namespace Waste.Application.Device
|
||||||
return new ResultInfo(ResultState.SUCCESS, "配置成功");
|
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>
|
||||||
/// 设备状态修改
|
/// 设备状态修改
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using Nirvana.Common.ApiBase;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Waste.Domain;
|
using Waste.Domain;
|
||||||
|
|
||||||
|
|
@ -20,30 +16,35 @@ namespace Waste.Application
|
||||||
/// <param name="param"></param>
|
/// <param name="param"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PageParms<DeviceList>> GetListAsync(QueryParams param);
|
Task<PageParms<DeviceList>> GetListAsync(QueryParams param);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备信息提交
|
/// 设备信息提交
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="role"></param>
|
/// <param name="role"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ResultInfo> SubmitFormAsync(DeviceSubmit role);
|
Task<ResultInfo> SubmitFormAsync(DeviceSubmit role);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 详情
|
/// 详情
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DeviceSubmit> DetailAsync(Guid id);
|
Task<DeviceSubmit> DetailAsync(Guid id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备批量操作
|
/// 设备批量操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceBatchModel"></param>
|
/// <param name="deviceBatchModel"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ResultInfo> BatchSetAsync(DeviceBatchModel deviceBatchModel);
|
Task<ResultInfo> BatchSetAsync(DeviceBatchModel deviceBatchModel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备详情数据
|
/// 设备详情数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DeviceDetailS2Dto> DeviceDetailAsync(Guid id);
|
Task<DeviceDetailS2Dto> DeviceDetailAsync(Guid id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备状态修改
|
/// 设备状态修改
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -51,12 +52,20 @@ namespace Waste.Application
|
||||||
/// <param name="status">设备状态,0-停用,1-正常,2-激活</param>
|
/// <param name="status">设备状态,0-停用,1-正常,2-激活</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ResultInfo> SetStatusAsync(Guid id, int status);
|
Task<ResultInfo> SetStatusAsync(Guid id, int status);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置设备推送信息
|
/// 配置设备推送信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ResultInfo> SetConfigAsync(DeviceConfigC2SDto input);
|
Task<ResultInfo> SetConfigAsync(DeviceConfigC2SDto input);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量配置千灯镇商户推送
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SetQDConfig();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取设备配置详情
|
/// 获取设备配置详情
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -266,7 +263,13 @@ namespace Waste.Application
|
||||||
Time = time,
|
Time = time,
|
||||||
TrashCode = data.trashcode,
|
TrashCode = data.trashcode,
|
||||||
WasteType = data.WasteType,
|
WasteType = data.WasteType,
|
||||||
Weight = currentweight
|
Weight = currentweight,
|
||||||
|
faccode = device.FacEcode,
|
||||||
|
ecode = device.Ecode,
|
||||||
|
province = device.Province,
|
||||||
|
city = device.City,
|
||||||
|
area = device.Area,
|
||||||
|
address = device.Address
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +344,13 @@ namespace Waste.Application
|
||||||
Time = time,
|
Time = time,
|
||||||
TrashCode = myPackage.trashcode,
|
TrashCode = myPackage.trashcode,
|
||||||
WasteType = myPackage.WasteType,
|
WasteType = myPackage.WasteType,
|
||||||
Weight = Weight
|
Weight = Weight,
|
||||||
|
faccode = device.FacEcode,
|
||||||
|
ecode = device.Ecode,
|
||||||
|
province = device.Province,
|
||||||
|
city = device.City,
|
||||||
|
area = device.Area,
|
||||||
|
address = device.Address
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,7 +448,13 @@ namespace Waste.Application
|
||||||
TrashCode = myPackage.trashcode,
|
TrashCode = myPackage.trashcode,
|
||||||
WasteType = myPackage.WasteType,
|
WasteType = myPackage.WasteType,
|
||||||
Weight = Weight,
|
Weight = Weight,
|
||||||
WasteSType = wastestype
|
WasteSType = wastestype,
|
||||||
|
faccode = device.FacEcode,
|
||||||
|
ecode = device.Ecode,
|
||||||
|
province = device.Province,
|
||||||
|
city = device.City,
|
||||||
|
area = device.Area,
|
||||||
|
address = device.Address
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +464,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)
|
||||||
{
|
{
|
||||||
|
|
@ -580,7 +595,13 @@ namespace Waste.Application
|
||||||
Time = time,
|
Time = time,
|
||||||
TrashCode = myPackage.Area,
|
TrashCode = myPackage.Area,
|
||||||
WasteType = myPackage.WasteType,
|
WasteType = myPackage.WasteType,
|
||||||
Weight = weight
|
Weight = weight,
|
||||||
|
faccode = device.FacEcode,
|
||||||
|
ecode = device.Ecode,
|
||||||
|
province = device.Province,
|
||||||
|
city = device.City,
|
||||||
|
area = device.Area,
|
||||||
|
address = device.Address
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return new ResultInfo(ResultState.SUCCESS, "success");
|
return new ResultInfo(ResultState.SUCCESS, "success");
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Waste.Application.SubscribeInfo
|
namespace Waste.Application.SubscribeInfo
|
||||||
{
|
{
|
||||||
|
|
@ -132,6 +128,36 @@ namespace Waste.Application.SubscribeInfo
|
||||||
/// 上报时间
|
/// 上报时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Time { get; set; }
|
public DateTime Time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备机器码
|
||||||
|
/// </summary>
|
||||||
|
public string ecode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备编号
|
||||||
|
/// </summary>
|
||||||
|
public string faccode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属省份
|
||||||
|
/// </summary>
|
||||||
|
public string province { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属城市
|
||||||
|
/// </summary>
|
||||||
|
public string city { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属区/县
|
||||||
|
/// </summary>
|
||||||
|
public string area { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备详细地址
|
||||||
|
/// </summary>
|
||||||
|
public string address { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -184,5 +210,40 @@ namespace Waste.Application.SubscribeInfo
|
||||||
/// 设备ID
|
/// 设备ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid DeviceId { get; set; }
|
public Guid DeviceId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备机器码
|
||||||
|
/// </summary>
|
||||||
|
public string ecode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备编号
|
||||||
|
/// </summary>
|
||||||
|
public string faccode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属省份
|
||||||
|
/// </summary>
|
||||||
|
public string province { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属城市
|
||||||
|
/// </summary>
|
||||||
|
public string city { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备所属区/县
|
||||||
|
/// </summary>
|
||||||
|
public string area { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备详细地址
|
||||||
|
/// </summary>
|
||||||
|
public string address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最近心跳时间
|
||||||
|
/// </summary>
|
||||||
|
public long BeatTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -269,6 +265,11 @@ namespace Waste.Application.SubscribeInfo
|
||||||
{
|
{
|
||||||
string errmsg = string.Empty;
|
string errmsg = string.Empty;
|
||||||
var senddata = data.Adapt<SendMessageToThirdS2CDto>();
|
var senddata = data.Adapt<SendMessageToThirdS2CDto>();
|
||||||
|
var devicedata = await dbClient.Queryable<W_DeviceData>().Where(x => x.DeviceId == data.DeviceId).Select(x => new W_DeviceData
|
||||||
|
{
|
||||||
|
LastBeatTime = x.LastBeatTime
|
||||||
|
}).FirstAsync();
|
||||||
|
senddata.BeatTime = devicedata == null ? 0 : devicedata.LastBeatTime.GetTimeStamp();
|
||||||
var response = await data.Url
|
var response = await data.Url
|
||||||
.SetBody(senddata, "application/json", Encoding.UTF8)
|
.SetBody(senddata, "application/json", Encoding.UTF8)
|
||||||
.OnException((res, errors) =>
|
.OnException((res, errors) =>
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,23 @@ 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(),
|
||||||
|
faccode = device.FacEcode,
|
||||||
|
ecode = device.Ecode,
|
||||||
|
province = device.Province,
|
||||||
|
city = device.City,
|
||||||
|
area = device.Area,
|
||||||
|
address = device.Address
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -238,38 +255,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 +362,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 +448,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>
|
||||||
|
|
|
||||||
|
|
@ -589,6 +589,12 @@
|
||||||
<param name="input"></param>
|
<param name="input"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.DeviceAppService.SetQDConfig">
|
||||||
|
<summary>
|
||||||
|
批量配置千灯镇商户推送
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.Device.DeviceService">
|
<member name="T:Waste.Application.Device.DeviceService">
|
||||||
<summary>
|
<summary>
|
||||||
设备管理
|
设备管理
|
||||||
|
|
@ -636,6 +642,12 @@
|
||||||
<param name="input"></param>
|
<param name="input"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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)">
|
<member name="M:Waste.Application.Device.DeviceService.SetStatusAsync(System.Guid,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
设备状态修改
|
设备状态修改
|
||||||
|
|
@ -868,6 +880,12 @@
|
||||||
<param name="input"></param>
|
<param name="input"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.IDeviceService.SetQDConfig">
|
||||||
|
<summary>
|
||||||
|
批量配置千灯镇商户推送
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.IDeviceService.GetConfigAsync(System.Guid)">
|
<member name="M:Waste.Application.IDeviceService.GetConfigAsync(System.Guid)">
|
||||||
<summary>
|
<summary>
|
||||||
获取设备配置详情
|
获取设备配置详情
|
||||||
|
|
@ -2106,6 +2124,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 +3355,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 +3376,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 +3390,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数据解析
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<key id="c2bee2c8-4c80-40e0-802c-5f5a51ff95d1" version="1">
|
||||||
|
<creationDate>2023-11-06T09:29:17.0142323Z</creationDate>
|
||||||
|
<activationDate>2023-11-06T09:29:16.9516438Z</activationDate>
|
||||||
|
<expirationDate>2024-02-04T09:29:16.9516438Z</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>ObJzvr6B6Rz5ZFItThMbbfbTiGATKLJiwa31wlJkcgXomsyU+LEYb2Z5oFipInn7ufXzRnjJbUCj71yk+9PYUA==</value>
|
||||||
|
</masterKey>
|
||||||
|
</descriptor>
|
||||||
|
</descriptor>
|
||||||
|
</key>
|
||||||
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