27 lines
869 B
C#
27 lines
869 B
C#
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<MealSupplementReceiveReuqest> reuqests)
|
|
{
|
|
await _dbContext.InsertAsync(reuqests.Adapt<List<MealSupplementRequestRecordEntity>>());
|
|
await _eventBus.PublishAsync(new MealSupplementMessage { Items = reuqests });
|
|
}
|
|
}
|