feat 电子餐券
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Dlhis.Canteen.Order.Dto;
|
using Dlhis.Canteen.Order.Dto;
|
||||||
using Dlhis.Canteen.Setting.Services;
|
using Dlhis.Canteen.Setting.Services;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.Entity.Canteen.Entities;
|
using Dlhis.Entity.Canteen.Entities;
|
||||||
@@ -575,6 +575,22 @@ public class OrderService : BaseOrderService, IOrderService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (request.IsOffline)
|
||||||
|
{
|
||||||
|
if (request.ThirdNo.IsPresent())
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await EMealVoucherConsumeAsync(request.Adapt<ConsumeRequest>(), gainfo);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (request.IsOffline)
|
if (request.IsOffline)
|
||||||
{
|
{
|
||||||
@@ -674,15 +690,16 @@ public class OrderService : BaseOrderService, IOrderService
|
|||||||
return await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == gainfoQrCode.UserCode).SingleAsync();
|
return await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == gainfoQrCode.UserCode).SingleAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task EMealVoucherConsumeAsync(ConsumeRequest request, GainfoEntity gainfo, string originData, string no, string ts, string idNo)
|
private async Task EMealVoucherConsumeAsync(ConsumeRequest request, GainfoEntity gainfo, string originData, string no, string ts, string idNo)
|
||||||
{
|
{
|
||||||
|
|
||||||
var nowDate = DateTime.Now.Date;
|
var nowDate = DateTime.Now.Date;
|
||||||
var current = await DbContext.Queryable<EMealVoucherDetailEntity>()
|
var current = await DbContext.Queryable<EMealVoucherDetailEntity>()
|
||||||
.Where(x => x.No == no && x.IdNo == idNo).SingleAsync();
|
.Where(x => x.No == no && x.IdNo == idNo).SingleAsync();
|
||||||
(nowDate >= current.Start && nowDate <= current.End).ThrowIfFalse("餐券已过期");
|
(nowDate >= current.Start && nowDate <= current.End).ThrowIfFalse("餐券已过期");
|
||||||
|
|
||||||
var time = DateTimeOffset.FromUnixTimeMilliseconds(Convert.ToInt64(ts.Reverse().Join(string.Empty))).ToLocalTime().DateTime;
|
var time = DateTimeOffset.FromUnixTimeMilliseconds(Convert.ToInt64(ts.Reverse().Join(string.Empty))).ToLocalTime().DateTime;
|
||||||
|
|
||||||
(time.AddMinutes(60) >= DateTime.Now).ThrowIfFalse("二维码已过期");
|
(time.AddMinutes(60) >= DateTime.Now).ThrowIfFalse("二维码已过期");
|
||||||
|
|
||||||
var eMealVoucher = await DbContext.Queryable<EMealVoucherEntity>().Where(x => x.No == no).SingleAsync();
|
var eMealVoucher = await DbContext.Queryable<EMealVoucherEntity>().Where(x => x.No == no).SingleAsync();
|
||||||
@@ -750,6 +767,7 @@ public class OrderService : BaseOrderService, IOrderService
|
|||||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||||
.Where(x => x.Id == orderId)
|
.Where(x => x.Id == orderId)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user