Compare commits
8 Commits
Feature/In
...
Feature/ro
| Author | SHA1 | Date | |
|---|---|---|---|
| d1ac8e49ba | |||
| c10ae17f8c | |||
| c13ad3a8a7 | |||
| e0c247d07b | |||
| 1a3558df52 | |||
| 25c7b67eb5 | |||
| 19b390b17d | |||
| d3cd7e5b3c |
@@ -27,9 +27,10 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -79,4 +79,5 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
#endregion
|
||||
|
||||
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace Company.Domain.RollCallAgg
|
||||
DateTime endSearch);
|
||||
void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date);
|
||||
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(IEnumerable<long> employeeIds,
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public class SmsResult: EntityBase
|
||||
{
|
||||
public SmsResult(int messageId, string status,string typeOfSms, string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
public SmsResult(int messageId, string status,string typeOfSms,
|
||||
string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
{
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
|
||||
@@ -76,6 +76,7 @@ public interface IEmployeeApplication
|
||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||
|
||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -266,8 +266,7 @@ public class InstitutionContractPrintViewModel
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifyDateTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <summary>
|
||||
/// گزارش آنلاین حضور غیاب
|
||||
/// </summary>
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// گزارش آفلاین حضور غیاب کارگاه
|
||||
@@ -126,6 +126,13 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <returns></returns>
|
||||
OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
|
||||
}
|
||||
|
||||
public class WorkshopCurrentDayRollCallSearchModel
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public int PersonnelCode { get; set; }
|
||||
}
|
||||
|
||||
public class ReCalculateRollCallValues
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
@@ -373,7 +373,9 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
}).OrderBy(x => x.Color switch { "orange" => 0, "white" => 1, "red" => 2, "green" => 3, "black" => 4, _ => 5 })
|
||||
.ToList();
|
||||
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1676,6 +1676,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1141,7 +1141,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
@@ -1378,7 +1378,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId);
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +144,9 @@ public class RollCallApplication : IRollCallApplication
|
||||
return _rollCallRepository.GetWorkshopRollCallHistory(searchModel);
|
||||
}
|
||||
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId, WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
{
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId, searchModel);
|
||||
}
|
||||
|
||||
public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate,
|
||||
|
||||
@@ -1062,5 +1062,29 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
|
||||
|
||||
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
|
||||
|
||||
|
||||
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
|
||||
|
||||
|
||||
var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
||||
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id));
|
||||
|
||||
|
||||
return await employeesQuery.Select(x => new EmployeeSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FullName
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2343,7 +2343,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -2740,8 +2740,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
|
||||
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
|
||||
VerifyDateTime = institution.VerifyCodeCreation.ToFarsi(),
|
||||
Workshops = institution.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
|
||||
{
|
||||
|
||||
@@ -1052,11 +1052,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
|
||||
//گزارش آنلاین حضور غیاب کارگاه
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,
|
||||
WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
{
|
||||
var date = DateTime.Now.Date;
|
||||
|
||||
|
||||
|
||||
//get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی
|
||||
var leaves = _context.LeaveList
|
||||
.Where(x =>
|
||||
@@ -1070,7 +1070,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
//var workingEmployees =
|
||||
// _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.StartWorkDate < date && x.LeftWorkDate.Date > date);
|
||||
|
||||
|
||||
if (searchModel.PersonnelCode>0)
|
||||
{
|
||||
personnelCodes = personnelCodes.Where(x=>x.PersonnelCode == searchModel.PersonnelCode);
|
||||
}
|
||||
|
||||
|
||||
//get activated employees
|
||||
var activeEmployees =
|
||||
@@ -1084,6 +1088,15 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
x.WorkshopId == workshopId && (x.ShiftDate.Date == date || x.EndDate == null) && x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
|
||||
|
||||
if (searchModel.EmployeeId>0)
|
||||
{
|
||||
leaves = leaves.Where(x=>x.WorkshopId == searchModel.EmployeeId);
|
||||
personnelCodes = personnelCodes.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
activeEmployees = activeEmployees.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
rollCallsQuery = rollCallsQuery.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var mustBePresent = activeEmployees.Where(x => !leaves.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace _0_Framework.Application.Sms;
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
|
||||
public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
|
||||
|
||||
public SmsService(IConfiguration configuration)
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_smsResultRepository = smsResultRepository;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
}
|
||||
@@ -330,7 +332,7 @@ public class SmsService : ISmsService
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
@@ -341,15 +343,25 @@ public class SmsService : ISmsService
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -56,7 +56,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentDayAjax(string type, long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -83,7 +83,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentAjaxCount(long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
35
ServiceHost/Areas/Client/Controllers/RollCallController.cs
Normal file
35
ServiceHost/Areas/Client/Controllers/RollCallController.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class RollCallController:ClientBaseController
|
||||
{
|
||||
private long _workshopId;
|
||||
private readonly IRollCallApplication _rollCallApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
|
||||
public RollCallController(IRollCallApplication rollCallApplication,IAuthHelper authHelper, IEmployeeApplication employeeApplication)
|
||||
{
|
||||
_rollCallApplication = rollCallApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
[HttpGet("current-day")]
|
||||
public ActionResult<CurrentDayRollCall> GetCurrentDay(WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
{
|
||||
var res = _rollCallApplication.GetWorkshopCurrentDayRollCalls(_workshopId, searchModel);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet("employee-select-list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
||||
{
|
||||
var res = await _employeeApplication.GetWorkingEmployeesSelectList(_workshopId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -143,7 +143,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
Reference in New Issue
Block a user