Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development

This commit is contained in:
cheche
2024-01-18 17:23:45 +08:00
9 changed files with 13 additions and 36 deletions

View File

@@ -2,7 +2,6 @@
using Dlhis.Canteen.Order.Response;
using Dlhis.Canteen.Order.Services;
using Kurisu.Core.DataAccess.Dto;
using Kurisu.RemoteCall.Attributes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

View File

@@ -24,7 +24,7 @@ public class OrderAddRequest : IValidatableObject
/// <summary>
/// 档案号/QrCode/学工号
/// </summary>
[Required(ErrorMessage = "人员档案号/QrCode/学工号不能为空")]
[Required(ErrorMessage = "人员档案号/QrCode/学工号不能为空/userId")]
public string UserUniqueNo { get; set; }
/// <summary>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)
{