From ba6a9c246898ecf04f40c827db27a1729f1b0f87 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期四, 14 八月 2025 11:27:24 +0800 Subject: [PATCH] feat:开发 --- FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs b/FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs index fbda053..575f837 100644 --- a/FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs +++ b/FlexJobApi.UserServer.Application/EnterpriseEmployees/Commands/EnterpriseEmployeesCommandHandler.cs @@ -1,13 +1,18 @@ 锘縰sing FlexJobApi.Core; +using Furion; using Furion.DatabaseAccessor; using Furion.FriendlyException; +using Furion.HttpRemote; using Mapster; 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 @@ -18,14 +23,34 @@ public class EnterpriseEmployeesCommandHandler( IRepository<EnterpriseEmployee> rep ) : - IRequestHandler<ImportEnterpriseEmployeesCommand, int>, + IRequestHandler<ImportEnterpriseEmployeesCommand, ImportEnterpriseEmployeesCommandResult>, IRequestHandler<EditEnterpriseEmployeeCommand, Guid> { private readonly IRepository<EnterpriseEmployee> rep = rep; - public Task<int> Handle(ImportEnterpriseEmployeesCommand request, CancellationToken cancellationToken) + /// <summary> + /// 瀵煎叆鐏靛伐淇℃伅 + /// </summary> + /// <param name="request"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + public async Task<ImportEnterpriseEmployeesCommandResult> Handle(ImportEnterpriseEmployeesCommand request, CancellationToken cancellationToken) { - throw new NotImplementedException(); + var result = new ImportEnterpriseEmployeesCommandResult(); + var models = await request.ExcelUrl.ImportExcelFromOSS<ImportEnterpriseEmployeesCommandModel>(); + 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 += "鎵嬫満鍙锋牸寮忎笉姝g‘"; + } + } + return result; } /// <summary> -- Gitblit v1.9.1