Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services;
|
||||
|
||||
|
||||
@@ -10,11 +10,7 @@ using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Attributes;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services.Implements;
|
||||
|
||||
|
||||
@@ -45,17 +45,20 @@ public class OrderService : IOrderService
|
||||
[IgnoreTenant]
|
||||
public async Task<OrderResultResponse> AddAsync(OrderAddRequest request)
|
||||
{
|
||||
//根据档案号
|
||||
var canteenUserExists = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Where(x => x.UserNo == request.UserUniqueNo || x.UserCode == request.UserUniqueNo)
|
||||
.AnyAsync();
|
||||
canteenUserExists.ThrowIfFalse($"就餐用户{request.UserUniqueNo}不存在,无法操作");
|
||||
//尝试匹配userId
|
||||
_ = long.TryParse(request.UserUniqueNo, out var userId);
|
||||
|
||||
//根据档案号
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.No == request.UserUniqueNo || x.Code == request.UserUniqueNo)
|
||||
.Where(x => x.No == request.UserUniqueNo || x.Code == request.UserUniqueNo || x.Id == userId)
|
||||
.FirstAsync();
|
||||
gainfo.ThrowIfNull($"用户{request.UserUniqueNo}不存在,无法操作");
|
||||
|
||||
var canteenUserExists = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Where(x => x.UserNo == gainfo.No)
|
||||
.AnyAsync();
|
||||
canteenUserExists.ThrowIfFalse($"就餐用户{request.UserUniqueNo}不存在,无法操作");
|
||||
|
||||
//消费
|
||||
if (request.Type == BalanceRecordTypeEnumType.Out)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user