fix 集团数据返回所有类型
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Dlhis.Entity.Canteen.Enums;
|
||||||
using Kurisu.AspNetCore.CustomClass;
|
using Kurisu.AspNetCore.CustomClass;
|
||||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||||
|
|
||||||
@@ -18,6 +19,13 @@ public class BalanceRecordUserGroupPageRequest : PageDto, IValidatableObject
|
|||||||
public string UserCode { get; set; }
|
public string UserCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消费类型
|
||||||
|
/// </summary>
|
||||||
|
[EnumDataType(typeof(BalanceRecordTypeEnumType))]
|
||||||
|
public BalanceRecordTypeEnumType? Type { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||||
{
|
{
|
||||||
if (SearchDateTimePeriod is { End: not null })
|
if (SearchDateTimePeriod is { End: not null })
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ public class BalanceService : IBalanceService
|
|||||||
|
|
||||||
|
|
||||||
var amount = await queryable.SumAsync(record => SqlFunc.Abs(record.Amount));
|
var amount = await queryable.SumAsync(record => SqlFunc.Abs(record.Amount));
|
||||||
var total = await queryable.GroupBy(record => record.UserNo).Select(record => record.UserNo).CountAsync();
|
var total = await queryable.Select(record => record.UserCode).Distinct().CountAsync();
|
||||||
|
|
||||||
return new BalanceRecordByBusinessPlaceResponse
|
return new BalanceRecordByBusinessPlaceResponse
|
||||||
{
|
{
|
||||||
@@ -388,8 +388,8 @@ public class BalanceService : IBalanceService
|
|||||||
.LeftJoin<DepartmentEntity>((record, ga, department) => ga.DepartmentNo == department.No)
|
.LeftJoin<DepartmentEntity>((record, ga, department) => ga.DepartmentNo == department.No)
|
||||||
.LeftJoin<BusinessPlaceEntity>((record, ga, department, bPlace) => record.BusinessPlaceCode == bPlace.Code)
|
.LeftJoin<BusinessPlaceEntity>((record, ga, department, bPlace) => record.BusinessPlaceCode == bPlace.Code)
|
||||||
.Where((record, ga) => record.UserCode == request.UserCode)
|
.Where((record, ga) => record.UserCode == request.UserCode)
|
||||||
.Where(record => record.Status == BalanceRecordStatusEnumType.Valid && record.Type == BalanceRecordTypeEnumType.Out)
|
.Where(record => record.Status == BalanceRecordStatusEnumType.Valid && record.Source != BalanceRecordSourceEnumType.EMealVoucher) //不展示电子餐券信息
|
||||||
.Where(record => record.Source != BalanceRecordSourceEnumType.EMealVoucher) //不展示电子餐券信息
|
.WhereIF(request.Type.HasValue, record => record.Type == request.Type)
|
||||||
.WhereIF(request.SearchDateTimePeriod.HasValue(), record => record.CostDate >= request.SearchDateTimePeriod.Start && record.CostDate <= request.SearchDateTimePeriod.End)
|
.WhereIF(request.SearchDateTimePeriod.HasValue(), record => record.CostDate >= request.SearchDateTimePeriod.Start && record.CostDate <= request.SearchDateTimePeriod.End)
|
||||||
.OrderBy(record => record.CostDateTime)
|
.OrderBy(record => record.CostDateTime)
|
||||||
.Select((record, ga, department, bPlace) => new BalanceRecordUserPageResponse
|
.Select((record, ga, department, bPlace) => new BalanceRecordUserPageResponse
|
||||||
@@ -555,7 +555,7 @@ public class BalanceService : IBalanceService
|
|||||||
{
|
{
|
||||||
await CommonHelper.RetryAsync(async () =>
|
await CommonHelper.RetryAsync(async () =>
|
||||||
{
|
{
|
||||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == userCode).SingleAsync()
|
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == userCode).SingleAsync()
|
||||||
?? await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.Code == userCode).SingleAsync();
|
?? await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.Code == userCode).SingleAsync();
|
||||||
|
|
||||||
gainfo.ThrowIfNull("档案不存在");
|
gainfo.ThrowIfNull("档案不存在");
|
||||||
|
|||||||
Reference in New Issue
Block a user