fix 设备组重组
This commit is contained in:
@@ -24,7 +24,7 @@ public class CreateDefinitelyGroupJob : BaseJob
|
||||
_tenantApi = tenantApi;
|
||||
}
|
||||
|
||||
private static readonly string _remark = "系统自动生成";
|
||||
private const string _remark = "系统自动生成";
|
||||
|
||||
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
@@ -45,16 +45,15 @@ public class CreateDefinitelyGroupJob : BaseJob
|
||||
//*****************************************************门禁设备组********************************************************/
|
||||
|
||||
await CreateDeviceGroupAsync(DeviceTypeEnumType.Door, new List<string> { "*共用区域", "*非共用区域" }, tenants);
|
||||
|
||||
}
|
||||
|
||||
private async Task CreateGainfoGroupsAsync(List<TenantResponse> tenants)
|
||||
{
|
||||
var grps = new List<string> { "*自定义人员分组", "*督查组", "*X3及以上领导组" };
|
||||
var searchGrps = await DbContext.Queryable<GainfoGroupEntity>().Where(x => grps.Contains(x.Name)).ToListAsync();
|
||||
foreach (var grp in grps)
|
||||
var groups = new List<string> { "*自定义人员分组", "*督查组", "*X3及以上领导组" };
|
||||
var searchGroups = await DbContext.Queryable<GainfoGroupEntity>().Where(x => groups.Contains(x.Name)).ToListAsync();
|
||||
foreach (var grp in groups)
|
||||
{
|
||||
if (!searchGrps.Any(x => x.Name == grp))
|
||||
if (searchGroups.All(x => x.Name != grp))
|
||||
{
|
||||
await DbContext.InsertAsync(new GainfoGroupEntity
|
||||
{
|
||||
@@ -122,7 +121,7 @@ public class CreateDefinitelyGroupJob : BaseJob
|
||||
CreateTime = DateTime.Now,
|
||||
ModifiedBy = 1,
|
||||
ModifiedTime = DateTime.Now,
|
||||
TenantId = null,
|
||||
TenantId = workplace.Code,
|
||||
};
|
||||
await DbContext.InsertAsync(workplaceGrp);
|
||||
}
|
||||
@@ -153,4 +152,4 @@ public class CreateDefinitelyGroupJob : BaseJob
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user