sunpengfei
2025-08-14 ba6a9c246898ecf04f40c827db27a1729f1b0f87
feat:开发
4个文件已修改
121 ■■■■ 已修改文件
FlexJobApi.Core/FlexJobApi.Core.xml 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Models/UserServer/EnterpriseEmployees/Commands/ImportEnterpriseEmployeesCommand.cs 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.FlexJobServer.Application/TaskUsers/Queries/TaskUserQueryHandler.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/FlexJobApi.Core.xml
@@ -5788,6 +5788,11 @@
            Excel地址
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.ImportEnterpriseEmployeesCommandModel">
            <summary>
            导入灵工信息-模板
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandModel.Name">
            <summary>
            姓名
@@ -5804,6 +5809,41 @@
            身份证号
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResult">
            <summary>
            导入灵工信息-结果
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResult.TotalCount">
            <summary>
            总数
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResult.SuccessCount">
            <summary>
            成功数量
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResult.FailCount">
            <summary>
            失败数量
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResult.MyProperty">
            <summary>
            错误信息
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResultError">
            <summary>
            导入灵工信息-结果-错误信息
            </summary>
        </member>
        <member name="P:FlexJobApi.Core.ImportEnterpriseEmployeesCommandResultError.ErrorMessage">
            <summary>
            错误信息
            </summary>
        </member>
        <member name="T:FlexJobApi.Core.GetEnterpriseEmployeeQuery">
            <summary>
            查询灵工详情
FlexJobApi.Core/Models/UserServer/EnterpriseEmployees/Commands/ImportEnterpriseEmployeesCommand.cs
@@ -15,7 +15,7 @@
    /// 导入灵工信息
    /// </summary>
    [Resource([EnumResourceController.EnterpriseEmployee])]
    public class ImportEnterpriseEmployeesCommand : IRequest<int>
    public class ImportEnterpriseEmployeesCommand : IRequest<ImportEnterpriseEmployeesCommandResult>
    {
        /// <summary>
        /// Excel地址
@@ -23,26 +23,59 @@
        public string ExcelUrl { get; set; }
    }
    /// <summary>
    /// 导入灵工信息-模板
    /// </summary>
    public class ImportEnterpriseEmployeesCommandModel
    {
        /// <summary>
        /// 姓名
        /// </summary>
        [Required]
        public string Name { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        /// <remarks>联系电话</remarks>
        [MaxLength(11)]
        [Required]
        public string ContactPhoneNumber { get; set; }
        /// <summary>
        /// 身份证号
        /// </summary>
        [Required]
        public string Identity { get; set; }
    }
    /// <summary>
    /// 导入灵工信息-结果
    /// </summary>
    public class ImportEnterpriseEmployeesCommandResult
    {
        /// <summary>
        /// 总数
        /// </summary>
        public int TotalCount { get; set; }
        /// <summary>
        /// 成功数量
        /// </summary>
        public int SuccessCount { get; set; }
        /// <summary>
        /// 失败数量
        /// </summary>
        public int FailCount { get; set; }
        /// <summary>
        /// 错误信息
        /// </summary>
        public List<ImportEnterpriseEmployeesCommandResultError> MyProperty { get; set; }
    }
    /// <summary>
    /// 导入灵工信息-结果-错误信息
    /// </summary>
    public class ImportEnterpriseEmployeesCommandResultError : ImportEnterpriseEmployeesCommandModel
    {
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; set; }
    }
}
FlexJobApi.FlexJobServer.Application/TaskUsers/Queries/TaskUserQueryHandler.cs
@@ -141,12 +141,16 @@
            {
                throw Oops.Oh(EnumErrorCodeType.s400, "请选择用户");
            }
            var model = await q
                .Select(it => new GetTaskUserHireStatusQueryResult
                {
                    HireStatus = it.EnterpriseEmployee.HireStatus
                })
                .FirstOrDefaultAsync(cancellationToken);
            else
            {
                q = q.Where(it => it.EnterpriseEmployee.UserId == request.UserId);
            }
                var model = await q
                    .Select(it => new GetTaskUserHireStatusQueryResult
                    {
                        HireStatus = it.EnterpriseEmployee.HireStatus
                    })
                    .FirstOrDefaultAsync(cancellationToken);
            if (model == null) throw Oops.Oh(EnumErrorCodeType.s404, "该报名信息");
            return model;
        }
FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs
@@ -7,10 +7,12 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using MiniExcelLibs;
using NetTopologySuite.Index.HPRtree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace FlexJobApi.UserServer.Application
@@ -21,7 +23,7 @@
    public class EnterpriseEmployeesCommandHandler(
            IRepository<EnterpriseEmployee> rep
        ) :
        IRequestHandler<ImportEnterpriseEmployeesCommand, int>,
        IRequestHandler<ImportEnterpriseEmployeesCommand, ImportEnterpriseEmployeesCommandResult>,
        IRequestHandler<EditEnterpriseEmployeeCommand, Guid>
    {
        private readonly IRepository<EnterpriseEmployee> rep = rep;
@@ -32,11 +34,23 @@
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(ImportEnterpriseEmployeesCommand request, CancellationToken cancellationToken)
        public async Task<ImportEnterpriseEmployeesCommandResult> Handle(ImportEnterpriseEmployeesCommand request, CancellationToken cancellationToken)
        {
            var result = new ImportEnterpriseEmployeesCommandResult();
            var models = await request.ExcelUrl.ImportExcelFromOSS<ImportEnterpriseEmployeesCommandModel>();
            Console.WriteLine();
            throw new NotImplementedException();
            foreach (var model in models)
            {
                var error = new ImportEnterpriseEmployeesCommandResultError();
                if (model.ContactPhoneNumber.IsNull())
                {
                    error.ErrorMessage += "请填写手机号";
                }
                else if (!Regex.IsMatch(model.ContactPhoneNumber, @"^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$"))
                {
                    error.ErrorMessage += "手机号格式不正确";
                }
            }
            return result;
        }
        /// <summary>