Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -44,8 +44,6 @@ public class MealUserService : IMealUserService
|
||||
{
|
||||
UserNo = request.UserNo,
|
||||
UserType = request.UserType,
|
||||
UserCode = gainfoEntity.Code,
|
||||
CardNo = gainfoEntity.CardNo,
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
|
||||
@@ -4,7 +4,6 @@ using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dm.filter.rw;
|
||||
using Kurisu.AspNetCore.Scope;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class OrderAddRequest : IValidatableObject
|
||||
/// <summary>
|
||||
/// 档案号/QrCode/学工号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "人员档案号/QrCode/学工号不能为空")]
|
||||
[Required(ErrorMessage = "人员档案号/QrCode/学工号不能为空/userId")]
|
||||
public string UserUniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -15,45 +15,27 @@ public class CanteenUserEntity : SugarBaseEntity, IVersion, ITenantId
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "档案号")]
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "档案号", UniqueGroupNameList = new[] { "idx_CanteenUser_UserNo" })]
|
||||
public string UserNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "学工号")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消费人员类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "消费人员类型")]
|
||||
public CanteenUserEnumType UserType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "卡号")]
|
||||
public string CardNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "余额")]
|
||||
public decimal Balance { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额(充值)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "余额(充值)")]
|
||||
public decimal BalanceOfRecharge { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额(餐补)
|
||||
/// </summary>
|
||||
@@ -67,5 +49,6 @@ public class CanteenUserEntity : SugarBaseEntity, IVersion, ITenantId
|
||||
public int Version { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(IndexGroupNameList = new[] { "idx_CanteenUser_TenantId" })]
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GainfoFaceEntity : SugarBaseEntity
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false)]
|
||||
[SugarColumn(IsNullable = false, UniqueGroupNameList = new[] { "idx_GainfoFace_UserCode" })]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user