fix 菜单分页响应调整,增加详情接口
This commit is contained in:
@@ -16,6 +16,6 @@ public interface IDisheMenuApi
|
||||
/// <param name="dishesCode"></param>
|
||||
/// <returns></returns>
|
||||
[Auth]
|
||||
[Get("/api/dishesMenus/detail")]
|
||||
[Get("/api/dishesMenus/checkdetail")]
|
||||
Task<DefaultApiResult<DishesMenuDetailDto>> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, int shiftType, string dishesCode);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Controller;
|
||||
|
||||
@@ -38,6 +39,19 @@ public class DishesMenusController : ControllerBase
|
||||
return await _dishesMenuService.GetDishesMenuPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单详情
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <param name="customCode"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime date)
|
||||
{
|
||||
return await _dishesMenuService.GetDishesMenuDetailAsync(businessPlaceCode, customCode, date);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单保存/更改
|
||||
/// </summary>
|
||||
@@ -51,14 +65,14 @@ public class DishesMenusController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单信息明细
|
||||
/// 检查明细
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <param name="shiftType"></param>
|
||||
/// <param name="dishesCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[HttpGet("checkdetail")]
|
||||
public async Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode)
|
||||
{
|
||||
return await _dishesMenuService.GetBookingDishesDetailAsync(date, businessPlaceCode, shiftType, dishesCode);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
@@ -9,14 +8,4 @@ public class DisheMenuPageRequest : PageDto
|
||||
/// 营业点code
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public List<ShiftEnumType> ShiftTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public Guid? CategoryCode { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesMenuPageResponse
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单编码
|
||||
/// </summary>
|
||||
@@ -20,32 +16,4 @@ public class DishesMenuPageResponse
|
||||
/// 营业日期
|
||||
/// </summary>
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public string DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余数量
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ public interface IDishesMenuService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request);
|
||||
|
||||
Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime date);
|
||||
|
||||
Task SaveDishesMenuAsync(DishesMenuSaveRequest request);
|
||||
|
||||
Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode);
|
||||
|
||||
@@ -9,6 +9,7 @@ using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Dto;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -26,10 +27,53 @@ public class DishesMenuService : IDishesMenuService
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.Select<DishesMenuPageResponse>()
|
||||
.Where(x => x.BusinessPlaceCode == request.BusinessPlaceCode)
|
||||
.GroupBy(x => new { x.BusinessPlaceCode, x.CustomCode, x.Date })
|
||||
.Select(x => new DishesMenuPageResponse
|
||||
{
|
||||
BusinessPlaceCode = x.BusinessPlaceCode,
|
||||
CustomCode = x.CustomCode,
|
||||
Date = x.Date,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime date)
|
||||
{
|
||||
var data = await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.ToListAsync();
|
||||
|
||||
return new DishesMenuSaveRequest
|
||||
{
|
||||
BusinessPlaceCode = businessPlaceCode,
|
||||
Items = new List<DishesMenuNameDateSaveRequest>
|
||||
{
|
||||
new()
|
||||
{
|
||||
CustomCode = customCode,
|
||||
Date = date,
|
||||
ShiftTypes = data.GroupBy(x => x.ShiftType).Select(item =>
|
||||
{
|
||||
var shiftType = item.Key;
|
||||
|
||||
return new DishesMenuShiftTypeSaveRequest
|
||||
{
|
||||
ShiftType = shiftType,
|
||||
Dishes = item.Select(x => new MenuDishesSaveRequest
|
||||
{
|
||||
DishesCode = x.DishesCode,
|
||||
Number = x.Number,
|
||||
Price = x.Price,
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
}).ToList()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public async Task SaveDishesMenuAsync(DishesMenuSaveRequest request)
|
||||
{
|
||||
//检验数据
|
||||
@@ -68,7 +112,6 @@ public class DishesMenuService : IDishesMenuService
|
||||
|
||||
Type = CanteenApplicaitonTypeEnumType.Booking,
|
||||
Version = 0,
|
||||
Enable = true,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,25 +54,18 @@ public class DishesMenuEntity : SugarBaseEntity, ITenantId, IVersion
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")]
|
||||
public bool Enable { get; set; }
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 并发控制
|
||||
/// </summary>
|
||||
public int Version { get; set; }
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user