fix 手动添加isDeleted
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
@@ -9,12 +8,9 @@ namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IGainfoPermissionService : IScopeDependency
|
||||
{
|
||||
Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode);
|
||||
|
||||
Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request);
|
||||
|
||||
Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssUserCodeRequest request);
|
||||
|
||||
|
||||
Task<DevicePermissionAssignResponse> ResetPermissionsAsync(string userNo, DeviceTaskEnumType type, List<Guid> deviceCodes, string source);
|
||||
}
|
||||
@@ -24,58 +24,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
_devicePermissionAnalyzeService = devicePermissionAnalyzeService;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode)
|
||||
{
|
||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().ToListAsync();
|
||||
var currentGroup = deviceGroups.FirstOrDefault(x => x.Code == deviceGroupCode);
|
||||
if (currentGroup == null)
|
||||
{
|
||||
return new List<GetDevicesUnderGroupByUserNoResponse>();
|
||||
}
|
||||
|
||||
var groups = RecursionHelper.HandlerDeviceGroupNextCodes(currentGroup.Code, deviceGroups);
|
||||
|
||||
return groups.Select(groupCode =>
|
||||
{
|
||||
var nos = _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.LeftJoin<DeviceEntity>((x, d) => x.DeviceCode == d.Code)
|
||||
.Where(x => groupCode == x.GroupCode)
|
||||
.Select((x, d) => d.UniqueNo)
|
||||
.ToList();
|
||||
|
||||
var page = _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.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,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new GetDevicesUnderGroupByUserNoResponse
|
||||
{
|
||||
GroupCode = groupCode,
|
||||
Devices = page
|
||||
};
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssUserCodeRequest request)
|
||||
|
||||
@@ -82,7 +82,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task TodoByCodeAsync(string code)
|
||||
{
|
||||
_logger.LogInformation("SAP根据学工号同步开始:{code}", code);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
/// <inheritdoc />
|
||||
public async Task HandlerBusinessTripsByFactoryAsync(string factory)
|
||||
{
|
||||
var today =DateTime.Today;
|
||||
var today = DateTime.Today;
|
||||
var yesterday = today.AddDays(-1);
|
||||
|
||||
try
|
||||
@@ -84,7 +84,15 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
|
||||
if (deviceCodes.Any())
|
||||
{
|
||||
var userCodes = tripInfos.Select(x => x.Code).Distinct().ToList();
|
||||
//排除当前记录存例外的人员
|
||||
var manuallyUserCodes = await _dbContext.Queryable<DevicePermissionManuallyEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.Where(x => x.TenantId == factory)
|
||||
.Select((x, ga) => ga.Code)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
||||
var userCodes = tripInfos.Select(x => x.Code).Distinct().Where(x => !manuallyUserCodes.Contains(x)).ToList();
|
||||
var gainfos = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.Factory != factory) //排除本基地出差
|
||||
.Where(x => userCodes.Contains(x.Code))
|
||||
|
||||
Reference in New Issue
Block a user