feat 余额明细

This commit is contained in:
2024-11-06 14:52:54 +08:00
parent 57eebb4924
commit 2cb146dd93
2 changed files with 42 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
using Dlhis.Entity.Canteen.Entities; using Dlhis.Entity.Canteen.Entities;
using Dlhis.Entity.Canteen.Enums;
using Dlhis.External.OpenApi.Response; using Dlhis.External.OpenApi.Response;
using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@@ -27,6 +29,7 @@ public class CanteenController : ControllerBase
/// <param name="dateTimePeriods"></param> /// <param name="dateTimePeriods"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("eMealVoucher/records")] [HttpGet("eMealVoucher/records")]
[IgnoreTenant]
public async Task<List<EMealVoucherRecordResponse>> GetEMealVoucherRecordsAsync(string factory, [FromQuery] DateTimePeriod dateTimePeriods) public async Task<List<EMealVoucherRecordResponse>> GetEMealVoucherRecordsAsync(string factory, [FromQuery] DateTimePeriod dateTimePeriods)
{ {
return await _dbContext.Queryable<EMealVoucherEntity>() return await _dbContext.Queryable<EMealVoucherEntity>()
@@ -50,4 +53,27 @@ public class CanteenController : ControllerBase
}) })
.ToListAsync(); .ToListAsync();
} }
/// <summary>
/// 余额明细
/// </summary>
/// <param name="factory"></param>
/// <param name="time"></param>
/// <returns></returns>
[HttpGet("balance/records")]
[IgnoreTenant]
public async Task<List<BalanceRecordResponse>> GetBalanceRecordsAsync(string factory, DateTime time)
{
return await _dbContext.Queryable<BalanceRecordEntity>()
.Where(x => x.CostDateTime == time && x.TenantId == factory && x.Status == BalanceRecordStatusEnumType.Valid)
.Select(x => new BalanceRecordResponse
{
UserCode = x.UserCode,
CostDateTime = x.CostDateTime,
Amount = x.Amount,
Type = x.Type,
Remark = x.Remark
})
.ToListAsync();
}
} }

View File

@@ -0,0 +1,16 @@
using Dlhis.Entity.Canteen.Enums;
namespace Dlhis.External.OpenApi.Response;
public class BalanceRecordResponse
{
public string UserCode { get; set; }
public DateTime CostDateTime { get; set; }
public decimal Amount { get; set; }
public BalanceRecordTypeEnumType Type { get; set; }
public string Remark { get; set; }
}