using Dlhis.Entity.Canteen.Entities; using Dlhis.External.MealSupplement.Channel; using Dlhis.External.MealSupplement.Request; using Kurisu.AspNetCore.EventBus.Abstractions; using Kurisu.SqlSugar.Services; using Mapster; namespace Dlhis.External.MealSupplement.Services.Implements; public class MealSupplementService : IMealSupplementService { private readonly IEventBus _eventBus; private readonly IDbContext _dbContext; public MealSupplementService(IEventBus eventBus, IDbContext dbContext) { _eventBus = eventBus; _dbContext = dbContext; } public async Task DoSupplementsAsync(List reuqests) { await _dbContext.InsertAsync(reuqests.Adapt>()); await _eventBus.PublishAsync(new MealSupplementMessage { Items = reuqests }); } }