From 149fa2e9e2c7a07f24c0ea58587e91f6bc0da55d Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 9 Dec 2025 14:22:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=81=94=E5=90=88=E7=B4=A2=E5=BC=95,?= =?UTF-8?q?=E5=B9=B4=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/UserBalanceUploadRecordEntity.cs | 16 ++++++++-------- Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs | 7 +++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceUploadRecordEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceUploadRecordEntity.cs index 7d81c52e..dd5ecf42 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceUploadRecordEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceUploadRecordEntity.cs @@ -9,24 +9,24 @@ namespace Dlhis.Entity.Canteen.Entities; [SugarTable(TableName = "UserBalanceUploadRecords", TableDescription = "用户消费上传记录表")] public class UserBalanceUploadRecordEntity : SugarBaseEntity { + /// + /// 学工号 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_UserBalances_useCode" })] + public string UserCode { get; set; } + /// /// 年份 /// - [SugarColumn(IsNullable = false, ColumnDescription = "年份")] + [SugarColumn(IsNullable = false, ColumnDescription = "年份", UniqueGroupNameList = new[] { "idx_UserBalances_useCode" })] public int Year { get; set; } /// /// 月份 /// - [SugarColumn(IsNullable = false, ColumnDescription = "月份")] + [SugarColumn(IsNullable = false, ColumnDescription = "月份", UniqueGroupNameList = new[] { "idx_UserBalances_useCode" })] public int Month { get; set; } - /// - /// 学工号 - /// - [SugarColumn(IsNullable = false, ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_UserBalances_useCode" })] - public string UserCode { get; set; } - /// /// 消费 /// diff --git a/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs b/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs index 6695974e..8d18ae87 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/CostUploadJob.cs @@ -23,9 +23,12 @@ public class CostUploadJob : BaseJob var jipApi = serviceProvider.GetService(); var now = DateTime.Now; + + var year = now.Month == 1 ? now.Year - 1 : now.Year; var month = now.Month == 1 ? 12 : now.Month - 1; - var s = new DateTime(2025, month, 1); - var e = new DateTime(2025, month + 1, 1); + + var s = new DateTime(year, month, 1); + var e = new DateTime(year, month + 1, 1); var endDayOfMonth = e.AddDays(-1); //从余额找人