Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -32,6 +32,12 @@ public class DeviceSaveRequest
|
||||
[Required(ErrorMessage = "设备功能不能为空")]
|
||||
public List<DeviceFuncEnumType> Funcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 心跳间隔
|
||||
/// </summary>
|
||||
[Range(0, int.MaxValue)]
|
||||
public int HeartbeatInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署点
|
||||
/// </summary>
|
||||
|
||||
@@ -27,9 +27,11 @@ public class DeviceService : IDeviceService
|
||||
public async Task<Pagination<DevicePageResponse>> GetPageAsync(DevicePageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Select(device => new DevicePageResponse
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.Select((d, dt) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = device.Funcs.ToString()
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
@@ -70,7 +72,8 @@ public class DeviceService : IDeviceService
|
||||
var entity = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Id == request.Id).FirstAsync();
|
||||
entity.ThrowIfNull("设备不存在,无法更新");
|
||||
|
||||
request.Adapt(entity);
|
||||
var uniqueNo = entity.UniqueNo;
|
||||
request.Adapt(entity).UniqueNo = uniqueNo;
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,16 @@ public class MealUserService : IMealUserService
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Select<MealUserResponse>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.Select((x, ga) => new MealUserResponse
|
||||
{
|
||||
Balance = x.Balance,
|
||||
BalanceOfRecharge = x.BalanceOfRecharge,
|
||||
BalanceOfSubsidies = x.BalanceOfSubsidies,
|
||||
UserCode = ga.Code,
|
||||
UserNo = ga.No,
|
||||
UserType = x.UserType
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SettingController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("enable")]
|
||||
[HttpPost("enable")]
|
||||
public async Task SetEnableAsync(CanteenSettingSetEnableRequest request)
|
||||
{
|
||||
await _settingService.SetEnableAsync(request);
|
||||
|
||||
@@ -1,38 +1,48 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Org.BouncyCastle.Asn1.X509.SigI;
|
||||
|
||||
namespace Dlhis.Canteen.Setting.Request;
|
||||
|
||||
public class CanteenSettingSaveRequest
|
||||
public class CanteenSettingSaveRequest : IValidatableObject
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置生效范围
|
||||
/// 配置生效范围类型 CanteenSettingUnqiueEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenSettingUnqiueEnumType))]
|
||||
public CanteenSettingUnqiueEnumType UniqueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一值 eg:UniqueType = 1时,传入非空字符串
|
||||
/// 配置生效范围
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "值不能为空")]
|
||||
public string UniqueValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义分类分类
|
||||
/// 自定义分类
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "分类不能为空")]
|
||||
public string Catalog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数 CanteenSettingItemEnumType
|
||||
/// 就餐配置 CanteenSettingItemEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenSettingItemEnumType))]
|
||||
public CanteenSettingItemEnumType Item { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// 参数值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (UniqueType != CanteenSettingUnqiueEnumType.Tenant && UniqueValue.IsEmpty())
|
||||
{
|
||||
yield return new ValidationResult($"配置{UniqueType.GetDescription()}值不能为空", new string[] { nameof(UniqueValue) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace Dlhis.Canteen.Setting.Response;
|
||||
|
||||
public class CanteenSettingResponse
|
||||
{
|
||||
|
||||
public long Id { get; set; }
|
||||
|
||||
public CanteenSettingUnqiueEnumType UniqueType { get; set; }
|
||||
public string UniqueTypeDesc => UniqueType.GetDescription();
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ public class CanteenSettingService : ICanteenSettingService
|
||||
.LeftJoin<CanteenUserEntity>((setting, user) => setting.UniqueValue == user.UserNo)
|
||||
.WhereIF(request.UniqueType.HasValue, setting => setting.UniqueType == request.UniqueType)
|
||||
.WhereIF(request.Item.HasValue, setting => setting.Item == request.Item)
|
||||
.WhereIF(request.Search.IsPresent(), setting => setting.UniqueValue.Contains(request.Search))
|
||||
.WhereIF(request.Search.IsPresent(), setting => setting.Catalog.Contains(request.Search))
|
||||
.Select((setting, user) => new CanteenSettingResponse
|
||||
{
|
||||
Id = setting.Id,
|
||||
UniqueType = setting.UniqueType,
|
||||
UniqueValue = setting.UniqueValue,
|
||||
//UniqueValueDesc = user.UserName,
|
||||
Catalog = setting.Catalog,
|
||||
Enable = setting.Enable,
|
||||
Item = setting.Item,
|
||||
|
||||
@@ -42,9 +42,9 @@ public class GainfoEntity : SugarBaseEntity
|
||||
public string NameEn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "工号")]
|
||||
[SugarColumn(ColumnDescription = "学工号")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,28 +8,20 @@ namespace Dlhis.Entity.Canteen.Enums;
|
||||
[Description("就餐配置项")]
|
||||
public enum CanteenSettingItemEnumType
|
||||
{
|
||||
//# BusinessSwitchTime varchar(255) not null comment '营业点切换时间 HH:00:00',
|
||||
//# DayCostMax decimal(16, 2) not null comment '每日允许消费最高金额(存在普通模式)',
|
||||
//# DayMarketCostMax decimal(16, 2) not null comment '每日超市允许消费最高金额',
|
||||
//# AllowSendAtMeal bit not null comment '允许就餐下发',
|
||||
//# DayEVoucherUseCountMax int not null comment '电子券每天使用最多次数',
|
||||
//# Subsidies decimal(16, 2) not null comment '补贴',
|
||||
//# AllowRepeatInOneShift bit not null comment '允许一餐次多次消费',
|
||||
//# OnceCostMax decimal(16, 2) not null comment '一次最高消费金额',
|
||||
//# AllowCrossTenant bit not null comment '允许跨基地消费',
|
||||
//# InitBalance decimal(16, 2) not null comment '初始金额',
|
||||
|
||||
/// <summary>
|
||||
/// 营业点切换时间
|
||||
/// </summary>
|
||||
[Description("营业点切换时间(HH:00:00)")]
|
||||
BusinessSwitchTime = 1,
|
||||
BusinessSwitchTime = 100,
|
||||
|
||||
|
||||
//----------------------------------------------------------------[200,300)--------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 每日允许消费最高金额
|
||||
/// </summary>
|
||||
[Description("每日允许消费最高金额(decimal)")]
|
||||
DayCostMax,
|
||||
DayCostMax = 200,
|
||||
|
||||
/// <summary>
|
||||
/// 每日超市允许消费最高金额
|
||||
@@ -37,17 +29,18 @@ public enum CanteenSettingItemEnumType
|
||||
[Description("每日超市允许消费最高金额(decimal)")]
|
||||
DayMarketCostMax,
|
||||
|
||||
/// <summary>
|
||||
/// 允许就餐下发
|
||||
/// </summary>
|
||||
[Description("允许就餐下发(0/1)")]
|
||||
AllowSendAtMeal,
|
||||
|
||||
/// <summary>
|
||||
/// 电子券每天使用最多次数
|
||||
/// 一次最高消费金额
|
||||
/// </summary>
|
||||
[Description("电子券每天使用最多次数(int)")]
|
||||
DayEVoucherUseCountMax,
|
||||
[Description("一次最高消费金额(decimal)")]
|
||||
OnceCostMax,
|
||||
|
||||
/// <summary>
|
||||
/// 初始金额
|
||||
/// </summary>
|
||||
[Description("初始金额(decimal)")]
|
||||
InitBalance,
|
||||
|
||||
/// <summary>
|
||||
/// 补贴
|
||||
@@ -55,28 +48,35 @@ public enum CanteenSettingItemEnumType
|
||||
[Description("补贴(decimal)")]
|
||||
Subsidies,
|
||||
|
||||
|
||||
//--------------------------------------------------------------------[300,400)----------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 允许就餐下发
|
||||
/// </summary>
|
||||
[Description("允许就餐下发(0/1)")]
|
||||
AllowSendAtMeal = 300,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 允许一餐次多次消费
|
||||
/// </summary>
|
||||
[Description("允许一餐次多次消费(0/1)")]
|
||||
AllowRepeatInOneShift,
|
||||
|
||||
/// <summary>
|
||||
/// 一次最高消费金额
|
||||
/// </summary>
|
||||
[Description("一次最高消费金额(decimal)")]
|
||||
OnceCostMax,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 允许跨基地消费
|
||||
/// </summary>
|
||||
[Description("允许跨基地消费(0/1)")]
|
||||
AllowCrossTenant,
|
||||
|
||||
|
||||
//--------------------------------------------------------------------[400,500)----------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 初始金额
|
||||
/// 电子券每天使用最多次数
|
||||
/// </summary>
|
||||
[Description("初始金额(decimal)")]
|
||||
InitBalance,
|
||||
[Description("电子券每天使用最多次数(int)")]
|
||||
DayEVoucherUseCountMax = 400,
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Job
|
||||
{
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Job;
|
||||
|
||||
public class CreateGetAttendanceJob
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
@@ -19,7 +20,7 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Job
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup();
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
try
|
||||
{
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Enable).ToListAsync();
|
||||
@@ -47,7 +48,7 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Job
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"生成{DeviceTaskEnumType.UploadRecord.GetDescription()}任务失败:" + ex.Message);
|
||||
_logger.LogError(ex, "生成{type}任务失败:{message}", DeviceTaskEnumType.UploadRecord.GetDescription(), ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -55,4 +56,3 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Job
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user