diff --git a/0_Framework/Application/Enums/TypeOfSmsSetting.cs b/0_Framework/Application/Enums/TypeOfSmsSetting.cs
index 28089ced..a604e9e6 100644
--- a/0_Framework/Application/Enums/TypeOfSmsSetting.cs
+++ b/0_Framework/Application/Enums/TypeOfSmsSetting.cs
@@ -45,6 +45,11 @@ public enum TypeOfSmsSetting
///
SendInstitutionContractConfirmationCode,
+ ///
+ /// لینک تاییدیه ایجاد قرارداد مالی
+ ///
+ SendInstitutionContractConfirmationLink,
+
///
/// یادآور وظایف
///
diff --git a/Company.Domain/SmsResultAgg/ISmsResultRepository.cs b/Company.Domain/SmsResultAgg/ISmsResultRepository.cs
index 24ee411b..395e3f4c 100644
--- a/Company.Domain/SmsResultAgg/ISmsResultRepository.cs
+++ b/Company.Domain/SmsResultAgg/ISmsResultRepository.cs
@@ -1,4 +1,5 @@
-using _0_Framework.Domain;
+using _0_Framework.Application.Enums;
+using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System.Collections.Generic;
@@ -22,8 +23,9 @@ public interface ISmsResultRepository : IRepository
///
///
///
+ ///
///
- Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
+ Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
#endregion
List Search(SmsResultSearchModel searchModel);
diff --git a/CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs b/CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs
index 445ed2b0..9a1fc20a 100644
--- a/CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs
+++ b/CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs
@@ -9,6 +9,11 @@ public class SmsReportDto
///
public string SentDate { get; set; }
+ ///
+ /// نوع پیامک
+ ///
+ public string TypeOfSms { get; set; }
+
}
diff --git a/CompanyManagment.App.Contracts/SmsResult/ISmsResultApplication.cs b/CompanyManagment.App.Contracts/SmsResult/ISmsResultApplication.cs
index 2c857396..cc8bfc54 100644
--- a/CompanyManagment.App.Contracts/SmsResult/ISmsResultApplication.cs
+++ b/CompanyManagment.App.Contracts/SmsResult/ISmsResultApplication.cs
@@ -1,4 +1,5 @@
using _0_Framework.Application;
+using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System;
using System.Collections.Generic;
@@ -24,8 +25,9 @@ public interface ISmsResultApplication
///
///
///
+ ///
///
- Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
+ Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
#endregion
diff --git a/CompanyManagment.Application/SmsResultApplication.cs b/CompanyManagment.Application/SmsResultApplication.cs
index 2c94d837..3cbd8981 100644
--- a/CompanyManagment.Application/SmsResultApplication.cs
+++ b/CompanyManagment.Application/SmsResultApplication.cs
@@ -1,10 +1,11 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using _0_Framework.Application;
+using _0_Framework.Application;
+using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
namespace CompanyManagment.Application;
@@ -25,9 +26,9 @@ public class SmsResultApplication : ISmsResultApplication
return await _smsResultRepository.GetSmsReportList(searchModel);
}
- public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
+ public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
- return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
+ return await _smsResultRepository.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
}
#endregion
diff --git a/CompanyManagment.EFCore/Repository/SmsResultRepository.cs b/CompanyManagment.EFCore/Repository/SmsResultRepository.cs
index 18ccbe1d..ee557614 100644
--- a/CompanyManagment.EFCore/Repository/SmsResultRepository.cs
+++ b/CompanyManagment.EFCore/Repository/SmsResultRepository.cs
@@ -77,6 +77,9 @@ public class SmsResultRepository : RepositoryBase, ISmsResultRe
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
typeOfSms = "کد تاییدیه قرارداد مالی";
break;
+ case TypeOfSmsSetting.SendInstitutionContractConfirmationLink:
+ typeOfSms = "لینک تاییدیه ایجاد قرارداد مالی";
+ break;
case TypeOfSmsSetting.TaskReminder:
typeOfSms = "یادآور وظایف";
break;
@@ -147,7 +150,7 @@ public class SmsResultRepository : RepositoryBase, ISmsResultRe
// مرحله 2: گروهبندی و انتخاب آخرین رکورد هر روز روی Client
var grouped = rawQuery
- .GroupBy(x => x.DateOnly)
+ .GroupBy(x => (x.DateOnly, x.TypeOfSms))
.Select(g => g.OrderByDescending(x => x.CreationDate).First())
.OrderByDescending(x => x.CreationDate)
.ToList();
@@ -155,15 +158,16 @@ public class SmsResultRepository : RepositoryBase, ISmsResultRe
// مرحله 3: تبدیل به DTO و ToFarsi
var result = grouped.Select(x => new SmsReportDto
{
- SentDate = x.CreationDate.ToFarsi()
+ SentDate = x.CreationDate.ToFarsi(),
+ TypeOfSms = x.TypeOfSms
}).ToList();
return result;
}
- public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
+ public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
- if(string.IsNullOrWhiteSpace(date))
+ if(string.IsNullOrWhiteSpace(date) || string.IsNullOrWhiteSpace(typeOfSmsSetting))
return new List();
if (date.TryToGeorgianDateTime(out var searchDate) == false)
@@ -198,41 +202,12 @@ public class SmsResultRepository : RepositoryBase, ISmsResultRe
query = query.Where(x => x.Mobile.Contains(searchModel.Mobile)).ToList();
}
- if (searchModel.TypeOfSms != TypeOfSmsSetting.All && searchModel.TypeOfSms != TypeOfSmsSetting.Warning)
- {
- var typeOfSms = "All";
- switch (searchModel.TypeOfSms)
- {
- case TypeOfSmsSetting.InstitutionContractDebtReminder:
- typeOfSms = "یادآور بدهی ماهانه";
- break;
- case TypeOfSmsSetting.MonthlyInstitutionContract:
- typeOfSms = "صورت حساب ماهانه";
- break;
- case TypeOfSmsSetting.BlockContractingParty:
- typeOfSms = "اعلام مسدودی طرف حساب";
- break;
- case TypeOfSmsSetting.LegalAction:
- typeOfSms = "اقدام قضایی";
- break;
- case TypeOfSmsSetting.InstitutionContractConfirm:
- typeOfSms = "یادآور تایید قرارداد مالی";
- break;
- case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
- typeOfSms = "کد تاییدیه قرارداد مالی";
- break;
- case TypeOfSmsSetting.TaskReminder:
- typeOfSms = "یادآور وظایف";
- break;
- }
- query = query.Where(x => x.TypeOfSms == typeOfSms).ToList();
- }
-
- if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
+ if (typeOfSmsSetting.Contains("هشدار"))
{
query = query.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
}
+ query = query.Where(x => x.TypeOfSms == typeOfSmsSetting).ToList();
if (searchModel.SendStatus != SendStatus.All)
{
diff --git a/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs b/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs
index de7fc3a2..b1bd8d0d 100644
--- a/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs
+++ b/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs
@@ -40,11 +40,12 @@ public class SmsReportController : AdminBaseController
///
///
///
+ ///
///
[HttpGet("GetExpandedList")]
- public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
+ public async Task> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
- var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date);
+ var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
return result;
}
@@ -131,7 +132,7 @@ public class SmsReportController : AdminBaseController
///
///
[HttpPost("CreateReminderSmsSetting")]
- public async Task> CreateReminderSmsSetting(int dayOfMonth, string timeOfDay)
+ public async Task> CreateReminderSmsSetting([FromBody] int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.InstitutionContractDebtReminder);
return result;
@@ -144,7 +145,7 @@ public class SmsReportController : AdminBaseController
///
///
[HttpPost("CreateBlockSmsSetting")]
- public async Task> CreateBlockSmsSetting(int dayOfMonth, string timeOfDay)
+ public async Task> CreateBlockSmsSetting([FromBody] int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.BlockContractingParty);
return result;
@@ -157,7 +158,7 @@ public class SmsReportController : AdminBaseController
///
///
[HttpPost("CreateWarningSmsSetting")]
- public async Task> CreateWarningSmsSetting(int dayOfMonth, string timeOfDay)
+ public async Task> CreateWarningSmsSetting([FromBody] int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.Warning);
return result;
@@ -171,7 +172,7 @@ public class SmsReportController : AdminBaseController
///
///
[HttpPost("CreateLegalActionSmsSetting")]
- public async Task> CreateLegalActionSmsSetting(int dayOfMonth, string timeOfDay)
+ public async Task> CreateLegalActionSmsSetting([FromBody] int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.LegalAction);
return result;
@@ -185,7 +186,7 @@ public class SmsReportController : AdminBaseController
///
///
[HttpPost("CreateContractConfirmSmsSetting")]
- public async Task> CreateContractConfirmSmsSetting(int dayOfMonth, string timeOfDay)
+ public async Task> CreateContractConfirmSmsSetting([FromBody] int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.InstitutionContractConfirm);
return result;
@@ -208,8 +209,8 @@ public class SmsReportController : AdminBaseController
///
///
///
- [HttpPost("EditSmsSetting")]
- public async Task> EditSmsSetting(SmsSettingDto command)
+ [HttpPut("EditSmsSetting")]
+ public async Task> EditSmsSetting([FromBody] SmsSettingDto command)
{
var result =await _smsSettingApplication.EditSmsSetting(command);
return result;