fix 调整消费处理,配置文件显示sql

This commit is contained in:
2024-01-10 16:39:12 +08:00
parent 7c242370fc
commit 5e9d4ac2a6
2 changed files with 13 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Core.CustomClass;
using Kurisu.Core.DataAccess.Dto;
using Kurisu.SqlSugar.Attributes;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using Mapster;
@@ -39,6 +40,7 @@ public class OrderService : IOrderService
return page;
}
[IgnoreTenant]
public async Task AddAsync(OrderAddRequest request)
{
var device = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo == request.DeviceUniqueNo).Where(x => x.Enable).FirstAsync();
@@ -67,7 +69,7 @@ public class OrderService : IOrderService
.FirstAsync();
var settings = await _canteenSettingService.GetUserSettingAsync(gafinfo.No);
var switchTime = GetSetting<TimeOnly>(settings, CanteenSettingItemEnumType.BusinessSwitchTime);
var switchTime = GetSetting<TimeOnly?>(settings, CanteenSettingItemEnumType.BusinessSwitchTime);
//金额处理
request.Amount = request.Type == BalanceRecordTypeEnumType.In ? Math.Abs(request.Amount) : -Math.Abs(request.Amount);
@@ -89,9 +91,12 @@ public class OrderService : IOrderService
costDate = DateTime.Now.AddDays(-1);
var beginOfDay = DateTime.Today;
var setTime = beginOfDay.Add(switchTime.ToTimeSpan());
if (DateTime.Now < setTime)
costDate = DateTime.Now.AddDays(-1);
if (switchTime.HasValue)
{
var setTime = beginOfDay.Add(switchTime.Value.ToTimeSpan());
if (DateTime.Now < setTime)
costDate = DateTime.Now.AddDays(-1);
}
}
var order = new CanteenOrderEntity
@@ -117,9 +122,10 @@ public class OrderService : IOrderService
IsOffline = request.IsOffline,
IsCostCrossTenant = GetSetting<bool>(settings, CanteenSettingItemEnumType.AllowCrossTenant),
OriginTenantId = canteenUser.TenantId,
OriginTenantId = canteenUser.TenantId,//人员可能跨基地消费
Status = BalanceRecordStatusEnumType.Doubtful,
TenantId = device.TenantId, //设备才能标识当前消费的基地
};
var id = await _dbContext.InsertReturnIdentityAsync(order);

View File

@@ -13,7 +13,8 @@
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
"SlaveConnectionString": [],
"Timeout": 30,
"SlowSqlTime": 1
"SlowSqlTime": 1,
"EnableSqlLog": true
},
"SwaggerOptions": {
"Enable": true,