sunpengfei
8 天以前 10760c944ad47ef9e27aebd88c45bebf23521792
feat:开发
2个文件已修改
62 ■■■■■ 已修改文件
FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.UserServer.Application/FlexJobApi.UserServer.Application.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.UserServer.Application/EnterpriseEmployees/Queries/EnterpriseEmployeeQueryHandler.cs
@@ -1,4 +1,5 @@
using FlexJobApi.Core;
using Aop.Api.Domain;
using FlexJobApi.Core;
using Furion.DatabaseAccessor;
using Furion.DistributedIDGenerator;
using Furion.FriendlyException;
@@ -9,6 +10,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
@@ -21,6 +23,8 @@
            IRepository<EnterpriseEmployee> rep,
            IRepository<ContractTemplate> repContractTemplate,
            IRepository<EnterpriseEmployeeContract> repEnterpriseEmployeeContract,
            IRepository<Enterprise> repEnterprise,
            IRepository<User> repUser,
            IMediator mediator
        ) :
        IRequestHandler<GetEnterpriseEmployeesQuery, GetEnterpriseEmployeesQueryResult>,
@@ -31,6 +35,8 @@
        private readonly IRepository<EnterpriseEmployee> rep = rep;
        private readonly IRepository<ContractTemplate> repContractTemplate = repContractTemplate;
        private readonly IRepository<EnterpriseEmployeeContract> repEnterpriseEmployeeContract = repEnterpriseEmployeeContract;
        private readonly IRepository<Enterprise> repEnterprise = repEnterprise;
        private readonly IRepository<User> repUser = repUser;
        private readonly IMediator mediator = mediator;
        /// <summary>
@@ -239,12 +245,51 @@
                }, cancellationToken);
                var entity = await rep.AsQueryable()
                    .Include(it => it.Enterprise)
                    .Where(it =>
                        it.UserId == logier.Id
                        && it.ContractTemplateId == contractTemplate.Id)
                    .FirstOrDefaultAsync();
                if (entity == null) throw Oops.Oh(EnumErrorCodeType.s404, "灵工");
                var enterprise = await repEnterprise.AsQueryable()
                    .Where(it => it.Id == contractTemplate.EnterpriseId)
                    .Select(it => new
                    {
                        it.EnterpriseName
                    })
                    .FirstOrDefaultAsync();
                if (enterprise == null) throw Oops.Oh(EnumErrorCodeType.s404, "企业");
                var add = false;
                if (entity == null)
                {
                    var user = await repUser.AsQueryable().AsNoTracking()
                        .Include(it => it.UserAuth)
                        .Where(it => it.Id == logier.Id)
                        .Select(it => new
                        {
                            it.Name,
                            it.Identity,
                            it.ContactPhoneNumber,
                            it.Gender,
                            it.Age,
                            it.UserAuth.IdentityImg,
                            it.UserAuth.IdentityBackImg
                        })
                        .FirstOrDefaultAsync(cancellationToken);
                    if (user == null) throw Oops.Oh(EnumErrorCodeType.s404, "账号");
                    entity = new EnterpriseEmployee
                    {
                        Id = IDGen.NextID(),
                        EnterpriseId = contractTemplate.EnterpriseId,
                        UserId = logier.Id,
                        Name = user.Name,
                        Identity = user.Identity,
                        ContactPhoneNumber = user.ContactPhoneNumber,
                        Gender = user.Gender,
                        Age = user.Age,
                        IdentityImg = user.IdentityImg,
                        IdentityBackImg = user.IdentityBackImg,
                    };
                    add = true;
                }
                if (entity.UserSignContractStatus == null)
                {
                    entity.ContractTemplateId = contractTemplate.Id;
@@ -262,6 +307,13 @@
                        UserSignContractStatus = entity.UserSignContractStatus,
                    };
                    await repEnterpriseEmployeeContract.InsertAsync(contract);
                }
                if (add)
                {
                    await rep.InsertAsync(entity);
                }
                else
                {
                    await rep.UpdateAsync(entity);
                }
                return new GetPersonalUserElectronSignQueryResult
@@ -274,7 +326,7 @@
                    Identity = entity.Identity,
                    ContactPhoneNumber = entity.ContactPhoneNumber,
                    UserSignContractTime = entity.UserSignContractTime,
                    EnterpriseEnterpriseName = entity.Enterprise.EnterpriseName,
                    EnterpriseEnterpriseName = enterprise.EnterpriseName,
                    EnterpriseSignContractTime = entity.EnterpriseSignContractTime,
                    ContractUrl = entity.ContractUrl,
                };
FlexJobApi.UserServer.Application/FlexJobApi.UserServer.Application.xml
@@ -432,7 +432,7 @@
            灵工查询处理器
            </summary>
        </member>
        <member name="M:FlexJobApi.UserServer.Application.EnterpriseEmployeeQueryHandler.#ctor(Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.EnterpriseEmployee},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.ContractTemplate},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.EnterpriseEmployeeContract},MediatR.IMediator)">
        <member name="M:FlexJobApi.UserServer.Application.EnterpriseEmployeeQueryHandler.#ctor(Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.EnterpriseEmployee},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.ContractTemplate},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.EnterpriseEmployeeContract},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.Enterprise},Furion.DatabaseAccessor.IRepository{FlexJobApi.Core.User},MediatR.IMediator)">
            <summary>
            灵工查询处理器
            </summary>