New file |
| | |
| | | using MediatR; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace FlexJobApi.Core |
| | | { |
| | | /// <summary> |
| | | /// 校验合同模是否可用 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.UserServerElectronSign])] |
| | | public class CheckContractTemplateCommand : IRequest<bool> |
| | | { |
| | | /// <summary> |
| | | /// 合同模板Id |
| | | /// </summary> |
| | | public Guid Id { get; set; } |
| | | } |
| | | } |
File was renamed from FlexJobApi.Core/Models/UserServer/EnterpriseEmployees/Queries/GetEnterpriseEmployeeElectronSignQuery.cs |
| | |
| | | /// 查询个人用户签约详情 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.UserServerEnterpriseEmployee])] |
| | | public class GetEnterpriseEmployeeElectronSignQuery : IRequest<GetEnterpriseEmployeeElectronSignQueryResult> |
| | | public class GetPersonalUserElectronSignQuery : IRequest<GetPersonalUserElectronSignQueryResult> |
| | | { |
| | | /// <summary> |
| | | /// 灵工Id |
| | |
| | | /// <summary> |
| | | /// 查询个人用户签约详情-结果 |
| | | /// </summary> |
| | | public class GetEnterpriseEmployeeElectronSignQueryResult |
| | | public class GetPersonalUserElectronSignQueryResult |
| | | { |
| | | /// <summary> |
| | | /// 合同编号 |
| | |
| | | ) : |
| | | IRequestHandler<SaveContractTemplateCommand, Guid>, |
| | | IRequestHandler<SaveContractTemplateValuesCommand, Guid>, |
| | | IRequestHandler<SetIsDisabledContractTemplateCommand, int> |
| | | IRequestHandler<SetIsDisabledContractTemplateCommand, int>, |
| | | IRequestHandler<CheckContractTemplateCommand, bool> |
| | | { |
| | | private readonly IMediator mediator = mediator; |
| | | private readonly IRepository<ContractTemplate> rep = rep; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 校验合同模是否可用 |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<bool> Handle(CheckContractTemplateCommand request, CancellationToken cancellationToken) |
| | | { |
| | | var model = await rep.AsQueryable().AsNoTracking() |
| | | .Where(it => it.Id == request.Id && !it.IsDisabled) |
| | | .Select(it => new |
| | | { |
| | | it.Access, |
| | | it.Status |
| | | }) |
| | | .FirstOrDefaultAsync(); |
| | | if (model == null) throw Oops.Oh(EnumErrorCodeType.s404, "合同模板"); |
| | | if (model.Status != EnumContractTemplateStatus.Completed) throw Oops.Oh(EnumErrorCodeType.s510, "未制版"); |
| | | await mediator.Send(new CheckElectronSignAccessEnabledsCommand |
| | | { |
| | | Accesses = new List<EnumElectronSignAccess> |
| | | { |
| | | model.Access!.Value |
| | | } |
| | | }, cancellationToken); |
| | | return true; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步电子签合同模板 |
| | | /// </summary> |
| | | /// <param name="entity"></param> |
| | |
| | | using Furion.HttpRemote; |
| | | using Mapster; |
| | | using MediatR; |
| | | using Microsoft.AspNetCore.Components.Forms; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using MiniExcelLibs; |
| | | using NetTopologySuite.Index.HPRtree; |
| | |
| | | /// 灵工命令处理器 |
| | | /// </summary> |
| | | public class EnterpriseEmployeesCommandHandler( |
| | | IMediator mediator, |
| | | IRepository<EnterpriseEmployee> rep, |
| | | IRepository<User> repUser, |
| | | IRepository<EnterpriseEmployeeContract> repEnterpriseEmployeeContract |
| | |
| | | IRequestHandler<EditEnterpriseEmployeeCommand, Guid>, |
| | | IRequestHandler<InviteEnterpriseEmployeeElectronSignCommand, Guid> |
| | | { |
| | | private readonly IMediator mediator = mediator; |
| | | private readonly IRepository<EnterpriseEmployee> rep = rep; |
| | | private readonly IRepository<User> repUser = repUser; |
| | | private readonly IRepository<EnterpriseEmployeeContract> repEnterpriseEmployeeContract = repEnterpriseEmployeeContract; |
| | |
| | | if (entity.UserSignContractStatus == EnumTaskUserSignContractStatus.Pass) throw Oops.Oh(EnumErrorCodeType.s400, "已签约"); |
| | | if (entity.UserSignContractStatus == EnumTaskUserSignContractStatus.Effect) throw Oops.Oh(EnumErrorCodeType.s400, "已生效"); |
| | | if (entity.UserSignContractStatus == EnumTaskUserSignContractStatus.Wait) throw Oops.Oh(EnumErrorCodeType.s400, "已邀请"); |
| | | await mediator.Send(new CheckContractTemplateCommand |
| | | { |
| | | Id = request.Id |
| | | }, cancellationToken); |
| | | entity.ContractTemplateId = request.Id; |
| | | entity.UserSignContractStatus = EnumTaskUserSignContractStatus.Wait; |
| | | entity.UserSignContractTime = null; |
| | |
| | | IRequestHandler<GetEnterpriseEmployeesQuery, GetEnterpriseEmployeesQueryResult>, |
| | | IRequestHandler<GetEnterpriseEmployeeQuery, GetEnterpriseEmployeeQueryResult>, |
| | | IRequestHandler<GetEnterpriseEmployeeElectronSignsQuery, GetEnterpriseEmployeeElectronSignsQueryResult>, |
| | | IRequestHandler<GetEnterpriseEmployeeElectronSignQuery, GetEnterpriseEmployeeElectronSignQueryResult> |
| | | IRequestHandler<GetPersonalUserElectronSignQuery, GetPersonalUserElectronSignQueryResult> |
| | | { |
| | | private readonly IRepository<EnterpriseEmployee> rep = rep; |
| | | |
| | |
| | | /// <param name="request"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<GetEnterpriseEmployeeElectronSignQueryResult> Handle(GetEnterpriseEmployeeElectronSignQuery request, CancellationToken cancellationToken) |
| | | public async Task<GetPersonalUserElectronSignQueryResult> Handle(GetPersonalUserElectronSignQuery request, CancellationToken cancellationToken) |
| | | { |
| | | var logier = JwtUtils.GetCurrentLogier(); |
| | | var q = rep.AsQueryable().AsNoTracking() |
| | |
| | | q = q.Where(it => it.ContractTemplate.Code == request.Code); |
| | | } |
| | | |
| | | var model = await q.GetDetail<EnterpriseEmployee, GetEnterpriseEmployeeElectronSignQueryResult>(); |
| | | var model = await q.GetDetail<EnterpriseEmployee, GetPersonalUserElectronSignQueryResult>(); |
| | | return model; |
| | | } |
| | | } |