diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs index b97ff4f8..b4487ac7 100644 --- a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs +++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs @@ -1,5 +1,6 @@ using _0_Framework.Application; +using _0_Framework.Application.Sms; using Company.Domain.ContarctingPartyAgg; using Company.Domain.InstitutionContractAgg; using Hangfire; @@ -13,13 +14,15 @@ public class JobSchedulerRegistrator private readonly IInstitutionContractRepository _institutionContractRepository; private static DateTime? _lastRunCreateTransaction; private static DateTime? _lastRunSendMonthlySms; + private readonly ISmsService _smsService; - public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository) + public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService) { _smsReminder = smsReminder; _backgroundJobClient = backgroundJobClient; _institutionContractRepository = institutionContractRepository; + _smsService = smsService; } public void Register() @@ -91,8 +94,8 @@ public class JobSchedulerRegistrator } catch (Exception e) { - //_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی"); - + await _smsService.Alarm("09114221321", "خطا-ایجاد سند مالی"); + } } diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs new file mode 100644 index 00000000..ddb1796b --- /dev/null +++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs @@ -0,0 +1,10 @@ +using GozareshgirProgramManager.Application.Interfaces; +using GozareshgirProgramManager.Domain.ProjectAgg.Enums; + +public class NullBoardNotificationPublisher:IBoardNotificationPublisher +{ + public Task SendProjectStatusChanged(long userId, TaskSectionStatus oldStatus, TaskSectionStatus newStatus, Guid sectionId) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs index 3cb83458..c08fcf29 100644 --- a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs +++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs @@ -8,6 +8,7 @@ using BackgroundInstitutionContract.Task.Jobs; using CompanyManagment.App.Contracts.Hubs; using CompanyManagment.EFCore.Services; using GozareshgirProgramManager.Application._Bootstrapper; +using GozareshgirProgramManager.Application.Interfaces; using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser; using GozareshgirProgramManager.Infrastructure; using GozareshgirProgramManager.Infrastructure.Persistence.Seed; @@ -31,7 +32,7 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.Configure(builder.Configuration); - +builder.Services.AddScoped(); #region MongoDb var mongoConnectionSection = builder.Configuration.GetSection("MongoDb"); diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs index 2b3032cc..1e7ee84c 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs @@ -76,5 +76,7 @@ public class InstitutionContractViewModel public bool IsInstallment { get; set; } public InstitutionContractVerificationStatus VerificationStatus { get; set; } + public InstitutionContractSigningType? SigningType { get; set; } + public List InstallmentList { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index af34b1b3..6ae60e32 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -4364,6 +4364,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) .OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(), }).Where(x => - x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0) + x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) .ToListAsync(); #endregion @@ -4438,13 +4440,13 @@ public class InstitutionContractRepository : RepositoryBase futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList(); List deatcivedContract = await _context.InstitutionContractSet .Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) && - x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0) + x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) .Select(x => new InstitutionContractViewModel { Id = x.id, @@ -4459,6 +4461,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) @@ -4469,6 +4472,12 @@ public class InstitutionContractRepository : RepositoryBase + x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList(); + + //حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه + institutionContracts = institutionContracts.Except(paidInFull).ToList(); #region RollCallServicCompute @@ -4516,8 +4525,7 @@ public class InstitutionContractRepository : RepositoryBase @@ -4551,8 +4559,7 @@ public class InstitutionContractRepository : RepositoryBase @@ -4579,12 +4586,17 @@ public class InstitutionContractRepository : RepositoryBase x.ContractingPartyId == item.ContractingPartyId) .Select(x => x.id).ToListAsync();