fix 修改为分配设备
This commit is contained in:
@@ -17,12 +17,11 @@ public class AppointmentAreaAssignmentEntity : SugarBaseEntity, ITenantId
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组code
|
||||
/// 设备code
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "分组code")]
|
||||
public Guid GroupCode { get; set; }
|
||||
//UniqueGroupNameList = new[] { "idx_aaa_cc_grpc_tid" }
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "设备code")]
|
||||
public Guid DeviceCode { get; set; }
|
||||
|
||||
[SugarColumn()]
|
||||
[SugarColumn]
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ApponintmentAreasController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分配设备组
|
||||
/// 分配设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("assign")]
|
||||
|
||||
@@ -10,9 +10,8 @@ public class AppointmentAreaAssignRequest
|
||||
[Required]
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分组
|
||||
/// </summary>
|
||||
public List<Guid> GroupCodes { get; set; }
|
||||
public List<Guid> DeviceCodes { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Basic.Api;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Entity;
|
||||
@@ -20,13 +19,11 @@ namespace Dlhis.Visitor.Appointment.Services.Implements;
|
||||
public class AppointmentService : IAppointmentService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IDeviceGroupApi _deviceGroupApi;
|
||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
|
||||
public AppointmentService(IDbContext dbContext, IDeviceGroupApi deviceGroupApi, IDataProtectionProvider dataProtectionProvider)
|
||||
public AppointmentService(IDbContext dbContext, IDataProtectionProvider dataProtectionProvider)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_deviceGroupApi = deviceGroupApi;
|
||||
_dataProtectionProvider = dataProtectionProvider;
|
||||
}
|
||||
|
||||
@@ -136,23 +133,22 @@ public class AppointmentService : IAppointmentService
|
||||
detail.ThrowIfNull("预约信息不存在");
|
||||
|
||||
var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).FirstAsync();
|
||||
var deviceGroup = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
var deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == mst.AreaCustomCode)
|
||||
.Select(x => x.GroupCode)
|
||||
.FirstAsync();
|
||||
.Select(x => x.DeviceCode)
|
||||
.ToListAsync();
|
||||
|
||||
var deviceCodesResult = await _deviceGroupApi.GetDevicesByCodeAsync(deviceGroup);
|
||||
var deviceCodes = deviceCodesResult.Data;
|
||||
var deviceUniqueNos = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).Select(x => x.UniqueNo).ToListAsync();
|
||||
|
||||
var userNo = detail.IsExternal
|
||||
? await _dbContext.Queryable<GainfoExternalEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync()
|
||||
: await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync();
|
||||
|
||||
await _dbContext.InsertAsync(deviceCodes.Select(x => new DeviceTaskEntity
|
||||
await _dbContext.InsertAsync(deviceUniqueNos.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
CancellationId = 0,
|
||||
DeviceType = DeviceTypeEnumType.Door,
|
||||
DeviceUniqueNo = x.UniqueNo,
|
||||
DeviceUniqueNo = x,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
UserNo = userNo,
|
||||
Type = DeviceTaskEnumType.Add,
|
||||
|
||||
@@ -63,10 +63,10 @@ public class ApponintmentAreaService : IApponintmentAreaService
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
var data = request.GroupCodes.Select(x => new AppointmentAreaAssignmentEntity
|
||||
var data = request.DeviceCodes.Select(x => new AppointmentAreaAssignmentEntity
|
||||
{
|
||||
CustomCode = request.CustomCode,
|
||||
GroupCode = x,
|
||||
DeviceCode = x,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.Visitor/Dlhis.Visitor.csproj", "Src/Dlhis.Visitor/"]
|
||||
COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
RUN dotnet restore "./Src/Dlhis.Visitor/./Dlhis.Visitor.csproj"
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user