employeeDocument Refactor

This commit is contained in:
MahanCh
2025-05-05 18:09:53 +03:30
parent 9cdb922aa1
commit 6eec454685
63 changed files with 16549 additions and 978 deletions

View File

@@ -1,6 +1,7 @@
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.RollCallAgg.DomainService;
using CompanyManagment.App.Contracts.EmployeeDocuments;
using WorkFlow.Application.Contracts.RollCallConfirmedAbsence;
using WorkFlow.Application.Contracts.RollCallConfirmedWithoutLunchBreak;
using WorkFlow.Application.Contracts.Shared;
@@ -21,8 +22,8 @@ public class WorkFlowApplication : IWorkFlowApplication
private readonly IWorkFlowCustomizedWorkshopSettingsACL _customizedWorkshopSettingsACL;
private readonly IRollCallDomainService _rollCallDomainService;
private readonly IRollCallConfirmedWithoutLunchBreakRepository _rollCallConfirmedWithoutLunchBreakRepository;
public WorkFlowApplication(IRollCallConfirmedAbsenceRepository absenceRepository, IWorkFlowRollCallACL rollCallACL, IWorkFlowCheckoutACL checkoutACL, IWorkFlowCustomizedWorkshopSettingsACL customizedWorkshopSettingsACL, IRollCallConfirmedWithoutLunchBreakRepository rollCallConfirmedWithoutLunchBreakRepository, IRollCallDomainService rollCallDomainService)
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
public WorkFlowApplication(IRollCallConfirmedAbsenceRepository absenceRepository, IWorkFlowRollCallACL rollCallACL, IWorkFlowCheckoutACL checkoutACL, IWorkFlowCustomizedWorkshopSettingsACL customizedWorkshopSettingsACL, IRollCallConfirmedWithoutLunchBreakRepository rollCallConfirmedWithoutLunchBreakRepository, IRollCallDomainService rollCallDomainService, IEmployeeDocumentsApplication employeeDocumentsApplication)
{
_absenceRepository = absenceRepository;
_rollCallACL = rollCallACL;
@@ -30,6 +31,7 @@ public class WorkFlowApplication : IWorkFlowApplication
_customizedWorkshopSettingsACL = customizedWorkshopSettingsACL;
_rollCallConfirmedWithoutLunchBreakRepository = rollCallConfirmedWithoutLunchBreakRepository;
_rollCallDomainService = rollCallDomainService;
_employeeDocumentsApplication = employeeDocumentsApplication;
}
public async Task<OperationResult> CreateRollCallConfirmedAbsence(CreateRollCallConfirmedAbsence command)
@@ -57,16 +59,16 @@ public class WorkFlowApplication : IWorkFlowApplication
var newEntity = new RollCallConfirmedWithoutLunchBreak(command.RollCallId, entity.EmployeeId, entity.WorkshopId, entity.RollCallDate);
_rollCallConfirmedWithoutLunchBreakRepository.Create(newEntity);
await _rollCallConfirmedWithoutLunchBreakRepository.CreateAsync(newEntity);
await _rollCallConfirmedWithoutLunchBreakRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<int> GetCountAllWorkFlows(long workshopId)
public async Task<int> GetCountAllWorkFlows(long workshopId,long accountId)
{
int count = 0;
count += await GetAllWorkFlowCount(workshopId);
count += await GetAllWorkFlowCount(workshopId,accountId);
return count;
}
public Task<int> GetRollCallAbsentsWorkFlows(long workshopId)
@@ -81,29 +83,53 @@ public class WorkFlowApplication : IWorkFlowApplication
{
return (await GetRollCallWorkFlowsCutByBgService(workshopId)).Count;
}
public async Task<int> GetAllWorkFlowCount(long workshopId)
{
var count = 0;
var activeServiceByWorkshopId = _rollCallACL.GetActiveServiceByWorkshopId(workshopId);
if (activeServiceByWorkshopId == null)
{
return count;
}
//count += _rollCallACL.GetRollCallAbsentsWorkFlows(accId, workshopId);
count += (await GetAbsentRollCallWorkFlows(workshopId))?.Count ?? 0;
count += (await GetRollCallWorkFlowsCutByBgService(workshopId))?.Count ?? 0;
count += (await GetEmployeesWithoutLunchBreak(workshopId))?.Count ?? 0;
//count += (await GetRollCallsOverlappingLeaves(workshopId))?.Count ?? 0;
count += (await GetUndefinedRollCalls(workshopId))?.Count ?? 0;
public async Task<int> GetAllWorkFlowCount(long workshopId,long accountId)
{
var count = 0;
// RollCall
count += await GetAllRollCallCount(workshopId);
count += await GetAllEmployeeDocuments(workshopId,accountId );
// Employee Documents
return count;
}
public async Task<int> GetAllEmployeeDocuments(long workshopId, long accountId)
{
int count = 0;
count += (await _employeeDocumentsApplication.GetClientRejectedDocumentForClient(workshopId, accountId)).Count;
return count;
}
public Task<int> GetAllWorkFlowCountAsync(long workshopId)
{
return Task.FromResult(20);
}
public async Task<int> GetAllRollCallCount(long workshopId)
{
int count = 0;
var activeServiceByWorkshopId = _rollCallACL.GetActiveServiceByWorkshopId(workshopId);
if (activeServiceByWorkshopId == null)
{
return count;
}
//count += _rollCallACL.GetRollCallAbsentsWorkFlows(accId, workshopId);
count += (await GetAbsentRollCallWorkFlows(workshopId))?.Count ?? 0;
count += (await GetRollCallWorkFlowsCutByBgService(workshopId))?.Count ?? 0;
count += (await GetEmployeesWithoutLunchBreak(workshopId))?.Count ?? 0;
//count += (await GetRollCallsOverlappingLeaves(workshopId))?.Count ?? 0;
count += (await GetUndefinedRollCalls(workshopId))?.Count ?? 0;
return count;
}
#region Methods For Ajax
/// <summary>
@@ -342,8 +368,6 @@ public class WorkFlowApplication : IWorkFlowApplication
}
#region Methods For OnGet