fix 修复已知问题
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -24,18 +19,15 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IDeviceTemplateService _deviceTemplateService;
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IDeviceConnectService _deviceConnectService;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DevicesController(IDeviceService deviceService,
|
||||
IDeviceTemplateService deviceTemplateService,
|
||||
IDbContext dbContext,
|
||||
IDeviceConnectService deviceConnectService, IConfiguration configuration)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
_deviceTemplateService = deviceTemplateService;
|
||||
_dbContext = dbContext;
|
||||
_deviceConnectService = deviceConnectService;
|
||||
_configuration = configuration;
|
||||
}
|
||||
@@ -170,70 +162,4 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
await _deviceService.ImportAsync(request);
|
||||
}
|
||||
|
||||
[HttpPost("test")]
|
||||
[IgnoreTenant]
|
||||
[AllowAnonymous]
|
||||
public async Task<int> Test()
|
||||
{
|
||||
var tasks = new List<DeviceTaskEntity>();
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.TenantId == "2401").Where(x => x.Type == DeviceTypeEnumType.Meal).ToListAsync();
|
||||
|
||||
var gainfos = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.Type == GainfoUserTypeEnumType.External || x.Type == GainfoUserTypeEnumType.Outsource)
|
||||
.Where(x => x.Factory == "2401")
|
||||
.ToListAsync();
|
||||
|
||||
var gainfoLeaves = await _dbContext.Queryable<GainfoLeaveEntity>()
|
||||
.Where(x => x.Type == GainfoUserTypeEnumType.External || x.Type == GainfoUserTypeEnumType.Outsource)
|
||||
.Where(x => x.Factory == "2401")
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var device in devices)
|
||||
{
|
||||
foreach (var gainfo in gainfos)
|
||||
{
|
||||
tasks.Add(new DeviceTaskEntity
|
||||
{
|
||||
Type = DeviceTaskEnumType.Delete,
|
||||
DeviceType = DeviceTypeEnumType.Meal,
|
||||
UserId = gainfo.Id,
|
||||
UserNo = gainfo.No,
|
||||
DeviceUniqueNo = device.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
ResultMessage = null,
|
||||
Source = "主动删除2401异常餐饮人员",
|
||||
Priority = 0,
|
||||
TenantId = device.TenantId
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var gainfo in gainfoLeaves)
|
||||
{
|
||||
tasks.Add(new DeviceTaskEntity
|
||||
{
|
||||
Type = DeviceTaskEnumType.Delete,
|
||||
DeviceType = DeviceTypeEnumType.Meal,
|
||||
UserId = gainfo.IdentityUserId,
|
||||
UserNo = gainfo.No,
|
||||
DeviceUniqueNo = device.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
ResultMessage = null,
|
||||
Source = "主动删除2401异常餐饮人员",
|
||||
Priority = 0,
|
||||
TenantId = device.TenantId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var items in tasks.Chunk(1000))
|
||||
{
|
||||
await _dbContext.InsertAsync(items);
|
||||
}
|
||||
|
||||
return tasks.Count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user