280 lines
9.8 KiB
C#
280 lines
9.8 KiB
C#
using _0_Framework.Application;
|
||
using _0_Framework.Application.Enums;
|
||
using _0_Framework.Application.Sms;
|
||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||
using CompanyManagment.App.Contracts.SmsResult;
|
||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using ServiceHost.BaseControllers;
|
||
|
||
namespace ServiceHost.Areas.Admin.Controllers;
|
||
|
||
public class SmsReportController : AdminBaseController
|
||
{
|
||
private readonly ISmsResultApplication _smsResultApplication;
|
||
private readonly ISmsSettingApplication _smsSettingApplication;
|
||
private readonly ISmsService _smsService;
|
||
|
||
public SmsReportController(ISmsResultApplication smsResultApplication, ISmsService smsService, ISmsSettingApplication smsSettingApplication)
|
||
{
|
||
_smsResultApplication = smsResultApplication;
|
||
_smsService = smsService;
|
||
_smsSettingApplication = smsSettingApplication;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست پیامک ها
|
||
/// </summary>
|
||
/// <param name="searchModel"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||
{
|
||
|
||
var result =await _smsResultApplication.GetSmsReportList(searchModel);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت اطلاعات هر تاریخ برای اکسپند
|
||
/// </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, string typeOfSmsSetting)
|
||
{
|
||
var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت جزئیات پیامک
|
||
/// </summary>
|
||
/// <param name="messId"></param>
|
||
/// <param name="fullName"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetSmsDetails")]
|
||
public async Task<SmsDetailsDto> GetSmsDetails(int messId, string fullName)
|
||
{
|
||
var result =await _smsService.GetSmsDetailsByMessageId(messId, fullName);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// گزارش ای پی آی
|
||
/// </summary>
|
||
/// <param name="startDate"></param>
|
||
/// <param name="endDate"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetApiReport")]
|
||
public async Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate)
|
||
{
|
||
var result =await _smsService.GetApiReport(startDate, endDate);
|
||
return result;
|
||
}
|
||
|
||
//تنظیمات پیامک خودکار
|
||
#region SmsSettings
|
||
|
||
/// <summary>
|
||
/// لیست تنظیمات پیامک - یادآور
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("ReminderSmsSettingList")]
|
||
public async Task<List<SmsSettingDto>> ReminderSmsSettingList()
|
||
{
|
||
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||
return result;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// لیست تنظیمات پیامک - مسدودی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("BlockSmsSettingList")]
|
||
public async Task<List<SmsSettingDto>> BlockSmsSettingList()
|
||
{
|
||
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.BlockContractingParty);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// لیست تنظیمات پیامک - هشدار قضایی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("WarningSmsSettingList")]
|
||
public async Task<List<SmsSettingDto>> WarningSmsSettingList()
|
||
{
|
||
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.Warning);
|
||
return result;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// لیست تنظیمات پیامک - اقدام قضایی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("LegalActionSmsSettingList")]
|
||
public async Task<List<SmsSettingDto>> LegalActionSmsSettingList()
|
||
{
|
||
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.LegalAction);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// لیست تنظیمات پیامک - تایید قراداد مالی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("ContractConfirmSmsSettingList")]
|
||
public async Task<List<SmsSettingDto>> ContractConfirmSmsSettingList()
|
||
{
|
||
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.InstitutionContractConfirm);
|
||
return result;
|
||
}
|
||
|
||
//=====================Create=========================
|
||
|
||
/// <summary>
|
||
/// ایجاد پیامک یادآور
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("CreateReminderSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> CreateReminderSmsSetting([FromBody] CreateSmsSettingDto command)
|
||
{
|
||
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد پیامک مسدودی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("CreateBlockSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> CreateBlockSmsSetting([FromBody] CreateSmsSettingDto command)
|
||
{
|
||
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.BlockContractingParty);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد پیامک هشدار قضایی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("CreateWarningSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> CreateWarningSmsSetting([FromBody] CreateSmsSettingDto command)
|
||
{
|
||
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.Warning);
|
||
return result;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// ایجاد پیامک اقدام قضایی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("CreateLegalActionSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> CreateLegalActionSmsSetting([FromBody] CreateSmsSettingDto command)
|
||
{
|
||
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.LegalAction);
|
||
return result;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// ایجاد پیامک تایید قرارداد مالی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("CreateContractConfirmSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> CreateContractConfirmSmsSetting([FromBody] CreateSmsSettingDto command)
|
||
{
|
||
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.InstitutionContractConfirm);
|
||
return result;
|
||
}
|
||
//=====================Edit=========================
|
||
|
||
/// <summary>
|
||
/// دریافت اطلاعات ویرایش تنظیمات پیامک
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetEditData")]
|
||
public async Task<SmsSettingDto> GetEditData(long id)
|
||
{
|
||
return await _smsSettingApplication.GetSmsSettingDataToEdit(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ویرایش تنظیمات پیامک
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPut("EditSmsSetting")]
|
||
public async Task<ActionResult<OperationResult>> EditSmsSetting([FromBody] SmsSettingDto command)
|
||
{
|
||
var result =await _smsSettingApplication.EditSmsSetting(command);
|
||
return result;
|
||
}
|
||
|
||
//=====================Remove=========================
|
||
|
||
/// <summary>
|
||
/// حذف تنظیمات پیامک
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpDelete]
|
||
public async Task RemoveSmsSetting(long id)
|
||
{
|
||
await _smsSettingApplication.RemoveSetting(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست ارسال آنی یادآور
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetInstantReminderSmsListData")]
|
||
public async Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData()
|
||
{
|
||
var result =await _smsSettingApplication.GetInstantReminderSmsListData(TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست ارسال آنی مسدودی
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetInstantBlockSmsListData")]
|
||
public async Task<List<InstantReminderSendSms>> GetInstantBlockSmsListData()
|
||
{
|
||
var result = await _smsSettingApplication.GetInstantReminderSmsListData(TypeOfSmsSetting.BlockContractingParty);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ارسال پیامک آنی یادآور
|
||
/// </summary>
|
||
/// <param name="phoneNumbers"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("InstantReminderSmsSend")]
|
||
public async Task<ActionResult<OperationResult>> InstantReminderSmsSend([FromBody] List<string> phoneNumbers)
|
||
{
|
||
var result = await _smsSettingApplication.InstantSmsSendApi(TypeOfSmsSetting.InstitutionContractDebtReminder, phoneNumbers);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ارسال پیامک آنی مسدودی
|
||
/// </summary>
|
||
/// <param name="phoneNumbers"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("InstantBlockSmsSend")]
|
||
public async Task<ActionResult<OperationResult>> InstantBlockSmsSend([FromBody] List<string> phoneNumbers)
|
||
{
|
||
var result = await _smsSettingApplication.InstantSmsSendApi(TypeOfSmsSetting.BlockContractingParty, phoneNumbers);
|
||
return result;
|
||
}
|
||
#endregion
|
||
} |