diff --git a/0_Framework/Application/Sms/ApiResultViewModel.cs b/0_Framework/Application/Sms/ApiResultViewModel.cs index 0d5c1ca1..4bb3bd47 100644 --- a/0_Framework/Application/Sms/ApiResultViewModel.cs +++ b/0_Framework/Application/Sms/ApiResultViewModel.cs @@ -30,5 +30,22 @@ public class ApiReportDto public string DeliveryState { get; set; } public string DeliveryUnixTime { get; set; } public string DeliveryColor { get; set; } + public string FullName { get; set; } + +} + +public class SmsDetailsDto +{ + + + public string MessageText { get; set; } + + public long Mobile { get; set; } + + public string SendUnixTime { get; set; } + public string DeliveryState { get; set; } + public string DeliveryUnixTime { get; set; } + public string DeliveryColor { get; set; } + public string FullName { get; set; } } \ No newline at end of file diff --git a/0_Framework/Application/Sms/ISmsService.cs b/0_Framework/Application/Sms/ISmsService.cs index 20e41608..3c02e90f 100644 --- a/0_Framework/Application/Sms/ISmsService.cs +++ b/0_Framework/Application/Sms/ISmsService.cs @@ -16,15 +16,21 @@ public interface ISmsService /// /// Task SendVerifyCodeToClient(string number, string code); - bool SendAccountsInfo(string number,string fullName, string userName); + bool SendAccountsInfo(string number, string fullName, string userName); Task GetByMessageId(int messId); Task> GetApiResult(string startDate, string endDate); #region ForApi Task> GetApiReport(string startDate, string endDate); - -#endregion + /// + /// دریافت جزئیات پیامک + /// + /// + /// + /// + Task GetSmsDetailsByMessageId(int messId, string fullName); + #endregion string DeliveryStatus(byte? dv); string DeliveryColorStatus(byte? dv); @@ -33,9 +39,9 @@ public interface ISmsService #region Mahan Task GetCreditAmount(); - + public Task SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms = null); - + public Task SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName, long contractingPartyId, long institutionContractId); @@ -68,7 +74,7 @@ public interface ISmsService /// /// Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id, string aprove); - + /// /// پیامک مسدودی طرف حساب /// قراردادهای قدیم diff --git a/CompanyManagment.Application/SmsResultApplication.cs b/CompanyManagment.Application/SmsResultApplication.cs index 3cbd8981..76f7b50c 100644 --- a/CompanyManagment.Application/SmsResultApplication.cs +++ b/CompanyManagment.Application/SmsResultApplication.cs @@ -1,21 +1,26 @@ using _0_Framework.Application; using _0_Framework.Application.Enums; +using _0_Framework.Application.Sms; using Company.Domain.SmsResultAgg; using CompanyManagment.App.Contracts.SmsResult; using CompanyManagment.App.Contracts.SmsResult.Dto; +using CompanyManagment.EFCore.Services; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using SmsResult = Company.Domain.SmsResultAgg.SmsResult; namespace CompanyManagment.Application; public class SmsResultApplication : ISmsResultApplication { private readonly ISmsResultRepository _smsResultRepository; + private readonly ISmsService _smsService; - public SmsResultApplication(ISmsResultRepository smsResultRepository) + public SmsResultApplication(ISmsResultRepository smsResultRepository, ISmsService smsService) { _smsResultRepository = smsResultRepository; + _smsService = smsService; } @@ -68,4 +73,6 @@ public class SmsResultApplication : ISmsResultApplication }).ToList(); return result; } + + } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Services/SmsService.cs b/CompanyManagment.EFCore/Services/SmsService.cs index 11ea7adb..d73ac87f 100644 --- a/CompanyManagment.EFCore/Services/SmsService.cs +++ b/CompanyManagment.EFCore/Services/SmsService.cs @@ -205,6 +205,26 @@ public class SmsService : ISmsService }; return appendData; } + + public async Task GetSmsDetailsByMessageId(int messId, string fullName) + { + + SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa"); + var response = await smsIr.GetReportAsync(messId); + MessageReportResult messages = response.Data; + + var appendData = new SmsDetailsDto() + { + Mobile = messages.Mobile, + MessageText = messages.MessageText, + SendUnixTime = UnixTimeStampToDateTime(messages.SendDateTime), + DeliveryState = DeliveryStatus(messages.DeliveryState), + DeliveryUnixTime = UnixTimeStampToDateTime(messages.DeliveryDateTime), + DeliveryColor = DeliveryColorStatus(messages.DeliveryState), + FullName = fullName + }; + return appendData; + } public async Task> GetApiResult(string startDate, string endDate) { diff --git a/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs b/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs index 80122800..5a864bd8 100644 --- a/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs +++ b/ServiceHost/Areas/Admin/Controllers/SmsReportController.cs @@ -49,6 +49,19 @@ public class SmsReportController : AdminBaseController return result; } + /// + /// دریافت جزئیات پیامک + /// + /// + /// + /// + [HttpGet("GetSmsDetails")] + public async Task GetSmsDetails(int messId, string fullName) + { + var result =await _smsService.GetSmsDetailsByMessageId(messId, fullName); + return result; + } + /// /// گزارش ای پی آی ///