Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -42,11 +42,6 @@ public class DishesDetailResponse
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余数量
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
|
||||
@@ -8,10 +8,6 @@ public interface IDishesCategoryService : IScopeDependency
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode);
|
||||
|
||||
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode);
|
||||
|
||||
|
||||
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode);
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ public interface IDishesMenuService : IScopeDependency
|
||||
|
||||
Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, Guid categoryCode);
|
||||
|
||||
Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, Guid categoryCode);
|
||||
|
||||
Task SaveDishesMenuAsync(DishesMenuSaveRequest request);
|
||||
|
||||
Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode);
|
||||
|
||||
@@ -17,7 +17,6 @@ public class DishesCategoryService : IDishesCategoryService
|
||||
public DishesCategoryService(IDbContext dbContext, IBusinessPlacePermissionsService businessPlacePermissionsService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode)
|
||||
@@ -49,8 +48,6 @@ public class DishesCategoryService : IDishesCategoryService
|
||||
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode)
|
||||
{
|
||||
var mybCodes = await GetMyBusinessPlaceCodesAsync();
|
||||
|
||||
var categories = await _dbContext.Queryable<DishesCategoryEntity>()
|
||||
.LeftJoin<BusinessPlaceEntity>((x, bplace) => x.BusinessPlaceCode == bplace.Code)
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
|
||||
@@ -90,11 +90,37 @@ public class OrdersController : ControllerBase
|
||||
}
|
||||
|
||||
//************************************************************** 订餐功能 **********************************************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 订单聚合数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("aggregation")]
|
||||
[IgnoreTenant]
|
||||
public async Task<Pagination<OrderAggregationResponse>> GetOrdersAggregationAsync([FromQuery] PageDto page)
|
||||
{
|
||||
return await _orderService.GetOrdersAggregationAsync(page);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("user-cancel")]
|
||||
[Transactional]
|
||||
[IgnoreTenant]
|
||||
public async Task CancelOrderAsync(OrderCancelRequest request)
|
||||
{
|
||||
await _bookingOrderService.UserCancelOrderAsync(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("booking")]
|
||||
[Transactional]
|
||||
[IgnoreTenant]
|
||||
@@ -115,15 +141,4 @@ public class OrdersController : ControllerBase
|
||||
{
|
||||
return await _bookingOrderService.GetBookingPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("booking/page")]
|
||||
public async Task<Pagination<OrderBookingResponse>> GetBookingPageAsync([FromQuery] OrderBookingPageRequest request)
|
||||
{
|
||||
return await _bookingOrderService.GetBookingPageAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class BalanceRecordByUserRequest : PageDto
|
||||
{
|
||||
public class BalanceRecordByUserRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户档案号
|
||||
/// </summary>
|
||||
|
||||
@@ -9,9 +9,9 @@ public class BalanceRecordByUserResponse
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -47,7 +47,7 @@ public class BalanceRecordByUserResponse
|
||||
/// <summary>
|
||||
/// 金额 + - 表示
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费时间
|
||||
|
||||
@@ -101,17 +101,17 @@ public class BookingOrderService : BaseOrderService, IBookingOrderService
|
||||
{
|
||||
|
||||
var mealInfo = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserNo == order.UserNo).FirstAsync();
|
||||
if (mealInfo == null)
|
||||
{
|
||||
await DbContext.InsertAsync(new GainfoMealEntity
|
||||
if (mealInfo == null)
|
||||
{
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
UserCode = gainfo.Code,
|
||||
UserNo = gainfo.No,
|
||||
Version = 0,
|
||||
});
|
||||
await DbContext.InsertAsync(new GainfoMealEntity
|
||||
{
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
UserCode = gainfo.Code,
|
||||
UserNo = gainfo.No,
|
||||
Version = 0,
|
||||
});
|
||||
|
||||
(mealInfo == null).ThrowIfTrue("余额不足,无法消费");
|
||||
}
|
||||
@@ -120,26 +120,26 @@ public class BookingOrderService : BaseOrderService, IBookingOrderService
|
||||
(mealInfo.Balance < 0).ThrowIfTrue("余额不足,无法消费");
|
||||
|
||||
var effectMeal = await DbContext.Updateable<GainfoMealEntity>()
|
||||
.SetColumns(x => x.Balance == mealInfo.Balance)
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.Where(x => x.UserNo == order.UserNo && x.Version == mealInfo.Version)//必须与查询时的version一致
|
||||
.ExecuteCommandAsync();
|
||||
.SetColumns(x => x.Balance == mealInfo.Balance)
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.Where(x => x.UserNo == order.UserNo && x.Version == mealInfo.Version)//必须与查询时的version一致
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (effectMeal <= 0) throw new VersionExceptions("更新版本冲突");
|
||||
}
|
||||
|
||||
|
||||
var effectMenu = await DbContext.Updateable<DishesMenuEntity>()
|
||||
.SetColumns(x => x.Number == menuDetail.Number)
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.SetColumns(x => x.ModifiedTime == now)
|
||||
.SetColumns(x => x.Number == menuDetail.Number)
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.SetColumns(x => x.ModifiedTime == now)
|
||||
.Where(x => x.StartDate <= menuDetail.Date && menuDetail.Date <= x.EndDate
|
||||
&& x.ShiftType == request.ShiftType
|
||||
&& x.BusinessPlaceCode == request.BusinessPlaceCode
|
||||
&& x.DishesCode == request.DishesCode
|
||||
&& x.Version == menuDetail.Version
|
||||
)
|
||||
.ExecuteCommandAsync();
|
||||
&& x.ShiftType == request.ShiftType
|
||||
&& x.BusinessPlaceCode == request.BusinessPlaceCode
|
||||
&& x.DishesCode == request.DishesCode
|
||||
&& x.Version == menuDetail.Version
|
||||
)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (effectMenu <= 0) throw new VersionExceptions("更新版本冲突");
|
||||
|
||||
@@ -176,7 +176,7 @@ public class BookingOrderService : BaseOrderService, IBookingOrderService
|
||||
var myCodes = (await _businessPlacePermissionsApi.GetMyAsync()).Data.Select(x => (Guid?)x.Code).ToList();
|
||||
|
||||
var page = await DbContext.Queryable<CanteenOrderEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.Where(x => myCodes.Contains(x.BusinessPlaceCode))
|
||||
.WhereIF(request.OrderStatus.HasValue, x => x.OrderStatus == request.OrderStatus)
|
||||
.WhereIF(request.Search.IsPresent(), (x, ga) => x.UserCode == request.Search || ga.Name.Contains(request.Search))
|
||||
@@ -242,9 +242,9 @@ public class BookingOrderService : BaseOrderService, IBookingOrderService
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (effect <= 0)
|
||||
{
|
||||
{
|
||||
throw new VersionExceptions("取消订单失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}, 5);
|
||||
}
|
||||
|
||||
@@ -18,26 +18,8 @@ public class DelApiLogTaskJob
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime todayStart = now.Date;
|
||||
DateTime threeDaysAgoStart = todayStart.AddDays(-7);
|
||||
|
||||
var logs = await _dbContext.ChangeDb("log")
|
||||
.Queryable<ApiLogEntity>()
|
||||
.Where(x => x._ts >= threeDaysAgoStart && x._ts <= now)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
|
||||
var lst = new List<ApiLogEntity>();
|
||||
foreach (var id in logs)
|
||||
{
|
||||
var entity = new ApiLogEntity
|
||||
{
|
||||
Id = id,
|
||||
};
|
||||
lst.Add(entity);
|
||||
}
|
||||
await _dbContext.ChangeDb("log").DeleteReallyAsync(lst);
|
||||
DateTime before = DateTime.Now.Date.AddDays(-7);
|
||||
await _dbContext.ChangeDb("log").Client.Deleteable<ApiLogEntity>().Where(x => x._ts <= before).ExecuteCommandAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user