From 3a47580441460254f9177932a67fd109e67028af Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 13 Nov 2024 16:11:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=B0=B1=E9=A4=90=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=A0=B9=E6=8D=AE=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E8=AE=B0=E5=BD=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/GainfoMealService.cs | 4 ++-- .../Order/Services/Implements/MiddleService.cs | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoMealService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoMealService.cs index f9a354e7..a121c671 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoMealService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoMealService.cs @@ -28,12 +28,12 @@ public class GainfoMealService : IGainfoMealService public async Task> GetPageAsync(GainfoMealPageRequest request) { var factory = _currentUser.GetStringTenantId(); - var factories = await GetWalletFactoriesAsync(_currentUser.GetStringTenantId()); + var factories = await GetWalletFactoriesAsync(factory); return await _dbContext.Queryable().AS(request.IsLeave ? "GainfoLeave" : "Gainfo") .LeftJoin((x, dept) => dept.No == x.DepartmentNo) .WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search) - .Where(x => x.Factory == factory) + .Where(x => SqlFunc.Subqueryable().Where(p => p.UserCode == x.Code && p.TenantId == factory).Any()) .WhereIF(request.IsLeave && request.SearchDateTimePeriod.HasValue(), x => x.ResignationDate >= request.SearchDateTimePeriod.Start && x.ResignationDate <= request.SearchDateTimePeriod.End) .Select((x, dept) => new GainfoMealResponse diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/MiddleService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/MiddleService.cs index 55530c2f..f0a1bb2f 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/MiddleService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/MiddleService.cs @@ -1,3 +1,4 @@ +using Dlhis.Canteen.Order.Repository; using Dlhis.Canteen.Order.Response; using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Canteen.Entities; @@ -8,12 +9,12 @@ namespace Dlhis.Canteen.Order.Services.Implements; public class MiddleService : IMiddleService { private readonly IDbContext _dbContext; - private readonly IBalanceService _balanceService; + private readonly IBalanceRepository _balanceRepository; - public MiddleService(IDbContext dbContext, IBalanceService balanceService) + public MiddleService(IDbContext dbContext, IBalanceRepository balanceRepository) { _dbContext = dbContext; - _balanceService = balanceService; + _balanceRepository = balanceRepository; } /// @@ -27,6 +28,8 @@ public class MiddleService : IMiddleService await _dbContext.InsertAsync(entity); } + var balance = await _balanceRepository.GetBalanceAsync(entity.UserCode, string.Empty); + //获取人员余额 return await _dbContext.Queryable() .LeftJoin((x, department) => x.DepartmentNo == department.No) @@ -37,7 +40,7 @@ public class MiddleService : IMiddleService UserName = x.Name, DepartmentNo = x.DepartmentNo, DepartmentName = department.Name, - //CurrentBalance = x.Balance todo 余额 + CurrentBalance = balance }) .SingleAsync(); }