test .
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using Dlhis.Entity.Canteen.Entities;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Dlhis.Entity.Basic.Enums;
|
||||||
|
using Dlhis.Entity.Canteen.Entities;
|
||||||
using Dlhis.Entity.Canteen.Enums;
|
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;
|
||||||
@@ -71,15 +73,14 @@ public class AssignmentsController : ControllerBase
|
|||||||
[IgnoreTenant]
|
[IgnoreTenant]
|
||||||
public async Task Calc()
|
public async Task Calc()
|
||||||
{
|
{
|
||||||
var userCodes = await _dbContext.Queryable<UserBalanceEntity>()
|
var s = new DateTime(2025, 7, 1);
|
||||||
.Where(x => SqlFunc.Subqueryable<UserBalanceTmpEntity>().Where(p => p.UserCode == x.UserCode).NotAny())
|
var e = new DateTime(2025, 8, 1);
|
||||||
.Select(x => x.UserCode)
|
var userCodes = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.ResignationDate.HasValue && x.ResignationDate >= s && x.ResignationDate <= e)
|
||||||
|
.Where(x => x.Type != GainfoUserTypeEnumType.External && x.Type != GainfoUserTypeEnumType.Outsource)
|
||||||
|
.Select(x => x.Code)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.Take(5000)
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var d = new DateTime(2025, 6, 30);
|
|
||||||
|
|
||||||
foreach (var userCode in userCodes)
|
foreach (var userCode in userCodes)
|
||||||
{
|
{
|
||||||
if (!await _dbContext.Queryable<UserBalanceTmpEntity>().Where(x => x.UserCode == userCode).AnyAsync())
|
if (!await _dbContext.Queryable<UserBalanceTmpEntity>().Where(x => x.UserCode == userCode).AnyAsync())
|
||||||
@@ -96,7 +97,8 @@ public class AssignmentsController : ControllerBase
|
|||||||
.Where(x => x.UserCode == userCode)
|
.Where(x => x.UserCode == userCode)
|
||||||
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
||||||
.Where(x => !BalanceRecordSourceConstants.IgnoreSources.Contains(x.Source))
|
.Where(x => !BalanceRecordSourceConstants.IgnoreSources.Contains(x.Source))
|
||||||
.Where(x => x.CostDate <= d)
|
.Where(x => x.CostDate >= s && x.CostDate <= e)
|
||||||
|
.Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
||||||
.SumAsync(x => x.Amount);
|
.SumAsync(x => x.Amount);
|
||||||
|
|
||||||
await _dbContext.Updateable<UserBalanceTmpEntity>()
|
await _dbContext.Updateable<UserBalanceTmpEntity>()
|
||||||
|
|||||||
Reference in New Issue
Block a user