Files
Backend-Api/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs
2026-01-13 15:16:33 +03:30

277 lines
9.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>
/// <returns></returns>
[HttpGet("GetExpandedList")]
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
{
var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date);
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>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
[HttpPost("CreateReminderSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateReminderSmsSetting(int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.InstitutionContractDebtReminder);
return result;
}
/// <summary>
/// ایجاد پیامک مسدودی
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <returns></returns>
[HttpPost("CreateBlockSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateBlockSmsSetting(int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.BlockContractingParty);
return result;
}
/// <summary>
/// ایجاد پیامک هشدار قضایی
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <returns></returns>
[HttpPost("CreateWarningSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateWarningSmsSetting(int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.Warning);
return result;
}
/// <summary>
/// ایجاد پیامک اقدام قضایی
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <returns></returns>
[HttpPost("CreateLegalActionSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateLegalActionSmsSetting(int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, TypeOfSmsSetting.LegalAction);
return result;
}
/// <summary>
/// ایجاد پیامک تایید قرارداد مالی
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <returns></returns>
[HttpPost("CreateContractConfirmSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateContractConfirmSmsSetting(int dayOfMonth, string timeOfDay)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, 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>
[HttpPost("EditSmsSetting")]
public async Task<ActionResult<OperationResult>> EditSmsSetting(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
}