feat tickets

This commit is contained in:
2025-02-11 16:33:21 +08:00
parent c9df417799
commit 964e033583
33 changed files with 473 additions and 28 deletions

View File

@@ -3,6 +3,7 @@ using Dlhis.Canteen.Order.Repository;
using Dlhis.Canteen.Order.Request;
using Dlhis.Canteen.Order.Response;
using Dlhis.Canteen.Setting.Services;
using Dlhis.Constants;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Canteen.Entities;
using Dlhis.Entity.Canteen.Enums;
@@ -334,7 +335,7 @@ public class BalanceService : IBalanceService
public async Task<BalanceRecordUserResultResponse> GetPageByUserAsync(BalanceRecordUserPageRequest request)
{
var userCode = _currentUser.GetUserClaim("jinko-code") ?? string.Empty;
var userCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode) ?? string.Empty;
var factory = await _dbContext.Queryable<WalletEntity>().Where(x => x.Code == request.WalletCode).Select(x => x.Factory).FirstAsync();
var factories = await _balanceRepository.GetWalletFactoriesAsync(factory);

View File

@@ -21,6 +21,7 @@ using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.UnifyResultAndValidation;
using Dlhis.Constants;
namespace Dlhis.Canteen.Order.Services.Implements;
@@ -88,7 +89,7 @@ public class OrderService : IOrderService
{
var subjectId = _currentUser.GetIntSubjectId();
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdentityUserId == subjectId).FirstAsync();
var jinkoCode = _currentUser.GetUserClaim("jinko-code") ?? string.Empty;
var jinkoCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode) ?? string.Empty;
if (jinkoCode.IsPresent())
{
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == jinkoCode).SingleAsync();
@@ -153,12 +154,12 @@ public class OrderService : IOrderService
if (request.Source == BalanceRecordSourceEnumType.QrCode)
{
if (request.UserUniqueNo.StartsWith("01"))
if (request.UserUniqueNo.StartsWith(QrCodeConstants.User))
{
gainfo = await GetUserByQrCodeAsync(request.UserUniqueNo);
await CheckPermissionAsync(gainfo.Code, request.DeviceUniqueNo);
}
else if (request.UserUniqueNo.StartsWith("02"))
else if (request.UserUniqueNo.StartsWith(QrCodeConstants.EMealVoucher))
{
request.Source = BalanceRecordSourceEnumType.EMealVoucher;
var eMealVoucherQrCode = await _dbContext.Queryable<EMealVoucherDetailQrCodeEntity>().Where(x => x.QrCode == request.UserUniqueNo).SingleAsync();
@@ -166,6 +167,12 @@ public class OrderService : IOrderService
var code = eMealVoucherQrCode.OriginData.Split(':')[2];
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == code).SingleAsync();
}
else if (request.UserUniqueNo.StartsWith(QrCodeConstants.Birthday))
{
var ticket = await _dbContext.Queryable<TicketEntity>().Where(x => x.Type == TicketEnumType.Birthday).Where(x => x.QrCode == request.UserUniqueNo).SingleAsync();
ticket.ThrowIfNull("无法识别");
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == ticket.UserCode).SingleAsync();
}
else
{
throw new UserFriendlyException($"无法识别{request.UserUniqueNo}");