Merge branch 'Feature/SmsRepoetApi' into Main
This commit is contained in:
@@ -45,6 +45,11 @@ public enum TypeOfSmsSetting
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationCode,
|
||||
|
||||
/// <summary>
|
||||
/// لینک تاییدیه ایجاد قرارداد مالی
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationLink,
|
||||
|
||||
/// <summary>
|
||||
/// یادآور وظایف
|
||||
/// </summary>
|
||||
|
||||
@@ -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<long, SmsResult>
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
|
||||
|
||||
#endregion
|
||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||
|
||||
@@ -9,6 +9,11 @@ public class SmsReportDto
|
||||
/// </summary>
|
||||
public string SentDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع پیامک
|
||||
/// </summary>
|
||||
public string TypeOfSms { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -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<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
|
||||
{
|
||||
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
|
||||
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -77,6 +77,9 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
|
||||
typeOfSms = "کد تاییدیه قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationLink:
|
||||
typeOfSms = "لینک تاییدیه ایجاد قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.TaskReminder:
|
||||
typeOfSms = "یادآور وظایف";
|
||||
break;
|
||||
@@ -147,7 +150,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, 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<long, SmsResult>, 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<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(date))
|
||||
if(string.IsNullOrWhiteSpace(date) || string.IsNullOrWhiteSpace(typeOfSmsSetting))
|
||||
return new List<SmsReportListDto>();
|
||||
|
||||
if (date.TryToGeorgianDateTime(out var searchDate) == false)
|
||||
@@ -198,41 +202,12 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, 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)
|
||||
{
|
||||
|
||||
@@ -40,11 +40,12 @@ public class SmsReportController : AdminBaseController
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetExpandedList")]
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
public async Task<List<SmsReportListDto>> 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
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateReminderSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> CreateReminderSmsSetting(int dayOfMonth, string timeOfDay)
|
||||
public async Task<ActionResult<OperationResult>> 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
|
||||
/// <param name="timeOfDay"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateBlockSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> CreateBlockSmsSetting(int dayOfMonth, string timeOfDay)
|
||||
public async Task<ActionResult<OperationResult>> 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
|
||||
/// <param name="timeOfDay"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateWarningSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> CreateWarningSmsSetting(int dayOfMonth, string timeOfDay)
|
||||
public async Task<ActionResult<OperationResult>> 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
|
||||
/// <param name="timeOfDay"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateLegalActionSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> CreateLegalActionSmsSetting(int dayOfMonth, string timeOfDay)
|
||||
public async Task<ActionResult<OperationResult>> 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
|
||||
/// <param name="timeOfDay"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateContractConfirmSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> CreateContractConfirmSmsSetting(int dayOfMonth, string timeOfDay)
|
||||
public async Task<ActionResult<OperationResult>> 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
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("EditSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> EditSmsSetting(SmsSettingDto command)
|
||||
[HttpPut("EditSmsSetting")]
|
||||
public async Task<ActionResult<OperationResult>> EditSmsSetting([FromBody] SmsSettingDto command)
|
||||
{
|
||||
var result =await _smsSettingApplication.EditSmsSetting(command);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user