fix 查询取消异常抛出
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -42,7 +40,7 @@ public class GainfoPermissionsController : ControllerBase
|
||||
/// <param name="deviceGroupCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("devicesUnderGroupByUserNo")]
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, string deviceGroupCode)
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode)
|
||||
{
|
||||
return await _gainfoPermissions.GetDevicesUnderGroupByUserNoAsync(userNo, deviceGroupCode);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
@@ -11,7 +10,7 @@ public interface IGainfoPermissions : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BusinessPlaceResponse>> GetPlaceByGainfoAsync(DeviceAssRequest request);
|
||||
|
||||
Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, string deviceGroupCode);
|
||||
Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode);
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request);
|
||||
}
|
||||
|
||||
@@ -8,12 +8,9 @@ using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
@@ -48,8 +45,8 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
return await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceRegistryEntity>((x, dr) => x.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((x, dr, place) => dr.BusinessPlaceCode == place.Code)
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((x,dr,place, ps) => x.Code == ps.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((x, dr, place, ps,s) => s.Code == ps.ShiftCode)
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((x, dr, place, ps) => x.Code == ps.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((x, dr, place, ps, s) => s.Code == ps.ShiftCode)
|
||||
.Where(x => x.Type == DeviceTypeEnumType.Meal)
|
||||
.Where(x => deviceCodes.Contains(x.Code))
|
||||
.Where((x, dr) => !string.IsNullOrEmpty(dr.BusinessPlaceCustomCode))
|
||||
@@ -70,11 +67,14 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, string deviceGroupCode)
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode)
|
||||
{
|
||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().ToListAsync();
|
||||
var currentGroup = deviceGroups.Where(x => x.Code.ToString() == deviceGroupCode).FirstOrDefault();
|
||||
currentGroup.ThrowIfNull($"{deviceGroupCode}在设备组中不存在");
|
||||
var currentGroup = deviceGroups.Where(x => x.Code == deviceGroupCode).FirstOrDefault();
|
||||
if (currentGroup == null)
|
||||
{
|
||||
return new List<GetDevicesUnderGroupByUserNoResponse>();
|
||||
}
|
||||
|
||||
var groups = RecursionGetNext(currentGroup, deviceGroups).ToList();
|
||||
|
||||
@@ -96,21 +96,21 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.Where(d => nos.Contains(d.UniqueNo))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime,
|
||||
UniqueNo = d.UniqueNo,
|
||||
Supplier = d.Supplier,
|
||||
DeployPlace = d.DeployPlace,
|
||||
DeployPosition = d.DeployPosition,
|
||||
DeployDirection = d.DeployDirection,
|
||||
TemplateCode = dt.Code,
|
||||
ConnectionInfo = d.ConnectionInfo,
|
||||
Enable = d.Enable,
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime,
|
||||
UniqueNo = d.UniqueNo,
|
||||
Supplier = d.Supplier,
|
||||
DeployPlace = d.DeployPlace,
|
||||
DeployPosition = d.DeployPosition,
|
||||
DeployDirection = d.DeployDirection,
|
||||
TemplateCode = dt.Code,
|
||||
ConnectionInfo = d.ConnectionInfo,
|
||||
Enable = d.Enable,
|
||||
})
|
||||
.ToListAsync();
|
||||
var deviceUniqueNos = page.Select(x => x.UniqueNo).ToList();
|
||||
@@ -146,9 +146,9 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
return lst;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request)
|
||||
{
|
||||
var ids = await _devicePermissionService.GetAssignDeviceCodesAsync(request.UserNo);
|
||||
var ids = await _devicePermissionService.GetAssignDeviceCodesAsync(request.UserNo);
|
||||
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
|
||||
Reference in New Issue
Block a user