解决balanceService冲突
This commit is contained in:
@@ -5,6 +5,7 @@ using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
@@ -23,12 +24,14 @@ public class BalanceService : IBalanceService
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly ILogger<BalanceService> _logger;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
|
||||
public BalanceService(IDbContext dbContext, ICurrentUser currentUser, ILogger<BalanceService> logger)
|
||||
public BalanceService(IDbContext dbContext, ICurrentUser currentUser, ILogger<BalanceService> logger ,ITenantApi tenantApi)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
_logger = logger;
|
||||
_tenantApi = tenantApi;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BalanceRecordResponse>> GetPageAsync(BalanceRecordPageRequest request)
|
||||
@@ -72,10 +75,26 @@ public class BalanceService : IBalanceService
|
||||
DepartmentName = department.Name,
|
||||
BusinessPlaceName = bplace.Name,
|
||||
BusinessShiftName = type.Display,
|
||||
CostDateTime = record.CostDateTime
|
||||
CostDateTime = record.CostDateTime,
|
||||
TenantId = record.TenantId,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
try
|
||||
{
|
||||
var tenantResult = await _tenantApi.GetTenantsInternalAsync();
|
||||
var tenants = tenantResult.Data;
|
||||
|
||||
page.Data.ForEach(item =>
|
||||
{
|
||||
item.TenantName = tenants.FirstOrDefault(x => x.Code == item.TenantId)?.Name;
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -563,7 +582,7 @@ public class BalanceService : IBalanceService
|
||||
var offCount = await GetOfflineDevicesCount(devices);
|
||||
|
||||
var places = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Where(x =>x.Status == CanteenBusinessPlaceStatusEnumType.Opened)
|
||||
.Where(x => x.Status == CanteenBusinessPlaceStatusEnumType.Opened)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -826,7 +845,7 @@ public class BalanceService : IBalanceService
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().ToListAsync();
|
||||
|
||||
if (request.UniqueNos!=null && request.UniqueNos.Count > 0)
|
||||
if (request.UniqueNos != null && request.UniqueNos.Count > 0)
|
||||
{
|
||||
foreach (var no in request.UniqueNos)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user