From ab3d6892323dd411e6867d42c3ae822fd1ee0efb Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 12 Jun 2024 15:38:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=20import=E9=A4=90=E9=A5=AE=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Order/Request/BalanceHainingImportRequest.cs | 5 +++++ .../Order/Services/Implements/BalanceService.cs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs b/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs index 1b23a7f4..391a765d 100644 --- a/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs +++ b/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs @@ -101,6 +101,11 @@ public class BalanceHainingImportRequest : IValidatableObject { yield return new ValidationResult("仅支持设备消费", new[] { nameof(ApplicationType) }); } + + if (BusinessPlaceCode.IsEmpty()) + { + yield return new ValidationResult("营业掉不可为空", new[] { nameof(BusinessPlaceCode) }); + } } else { diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs index 4a32d04f..5da5d96a 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs @@ -500,6 +500,22 @@ public class BalanceService : IBalanceService var gainfo = await _dbContext.Queryable().Where(x => x.Code == request.UserCode).SingleAsync(); gainfo.ThrowIfNull($"工号{request.UserCode}不存在"); var gainfoMeal = await _dbContext.Queryable().Where(x => x.UserCode == request.UserCode).SingleAsync(); + if (gainfoMeal == null) + { + gainfoMeal = new GainfoMealEntity + { + CreatedBy = 1, + ModifiedBy = 1, + UserNo = gainfo.No, + UserCode = gainfo.Code, + Balance = 0, + BalanceOfRecharge = 0, + BalanceOfSubsidies = 0, + Version = 0 + }; + + await _dbContext.InsertAsync(gainfoMeal); + } var businessPlace = await _dbContext.Queryable() .LeftJoin((a, b) => a.Code == b.PlaceCode)