Merge branch 'Main' of https://github.com/syntax24/OriginalGozareshgir into Main
This commit is contained in:
14
.github/workflows/dotnet-developPublish.yml
vendored
14
.github/workflows/dotnet-developPublish.yml
vendored
@@ -33,14 +33,18 @@ jobs:
|
||||
shell: powershell
|
||||
run: |
|
||||
$publishFolder = Resolve-Path ./publish
|
||||
$server = $env:SERVER_HOST
|
||||
$user = $env:DEPLOY_USER
|
||||
$pass = $env:DEPLOY_PASSWORD
|
||||
|
||||
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
||||
-verb:sync `
|
||||
-source:contentPath="$publishFolder" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://$env:SERVER_HOST:8172/msdeploy.axd?site=gozareshgir",userName="$env:DEPLOY_USER",password="$env:DEPLOY_PASSWORD",authType="Basic" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://${server}:8172/msdeploy.axd?site=dadmehrg",userName="$user",password="$pass",authType="Basic" `
|
||||
-allowUntrusted `
|
||||
-enableRule:AppOffline
|
||||
|
||||
env:
|
||||
SERVER_HOST: 171.22.24.15
|
||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||
DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
|
||||
env:
|
||||
SERVER_HOST: ${{ secrets.DEV_HOST }}
|
||||
DEPLOY_USER: ${{ secrets.DEV_USER }}
|
||||
DEPLOY_PASSWORD: ${{ secrets.DEV_PASS }}
|
||||
|
||||
@@ -54,6 +54,7 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
|
||||
Employee GetIgnoreQueryFilter(long id);
|
||||
|
||||
[Obsolete("این متد منسوخ شده است و از متد WorkedEmployeesInWorkshopSelectList استفاده کنید")]
|
||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||
|
||||
|
||||
@@ -85,10 +86,24 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeListDto>> ListOfAllEmployees(EmployeeSearchModelDto searchModel, long workshopId);
|
||||
Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// پرینت تجمیعی پرسنل کلاینت
|
||||
/// api
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست پرسنل های کارگاه کلاینت
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
||||
|
||||
/// <summary>
|
||||
/// پرینت تجمیعی پرسنل
|
||||
/// </summary>
|
||||
public class PrintAllEmployeesInfoDtoClient
|
||||
{
|
||||
public PrintAllEmployeesInfoDtoClient(EmployeeListDto source)
|
||||
{
|
||||
Id = source.Id;
|
||||
EmployeeFullName = source.EmployeeFullName;
|
||||
PersonnelCode = source.PersonnelCode;
|
||||
MaritalStatus = source.MaritalStatus;
|
||||
NationalCode = source.NationalCode;
|
||||
IdNumber = source.IdNumber;
|
||||
DateOfBirth = source.DateOfBirth;
|
||||
FatherName = source.FatherName;
|
||||
NumberOfChildren = source.NumberOfChildren;
|
||||
LatestContractStartDate = source.LatestContractStartDate;
|
||||
ContractLeftDate = source.ContractLeftDate;
|
||||
LatestInsuranceStartDate = source.LatestInsuranceStartDate;
|
||||
InsuranceLeftDate = source.InsuranceLeftDate;
|
||||
Black = source.EmployeeStatusInWorkshop == EmployeeStatusInWorkshop.HasLeft;
|
||||
}
|
||||
/// <summary>
|
||||
/// آی دی پرسنل
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد پرسنلی
|
||||
/// </summary>
|
||||
public int PersonnelCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تاهل
|
||||
/// </summary>
|
||||
public string MaritalStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FatherName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد فرزندان
|
||||
/// </summary>
|
||||
public string NumberOfChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آخرین تاریخ شروع بکار قرارداد
|
||||
/// </summary>
|
||||
public string LatestContractStartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ترک کار قرارداد
|
||||
/// </summary>
|
||||
public string ContractLeftDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آخرین تاریخ شروع بکار بیمه
|
||||
/// </summary>
|
||||
public string LatestInsuranceStartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ترک کار بیمه
|
||||
/// </summary>
|
||||
public string InsuranceLeftDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت پرسنل در کارگاه
|
||||
/// </summary>
|
||||
public bool Black { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
@@ -73,10 +75,11 @@ public interface IEmployeeApplication
|
||||
long workshopId);
|
||||
Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(EditEmployeeInEmployeeDocument command);
|
||||
|
||||
[Obsolete("این متد منسوخ شده است و از متد WorkedEmployeesInWorkshopSelectList استفاده کنید")]
|
||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||
|
||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -112,9 +115,25 @@ public interface IEmployeeApplication
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeListDto>> ListOfAllEmployees(EmployeeSearchModelDto searchModel, long workshopId);
|
||||
Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// پرینت تجمیعی پرسنل کلاینت
|
||||
/// api
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست پرسنل های کارگاه کلاینت
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class GetClientEmployeeListSearchModel
|
||||
|
||||
@@ -1714,10 +1714,6 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1738,9 +1734,19 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return await _EmployeeRepository.GetClientEmployeeList(searchModel, workshopId);
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeListDto>> ListOfAllEmployees(EmployeeSearchModelDto searchModel, long workshopId)
|
||||
public async Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.ListOfAllEmployees(searchModel, workshopId);
|
||||
return await _EmployeeRepository.ListOfAllEmployeesClient(searchModel, workshopId);
|
||||
}
|
||||
|
||||
public async Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.PrintAllEmployeesInfoClient(workshopId);
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -7,6 +7,7 @@ using Company.Domain.EmployeeAccountAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||
using Company.Domain.InsuranceListAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
@@ -1175,7 +1176,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<EmployeeListDto>> ListOfAllEmployees(EmployeeSearchModelDto searchModel, long workshopId)
|
||||
public async Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId)
|
||||
{
|
||||
var hasNotStoppedWorkingYet = Tools.GetUndefinedDateTime();
|
||||
|
||||
@@ -1276,28 +1277,81 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId)
|
||||
{
|
||||
var res = await ListOfAllEmployeesClient(new EmployeeSearchModelDto(), workshopId);
|
||||
|
||||
return res
|
||||
.Where(x=>x.EmployeeStatusInWorkshop != EmployeeStatusInWorkshop.CreatedByClient
|
||||
&& x.EmployeeStatusInWorkshop != EmployeeStatusInWorkshop.LefWorkTemp)
|
||||
.Select(x => new PrintAllEmployeesInfoDtoClient(x)).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var hasNotStoppedWorkingYet = Tools.GetUndefinedDateTime();
|
||||
|
||||
var baseQuery = await
|
||||
(
|
||||
from personnelCode in _context.PersonnelCodeSet
|
||||
join employee in _context.Employees
|
||||
on personnelCode.EmployeeId equals employee.id
|
||||
where personnelCode.WorkshopId == workshopId
|
||||
select new
|
||||
{
|
||||
Employee = employee,
|
||||
PersonnelCode = personnelCode
|
||||
}
|
||||
).ToListAsync();
|
||||
|
||||
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
|
||||
var employeeIds = baseQuery.Select(x => x.Employee.id).ToList();
|
||||
|
||||
var leftWorks = await _context.LeftWorkList
|
||||
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
||||
.ToListAsync();
|
||||
|
||||
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
|
||||
var insuranceLeftWorks = await _context.LeftWorkInsuranceList
|
||||
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
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()
|
||||
var result = baseQuery.Select(x =>
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FullName
|
||||
}).ToListAsync();
|
||||
var left = leftWorks
|
||||
.Where(l => l.EmployeeId == x.Employee.id)
|
||||
.MaxBy(l => l.StartWorkDate);
|
||||
|
||||
var insuranceLeftWork = insuranceLeftWorks
|
||||
.Where(l => l.EmployeeId == x.Employee.id).MaxBy(l => l.StartWorkDate);
|
||||
|
||||
|
||||
|
||||
|
||||
var contractLeft = left != null
|
||||
? left.LeftWorkDate != hasNotStoppedWorkingYet ? left.LeftWorkDate.ToFarsi() : ""
|
||||
: "";
|
||||
var insuranceLeft = insuranceLeftWork != null
|
||||
? insuranceLeftWork.LeftWorkDate != null ? insuranceLeftWork.LeftWorkDate.ToFarsi() : ""
|
||||
: "";
|
||||
|
||||
|
||||
|
||||
|
||||
bool employeeHasLeft =
|
||||
(!string.IsNullOrWhiteSpace(insuranceLeft) && !string.IsNullOrWhiteSpace(contractLeft))
|
||||
|| (left == null && !string.IsNullOrWhiteSpace(insuranceLeft))
|
||||
|| (insuranceLeftWork == null && !string.IsNullOrWhiteSpace(contractLeft));
|
||||
|
||||
return new EmployeeSelectListViewModel
|
||||
{
|
||||
Id = x.Employee.id,
|
||||
EmployeeFullName = x.Employee.FullName,
|
||||
Black = employeeHasLeft,
|
||||
};
|
||||
}).OrderBy(x => x.Black ? 1 : 0).ToList();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -16,15 +16,20 @@ public class EmployeeController:ClientBaseController
|
||||
_employeeApplication = employeeApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست پرسنل
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select-list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
||||
{
|
||||
var result = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId);
|
||||
var result = await _employeeApplication.GetWorkingEmployeesSelectList(_workshopId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پرسنل
|
||||
/// </summary>
|
||||
@@ -33,7 +38,20 @@ public class EmployeeController:ClientBaseController
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<EmployeeListDto>>> GetList(EmployeeSearchModelDto searchModel)
|
||||
{
|
||||
var result = await _employeeApplication.ListOfAllEmployees(searchModel, _workshopId);
|
||||
var result = await _employeeApplication.ListOfAllEmployeesClient(searchModel, _workshopId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پرینت تجمیعی پرسنل
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("PrintAllEmployeesInfo")]
|
||||
public async Task<ActionResult<List<PrintAllEmployeesInfoDtoClient>>> PrintAllEmployeesInfo()
|
||||
{
|
||||
var result = await _employeeApplication.PrintAllEmployeesInfoClient(_workshopId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user