Merge branch 'master' into AdminCheckoutApi
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -368,3 +368,6 @@ MigrationBackup/
|
||||
# Storage folder - ignore all uploaded files, thumbnails, and temporary files
|
||||
ServiceHost/Storage
|
||||
|
||||
.env
|
||||
.env.*
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ public enum TypeOfSmsSetting
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationCode,
|
||||
|
||||
/// <summary>
|
||||
/// لینک تاییدیه ایجاد قرارداد مالی
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationLink,
|
||||
|
||||
/// <summary>
|
||||
/// یادآور وظایف
|
||||
/// </summary>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -16,15 +16,21 @@ public interface ISmsService
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code);
|
||||
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||
bool SendAccountsInfo(string number, string fullName, string userName);
|
||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||
|
||||
#region ForApi
|
||||
|
||||
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// دریافت جزئیات پیامک
|
||||
/// </summary>
|
||||
/// <param name="messId"></param>
|
||||
/// <param name="fullName"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsDetailsDto> GetSmsDetailsByMessageId(int messId, string fullName);
|
||||
#endregion
|
||||
|
||||
string DeliveryStatus(byte? dv);
|
||||
string DeliveryColorStatus(byte? dv);
|
||||
@@ -33,9 +39,9 @@ public interface ISmsService
|
||||
#region Mahan
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
|
||||
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms = null);
|
||||
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
@@ -68,7 +74,7 @@ public interface ISmsService
|
||||
/// <param name="aprove"></param>
|
||||
/// <returns></returns>
|
||||
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id, string aprove);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// پیامک مسدودی طرف حساب
|
||||
/// قراردادهای قدیم
|
||||
|
||||
@@ -31,8 +31,9 @@ public static class StaticWorkshopAccounts
|
||||
/// 381 - مهدی قربانی
|
||||
/// 392 - عمار حسن دوست
|
||||
/// 20 - سمیرا الهی نیا
|
||||
/// 322 - ماهان چمنی
|
||||
/// </summary>
|
||||
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20, 476];
|
||||
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20, 476,322];
|
||||
|
||||
/// <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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.SmsResultAgg;
|
||||
@@ -27,4 +28,25 @@ public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task RemoveItem(long id);
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
|
||||
#endregion
|
||||
}
|
||||
@@ -324,6 +324,7 @@ public class InstitutionContractCreationWorkshopsResponse
|
||||
{
|
||||
public List<WorkshopTempViewModel> WorkshopTemps { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
public Guid TempId { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractCreationWorkshopsRequest
|
||||
|
||||
@@ -7,6 +7,7 @@ public class InstitutionContractExtensionCompleteRequest
|
||||
public Guid TemporaryId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public long LawId { get; set; }
|
||||
public bool CancelSendVerificationSms { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractCreationCompleteRequest
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
/// <summary>
|
||||
/// لیست پیامکهای بدهکاران قرارداد ملی
|
||||
@@ -113,10 +115,30 @@ public class BlockSmsListData
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست قراداد های آبی
|
||||
/// جهت ارسال هشدار یا اقدام قضائی
|
||||
///پیامک آنی یادآور
|
||||
/// </summary>
|
||||
public class BlueWarningSmsData
|
||||
public class InstantReminderSendSms
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بدهی
|
||||
/// </summary>
|
||||
public string Amount { get; set; }
|
||||
public List<InstantReminderSmsList> InstantReminderSmsList { get; set; }
|
||||
}
|
||||
|
||||
public class InstantReminderSmsList
|
||||
{
|
||||
/// <summary>
|
||||
/// شماره تماس طرف حساب
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -60,3 +60,43 @@ public class SmsSettingViewModel
|
||||
/// </summary>
|
||||
public List<EditSmsSetting> EditSmsSettings { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست تنظیمات پیامک خودکار
|
||||
/// </summary>
|
||||
public class SmsSettingDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// عدد روز از ماه
|
||||
/// </summary>
|
||||
public int DayOfMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نمایش ساعت و دقیقه
|
||||
/// </summary>
|
||||
public string TimeOfDayDisplay { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class CreateSmsSettingDto
|
||||
{
|
||||
/// <summary>
|
||||
/// عدد روز از ماه
|
||||
/// </summary>
|
||||
public int DayOfMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نمایش ساعت و دقیقه
|
||||
/// </summary>
|
||||
public string TimeOfDayDisplay { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -75,4 +75,45 @@ public interface ISmsSettingApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش تنظیمات پیامک
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> EditSmsSetting(SmsSettingDto command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست ارسال آنی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک آنی
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <param name="phoneNumbers"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -447,8 +447,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
}
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -458,7 +457,10 @@ public class RollCallApplication : IRollCallApplication
|
||||
_rollCallDomainService.GetEmployeeShiftDateByRollCallStartDate(command.WorkshopId, command.EmployeeId,
|
||||
x.StartDate!.Value,x.EndDate.Value);
|
||||
});
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.ShiftDate.Date >= y.StartDateGr.Date && x.ShiftDate.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
if (newRollCallDates.Any(x => x.ShiftDate.Date != date.Date))
|
||||
{
|
||||
return operation.Failed("حضور غیاب در حال ویرایش را نمیتوانید از تاریخ شیفت عقب تر یا جلو تر ببرید");
|
||||
@@ -487,8 +489,8 @@ public class RollCallApplication : IRollCallApplication
|
||||
|
||||
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date
|
||||
&& x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.ShiftDate.Date >= y.StartDateGr.Date
|
||||
&& x.ShiftDate.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
@@ -632,9 +634,6 @@ public class RollCallApplication : IRollCallApplication
|
||||
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
}
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
newRollCallDates.ForEach(x =>
|
||||
{
|
||||
@@ -642,6 +641,11 @@ public class RollCallApplication : IRollCallApplication
|
||||
_rollCallDomainService.GetEmployeeShiftDateByRollCallStartDate(command.WorkshopId, command.EmployeeId,
|
||||
x.StartDate!.Value,x.EndDate.Value);
|
||||
});
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.ShiftDate.Date >= y.StartDateGr.Date && x.ShiftDate.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
if (newRollCallDates.Any(x => x.ShiftDate.Date != date.Date))
|
||||
{
|
||||
return operation.Failed("حضور غیاب در حال ویرایش را نمیتوانید از تاریخ شیفت عقب تر یا جلو تر ببرید");
|
||||
@@ -664,7 +668,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
&& (y.StartDate.Value.Date <= x.ContractEndGr.Date))))
|
||||
return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است");
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.ShiftDate.Date >= y.StartDateGr.Date && x.ShiftDate.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
var currentDayRollCall = employeeRollCalls.FirstOrDefault(x => x.EndDate == null);
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
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 _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;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +31,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
|
||||
@@ -67,4 +73,6 @@ public class SmsResultApplication : ISmsResultApplication
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -17,12 +19,15 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository, IHostEnvironment hostEnvironment)
|
||||
{
|
||||
_smsSettingsRepository = smsSettingsRepository;
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +136,12 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
public async Task<OperationResult> InstantSendReminderSms(List<SmsListData> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
|
||||
|
||||
}
|
||||
string typeOfSms = "یادآور بدهی ماهانه";
|
||||
string sendMessStart = "شروع یادآور آنی";
|
||||
string sendMessEnd = "پایان یادآور آنی";
|
||||
@@ -151,6 +162,13 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
|
||||
|
||||
}
|
||||
string typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
string sendMessStart = "شروع مسدودی آنی";
|
||||
string sendMessEnd = "پایان مسدودی آنی ";
|
||||
@@ -165,4 +183,166 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
}
|
||||
}
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
return await _smsSettingsRepository.GetSmsSettingList(typeOfSmsSetting);
|
||||
}
|
||||
|
||||
|
||||
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
|
||||
{
|
||||
return await _smsSettingsRepository.GetSmsSettingDataToEdit(id);
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> EditSmsSetting(SmsSettingDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
|
||||
var timeSpan = new TimeSpan();
|
||||
if (string.IsNullOrWhiteSpace(command.TimeOfDayDisplay))
|
||||
return op.Failed("ساعت وارد نشده است");
|
||||
|
||||
try
|
||||
{
|
||||
timeSpan = TimeSpan.ParseExact(command.TimeOfDayDisplay, @"hh\:mm", null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("فرمت ساعت اشتباه است");
|
||||
}
|
||||
|
||||
if (command.DayOfMonth < 1 || command.DayOfMonth > 31)
|
||||
{
|
||||
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
|
||||
}
|
||||
|
||||
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == command.DayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == editSmsSetting.TypeOfSmsSetting && x.id != command.Id))
|
||||
return op.Failed("رکورد ایجاد شده تکراری است");
|
||||
|
||||
|
||||
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
|
||||
await _smsSettingsRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
var result = new List<InstantReminderSendSms>();
|
||||
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
|
||||
{
|
||||
FullName = m.Key,
|
||||
Amount = m.Select(c => c.Amount).First(),
|
||||
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
|
||||
{
|
||||
PhoneNumber = c.PhoneNumber,
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
|
||||
{
|
||||
FullName = m.Key,
|
||||
Amount = m.Select(c => c.Amount).First(),
|
||||
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
|
||||
{
|
||||
PhoneNumber = c.PhoneNumber,
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers)
|
||||
{
|
||||
|
||||
var op = new OperationResult();
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
var str = "";
|
||||
foreach (var item in phoneNumbers)
|
||||
{
|
||||
str += $" {item}, ";
|
||||
}
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد " + " لیست ارسال شما " + str);
|
||||
|
||||
}
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
|
||||
{
|
||||
if (phoneNumbers.Any())
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
|
||||
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
|
||||
var res = await InstantSendReminderSms(sendItems);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
|
||||
}
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
|
||||
{
|
||||
if (phoneNumbers.Any())
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
|
||||
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
|
||||
var res = await InstantSendBlockSms(sendItems);
|
||||
return res;
|
||||
}
|
||||
return op.Succcedded();
|
||||
}
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return op.Failed("خطای انتخاب نوع ارسال");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -2269,7 +2269,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
extenstionTemp
|
||||
);
|
||||
|
||||
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value)??[];
|
||||
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value) ??
|
||||
[];
|
||||
|
||||
var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList();
|
||||
|
||||
@@ -2317,7 +2318,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
WorkshopId = workshop?.id ?? 0,
|
||||
RollCallInPerson = service.RollCallInPerson
|
||||
};
|
||||
}).ToList()??[];
|
||||
}).ToList() ?? [];
|
||||
var notIncludeWorskhopsLeftWork = await _context.LeftWorkList
|
||||
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
|
||||
x.LeftWorkDate >= DateTime.Now)
|
||||
@@ -2959,8 +2960,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
if (!request.CancelSendVerificationSms)
|
||||
{
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
}
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -3363,10 +3367,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifierFullName,
|
||||
VerifierPhoneNumber =
|
||||
VerifierPhoneNumber =
|
||||
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifierPhoneNumber,
|
||||
? null
|
||||
: institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifyCode,
|
||||
@@ -4363,10 +4367,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var creationTemp = await _institutionContractCreationTemp.Find(x => x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
// creationTemp.SetContractingPartyInfo(request.LegalType,request.RealParty,request.LegalParty);
|
||||
|
||||
bool tempCreated = false;
|
||||
if (creationTemp == null)
|
||||
{
|
||||
throw new BadRequestException("دیتای درخواست شده نامعتبر است");
|
||||
creationTemp = new InstitutionContractCreationTemp();
|
||||
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
|
||||
}
|
||||
|
||||
List<WorkshopTempViewModel> workshopDetails = [];
|
||||
@@ -4460,7 +4465,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var res = new InstitutionContractCreationWorkshopsResponse()
|
||||
{
|
||||
TotalAmount = workshopDetails.Sum(x => x.WorkshopServicesAmount).ToMoney(),
|
||||
WorkshopTemps = workshopDetails
|
||||
WorkshopTemps = workshopDetails,
|
||||
TempId = creationTemp.Id
|
||||
};
|
||||
return res;
|
||||
}
|
||||
@@ -5107,9 +5113,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
if (!request.CancelSendVerificationSms)
|
||||
{
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
}
|
||||
|
||||
await SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
|
||||
@@ -2109,11 +2109,24 @@ public class InstitutionContractSmsServiceRepository : RepositoryBase<long, Inst
|
||||
int successProcess = 1;
|
||||
int countList = smsListData.Count;
|
||||
|
||||
#region Test
|
||||
|
||||
|
||||
//for (int i = 0; i < 100; i++)
|
||||
//{
|
||||
// var percent = (successProcess / (double)countList) * 100;
|
||||
// await _hubContext.Clients.Group(SendSmsHub.GetGroupName(7))
|
||||
// .SendAsync("showStatus", (int)percent);
|
||||
// Thread.Sleep(1000);
|
||||
// successProcess += 1;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
foreach (var item in smsListData)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (item.TypeOfSmsMethod == "MonthlyBill")
|
||||
{
|
||||
var res = await _smsService.MonthlyBill(item.PhoneNumber, item.TemplateId, item.PartyName,
|
||||
|
||||
@@ -82,25 +82,45 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
|
||||
var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId);
|
||||
|
||||
//اگر سرویس حضور غیاب نداشت
|
||||
if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date))
|
||||
return false;
|
||||
//var rollCallEmployee = GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
|
||||
//if (rollCallEmployee == null)
|
||||
// return false;
|
||||
var rollCallEmployee = _context.RollCallEmployees
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.Include(x => x.EmployeesStatus);
|
||||
if (!rollCallEmployee.Any())
|
||||
var rollCallEmployee = _context.RollCallEmployees.Include(xs => xs.EmployeesStatus)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
//اگر تنظیمات حضور غیاب نداشت
|
||||
if (rollCallEmployee == null)
|
||||
return false;
|
||||
|
||||
//اگر استاتوس نداشت
|
||||
if (!rollCallEmployee.EmployeesStatus.Any())
|
||||
return false;
|
||||
|
||||
var a = rollCallEmployee.Any(x => x.EmployeesStatus.Any(s =>
|
||||
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date) ||
|
||||
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date)));
|
||||
//var result = _employeeRollCallStatusRepository.w(x => x.RollCallEmployeeId == rollCallEmployee.Id &&
|
||||
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date >= contractEnd.Date) ||
|
||||
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date > contractStart.Date));
|
||||
return a;
|
||||
var leftWork =
|
||||
_context.LeftWorkList.FirstOrDefault(x =>
|
||||
x.StartWorkDate <= contractEnd.Date && x.LeftWorkDate > contractStart);
|
||||
if (leftWork == null)
|
||||
return false;
|
||||
|
||||
var status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
|
||||
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date));
|
||||
//اگر استاتوس کامل پوشش داد
|
||||
if (status != null)
|
||||
return true;
|
||||
|
||||
|
||||
status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
|
||||
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date &&
|
||||
s.EndDate.Date < contractEnd.Date));
|
||||
//اگر قبل از پایان فیس استاتوس قطع شده ولی ترک کار داره
|
||||
if (status != null && leftWork.HasLeft)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
@@ -68,4 +69,48 @@ public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSetti
|
||||
_context.SmsSettings.Remove(removeItem);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
|
||||
var data = await _context.SmsSettings
|
||||
.Where(x => x.TypeOfSmsSetting == typeOfSmsSetting)
|
||||
.OrderBy(x => x.DayOfMonth).ThenBy(x => x.TimeOfDay)
|
||||
.Select(x =>
|
||||
new SmsSettingDto()
|
||||
{
|
||||
Id = x.id,
|
||||
DayOfMonth = x.DayOfMonth,
|
||||
TimeOfDayDisplay = x.TimeOfDay.ToString(@"hh\:mm")
|
||||
}).ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
|
||||
{
|
||||
var edit = new SmsSettingDto();
|
||||
var getItem = await _context.SmsSettings.FirstOrDefaultAsync(x => x.id == id);
|
||||
|
||||
if (getItem != null)
|
||||
{
|
||||
edit.Id = getItem.id;
|
||||
edit.TimeOfDayDisplay = getItem.TimeOfDay.ToString(@"hh\:mm");
|
||||
edit.DayOfMonth = getItem.DayOfMonth;
|
||||
|
||||
}
|
||||
|
||||
return edit;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -205,6 +205,26 @@ public class SmsService : ISmsService
|
||||
};
|
||||
return appendData;
|
||||
}
|
||||
|
||||
public async Task<SmsDetailsDto> 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<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.AddTaskToPhase;
|
||||
|
||||
/// <summary>
|
||||
/// Command to add a task to an existing phase
|
||||
/// </summary>
|
||||
public record AddTaskToPhaseCommand(
|
||||
Guid PhaseId,
|
||||
string Name,
|
||||
string? Description = null,
|
||||
ProjectTaskPriority Priority = ProjectTaskPriority.Medium,
|
||||
int OrderIndex = 0,
|
||||
DateTime? DueDate = null
|
||||
) : IBaseCommand;
|
||||
@@ -1,53 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.AddTaskToPhase;
|
||||
|
||||
public class AddTaskToPhaseCommandHandler : IRequestHandler<AddTaskToPhaseCommand, OperationResult>
|
||||
{
|
||||
private readonly IProjectPhaseRepository _phaseRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public AddTaskToPhaseCommandHandler(
|
||||
IProjectPhaseRepository phaseRepository,
|
||||
IUnitOfWork unitOfWork)
|
||||
{
|
||||
_phaseRepository = phaseRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(AddTaskToPhaseCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get phase
|
||||
var phase = await _phaseRepository.GetByIdAsync(request.PhaseId);
|
||||
if (phase == null)
|
||||
{
|
||||
return OperationResult.NotFound("فاز یافت نشد");
|
||||
}
|
||||
|
||||
// Add task
|
||||
var task = phase.AddTask(request.Name, request.Description);
|
||||
task.SetPriority(request.Priority);
|
||||
task.SetOrderIndex(request.OrderIndex);
|
||||
|
||||
if (request.DueDate.HasValue)
|
||||
{
|
||||
task.SetDates(dueDate: request.DueDate);
|
||||
}
|
||||
|
||||
// Save changes
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return OperationResult.Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return OperationResult.Failure($"خطا در افزودن تسک: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,5 @@ using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateProject;
|
||||
|
||||
public record CreateProjectCommand(string Name,ProjectHierarchyLevel Level,
|
||||
ProjectTaskPriority? Priority,
|
||||
Guid? ParentId):IBaseCommand;
|
||||
@@ -16,7 +16,8 @@ public class CreateProjectCommandHandler : IBaseCommandHandler<CreateProjectComm
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
|
||||
public CreateProjectCommandHandler(IProjectRepository projectRepository, IUnitOfWork unitOfWork, IProjectTaskRepository projectTaskRepository, IProjectPhaseRepository projectPhaseRepository)
|
||||
public CreateProjectCommandHandler(IProjectRepository projectRepository, IUnitOfWork unitOfWork,
|
||||
IProjectTaskRepository projectTaskRepository, IProjectPhaseRepository projectPhaseRepository)
|
||||
{
|
||||
_projectRepository = projectRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
@@ -55,8 +56,8 @@ public class CreateProjectCommandHandler : IBaseCommandHandler<CreateProjectComm
|
||||
{
|
||||
if (!request.ParentId.HasValue)
|
||||
throw new BadRequestException("برای ایجاد فاز، شناسه پروژه الزامی است");
|
||||
|
||||
if(!_projectRepository.Exists(x=>x.Id == request.ParentId.Value))
|
||||
|
||||
if (!_projectRepository.Exists(x => x.Id == request.ParentId.Value))
|
||||
{
|
||||
throw new BadRequestException("والد پروژه یافت نشد");
|
||||
}
|
||||
@@ -69,14 +70,15 @@ public class CreateProjectCommandHandler : IBaseCommandHandler<CreateProjectComm
|
||||
{
|
||||
if (!request.ParentId.HasValue)
|
||||
throw new BadRequestException("برای ایجاد تسک، شناسه فاز الزامی است");
|
||||
|
||||
if(!_projectPhaseRepository.Exists(x=>x.Id == request.ParentId.Value))
|
||||
|
||||
if (!_projectPhaseRepository.Exists(x => x.Id == request.ParentId.Value))
|
||||
{
|
||||
throw new BadRequestException("والد پروژه یافت نشد");
|
||||
}
|
||||
|
||||
var projectTask = new ProjectTask(request.Name, request.ParentId.Value);
|
||||
var priority = request.Priority ?? ProjectTaskPriority.Low;
|
||||
|
||||
var projectTask = new ProjectTask(request.Name, request.ParentId.Value, priority);
|
||||
await _projectTaskRepository.CreateAsync(projectTask);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,10 @@ public class GetProjectItemDto
|
||||
public int Percentage { get; init; }
|
||||
public ProjectHierarchyLevel Level { get; init; }
|
||||
public Guid? ParentId { get; init; }
|
||||
public int TotalHours { get; set; }
|
||||
public int Minutes { get; set; }
|
||||
|
||||
public TimeSpan TotalTime { get; init; }
|
||||
|
||||
public TimeSpan RemainingTime { get; init; }
|
||||
public AssignmentStatus Front { get; set; }
|
||||
public AssignmentStatus Backend { get; set; }
|
||||
public AssignmentStatus Design { get; set; }
|
||||
|
||||
@@ -16,7 +16,8 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetProjectsListResponse>> Handle(GetProjectsListQuery request, CancellationToken cancellationToken)
|
||||
public async Task<OperationResult<GetProjectsListResponse>> Handle(GetProjectsListQuery request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var projects = new List<GetProjectDto>();
|
||||
var phases = new List<GetPhaseDto>();
|
||||
@@ -51,13 +52,14 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
{
|
||||
return new List<GetProjectDto>();
|
||||
}
|
||||
|
||||
var entities = await query
|
||||
.OrderByDescending(p => p.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
var result = new List<GetProjectDto>();
|
||||
foreach (var project in entities)
|
||||
{
|
||||
var (percentage, totalTime) = await CalculateProjectPercentage(project, cancellationToken);
|
||||
var (percentage, totalTime,remainingTime) = await CalculateProjectPercentage(project, cancellationToken);
|
||||
result.Add(new GetProjectDto
|
||||
{
|
||||
Id = project.Id,
|
||||
@@ -65,10 +67,12 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
Level = ProjectHierarchyLevel.Project,
|
||||
ParentId = null,
|
||||
Percentage = percentage,
|
||||
TotalHours = (int)totalTime.TotalHours,
|
||||
Minutes = totalTime.Minutes,
|
||||
TotalTime = totalTime,
|
||||
RemainingTime = remainingTime
|
||||
});
|
||||
}
|
||||
|
||||
result = result.OrderByDescending(x => x.Percentage).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -79,13 +83,14 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
{
|
||||
query = query.Where(x => x.ProjectId == parentId);
|
||||
}
|
||||
|
||||
var entities = await query
|
||||
.OrderByDescending(p => p.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
var result = new List<GetPhaseDto>();
|
||||
foreach (var phase in entities)
|
||||
{
|
||||
var (percentage, totalTime) = await CalculatePhasePercentage(phase, cancellationToken);
|
||||
var (percentage, totalTime,remainingTime) = await CalculatePhasePercentage(phase, cancellationToken);
|
||||
result.Add(new GetPhaseDto
|
||||
{
|
||||
Id = phase.Id,
|
||||
@@ -93,10 +98,12 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
Level = ProjectHierarchyLevel.Phase,
|
||||
ParentId = phase.ProjectId,
|
||||
Percentage = percentage,
|
||||
TotalHours = (int)totalTime.TotalHours,
|
||||
Minutes = totalTime.Minutes,
|
||||
TotalTime = totalTime,
|
||||
RemainingTime = remainingTime
|
||||
});
|
||||
}
|
||||
result = result.OrderByDescending(x => x.Percentage).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -107,6 +114,7 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
{
|
||||
query = query.Where(x => x.PhaseId == parentId);
|
||||
}
|
||||
|
||||
var entities = await query
|
||||
.OrderByDescending(t => t.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
@@ -118,7 +126,7 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
|
||||
foreach (var task in entities)
|
||||
{
|
||||
var (percentage, totalTime) = await CalculateTaskPercentage(task, cancellationToken);
|
||||
var (percentage, totalTime,remainingTime) = await CalculateTaskPercentage(task, cancellationToken);
|
||||
var sections = await _context.TaskSections
|
||||
.Include(s => s.Activities)
|
||||
.Include(s => s.Skill)
|
||||
@@ -140,13 +148,12 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
|
||||
// محاسبه SpentTime و RemainingTime
|
||||
var spentTime = TimeSpan.FromTicks(sections.Sum(s => s.Activities.Sum(a => a.GetTimeSpent().Ticks)));
|
||||
var remainingTime = totalTime - spentTime;
|
||||
|
||||
// ساخت section DTOs برای تمام Skills
|
||||
var sectionDtos = allSkills.Select(skill =>
|
||||
{
|
||||
var section = sections.FirstOrDefault(s => s.SkillId == skill.Id);
|
||||
|
||||
|
||||
if (section == null)
|
||||
{
|
||||
// اگر section وجود نداشت، یک DTO با وضعیت Unassigned برمیگردانیم
|
||||
@@ -184,18 +191,20 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
Level = ProjectHierarchyLevel.Task,
|
||||
ParentId = task.PhaseId,
|
||||
Percentage = percentage,
|
||||
TotalHours = (int)totalTime.TotalHours,
|
||||
Minutes = totalTime.Minutes,
|
||||
TotalTime = totalTime,
|
||||
SpentTime = spentTime,
|
||||
RemainingTime = remainingTime,
|
||||
Sections = sectionDtos,
|
||||
Priority = task.Priority
|
||||
});
|
||||
}
|
||||
result = result.OrderByDescending(x => x.Percentage).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task SetSkillFlags<TItem>(List<TItem> items, CancellationToken cancellationToken) where TItem : GetProjectItemDto
|
||||
private async Task SetSkillFlags<TItem>(List<TItem> items, CancellationToken cancellationToken)
|
||||
where TItem : GetProjectItemDto
|
||||
{
|
||||
if (!items.Any())
|
||||
return;
|
||||
@@ -213,7 +222,8 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
}
|
||||
|
||||
|
||||
private async Task SetSkillFlagsForProjects<TItem>(List<TItem> items, List<Guid> projectIds, CancellationToken cancellationToken) where TItem : GetProjectItemDto
|
||||
private async Task SetSkillFlagsForProjects<TItem>(List<TItem> items, List<Guid> projectIds,
|
||||
CancellationToken cancellationToken) where TItem : GetProjectItemDto
|
||||
{
|
||||
// For projects: gather all phases, then tasks, then sections
|
||||
var phases = await _context.ProjectPhases
|
||||
@@ -243,7 +253,8 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetSkillFlagsForPhases<TItem>(List<TItem> items, List<Guid> phaseIds, CancellationToken cancellationToken) where TItem : GetProjectItemDto
|
||||
private async Task SetSkillFlagsForPhases<TItem>(List<TItem> items, List<Guid> phaseIds,
|
||||
CancellationToken cancellationToken) where TItem : GetProjectItemDto
|
||||
{
|
||||
// For phases: gather tasks, then sections
|
||||
var tasks = await _context.ProjectTasks
|
||||
@@ -269,68 +280,81 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<(int Percentage, TimeSpan TotalTime)> CalculateProjectPercentage(Project project, CancellationToken cancellationToken)
|
||||
private async Task<(int Percentage, TimeSpan TotalTime,TimeSpan RemainingTime)> CalculateProjectPercentage(Project project,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var phases = await _context.ProjectPhases
|
||||
.Where(ph => ph.ProjectId == project.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
if (!phases.Any())
|
||||
return (0, TimeSpan.Zero);
|
||||
return (0, TimeSpan.Zero,TimeSpan.Zero);
|
||||
var phasePercentages = new List<int>();
|
||||
var totalTime = TimeSpan.Zero;
|
||||
var remainingTime = TimeSpan.Zero;
|
||||
foreach (var phase in phases)
|
||||
{
|
||||
var (phasePercentage, phaseTime) = await CalculatePhasePercentage(phase, cancellationToken);
|
||||
var (phasePercentage, phaseTime,phaseRemainingTime) = await CalculatePhasePercentage(phase, cancellationToken);
|
||||
phasePercentages.Add(phasePercentage);
|
||||
totalTime += phaseTime;
|
||||
remainingTime += phaseRemainingTime;
|
||||
}
|
||||
|
||||
var averagePercentage = phasePercentages.Any() ? (int)phasePercentages.Average() : 0;
|
||||
return (averagePercentage, totalTime);
|
||||
return (averagePercentage, totalTime,remainingTime);
|
||||
}
|
||||
|
||||
private async Task<(int Percentage, TimeSpan TotalTime)> CalculatePhasePercentage(ProjectPhase phase, CancellationToken cancellationToken)
|
||||
private async Task<(int Percentage, TimeSpan TotalTime,TimeSpan RemainingTime)> CalculatePhasePercentage(ProjectPhase phase,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var tasks = await _context.ProjectTasks
|
||||
.Where(t => t.PhaseId == phase.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
if (!tasks.Any())
|
||||
return (0, TimeSpan.Zero);
|
||||
return (0, TimeSpan.Zero,TimeSpan.Zero);
|
||||
var taskPercentages = new List<int>();
|
||||
var totalTime = TimeSpan.Zero;
|
||||
var remainingTime = TimeSpan.Zero;
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
var (taskPercentage, taskTime) = await CalculateTaskPercentage(task, cancellationToken);
|
||||
var (taskPercentage, taskTime,taskRemainingTime) = await CalculateTaskPercentage(task, cancellationToken);
|
||||
taskPercentages.Add(taskPercentage);
|
||||
totalTime += taskTime;
|
||||
remainingTime += taskRemainingTime;
|
||||
}
|
||||
|
||||
var averagePercentage = taskPercentages.Any() ? (int)taskPercentages.Average() : 0;
|
||||
return (averagePercentage, totalTime);
|
||||
return (averagePercentage, totalTime,remainingTime);
|
||||
}
|
||||
|
||||
private async Task<(int Percentage, TimeSpan TotalTime)> CalculateTaskPercentage(ProjectTask task, CancellationToken cancellationToken)
|
||||
private async Task<(int Percentage, TimeSpan TotalTime, TimeSpan RemainingTime)> CalculateTaskPercentage(
|
||||
ProjectTask task, CancellationToken cancellationToken)
|
||||
{
|
||||
var sections = await _context.TaskSections
|
||||
.Include(s => s.Activities)
|
||||
.Include(x=>x.AdditionalTimes)
|
||||
.Include(x => x.AdditionalTimes)
|
||||
.Where(s => s.TaskId == task.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
if (!sections.Any())
|
||||
return (0, TimeSpan.Zero);
|
||||
return (0, TimeSpan.Zero, TimeSpan.Zero);
|
||||
var sectionPercentages = new List<int>();
|
||||
var totalTime = TimeSpan.Zero;
|
||||
var spentTime = TimeSpan.Zero;
|
||||
foreach (var section in sections)
|
||||
{
|
||||
var (sectionPercentage, sectionTime) = CalculateSectionPercentage(section);
|
||||
var sectionSpent = TimeSpan.FromTicks(section.Activities.Sum(x => x.GetTimeSpent().Ticks));
|
||||
sectionPercentages.Add(sectionPercentage);
|
||||
totalTime += sectionTime;
|
||||
spentTime += sectionSpent;
|
||||
}
|
||||
var remainingTime = totalTime - spentTime;
|
||||
var averagePercentage = sectionPercentages.Any() ? (int)sectionPercentages.Average() : 0;
|
||||
return (averagePercentage, totalTime);
|
||||
return (averagePercentage, totalTime, remainingTime);
|
||||
}
|
||||
|
||||
private static (int Percentage, TimeSpan TotalTime) CalculateSectionPercentage(TaskSection section)
|
||||
{
|
||||
return ((int)section.GetProgressPercentage(),section.FinalEstimatedHours);
|
||||
return ((int)section.GetProgressPercentage(), section.FinalEstimatedHours);
|
||||
}
|
||||
|
||||
private static AssignmentStatus GetAssignmentStatus(TaskSection? section)
|
||||
@@ -341,7 +365,7 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
|
||||
// بررسی وجود user
|
||||
bool hasUser = section.CurrentAssignedUserId > 0;
|
||||
|
||||
|
||||
// بررسی وجود time (InitialEstimatedHours بزرگتر از صفر باشد)
|
||||
bool hasTime = section.InitialEstimatedHours > TimeSpan.Zero;
|
||||
|
||||
@@ -356,5 +380,4 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
// تعیین تکلیف نشده: نه user دارد نه time
|
||||
return AssignmentStatus.Unassigned;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,8 +9,8 @@ public class GetTaskDto
|
||||
public int Percentage { get; init; }
|
||||
public ProjectHierarchyLevel Level { get; init; }
|
||||
public Guid? ParentId { get; init; }
|
||||
public int TotalHours { get; set; }
|
||||
public int Minutes { get; set; }
|
||||
|
||||
public TimeSpan TotalTime { get; set; }
|
||||
|
||||
// Task-specific fields
|
||||
public TimeSpan SpentTime { get; init; }
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
|
||||
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
||||
{
|
||||
public long? UserId { get; set; }
|
||||
public string? SearchText { get; set; }
|
||||
public string? ProjectName { get; set; }
|
||||
public TaskSectionStatus? Status { get; set; }
|
||||
}
|
||||
@@ -46,11 +46,11 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.SearchText))
|
||||
if (!string.IsNullOrWhiteSpace(request.ProjectName))
|
||||
{
|
||||
queryable = queryable.Where(x=>x.Task.Name.Contains(request.SearchText)
|
||||
|| x.Task.Phase.Name.Contains(request.SearchText)
|
||||
|| x.Task.Phase.Project.Name.Contains(request.SearchText));
|
||||
queryable = queryable.Where(x=>x.Task.Name.Contains(request.ProjectName)
|
||||
|| x.Task.Phase.Name.Contains(request.ProjectName)
|
||||
|| x.Task.Phase.Project.Name.Contains(request.ProjectName));
|
||||
}
|
||||
|
||||
var data = await queryable.ToListAsync(cancellationToken);
|
||||
@@ -70,6 +70,9 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
.OrderByDescending(x => x.CurrentAssignedUserId == currentUserId)
|
||||
.ThenByDescending(x=>x.Task.Priority)
|
||||
.ThenBy(x => GetStatusOrder(x.Status))
|
||||
.ThenBy(x=>x.Task.Phase.ProjectId)
|
||||
.ThenBy(x=>x.Task.PhaseId)
|
||||
.ThenBy(x=>x.TaskId)
|
||||
.Select(x =>
|
||||
{
|
||||
// محاسبه یکبار برای هر Activity و Cache کردن نتیجه
|
||||
|
||||
@@ -28,26 +28,25 @@ public class SendMessageCommandHandler : IBaseCommandHandler<SendMessageCommand,
|
||||
private readonly ITaskChatMessageRepository _messageRepository;
|
||||
private readonly IUploadedFileRepository _fileRepository;
|
||||
private readonly IProjectTaskRepository _taskRepository;
|
||||
private readonly IFileStorageService _fileStorageService;
|
||||
private readonly IThumbnailGeneratorService _thumbnailService;
|
||||
private readonly IFileUploadService _fileUploadService;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
public SendMessageCommandHandler(
|
||||
ITaskChatMessageRepository messageRepository,
|
||||
IUploadedFileRepository fileRepository,
|
||||
IProjectTaskRepository taskRepository,
|
||||
IFileStorageService fileStorageService,
|
||||
IThumbnailGeneratorService thumbnailService, IAuthHelper authHelper)
|
||||
IProjectTaskRepository taskRepository,
|
||||
IAuthHelper authHelper,
|
||||
IFileUploadService fileUploadService)
|
||||
{
|
||||
_messageRepository = messageRepository;
|
||||
_fileRepository = fileRepository;
|
||||
_taskRepository = taskRepository;
|
||||
_fileStorageService = fileStorageService;
|
||||
_thumbnailService = thumbnailService;
|
||||
_authHelper = authHelper;
|
||||
_fileUploadService = fileUploadService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<MessageDto>> Handle(SendMessageCommand request, CancellationToken cancellationToken)
|
||||
public async Task<OperationResult<MessageDto>> Handle(SendMessageCommand request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var currentUserId = _authHelper.GetCurrentUserId()
|
||||
?? throw new UnAuthorizedException("کاربر احراز هویت نشده است");
|
||||
@@ -57,75 +56,21 @@ public class SendMessageCommandHandler : IBaseCommandHandler<SendMessageCommand,
|
||||
{
|
||||
return OperationResult<MessageDto>.NotFound("تسک یافت نشد");
|
||||
}
|
||||
|
||||
|
||||
Guid? uploadedFileId = null;
|
||||
if (request.File != null)
|
||||
{
|
||||
if (request.File.Length == 0)
|
||||
{
|
||||
return OperationResult<MessageDto>.ValidationError("فایل خالی است");
|
||||
}
|
||||
|
||||
const long maxFileSize = 100 * 1024 * 1024;
|
||||
if (request.File.Length > maxFileSize)
|
||||
{
|
||||
return OperationResult<MessageDto>.ValidationError("حجم فایل بیش از حد مجاز است (حداکثر 100MB)");
|
||||
}
|
||||
|
||||
var fileType = DetectFileType(request.File.ContentType, Path.GetExtension(request.File.FileName));
|
||||
|
||||
var uploadedFile = new UploadedFile(
|
||||
originalFileName: request.File.FileName,
|
||||
fileSizeBytes: request.File.Length,
|
||||
mimeType: request.File.ContentType,
|
||||
fileType: fileType,
|
||||
category: FileCategory.TaskChatMessage,
|
||||
uploadedByUserId: currentUserId,
|
||||
storageProvider: StorageProvider.LocalFileSystem
|
||||
var uploadedFile = await _fileUploadService.UploadFileAsync
|
||||
(
|
||||
request.File,
|
||||
FileCategory.TaskChatMessage,
|
||||
currentUserId
|
||||
);
|
||||
|
||||
await _fileRepository.AddAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
|
||||
try
|
||||
if (!uploadedFile.IsSuccess)
|
||||
{
|
||||
using var stream = request.File.OpenReadStream();
|
||||
var uploadResult = await _fileStorageService.UploadAsync(
|
||||
stream,
|
||||
uploadedFile.UniqueFileName,
|
||||
"TaskChatMessage"
|
||||
);
|
||||
|
||||
uploadedFile.CompleteUpload(uploadResult.StoragePath, uploadResult.StorageUrl);
|
||||
|
||||
if (fileType == FileType.Image)
|
||||
{
|
||||
var dimensions = await _thumbnailService.GetImageDimensionsAsync(uploadResult.StoragePath);
|
||||
if (dimensions.HasValue)
|
||||
{
|
||||
uploadedFile.SetImageDimensions(dimensions.Value.Width, dimensions.Value.Height);
|
||||
}
|
||||
|
||||
var thumbnail = await _thumbnailService
|
||||
.GenerateImageThumbnailAsync(uploadResult.StoragePath, category: "TaskChatMessage");
|
||||
if (thumbnail.HasValue)
|
||||
{
|
||||
uploadedFile.SetThumbnail(thumbnail.Value.ThumbnailUrl);
|
||||
}
|
||||
}
|
||||
|
||||
await _fileRepository.UpdateAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
|
||||
uploadedFileId = uploadedFile.Id;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _fileRepository.DeleteAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
|
||||
return OperationResult<MessageDto>.ValidationError($"خطا در آپلود فایل: {ex.Message}");
|
||||
return OperationResult<MessageDto>.Failure(uploadedFile.ErrorMessage ?? "خطا در آپلود فایل");
|
||||
}
|
||||
uploadedFileId = uploadedFile.FileId!.Value;
|
||||
}
|
||||
|
||||
var message = new TaskChatMessage(
|
||||
@@ -209,4 +154,4 @@ public class SendMessageCommandHandler : IBaseCommandHandler<SendMessageCommand,
|
||||
|
||||
return FileType.Document;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Enums;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Services.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// سرویس آپلود و مدیریت کامل فایل
|
||||
/// این سرویس تمام مراحل آپلود، ذخیره، تولید thumbnail و... را انجام میدهد
|
||||
/// </summary>
|
||||
public interface IFileUploadService
|
||||
{
|
||||
/// <summary>
|
||||
/// آپلود فایل با تمام مراحل پردازش
|
||||
/// </summary>
|
||||
/// <param name="file">فایل برای آپلود</param>
|
||||
/// <param name="category">دستهبندی فایل</param>
|
||||
/// <param name="uploadedByUserId">شناسه کاربر آپلودکننده</param>
|
||||
/// <param name="maxFileSizeBytes">حداکثر حجم مجاز فایل (پیشفرض: 100MB)</param>
|
||||
/// <returns>شناسه فایل آپلود شده یا null در صورت خطا</returns>
|
||||
Task<FileUploadResult> UploadFileAsync(
|
||||
IFormFile file,
|
||||
FileCategory category,
|
||||
long uploadedByUserId,
|
||||
long maxFileSizeBytes = 100 * 1024 * 1024);
|
||||
|
||||
/// <summary>
|
||||
/// آپلود فایل با Stream
|
||||
/// </summary>
|
||||
Task<FileUploadResult> UploadFileFromStreamAsync(
|
||||
Stream fileStream,
|
||||
string fileName,
|
||||
string contentType,
|
||||
FileCategory category,
|
||||
long uploadedByUserId,
|
||||
long maxFileSizeBytes = 100 * 1024 * 1024);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نتیجه عملیات آپلود فایل
|
||||
/// </summary>
|
||||
public class FileUploadResult
|
||||
{
|
||||
public bool IsSuccess { get; set; }
|
||||
public Guid? FileId { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
public string? StorageUrl { get; set; }
|
||||
public string? ThumbnailUrl { get; set; }
|
||||
|
||||
public static FileUploadResult Success(Guid fileId, string storageUrl, string? thumbnailUrl = null)
|
||||
{
|
||||
return new FileUploadResult
|
||||
{
|
||||
IsSuccess = true,
|
||||
FileId = fileId,
|
||||
StorageUrl = storageUrl,
|
||||
ThumbnailUrl = thumbnailUrl
|
||||
};
|
||||
}
|
||||
|
||||
public static FileUploadResult Failed(string errorMessage)
|
||||
{
|
||||
return new FileUploadResult
|
||||
{
|
||||
IsSuccess = false,
|
||||
ErrorMessage = errorMessage
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +149,22 @@ public static class ProgramManagerPermissionCode
|
||||
{
|
||||
public const int Code = 990111;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// اولویت بندی
|
||||
/// </summary>
|
||||
public static class Priority
|
||||
{
|
||||
public const int Code = 990112;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد تسک باگ
|
||||
/// </summary>
|
||||
public static class CreateBug
|
||||
{
|
||||
public const int Code = 990113;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -226,11 +242,26 @@ public static class ProgramManagerPermissionCode
|
||||
{
|
||||
public const int Code = 990208;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// رد با تایید اتمام اجرا
|
||||
/// </summary>
|
||||
public static class RejectOrApproveTaskComplete
|
||||
{
|
||||
public const int Code = 990209;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workflow[تب کارپوشه]
|
||||
public static class Workflow
|
||||
{
|
||||
public const int Code = 9903;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public static Dictionary<string, object> GetAllCodes()
|
||||
{
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
@@ -41,15 +41,7 @@ public class ProjectPhase : ProjectHierarchyNode
|
||||
public ProjectDeployStatus DeployStatus { get; set; }
|
||||
|
||||
#region Task Management
|
||||
|
||||
public ProjectTask AddTask(string name, string? description = null)
|
||||
{
|
||||
var task = new ProjectTask(name, Id, description);
|
||||
_tasks.Add(task);
|
||||
AddDomainEvent(new TaskAddedEvent(task.Id, Id, name));
|
||||
return task;
|
||||
}
|
||||
|
||||
|
||||
public void RemoveTask(Guid taskId)
|
||||
{
|
||||
var task = _tasks.FirstOrDefault(t => t.Id == taskId);
|
||||
|
||||
@@ -16,11 +16,11 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
_sections = new List<TaskSection>();
|
||||
}
|
||||
|
||||
public ProjectTask(string name, Guid phaseId, string? description = null) : base(name, description)
|
||||
public ProjectTask(string name, Guid phaseId,ProjectTaskPriority priority, string? description = null) : base(name, description)
|
||||
{
|
||||
PhaseId = phaseId;
|
||||
_sections = new List<TaskSection>();
|
||||
Priority = ProjectTaskPriority.Low;
|
||||
Priority = priority;
|
||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ public static class DependencyInjection
|
||||
// File Storage Services
|
||||
services.AddScoped<IFileStorageService, Services.FileManagement.LocalFileStorageService>();
|
||||
services.AddScoped<IThumbnailGeneratorService, Services.FileManagement.ThumbnailGeneratorService>();
|
||||
services.AddScoped<IFileUploadService, Services.FileManagement.FileUploadService>();
|
||||
|
||||
// JWT Settings
|
||||
services.Configure<JwtSettings>(configuration.GetSection("JwtSettings"));
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
using GozareshgirProgramManager.Application.Services.FileManagement;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Services.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// پیادهسازی سرویس آپلود کامل فایل
|
||||
/// </summary>
|
||||
public class FileUploadService : IFileUploadService
|
||||
{
|
||||
private readonly IUploadedFileRepository _fileRepository;
|
||||
private readonly IFileStorageService _fileStorageService;
|
||||
private readonly IThumbnailGeneratorService _thumbnailService;
|
||||
private readonly ILogger<FileUploadService> _logger;
|
||||
|
||||
public FileUploadService(
|
||||
IUploadedFileRepository fileRepository,
|
||||
IFileStorageService fileStorageService,
|
||||
IThumbnailGeneratorService thumbnailService,
|
||||
ILogger<FileUploadService> logger)
|
||||
{
|
||||
_fileRepository = fileRepository;
|
||||
_fileStorageService = fileStorageService;
|
||||
_thumbnailService = thumbnailService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<FileUploadResult> UploadFileAsync(
|
||||
IFormFile file,
|
||||
FileCategory category,
|
||||
long uploadedByUserId,
|
||||
long maxFileSizeBytes = 100 * 1024 * 1024)
|
||||
{
|
||||
try
|
||||
{
|
||||
// اعتبارسنجی ورودی
|
||||
if (file.Length == 0)
|
||||
{
|
||||
return FileUploadResult.Failed("فایل خالی است");
|
||||
}
|
||||
|
||||
if (file.Length > maxFileSizeBytes)
|
||||
{
|
||||
var maxSizeMb = maxFileSizeBytes / (1024 * 1024);
|
||||
return FileUploadResult.Failed($"حجم فایل بیش از حد مجاز است (حداکثر {maxSizeMb}MB)");
|
||||
}
|
||||
|
||||
using var stream = file.OpenReadStream();
|
||||
return await UploadFileFromStreamAsync(
|
||||
stream,
|
||||
file.FileName,
|
||||
file.ContentType,
|
||||
category,
|
||||
uploadedByUserId,
|
||||
maxFileSizeBytes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "خطا در آپلود فایل {FileName}", file.FileName);
|
||||
return FileUploadResult.Failed($"خطا در آپلود فایل: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<FileUploadResult> UploadFileFromStreamAsync(
|
||||
Stream fileStream,
|
||||
string fileName,
|
||||
string contentType,
|
||||
FileCategory category,
|
||||
long uploadedByUserId,
|
||||
long maxFileSizeBytes = 100 * 1024 * 1024)
|
||||
{
|
||||
UploadedFile? uploadedFile = null;
|
||||
|
||||
try
|
||||
{
|
||||
// تشخیص نوع فایل
|
||||
var fileType = DetectFileType(contentType, Path.GetExtension(fileName));
|
||||
|
||||
// ایجاد رکورد فایل در دیتابیس
|
||||
uploadedFile = new UploadedFile(
|
||||
originalFileName: fileName,
|
||||
fileSizeBytes: fileStream.Length,
|
||||
mimeType: contentType,
|
||||
fileType: fileType,
|
||||
category: category,
|
||||
uploadedByUserId: uploadedByUserId,
|
||||
storageProvider: StorageProvider.LocalFileSystem
|
||||
);
|
||||
|
||||
await _fileRepository.AddAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
|
||||
// آپلود فایل به استوریج
|
||||
var categoryFolder = category.ToString();
|
||||
var uploadResult = await _fileStorageService.UploadAsync(
|
||||
fileStream,
|
||||
uploadedFile.UniqueFileName,
|
||||
categoryFolder
|
||||
);
|
||||
|
||||
// بهروزرسانی اطلاعات آپلود
|
||||
uploadedFile.CompleteUpload(uploadResult.StoragePath, uploadResult.StorageUrl);
|
||||
|
||||
// پردازشهای خاص بر اساس نوع فایل
|
||||
string? thumbnailUrl = null;
|
||||
if (fileType == FileType.Image)
|
||||
{
|
||||
thumbnailUrl = await ProcessImageAsync(uploadedFile, uploadResult.StoragePath, categoryFolder);
|
||||
}
|
||||
else if (fileType == FileType.Video)
|
||||
{
|
||||
thumbnailUrl = await ProcessVideoAsync(uploadedFile, uploadResult.StoragePath, categoryFolder);
|
||||
}
|
||||
|
||||
// ذخیره تغییرات نهایی
|
||||
await _fileRepository.UpdateAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
|
||||
_logger.LogInformation(
|
||||
"فایل {FileName} با شناسه {FileId} با موفقیت آپلود شد",
|
||||
fileName,
|
||||
uploadedFile.Id);
|
||||
|
||||
return FileUploadResult.Success(uploadedFile.Id, uploadResult.StorageUrl, thumbnailUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "خطا در آپلود فایل {FileName}", fileName);
|
||||
|
||||
// در صورت خطا، فایل آپلود شده را حذف کنیم
|
||||
if (uploadedFile != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _fileRepository.DeleteAsync(uploadedFile);
|
||||
await _fileRepository.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception deleteEx)
|
||||
{
|
||||
_logger.LogError(deleteEx, "خطا در حذف فایل ناموفق {FileId}", uploadedFile.Id);
|
||||
}
|
||||
}
|
||||
|
||||
return FileUploadResult.Failed($"خطا در آپلود فایل: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پردازش تصویر (ابعاد و thumbnail)
|
||||
/// </summary>
|
||||
private async Task<string?> ProcessImageAsync(UploadedFile file, string storagePath, string categoryFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
// دریافت ابعاد تصویر
|
||||
var dimensions = await _thumbnailService.GetImageDimensionsAsync(storagePath);
|
||||
if (dimensions.HasValue)
|
||||
{
|
||||
file.SetImageDimensions(dimensions.Value.Width, dimensions.Value.Height);
|
||||
}
|
||||
|
||||
// تولید thumbnail
|
||||
var thumbnail = await _thumbnailService.GenerateImageThumbnailAsync(
|
||||
storagePath,
|
||||
category: categoryFolder);
|
||||
|
||||
if (thumbnail.HasValue)
|
||||
{
|
||||
file.SetThumbnail(thumbnail.Value.ThumbnailUrl);
|
||||
return thumbnail.Value.ThumbnailUrl;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "خطا در پردازش تصویر {FileId}", file.Id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پردازش ویدیو (thumbnail)
|
||||
/// </summary>
|
||||
private async Task<string?> ProcessVideoAsync(UploadedFile file, string storagePath, string categoryFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
// تولید thumbnail از ویدیو
|
||||
var thumbnail = await _thumbnailService.GenerateVideoThumbnailAsync(
|
||||
storagePath,
|
||||
category: categoryFolder);
|
||||
|
||||
if (thumbnail.HasValue)
|
||||
{
|
||||
file.SetThumbnail(thumbnail.Value.ThumbnailUrl);
|
||||
return thumbnail.Value.ThumbnailUrl;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "خطا در پردازش ویدیو {FileId}", file.Id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تشخیص نوع فایل از روی MIME type و extension
|
||||
/// </summary>
|
||||
private FileType DetectFileType(string mimeType, string extension)
|
||||
{
|
||||
if (mimeType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
return FileType.Image;
|
||||
|
||||
if (mimeType.StartsWith("video/", StringComparison.OrdinalIgnoreCase))
|
||||
return FileType.Video;
|
||||
|
||||
if (mimeType.StartsWith("audio/", StringComparison.OrdinalIgnoreCase))
|
||||
return FileType.Audio;
|
||||
|
||||
if (new[] { ".zip", ".rar", ".7z", ".tar", ".gz" }.Contains(extension.ToLower()))
|
||||
return FileType.Archive;
|
||||
|
||||
return FileType.Document;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using _0_Framework.Application.Sms;
|
||||
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;
|
||||
@@ -9,12 +12,14 @@ 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)
|
||||
public SmsReportController(ISmsResultApplication smsResultApplication, ISmsService smsService, ISmsSettingApplication smsSettingApplication)
|
||||
{
|
||||
_smsResultApplication = smsResultApplication;
|
||||
_smsService = smsService;
|
||||
_smsSettingApplication = smsSettingApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,11 +40,25 @@ 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;
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
@@ -56,4 +75,206 @@ public class SmsReportController : AdminBaseController
|
||||
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
|
||||
}
|
||||
@@ -1216,10 +1216,31 @@
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990111" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد بخش فرعی </span> </label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990111" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد بخش فرعی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- اولویت بندی-->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990112" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> اولویت بندی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ایجاد تسک باگ-->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990113" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد تسک باگ </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--=================================================-->
|
||||
@@ -1310,8 +1331,28 @@
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- تایید یا رد اتمام اجرا -->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990209" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> تایید یا رد اتمام اجرا </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--=================================================-->
|
||||
<!--#### کارپوشه ####-->
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="9903" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> کارپوشه </span> </label>
|
||||
<!-----------------------Sub Menu------------------->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1202,15 +1202,35 @@
|
||||
|
||||
|
||||
<!-- ایجاد بخش فرعی -->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990111" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد بخش فرعی </span> </label>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990111" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد بخش فرعی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- اولویت بندی-->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990112" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> اولویت بندی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ایجاد تسک باگ-->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990113" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> ایجاد تسک باگ </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--=================================================-->
|
||||
<!--#### تب اجرا ####-->
|
||||
@@ -1292,17 +1312,36 @@
|
||||
</div>
|
||||
|
||||
<!-- چت -->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990208" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> چت </span> </label>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990208" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> چت </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- تایید یا رد اتمام اجرا -->
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="990209" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> تایید یا رد اتمام اجرا </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--=================================================-->
|
||||
<!--#### کارپوشه ####-->
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="9903" class="check-btn" data-pm=""> <span style="bottom: 2px;position: relative"> کارپوشه </span> </label>
|
||||
<!-----------------------Sub Menu------------------->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user