fix 数据处理接口
This commit is contained in:
@@ -60,7 +60,8 @@ public class SyncController : ControllerBase
|
||||
[IgnoreTenant]
|
||||
public async Task GetBusinessTripsAsync(CodeRequest request)
|
||||
{
|
||||
await _sapBusinessTripService.HandlerBusinessTripsByFactoryAsync(request.Code);
|
||||
await _sapBusinessTripService.HandleDirtyDataAsync(request.Code);
|
||||
//await _sapBusinessTripService.HandlerBusinessTripsByFactoryAsync(request.Code);
|
||||
}
|
||||
|
||||
[HttpGet("/api/sync/test")]
|
||||
|
||||
@@ -3,4 +3,6 @@ namespace Dlhis.Basic.Organization.Services;
|
||||
public interface ISapBusinessTripService : IScopeDependency
|
||||
{
|
||||
Task HandlerBusinessTripsByFactoryAsync(string factory);
|
||||
|
||||
Task HandleDirtyDataAsync(string factory);
|
||||
}
|
||||
@@ -144,8 +144,6 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
_logger.LogError(e, "出差自动下发任务失败:{message}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
await HandleDirtyDataAsync(factory, tripGroup, deviceCodes);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -207,8 +205,11 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
private async Task HandleDirtyDataAsync(string factory, DeviceGroupEntity tripGroup, List<Guid> deviceCodes)
|
||||
public async Task HandleDirtyDataAsync(string factory)
|
||||
{
|
||||
var tripGroup = await GetTripGroupAsync(factory);
|
||||
var deviceCodes = await GetTripGroupUnderDeviceCodesAsync(tripGroup.Code);
|
||||
|
||||
//确保是真实脏数据
|
||||
var yesterday = DateTime.Now.Date.AddDays(-2);
|
||||
try
|
||||
@@ -231,11 +232,20 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentGainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
var currentGainfo = await _dbContext.Queryable<GainfoLeaveEntity>()
|
||||
.Where(x => x.Code == item.Code)
|
||||
.Select(x => new { x.No, x.Code })
|
||||
.SingleAsync();
|
||||
|
||||
if (currentGainfo == null)
|
||||
{
|
||||
continue;
|
||||
// currentGainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
// .Where(x => x.Code == item.Code)
|
||||
// .Select(x => new { x.No, x.Code })
|
||||
// .SingleAsync();
|
||||
}
|
||||
|
||||
await _dbContext.Updateable<DevicePermissionEntity>()
|
||||
.SetColumns(x => x.IsDeleted == true)
|
||||
.Where(x => x.AssignType == AssignTypeEnumType.User)
|
||||
@@ -251,7 +261,6 @@ public class SapBusinessTripService : ISapBusinessTripService
|
||||
.Where(x => x.Id == item.Id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
|
||||
await _gainfoPermissionService.ResetPermissionsAsync(currentGainfo.No, DeviceTaskEnumType.Delete, deviceCodes, "出差遗留脏数据删除");
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user