Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -20,7 +20,10 @@ public class DevicesController : ControllerBase
|
||||
private readonly IDeviceConnectService _deviceConnectService;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DevicesController(IDeviceService deviceService, IDeviceTemplateService deviceTemplateService, IDeviceConnectService deviceConnectService, IConfiguration configuration)
|
||||
public DevicesController(IDeviceService deviceService,
|
||||
IDeviceTemplateService deviceTemplateService,
|
||||
IDeviceConnectService deviceConnectService,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
_deviceTemplateService = deviceTemplateService;
|
||||
@@ -56,7 +59,7 @@ public class DevicesController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<DeviceResponse>> GetPageAsync([FromQuery] DevicePageRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetPageAsync([FromQuery] DevicePageRequest request)
|
||||
{
|
||||
return await _deviceService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
80
Src/Dlhis.Basic/Device/Response/DevicePageResponse.cs
Normal file
80
Src/Dlhis.Basic/Device/Response/DevicePageResponse.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DevicePageResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备code
|
||||
/// </summary>
|
||||
public Guid Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备唯一码,IP/MAC/SNO
|
||||
/// </summary>
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 心跳间隔
|
||||
/// </summary>
|
||||
public int HeartbeatInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string Supplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备功能 DeviceFuncEnumType
|
||||
/// </summary>
|
||||
public List<DeviceFuncEnumType> Funcs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FuncsStr.IsEmpty()) FuncsStr = "[]";
|
||||
|
||||
return FuncsStr.ToObject<List<DeviceFuncEnumType>>();
|
||||
}
|
||||
}
|
||||
|
||||
public string FuncsStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署点
|
||||
/// </summary>
|
||||
public string DeployPlace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署坐标
|
||||
/// </summary>
|
||||
public string DeployPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署方向
|
||||
/// </summary>
|
||||
public string DeployDirection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public Guid TemplateCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接信息
|
||||
/// </summary>
|
||||
public string ConnectionInfo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
public interface IDeviceService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request);
|
||||
Task<Pagination<DevicePageResponse>> GetPageAsync(DevicePageRequest request);
|
||||
|
||||
Task SaveAsync(DeviceSaveRequest request);
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
device = new DeviceEntity()
|
||||
{
|
||||
Code = Guid.NewGuid(),
|
||||
Brand = string.Empty,
|
||||
ConnectionInfo = string.Empty,
|
||||
TemplateCode = null,
|
||||
UniqueNo = uniqueNo,
|
||||
|
||||
@@ -24,10 +24,10 @@ public class DeviceService : IDeviceService
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetPageAsync(DevicePageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Select(device => new DeviceResponse
|
||||
.Select(device => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = device.Funcs.ToString()
|
||||
|
||||
@@ -48,7 +48,6 @@ public class DeviceService : IDeviceService
|
||||
{
|
||||
var entity = request.Adapt<DeviceEntity>();
|
||||
entity.Code = Guid.NewGuid();
|
||||
entity.Brand = template.Brand;
|
||||
await _dbContext.InsertAsync(entity);
|
||||
//同时保存注册信息
|
||||
var registry = await _dbContext.Queryable<DeviceRegistryEntity>().Where(x => x.DeviceUniqueNo == request.UniqueNo).FirstAsync();
|
||||
@@ -72,7 +71,6 @@ public class DeviceService : IDeviceService
|
||||
entity.ThrowIfNull("设备不存在,无法更新");
|
||||
|
||||
request.Adapt(entity);
|
||||
entity.Brand = template.Brand;
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
@@ -29,12 +29,6 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
[SugarColumn(ColumnDescription = "心跳检查间隔")]
|
||||
public int HeartbeatInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "品牌")]
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
@@ -56,7 +50,7 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 部署坐标
|
||||
/// </summary>
|
||||
[SugarColumn(IsJson = true, ColumnDescription = "部署坐标")]
|
||||
[SugarColumn(ColumnDescription = "部署坐标")]
|
||||
public string DeployPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -61,7 +61,7 @@ public class UserEntity
|
||||
/// <summary>
|
||||
/// 手机号确认
|
||||
/// </summary>
|
||||
public string PhoneNumberConfirmed { get; set; }
|
||||
public bool PhoneNumberConfirmed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 双重验证启用
|
||||
|
||||
@@ -24,7 +24,7 @@ public class JobPack : BaseAppPack
|
||||
});
|
||||
|
||||
|
||||
RecurringJob.AddOrUpdate<CreateGetAttendanceJob>("CreateGetAttendance", s => s.RunAsync(), "0 0/5 * * * ?", new RecurringJobOptions
|
||||
RecurringJob.AddOrUpdate<CreateGetAttendanceJob>("CreateGetAttendance", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AssignmentService : IAssignmentService
|
||||
deviceTask.Type,
|
||||
deviceTask.DeviceUniqueNo,
|
||||
DeviceConnectionInfo = deivce.ConnectionInfo,
|
||||
deivce.Brand,
|
||||
deivceTamplate.Brand,
|
||||
FuncStr = deivce.Funcs.ToString(),
|
||||
deviceTask.UserNo,
|
||||
deviceTask.UserCode,
|
||||
|
||||
@@ -16,7 +16,7 @@ public class UserResponse
|
||||
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public string PhoneNumberConfirmed { get; set; }
|
||||
public bool PhoneNumberConfirmed { get; set; }
|
||||
|
||||
public bool TwoFactorEnabled { get; set; }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class UserResponse
|
||||
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public string PhoneNumberConfirmed { get; set; }
|
||||
public bool PhoneNumberConfirmed { get; set; }
|
||||
|
||||
public bool TwoFactorEnabled { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user