fix import餐饮人员创建

This commit is contained in:
2024-06-12 15:38:56 +08:00
parent 2f53e825a0
commit ab3d689232
2 changed files with 21 additions and 0 deletions

View File

@@ -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
{

View File

@@ -500,6 +500,22 @@ public class BalanceService : IBalanceService
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.UserCode).SingleAsync();
gainfo.ThrowIfNull($"工号{request.UserCode}不存在");
var gainfoMeal = await _dbContext.Queryable<GainfoMealEntity>().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<BusinessPlaceEntity>()
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((a, b) => a.Code == b.PlaceCode)