From 37fe2cc6c007dae986ece6346408d6541078baa9 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期三, 13 八月 2025 10:45:02 +0800 Subject: [PATCH] feat:开发 --- FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs | 63 ++++++++++++++++++++++++++++++- 1 files changed, 60 insertions(+), 3 deletions(-) diff --git a/FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs b/FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs index 52822be..f59f0f7 100644 --- a/FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs +++ b/FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs @@ -17,7 +17,8 @@ public class EnterpriseEmployeeQueryHandler( IRepository<EnterpriseEmployee> rep ) : - IRequestHandler<GetEnterpriseEmployeesQuery, GetEnterpriseEmployeesQueryResult> + IRequestHandler<GetEnterpriseEmployeesQuery, GetEnterpriseEmployeesQueryResult>, + IRequestHandler<GetEnterpriseEmployeeQuery, GetEnterpriseEmployeeQueryResult> { private readonly IRepository<EnterpriseEmployee> rep = rep; @@ -37,7 +38,7 @@ { q = q.Where(it => it.Name.Contains(request.Keywords) - || it.PhoneNumber.Contains(request.Keywords) + || it.ContactPhoneNumber.Contains(request.Keywords) || it.Identity.Contains(request.Keywords)); } if (request.CreatedTimeStart.HasValue && request.CreatedTimeEnd.HasValue) @@ -70,8 +71,64 @@ { q = q.Where(it => it.EnterpriseSignContractStatus == request.EnterpriseSignContractStatus); } - var s = q.ProjectToType<GetEnterpriseEmployeesQueryResultItem>(); + var s = q.Select(it => new GetEnterpriseEmployeesQueryResultItem + { + Id = it.Id, + Avatar = it.User.Avatar, + Name = it.Name, + Identity = it.Identity, + Gender = it.Gender, + Age = it.Age, + ContactPhoneNumber = it.ContactPhoneNumber, + UserIsReal = it.User.IsReal, + RealMethod = it.User.RealMethod, + PersonalIdentityCode = it.User.PersonalIdentityCode, + PersonalIdentityContent = it.User.PersonalIdentity.Content, + EducationalBackgroundCode = it.User.EducationalBackgroundCode, + EducationalBackgroundContent = it.User.EducationalBackground.Content, + TaskCount = it.User.EnterpriseEmployees.Where(ee => ee.HireStatus == EnumTaskUserHireStatus.Pass).Sum(ee => ee.TaskInfoUsers.Count()), + WorkSeniority = it.User.WorkSeniority, + WorkExperience = it.User.WorkExperience, + HireStatus = it.HireStatus, + UserSignContractStatus = it.UserSignContractStatus, + HireTime = it.HireTime, + UserRealTime = it.User.RealTime, + UserSignContractTime = it.UserSignContractTime, + EnterpriseSignContractStatus = it.EnterpriseSignContractStatus, + EnterpriseSignContractTime = it.EnterpriseSignContractTime + }); return await request.PageModel.GetPagedListAsync<GetEnterpriseEmployeesQueryResult, GetEnterpriseEmployeesQueryResultItem>(s, cancellationToken); } + + /// <summary> + /// 鏌ヨ鐏靛伐璇︽儏 + /// </summary> + /// <param name="request"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + public async Task<GetEnterpriseEmployeeQueryResult> Handle(GetEnterpriseEmployeeQuery request, CancellationToken cancellationToken) + { + var logier = JwtUtils.GetCurrentLogier(); + var model = await rep.AsQueryable().AsNoTracking() + .Where(it => it.Id == request.Id) + .GetDetail<EnterpriseEmployee, GetEnterpriseEmployeeQueryResult>(cancellationToken); + if (request.TaskInfoId.HasValue) + { + model.ApplyTime = await rep.Change<TaskInfoUser>().AsQueryable().AsNoTracking() + .Where(it => it.TaskInfoId == request.TaskInfoId && it.EnterpriseEmployeeId == request.Id) + .Select(it => it.CreatedTime as DateTimeOffset?) + .FirstOrDefaultAsync(cancellationToken); + } + else if (logier.Type == EnumUserType.Enterprise) + { + model.ApplyTime = await rep.Change<TaskInfoUser>().AsQueryable().AsNoTracking() + .OrderBy(it => it.CreatedTime) + .Where(it => it.TaskInfo.EnterpriseId == logier.EnterpriseId && it.EnterpriseEmployeeId == request.Id) + .Select(it => it.CreatedTime as DateTimeOffset?) + .FirstOrDefaultAsync(cancellationToken); + } + + return model; + } } } -- Gitblit v1.9.1