fix 支持月份定义

This commit is contained in:
2025-10-11 13:46:00 +08:00
parent 50a72fe5f4
commit 7402d75ed2

View File

@@ -5,6 +5,7 @@ using Dlhis.Entity.Canteen.Enums;
using Dlhis.ScheduledTask.TaskAssignment.Request; using Dlhis.ScheduledTask.TaskAssignment.Request;
using Dlhis.ScheduledTask.TaskAssignment.Response; using Dlhis.ScheduledTask.TaskAssignment.Response;
using Dlhis.ScheduledTask.TaskAssignment.Services; using Dlhis.ScheduledTask.TaskAssignment.Services;
using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.UnifyResultAndValidation.Aop; using Kurisu.AspNetCore.UnifyResultAndValidation.Aop;
@@ -69,12 +70,17 @@ public class AssignmentsController : ControllerBase
} }
[AllowAnonymous] [AllowAnonymous]
[HttpPost("balance/calc")] [HttpPost("balance/calc/{month:int}")]
[IgnoreTenant] [IgnoreTenant]
public async Task Calc() public async Task Calc([FromQuery] int month)
{ {
var s = new DateTime(2025, 8, 1); if (month is < 1 or > 12)
var e = new DateTime(2025, 9, 1); {
throw new UserFriendlyException("月份错误");
}
var s = new DateTime(2025, month, 1);
var e = new DateTime(2025, month + 1, 1);
var userCodes = await _dbContext.Queryable<UserBalanceEntity>() var userCodes = await _dbContext.Queryable<UserBalanceEntity>()
.Where(x => SqlFunc.Subqueryable<UserBalanceTmpEntity>().Where(p => p.UserCode == x.UserCode).NotAny()) .Where(x => SqlFunc.Subqueryable<UserBalanceTmpEntity>().Where(p => p.UserCode == x.UserCode).NotAny())