fix 消息通知,消费明细查询

This commit is contained in:
2025-12-23 14:23:35 +08:00
parent 8004b7440c
commit bb10c62fab
2 changed files with 23 additions and 1 deletions

View File

@@ -21,4 +21,9 @@ public class VoucherBalancePageRequest : PageDto
/// 筛选厂区
/// </summary>
public List<string> Factories { get; set; }
/// <summary>
/// 部门号
/// </summary>
public string DepartmentNo { get; set; }
}

View File

@@ -1,5 +1,6 @@
using System.Text;
using Dlhis.Basic.Api;
using Dlhis.Basic.Api.Requests;
using Dlhis.Canteen.Tickets.Services;
using Dlhis.Canteen.Tickets.Services.Implements;
using Dlhis.Canteen.Voucher.Requests;
@@ -23,11 +24,15 @@ namespace Dlhis.Canteen.Voucher.Services.Implements;
public class BirthdayVoucherService : BaseVoucherService, IVoucherService
{
private readonly IFactorySettingApi _factorySettingApi;
private readonly IDingTalkApi _dingTalkApi;
private readonly ILogger<BirthdayVoucherService> _logger;
/// <inheritdoc />
public BirthdayVoucherService(IServiceProvider serviceProvider) : base(serviceProvider)
{
_factorySettingApi = serviceProvider.GetService<IFactorySettingApi>();
_dingTalkApi = serviceProvider.GetService<IDingTalkApi>();
_logger = serviceProvider.GetService<ILogger<BirthdayVoucherService>>();
}
/// <inheritdoc />
@@ -117,7 +122,18 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService
ModifiedTime = DateTime.Now
});
try
{
await _dingTalkApi.SendWorkMessageAsync(new JinkoSendWorkMessageRequest
{
WorkCodes = new List<string> { gainfo.Code },
Content = "你好,生日快乐,为你发放了生日福利券,请到人脸系统查询 (仅允许在超市消费)"
});
}
catch (Exception ex)
{
_logger.LogError(ex, "发送生日券消息失败,工号:{UserCode},错误原因:{Error}", gainfo.Code, ex.Message);
}
}
}
@@ -223,6 +239,7 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService
.LeftJoin<DepartmentEntity>((x, bPlace, department) => x.DepartmentNo == department.No)
.WhereIF(request.Factories.IsPresent(), x => request.Factories.Contains(x.TenantId))
.WhereIF(request.UserCode.IsPresent(), x => x.UserCode == request.UserCode)
.WhereIF(request.DepartmentNo.IsPresent(), x => x.DepartmentNo == request.DepartmentNo)
.WhereIF(request.SearchDateTimePeriod.HasValue(), x => x.CostDate >= request.SearchDateTimePeriod.Start && x.CostDate <= request.SearchDateTimePeriod.End) //成本日期
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid && x.Type == BalanceRecordTypeEnumType.Out) //有效,消费数据
.Where(x => x.Source == BalanceRecordSourceEnumType.Birthday)