Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir into Feature/gateway/add-debt-payment
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
@@ -64,6 +64,7 @@ public interface ISmsService
|
||||
|
||||
/// <summary>
|
||||
/// پیامک مسدودی طرف حساب
|
||||
/// قراردادهای قدیم
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="fullname"></param>
|
||||
@@ -74,6 +75,17 @@ public interface ISmsService
|
||||
/// <returns></returns>
|
||||
Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessage(string number, string fullname, string amount, string accountType, string id, string aprove);
|
||||
|
||||
/// <summary>
|
||||
/// پیامک مسدودی طرف حساب
|
||||
/// قرارداد های جدید
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="fullname"></param>
|
||||
/// <param name="amount"></param>
|
||||
/// <param name="code1"></param>
|
||||
/// <param name="code2"></param>
|
||||
/// <returns></returns>
|
||||
Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessageForElectronicContract(string number, string fullname, string amount, string code1, string code2)
|
||||
#endregion
|
||||
|
||||
#region AlarmMessage
|
||||
|
||||
@@ -57,6 +57,18 @@ public class JobSchedulerRegistrator
|
||||
() => SendInstitutionContractConfirmSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.SendWarningSms",
|
||||
() => SendWarningSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.SendLegalActionSms",
|
||||
() => SendLegalActionSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,4 +182,22 @@ public class JobSchedulerRegistrator
|
||||
await _institutionContractRepository.SendInstitutionContractConfirmSmsTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک هشدار
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task SendWarningSms()
|
||||
{
|
||||
_logger.LogInformation("SendWarningSms job run");
|
||||
await _institutionContractRepository.SendWarningSmsTask();
|
||||
}
|
||||
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||
{
|
||||
_logger.LogInformation("SendWarningSms job run");
|
||||
await _institutionContractRepository.SendLegalActionSmsTask();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
public interface IInstitutionContractRepository : IRepository<long, InstitutionContract>
|
||||
{
|
||||
|
||||
|
||||
EditInstitutionContract GetDetails(long id);
|
||||
EditInstitutionContract GetFirstContract(long contractingPartyId, string typeOfContract);
|
||||
List<InstitutionContractViewModel> InstitutionContractsWithoutAccount();
|
||||
@@ -56,12 +56,12 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
void UpdateStatusIfNeeded(long institutionContractId);
|
||||
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
|
||||
Task<InstitutionContract> GetByPublicIdAsync(Guid id);
|
||||
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request,string contractStart = null);
|
||||
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request, string contractStart = null);
|
||||
InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request);
|
||||
|
||||
#region Creation
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extension
|
||||
@@ -73,19 +73,19 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
Task<InstitutionContractDiscountResponse> SetDiscountForExtension(
|
||||
InstitutionContractSetDiscountForExtensionRequest request);
|
||||
Task<InstitutionContractDiscountResponse> ResetDiscountForExtension(InstitutionContractResetDiscountForExtensionRequest request);
|
||||
|
||||
|
||||
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upgrade(Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
#endregion
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
#endregion
|
||||
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
@@ -160,6 +160,25 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
Task CreateTransactionForInstitutionContracts(DateTime endOfMonthGr, string endOfMonthFa, string description);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region WarningSms
|
||||
/// <summary>
|
||||
/// پیامک های هشدار
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendWarningSmsTask();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region legalAction
|
||||
/// <summary>
|
||||
/// پیامک اقدام قضائی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendLegalActionSmsTask();
|
||||
|
||||
#endregion
|
||||
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
|
||||
@@ -94,4 +94,19 @@ public class BlockSmsListData
|
||||
/// آی دی صورت حساب مالی
|
||||
/// </summary>
|
||||
public string AproveId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا قرداد مالی قدیمی است
|
||||
/// </summary>
|
||||
public bool IsElectronicContract { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پابلیک آی دی بخش یک
|
||||
/// </summary>
|
||||
public string Code1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پابلیک آی دی بخش دو
|
||||
/// </summary>
|
||||
public string Code2 { get; set; }
|
||||
}
|
||||
@@ -119,69 +119,69 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
public EditInstitutionContract GetDetails(long id)
|
||||
{
|
||||
return _context.InstitutionContractSet.Select(x => new EditInstitutionContract()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractDateFa = x.ContractDateFa,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Address = x.Address,
|
||||
Description = x.Description,
|
||||
WorkshopManualCount = x.WorkshopManualCount,
|
||||
EmployeeManualCount = x.EmployeeManualCount,
|
||||
ContractAmountString = x.ContractAmount.ToMoney(),
|
||||
ContractAmount = x.ContractAmount,
|
||||
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
|
||||
ObligationString = x.Obligation.ToMoney(),
|
||||
TotalAmountString = x.TotalAmount.ToMoney(),
|
||||
ExtensionNo = x.ExtensionNo,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature,
|
||||
HasValueAddedTax = x.HasValueAddedTax,
|
||||
ValueAddedTax = x.ValueAddedTax,
|
||||
})
|
||||
{
|
||||
Id = x.id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractDateFa = x.ContractDateFa,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Address = x.Address,
|
||||
Description = x.Description,
|
||||
WorkshopManualCount = x.WorkshopManualCount,
|
||||
EmployeeManualCount = x.EmployeeManualCount,
|
||||
ContractAmountString = x.ContractAmount.ToMoney(),
|
||||
ContractAmount = x.ContractAmount,
|
||||
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
|
||||
ObligationString = x.Obligation.ToMoney(),
|
||||
TotalAmountString = x.TotalAmount.ToMoney(),
|
||||
ExtensionNo = x.ExtensionNo,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature,
|
||||
HasValueAddedTax = x.HasValueAddedTax,
|
||||
ValueAddedTax = x.ValueAddedTax,
|
||||
})
|
||||
.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
public EditInstitutionContract GetFirstContract(long contractingPartyId, string typeOfContract)
|
||||
{
|
||||
return _context.InstitutionContractSet.Select(x => new EditInstitutionContract()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractDateFa = x.ContractDateFa,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Address = x.Address,
|
||||
Description = x.Description,
|
||||
WorkshopManualCount = x.WorkshopManualCount,
|
||||
EmployeeManualCount = x.EmployeeManualCount,
|
||||
ContractAmountString = x.ContractAmount.ToMoney(),
|
||||
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
|
||||
ObligationString = x.Obligation.ToMoney(),
|
||||
TotalAmountString = x.TotalAmount.ToMoney(),
|
||||
ExtensionNo = x.ExtensionNo,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature
|
||||
})
|
||||
{
|
||||
Id = x.id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractDateFa = x.ContractDateFa,
|
||||
State = x.State,
|
||||
City = x.City,
|
||||
Address = x.Address,
|
||||
Description = x.Description,
|
||||
WorkshopManualCount = x.WorkshopManualCount,
|
||||
EmployeeManualCount = x.EmployeeManualCount,
|
||||
ContractAmountString = x.ContractAmount.ToMoney(),
|
||||
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
|
||||
ObligationString = x.Obligation.ToMoney(),
|
||||
TotalAmountString = x.TotalAmount.ToMoney(),
|
||||
ExtensionNo = x.ExtensionNo,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature
|
||||
})
|
||||
.Where(x => x.ContractingPartyId == contractingPartyId && x.TypeOfContract == typeOfContract)
|
||||
.OrderBy(x => x.ExtensionNo).FirstOrDefault();
|
||||
}
|
||||
@@ -599,40 +599,40 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}).ToList(),
|
||||
}).ToList();
|
||||
listQuery = listQuery.Select(x => new InstitutionContractViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractAmount = x.ContractAmount,
|
||||
TotalAmount = x.TotalAmount,
|
||||
SearchAmount = x.SearchAmount,
|
||||
IsActiveString = x.IsActiveString,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature,
|
||||
ExpireColor = x.ExpireColor,
|
||||
IsExpier = x.IsExpier,
|
||||
BalanceDouble = x.BalanceDouble,
|
||||
BalanceStr = x.BalanceStr,
|
||||
EmployerViewModels = x.EmployerViewModels,
|
||||
EmployerNo = x.EmployerNo,
|
||||
EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(),
|
||||
WorkshopViewModels = x.WorkshopViewModels,
|
||||
WorkshopCount = x.WorkshopCount,
|
||||
IsContractingPartyBlock = x.IsContractingPartyBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
EmployeeCount =
|
||||
{
|
||||
Id = x.Id,
|
||||
ContractNo = x.ContractNo,
|
||||
ContractStartGr = x.ContractStartGr,
|
||||
ContractStartFa = x.ContractStartFa,
|
||||
ContractEndGr = x.ContractEndGr,
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
RepresentativeId = x.RepresentativeId,
|
||||
RepresentativeName = x.RepresentativeName,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
ContractAmount = x.ContractAmount,
|
||||
TotalAmount = x.TotalAmount,
|
||||
SearchAmount = x.SearchAmount,
|
||||
IsActiveString = x.IsActiveString,
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
Signature = x.Signature,
|
||||
ExpireColor = x.ExpireColor,
|
||||
IsExpier = x.IsExpier,
|
||||
BalanceDouble = x.BalanceDouble,
|
||||
BalanceStr = x.BalanceStr,
|
||||
EmployerViewModels = x.EmployerViewModels,
|
||||
EmployerNo = x.EmployerNo,
|
||||
EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(),
|
||||
WorkshopViewModels = x.WorkshopViewModels,
|
||||
WorkshopCount = x.WorkshopCount,
|
||||
IsContractingPartyBlock = x.IsContractingPartyBlock,
|
||||
BlockTimes = x.BlockTimes,
|
||||
EmployeeCount =
|
||||
((x.WorkshopViewModels.Sum(w => w.LeftWorkIds.Count)) + (x.WorkshopViewModels.Sum(w =>
|
||||
w.InsuranceLeftWorkIds.Count(c => !w.LeftWorkIds.Contains(c))))).ToString(),
|
||||
ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0,
|
||||
}).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
|
||||
ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0,
|
||||
}).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
|
||||
.ThenBy(x => x.WorkshopCount == "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
|
||||
.ThenBy(x => x.IsExpier == "true")
|
||||
.ThenBy(x => x.ExpireColor == "purple")
|
||||
@@ -3550,7 +3550,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//یادآور
|
||||
#region DebtReminderSms
|
||||
|
||||
/// <summary>
|
||||
@@ -3617,8 +3617,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
//ماهانه
|
||||
#region MonthlySms
|
||||
|
||||
/// <summary>
|
||||
@@ -3640,6 +3641,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
//مسدودی
|
||||
#region BlockSms
|
||||
|
||||
/// <summary>
|
||||
@@ -3707,7 +3709,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
var smsList = new List<BlockSmsListData>();
|
||||
|
||||
var institutionContracts = await _context.InstitutionContractSet.Select(x => new InstitutionContractViewModel
|
||||
var institutionContracts = await _context.InstitutionContractSet
|
||||
.Include(x => x.Installments)
|
||||
.Select(x => new InstitutionContractViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
ContractingPartyId = x.ContractingPartyId,
|
||||
@@ -3718,11 +3722,24 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
ContractEndFa = x.ContractEndFa,
|
||||
IsActiveString = x.IsActiveString,
|
||||
ContractAmountDouble = x.ContractAmount,
|
||||
OfficialCompany = x.OfficialCompany
|
||||
OfficialCompany = x.OfficialCompany,
|
||||
IsInstallment = x.IsInstallment,
|
||||
VerificationStatus = x.VerificationStatus,
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).Where(x => x.ContractStartGr < checkDate && x.ContractEndGr >= checkDate &&
|
||||
x.ContractAmountDouble > 0).GroupBy(x => x.ContractingPartyId).Select(x => x.First())
|
||||
x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify).GroupBy(x => x.ContractingPartyId).Select(x => x.First())
|
||||
.ToListAsync();
|
||||
|
||||
// قرارداد هایی که بطور یکجا پرداخت شده اند
|
||||
var paidInFull = institutionContracts.Where(x =>
|
||||
x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
|
||||
|
||||
//حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
|
||||
institutionContracts = institutionContracts.Except(paidInFull).ToList();
|
||||
|
||||
var contractingPartyList = await _context.PersonalContractingParties
|
||||
.Where(x => institutionContracts.Select(ins => ins.ContractingPartyId).Contains(x.id)).ToListAsync();
|
||||
@@ -3735,8 +3752,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Where(x => institutionContracts.Select(ins => ins.Id).Contains(x.InstitutionContractId))
|
||||
.Where(x => x.SendSms && x.PhoneType == "شماره همراه" && !string.IsNullOrWhiteSpace(x.PhoneNumber) &&
|
||||
x.PhoneNumber.Length == 11).ToListAsync();
|
||||
|
||||
foreach (var item in institutionContracts)
|
||||
var oldInstitutionContract = institutionContracts.Where(x => x.IsInstallment == false).ToList();
|
||||
var electronicInstitutionContract = institutionContracts.Where(x => x.IsInstallment == true).ToList();
|
||||
foreach (var item in oldInstitutionContract)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -3820,7 +3838,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Amount = amount,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
InstitutionContractId = item.Id,
|
||||
AproveId = aprove
|
||||
AproveId = aprove,
|
||||
IsElectronicContract = false,
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3838,12 +3860,169 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in electronicInstitutionContract)
|
||||
{
|
||||
try
|
||||
{
|
||||
var contractingParty = contractingPartyList.FirstOrDefault(x => x.id == item.ContractingPartyId);
|
||||
if (contractingParty != null && contractingParty.IsBlock == "true")
|
||||
{
|
||||
var partyName = contractingParty.IsLegal == "حقیقی"
|
||||
? $"{contractingParty.FName} {contractingParty.LName}"
|
||||
: $"{contractingParty.LName}";
|
||||
if (!string.IsNullOrWhiteSpace(contractingParty.SureName))
|
||||
partyName = $"{partyName} ({contractingParty.SureName})";
|
||||
|
||||
if (partyName.Length > 25) partyName = $"{partyName.Substring(0, 25)}";
|
||||
|
||||
var isLegal = contractingParty.IsLegal == "حقوقی" ? true : false;
|
||||
|
||||
var hasFinancialStatment =
|
||||
financialStatmentList.Any(x =>
|
||||
x.ContractingPartyId == item.ContractingPartyId & x.FinancialTransactionList.Count > 0);
|
||||
|
||||
|
||||
var hasPhonNumber = phoneNumberList.Any(x => x.InstitutionContractId == item.Id);
|
||||
|
||||
|
||||
if (hasFinancialStatment && hasPhonNumber)
|
||||
{
|
||||
var transactions =
|
||||
financialStatmentList.FirstOrDefault(x => x.ContractingPartyId == item.ContractingPartyId);
|
||||
|
||||
var debtor = transactions.FinancialTransactionList.Sum(x => x.Deptor);
|
||||
var creditor = transactions.FinancialTransactionList.Sum(x => x.Creditor);
|
||||
|
||||
|
||||
var id = $"{item.ContractingPartyId}";
|
||||
var aprove = $"{transactions.id}";
|
||||
var balance = debtor - creditor;
|
||||
if (balance > 0)
|
||||
{
|
||||
|
||||
var instalment = item.InstallmentList
|
||||
.FirstOrDefault().AmountDouble;
|
||||
|
||||
var sumOfAmounts = instalment * 2;
|
||||
if (balance >= sumOfAmounts)
|
||||
{
|
||||
var phoneNumbers = new List<CreateContactInfo>();
|
||||
phoneNumbers = phoneNumberList.Where(x => x.InstitutionContractId == item.Id)
|
||||
.Select(x => new CreateContactInfo
|
||||
{
|
||||
PhoneType = x.PhoneType,
|
||||
PhoneNumber = x.PhoneNumber,
|
||||
|
||||
InstitutionContractId = x.InstitutionContractId,
|
||||
SendSms = x.SendSms
|
||||
}).Where(x => x.PhoneNumber.Length == 11).ToList();
|
||||
|
||||
|
||||
var accountType = item.OfficialCompany == "Official" ? "ol" : "nol";
|
||||
|
||||
var balanceToMoney = balance.ToMoney();
|
||||
var amount = balanceToMoney + " " + "ریال" + " ";
|
||||
string publicId = transactions.PublicIdStr;
|
||||
string code1 = publicId.Substring(0, 25);
|
||||
string code2 = publicId.Substring(25);
|
||||
foreach (var number in phoneNumbers)
|
||||
{
|
||||
|
||||
smsList.Add(new BlockSmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
PartyName = partyName,
|
||||
AccountType = accountType,
|
||||
Amount = amount,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
InstitutionContractId = item.Id,
|
||||
AproveId = aprove,
|
||||
IsElectronicContract = true,
|
||||
Code1 = code1,
|
||||
Code2 = code2
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string name = item.ContractingPartyName.Length > 18
|
||||
? item.ContractingPartyName.Substring(0, 18)
|
||||
: item.ContractingPartyName;
|
||||
string errMess = $"{name}-خطا";
|
||||
await _smsService.Alarm("09114221321", errMess);
|
||||
}
|
||||
}
|
||||
return smsList;
|
||||
}
|
||||
public async Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
||||
string sendMessStart, string sendMessEnd)
|
||||
{
|
||||
if (smsListData.Any())
|
||||
{
|
||||
await _smsService.Alarm("09114221321", sendMessStart);
|
||||
Thread.Sleep(1000);
|
||||
await _smsService.Alarm("09111485044", sendMessStart);
|
||||
Thread.Sleep(1000);
|
||||
int successProcess = 1;
|
||||
int countList = smsListData.Count;
|
||||
|
||||
foreach (var item in smsListData)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (item.IsElectronicContract)
|
||||
{
|
||||
var smsResult = await _smsService.BlockMessageForElectronicContract(item.PhoneNumber, item.PartyName,
|
||||
item.Amount, item.Code1, $"{item.Code2}");
|
||||
Thread.Sleep(1000);
|
||||
var createSmsResult = new Company.Domain.SmsResultAgg.SmsResult(smsResult.messaeId,
|
||||
smsResult.message, typeOfSms,
|
||||
item.PartyName, item.PhoneNumber, item.ContractingPartyId, item.InstitutionContractId);
|
||||
await _smsResultRepository.CreateAsync(createSmsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
var smsResult = await _smsService.BlockMessage(item.PhoneNumber, item.PartyName,
|
||||
item.Amount, item.AccountType, $"{item.ContractingPartyId}", item.AproveId);
|
||||
Thread.Sleep(1000);
|
||||
var createSmsResult = new Company.Domain.SmsResultAgg.SmsResult(smsResult.messaeId,
|
||||
smsResult.message, typeOfSms,
|
||||
item.PartyName, item.PhoneNumber, item.ContractingPartyId, item.InstitutionContractId);
|
||||
await _smsResultRepository.CreateAsync(createSmsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string name = item.PartyName.Length > 18 ? item.PartyName.Substring(0, 18) : item.PartyName;
|
||||
string errMess = $"{name}-خطا";
|
||||
await _smsService.Alarm("09114221321", errMess);
|
||||
}
|
||||
|
||||
Thread.Sleep(600);
|
||||
var percent = (successProcess / (double)countList) * 100;
|
||||
await _hubContext.Clients.Group(SendSmsHub.GetGroupName(10))
|
||||
.SendAsync("showStatus", (int)percent);
|
||||
|
||||
successProcess += 1;
|
||||
}
|
||||
|
||||
|
||||
await _smsService.Alarm("09114221321", sendMessEnd);
|
||||
Thread.Sleep(1000);
|
||||
await _smsService.Alarm("09111485044", sendMessEnd);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//دریافت لیست بدهکاران و ارسال پیامک
|
||||
#region GetListAndSendSmsMethods
|
||||
|
||||
/// <summary>
|
||||
///دریافت لیست بدهکارن
|
||||
@@ -3884,7 +4063,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).Where(x => x.ContractStartGr < checkDate && x.ContractEndGr >= checkDate &&
|
||||
x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
@@ -3972,7 +4151,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var aprove = $"{transactions.id}";
|
||||
var balance = debtor - creditor;
|
||||
|
||||
|
||||
|
||||
|
||||
if (balance > 0) // اگر بدهکار بود
|
||||
{
|
||||
@@ -4015,28 +4194,28 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||
number.PhoneNumber.Length == 11)
|
||||
{
|
||||
|
||||
var templateId = 161233;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 394006;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
var templateId = 161233;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 394006;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4048,28 +4227,28 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||
number.PhoneNumber.Length == 11)
|
||||
{
|
||||
|
||||
var templateId = 347415;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 679068;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
var templateId = 347415;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 679068;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4085,28 +4264,28 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||
number.PhoneNumber.Length == 11)
|
||||
{
|
||||
|
||||
var templateId = 998180;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 646040;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
var templateId = 998180;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 646040;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4119,29 +4298,29 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||
number.PhoneNumber.Length == 11)
|
||||
{
|
||||
|
||||
|
||||
var templateId = 810539;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 566537;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
var templateId = 810539;
|
||||
if (typeOfSmsSetting ==
|
||||
TypeOfSmsSetting.MonthlyInstitutionContract)
|
||||
{
|
||||
templateId = 566537;
|
||||
}
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
PhoneNumber = number.PhoneNumber,
|
||||
TemplateId = templateId,
|
||||
PartyName = partyName,
|
||||
Amount = balanceToMoney,
|
||||
ContractingPartyId = contractingParty.id,
|
||||
AproveId = aprove,
|
||||
TypeOfSmsMethod = "MonthlyBill",
|
||||
Code1 = "",
|
||||
Code2 = "",
|
||||
InstitutionContractId = item.Id
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4233,7 +4412,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
templateId = 479624;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (balance > 0) // اگر بدهکار بود
|
||||
{
|
||||
var balanceToMoney = balance.ToMoney();
|
||||
@@ -4243,7 +4422,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
string publicId = transactions.PublicIdStr;
|
||||
string code1 = publicId.Substring(0, 25);
|
||||
string code2 = publicId.Substring(25);
|
||||
|
||||
|
||||
|
||||
smsList.Add(new SmsListData()
|
||||
{
|
||||
@@ -4280,52 +4459,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return smsList;
|
||||
}
|
||||
|
||||
public async Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
||||
string sendMessStart, string sendMessEnd)
|
||||
{
|
||||
if (smsListData.Any())
|
||||
{
|
||||
await _smsService.Alarm("09114221321", sendMessStart);
|
||||
Thread.Sleep(1000);
|
||||
await _smsService.Alarm("09111485044", sendMessStart);
|
||||
Thread.Sleep(1000);
|
||||
int successProcess = 1;
|
||||
int countList = smsListData.Count;
|
||||
|
||||
foreach (var item in smsListData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var smsResult = await _smsService.BlockMessage(item.PhoneNumber, item.PartyName,
|
||||
item.Amount, item.AccountType, $"{item.ContractingPartyId}", item.AproveId);
|
||||
Thread.Sleep(1000);
|
||||
var createSmsResult = new Company.Domain.SmsResultAgg.SmsResult(smsResult.messaeId,
|
||||
smsResult.message, typeOfSms,
|
||||
item.PartyName, item.PhoneNumber, item.ContractingPartyId, item.InstitutionContractId);
|
||||
await _smsResultRepository.CreateAsync(createSmsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string name = item.PartyName.Length > 18 ? item.PartyName.Substring(0, 18) : item.PartyName;
|
||||
string errMess = $"{name}-خطا";
|
||||
await _smsService.Alarm("09114221321", errMess);
|
||||
}
|
||||
|
||||
Thread.Sleep(600);
|
||||
var percent = (successProcess / (double)countList) * 100;
|
||||
await _hubContext.Clients.Group(SendSmsHub.GetGroupName(10))
|
||||
.SendAsync("showStatus", (int)percent);
|
||||
|
||||
successProcess += 1;
|
||||
}
|
||||
|
||||
|
||||
await _smsService.Alarm("09114221321", sendMessEnd);
|
||||
Thread.Sleep(1000);
|
||||
await _smsService.Alarm("09111485044", sendMessEnd);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک های یاد آور بدهی
|
||||
@@ -4410,6 +4544,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateMetods
|
||||
|
||||
@@ -4539,9 +4674,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//ایجاد سند مالی ماهانه
|
||||
#region CreateMontlyTransaction
|
||||
|
||||
/// <summary>
|
||||
@@ -4581,7 +4716,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).Where(x =>
|
||||
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 &&
|
||||
@@ -4628,7 +4763,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).ToListAsync();
|
||||
|
||||
@@ -4932,6 +5067,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<long> GetIdByInstallmentId(long installmentId)
|
||||
{
|
||||
return await _context.InstitutionContractSet.Include(x => x.Installments)
|
||||
@@ -5285,7 +5423,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
var creationTemp = await _institutionContractCreationTemp.Find(x => x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
// creationTemp.SetContractingPartyInfo(request.LegalType,request.RealParty,request.LegalParty);
|
||||
// creationTemp.SetContractingPartyInfo(request.LegalType,request.RealParty,request.LegalParty);
|
||||
|
||||
if (creationTemp == null)
|
||||
{
|
||||
@@ -5367,9 +5505,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Id = 0,
|
||||
IdNumberSerial = "",
|
||||
IdNumberSeri = "",
|
||||
|
||||
|
||||
};
|
||||
creationTemp.SetContractingPartyInfo(request.LegalType,real,legal);
|
||||
creationTemp.SetContractingPartyInfo(request.LegalType, real, legal);
|
||||
}
|
||||
|
||||
creationTemp.SetContractingPartyContactInfo(request.Address, request.City, request.Province,
|
||||
@@ -5575,9 +5713,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
else
|
||||
{
|
||||
var monthly = institutionTemp.MonthlyPayment;
|
||||
|
||||
|
||||
institutionTemp.MonthlyPayment.TotalAmountWithoutDiscount = monthly.TotalAmount;
|
||||
|
||||
|
||||
res.Monthly = new()
|
||||
{
|
||||
PaymentAmount = monthly.PaymentAmount,
|
||||
@@ -6143,6 +6281,114 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region WarningSms
|
||||
|
||||
public async Task SendWarningSmsTask()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
|
||||
// تبدیل تاریخ میلادی به شمسی
|
||||
var persianNow = now.ToFarsi();
|
||||
var persianEndOfMonth = int.Parse(persianNow.FindeEndOfMonth().Substring(8, 2));
|
||||
var dayOfMonth = int.Parse(persianNow.Substring(8, 2));
|
||||
var hour = now.Hour;
|
||||
var minute = now.Minute;
|
||||
var checkAnyToExecute = false;
|
||||
|
||||
//اگر آخرین روز ماه باشد
|
||||
//اگر روز مثلا عدد روز 31 بود ولی آخرین روز ماه 30 بود
|
||||
if (dayOfMonth == persianEndOfMonth)
|
||||
{
|
||||
checkAnyToExecute = await _context.SmsSettings
|
||||
.AnyAsync(x =>
|
||||
x.DayOfMonth >= dayOfMonth &&
|
||||
x.TimeOfDay.Hours == hour &&
|
||||
x.TimeOfDay.Minutes == minute &&
|
||||
x.TypeOfSmsSetting == TypeOfSmsSetting.Warning &&
|
||||
x.IsActive
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAnyToExecute = await _context.SmsSettings
|
||||
.AnyAsync(x =>
|
||||
x.DayOfMonth == dayOfMonth &&
|
||||
x.TimeOfDay.Hours == hour &&
|
||||
x.TimeOfDay.Minutes == minute &&
|
||||
x.TypeOfSmsSetting == TypeOfSmsSetting.Warning &&
|
||||
x.IsActive
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (checkAnyToExecute)
|
||||
{
|
||||
//اجرای تسک
|
||||
_logger.LogInformation("اجرای تسک ارسال پیامک هشدار SendWarningSms" +
|
||||
persianNow + " - " + hour + ":" + minute);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region LegalActionSms
|
||||
|
||||
|
||||
public async Task SendLegalActionSmsTask()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
|
||||
// تبدیل تاریخ میلادی به شمسی
|
||||
var persianNow = now.ToFarsi();
|
||||
var persianEndOfMonth = int.Parse(persianNow.FindeEndOfMonth().Substring(8, 2));
|
||||
var dayOfMonth = int.Parse(persianNow.Substring(8, 2));
|
||||
var hour = now.Hour;
|
||||
var minute = now.Minute;
|
||||
var checkAnyToExecute = false;
|
||||
|
||||
//اگر آخرین روز ماه باشد
|
||||
//اگر روز مثلا عدد روز 31 بود ولی آخرین روز ماه 30 بود
|
||||
if (dayOfMonth == persianEndOfMonth)
|
||||
{
|
||||
checkAnyToExecute = await _context.SmsSettings
|
||||
.AnyAsync(x =>
|
||||
x.DayOfMonth >= dayOfMonth &&
|
||||
x.TimeOfDay.Hours == hour &&
|
||||
x.TimeOfDay.Minutes == minute &&
|
||||
x.TypeOfSmsSetting == TypeOfSmsSetting.LegalAction &&
|
||||
x.IsActive
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAnyToExecute = await _context.SmsSettings
|
||||
.AnyAsync(x =>
|
||||
x.DayOfMonth == dayOfMonth &&
|
||||
x.TimeOfDay.Hours == hour &&
|
||||
x.TimeOfDay.Minutes == minute &&
|
||||
x.TypeOfSmsSetting == TypeOfSmsSetting.LegalAction &&
|
||||
x.IsActive
|
||||
);
|
||||
}
|
||||
|
||||
if (checkAnyToExecute)
|
||||
{
|
||||
//اجرای تسک
|
||||
_logger.LogInformation("اجرای تسک ارسال پیامک اقدام قضائی SendLegalActionSms" +
|
||||
persianNow + " - " + hour + ":" + minute);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CustomViewModels
|
||||
|
||||
public class WorkshopsAndEmployeeViewModel
|
||||
|
||||
@@ -518,6 +518,31 @@ public class SmsService : ISmsService
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessageForElectronicContract(string number, string fullname, string amount,string code1, string code2)
|
||||
{
|
||||
var tamplateId = 117685;
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullname), new("AMOUNT", amount), new("CODE1", code1), new("CODE2", code2)
|
||||
});
|
||||
Thread.Sleep(500);
|
||||
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user