fix 获取订餐最晚时间
This commit is contained in:
@@ -8,6 +8,7 @@ using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using System;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -60,33 +61,46 @@ public class DishesService : IDishesService
|
||||
|
||||
public async Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request)
|
||||
{
|
||||
var shift = await _dbContext.Queryable<BusinessPlaceShiftRelationshipEntity>()
|
||||
try
|
||||
{
|
||||
var shift = await _dbContext.Queryable<BusinessPlaceShiftRelationshipEntity>()
|
||||
.Where(x => x.PlaceCode == request.PlaceCode)
|
||||
.FirstAsync();
|
||||
shift.ThrowIfNull($"营业点{request.PlaceCode}吗,没有餐别!");
|
||||
|
||||
var BusinessShiftMealRelationships = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
.Where(x => x.ShiftCode == shift.ShiftCode)
|
||||
.Select<BusinessShiftMealRelationshipResponse>()
|
||||
.ToListAsync();
|
||||
var BusinessShiftMealRelationships = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
.Where(x => x.ShiftCode == shift.ShiftCode)
|
||||
.Select<BusinessShiftMealRelationshipResponse>()
|
||||
.ToListAsync();
|
||||
|
||||
// 读取配置中的时间
|
||||
var eightThirtyPmStr = _configuration["EightThirtyPM"];
|
||||
DateTime.TryParseExact(eightThirtyPmStr, "HH:mm:ss", null, DateTimeStyles.None, out var dateTime);
|
||||
// 读取最晚订餐的时间
|
||||
var strDatetime = await _dbContext.Queryable<CanteenSettingEntity>()
|
||||
.Where(x => x.UniqueType == CanteenSettingUnqiueEnumType.Tenant && x.Item == CanteenSettingItemEnumType.BookingDeadline && x.Enable)
|
||||
.Select(x => x.Value)
|
||||
.FirstAsync();
|
||||
|
||||
var payTypes = new List<BalanceRecordSourceEnumType> { BalanceRecordSourceEnumType.Cash };
|
||||
if (shift.TenantId == request.Factory)
|
||||
{
|
||||
payTypes.Add(BalanceRecordSourceEnumType.LocalTenantSubsidies);
|
||||
DateTime dateTime;
|
||||
DateTime.TryParseExact(strDatetime, "HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out dateTime);
|
||||
|
||||
|
||||
var payTypes = new List<BalanceRecordSourceEnumType> { BalanceRecordSourceEnumType.Cash };
|
||||
if (shift.TenantId == request.Factory)
|
||||
{
|
||||
payTypes.Add(BalanceRecordSourceEnumType.LocalTenantSubsidies);
|
||||
}
|
||||
|
||||
var res = new GetDishesMenusBookingResponse
|
||||
{
|
||||
BusinessShiftMealRelationships = BusinessShiftMealRelationships,
|
||||
ServiceTime = dateTime,
|
||||
PayType = payTypes
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
var res = new GetDishesMenusBookingResponse
|
||||
catch (Exception ex)
|
||||
{
|
||||
BusinessShiftMealRelationships = BusinessShiftMealRelationships,
|
||||
ServiceTime = dateTime,
|
||||
PayType = payTypes
|
||||
};
|
||||
return res;
|
||||
return new GetDishesMenusBookingResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"EightThirtyPM": "20:30:00",
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common",
|
||||
|
||||
@@ -110,24 +110,16 @@ public class GetMiniProgramOrderResponse
|
||||
/// </summary>
|
||||
public MiniProgramOrderStatusEnumType OrderStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单状态CN
|
||||
/// </summary>
|
||||
public string OrderStatusCN => OrderStatus.GetDescription();
|
||||
/// <summary>
|
||||
/// 订单状态CN
|
||||
/// </summary>
|
||||
public string OrderStatusCN => OrderStatus.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public CanteenMenuEnumType OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型CN
|
||||
/// </summary>
|
||||
public string OrderTypeCN => OrderType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 总金额
|
||||
/// </summary>
|
||||
public decimal TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// 总金额
|
||||
/// </summary>
|
||||
public decimal TotalAmount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user