From 03da45903f74be2e4bc2f9ab60b45627e8a362c0 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 26 Dec 2024 09:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_ExamRecordController.cs | 7 +- .../Ghrh_ResumeTemplatePreviewController.cs | 2 + .../Ghrh_ResumeTemplatePreview/Index.cshtml | 28 ++- .../Ghre/IGhre_ExamRecordServices.cs | 1 + Tiobon.Core.Services/BASE/BaseServices.cs | 2 +- .../Ghre/Ghre_ExamRecordServices.cs | 25 +- .../Ghre/Ghre_TeacherServices.cs | 236 ++++++++++++++++++ .../Ghrh/Ghrh_OfferApplyOrderServices.cs | 3 +- .../Ghrh/Ghrh_ResumeServices.cs | 4 +- Tiobon.Core/Tiobon.Core.xml | 8 +- 10 files changed, 289 insertions(+), 27 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index fa01348b..e6f3eb9a 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -44,8 +44,13 @@ public class Ghre_ExamRecordController : BaseController ModifyIsPass(string examRecordId, [FromBody] EditGhre_ExamRecordInput edit) + { + return await _service.ModifyIsPass(examRecordId, edit); + } - /// + //cc/ /// 获取考试记录明细扩展接口 /// /// diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs index 1c9fe392..1b60bb10 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs @@ -217,6 +217,7 @@ END"; if (o.field == "CertificateType") o.field = "CertificateTypeLabel"; if (o.field == "RegisteredType") o.field = "RegisteredTypeLabel"; if (o.field == "EduDegree") o.field = "EduDegreeLabel"; + if (o.field == "ApplyStatus") o.field = "ApplyStatusLabel"; }); x.children = x.children.Where(o => o.field != "EduDegreeLabel" @@ -290,6 +291,7 @@ END"; columnNames.Add("CertificateTypeLabel"); columnNames.Add("RegisteredTypeLabel"); columnNames.Add("EduDegreeLabel"); + columnNames.Add("ApplyStatusLabel"); columnNames.ForEach(x => { var value = entity.GetPropertyValue(x); diff --git a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml index bbb2da32..98c0dc8b 100644 --- a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml +++ b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml @@ -57,7 +57,7 @@ @{ if (BaseDic.ContainsKey(children.field)) { - if (children.field == "Birthday" || children.field == "GraduateDate") + if (children.field == "Birthday" || children.field == "GraduateDate" || children.field == "Indate") @DateTimeHelper.ConvertToDayString(BaseDic[children.field]) else @BaseDic[children.field] @@ -262,19 +262,18 @@ @item.tabName } -
@Html.Raw(ViewBag.StatementRemark)
if (item.children != null && item.children.Any()) foreach (var children in item.children) { - if (ii > 0) - { -
- } + // if (ii > 0) + // { + //
+ // }
-

+

@(ii + 1). @(children.placeholder): @{ ii++; if (StatementDic.ContainsKey("Statement" + ii)) @@ -292,14 +291,21 @@

} +
+

+ @Html.Raw(ViewBag.StatementRemark) +

+ @if (displaySignatureArea) + { +

申请人签名:             日期:

+ } +
} - @if (displaySignatureArea) - { -
申请人签名:             日期:
- } + } } } +
\ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index a95f320a..02d30f76 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -29,4 +29,5 @@ public interface IGhre_ExamRecordServices : IBaseServices ViewExamPaperCallBackAsync(long examRecordId); Task ModifyActualScore(string examRecordId, EditGhre_ExamRecordInput edit); + Task ModifyIsPass(string examRecordId, EditGhre_ExamRecordInput edit); } \ No newline at end of file diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index fc8028e7..7766e25b 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -2053,7 +2053,7 @@ ORDER BY SortNo ASC"; sql = @$"Declare @Json nvarchar(max) = '' set @Json = (select '{title}' title, 'text' msgtype, - '{content}\n请至【ESS-招聘】下查看' [description] , + '{content}\n请至【GHR人力资源系统-招聘】下查看' [description] , 'Re'+(select Top 1 ParameterValue from Ghrs_Parameter where ParameterNo='GHRURL')+'/appOauth.html?jumpPage='+'F_APP_message/msgGroupList' url, 'GHR' picurl, '' htmlStr, diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index 53507260..4a01a4a6 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -1,5 +1,4 @@ using AgileObjects.AgileMapper.Extensions; -using Amazon.Auth.AccessControlPolicy; using MongoDB.Driver.Linq; using System.Net; using System.Text.RegularExpressions; @@ -158,7 +157,7 @@ public class Ghre_ExamRecordServices : BaseServices (entity.Score + entity.AdjustScore) ? false : true; - await Update(entity, ["IsPass", "AdjustScore"]); + await Update(entity, ["IsPass", "AdjustScore", "UpdateTime", "UpdateBy"]); return ServiceResult.OprateSuccess("修改成功!"); @@ -179,7 +178,27 @@ public class Ghre_ExamRecordServices : BaseServices ModifyIsPass(string examRecordId, EditGhre_ExamRecordInput edit) + { + var entity = await QuerySingle(examRecordId); + if (entity != null && entity.ExamId != null) + if (await Db.Queryable().Where(x => x.Id == entity.ExamId.Value && x.Status == "Disabled").AnyAsync()) + return ServiceResult.OprateFailed($"该考试已归档,不可进行调整!"); + + if (entity.ActualScore is null && entity.AdjustScore is null) + return ServiceResult.OprateFailed($"请先变更调整分或实操分!"); + + entity.IsPass = edit.IsPass ?? false; + + //string score1 = Regex.Replace(entity.Score.ToString(), @"\.(0+)$", "") + "/" + Regex.Replace(entity.Score.ToString(), @"\.(0+)$", ""); + + + await Update(entity, ["IsPass", "UpdateTime", "UpdateBy"]); return ServiceResult.OprateSuccess("修改成功!"); } diff --git a/Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs b/Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs index 46bf7ed3..9addaeb5 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs @@ -318,4 +318,240 @@ FROM (SELECT A.*, return ServiceResult.OprateSuccess("执行成功!"); } + + + #region Excel导入 + public override async Task> DownloadExcel(string menuName) + { + var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; + var path = $"{$"{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}ExcelTemplate{Path.DirectorySeparatorChar}"}"; + if (!Directory.Exists(physicsPath + path)) + Directory.CreateDirectory(physicsPath + path); + + Type entityType = typeof(Ghre_Teacher); + var fileName = entityType.GetEntityTableName() + ".xlsx"; + + + var physicsPath1 = physicsPath + path + fileName; + //if (dataSourceLists.Any()) + // physicsPath1 = physicsPath + path + newFileName; + var result = ServiceResult.OprateSuccess("讲师维护_" + DateTimeHelper.ConvertToSecondString1(DateTime.Now) + ".xlsx", physicsPath1); + return result; + } + public override async Task> ImportExcel(IFormFile file, string menuName = null, long? MasterId = null) + { + var data = new ExcelData(); + long id = SnowFlakeSingle.instance.getID(); + var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; + var path = $"{$"{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}import{Path.DirectorySeparatorChar}{id}{Path.DirectorySeparatorChar}"}"; + if (!Directory.Exists(physicsPath + path)) + Directory.CreateDirectory(physicsPath + path); + + var filepath = physicsPath + path + file.FileName; + using (var stream = File.Create(filepath)) + { + await file.CopyToAsync(stream); + } + string extension = Path.GetExtension(filepath); + + bool isExistError = false; + var id1 = SnowFlakeSingle.instance.getID(); + string errorFileName = path + SnowFlakeSingle.instance.getID() + extension; + + var dt = NPOIHelper.ImportExcel(filepath, "讲师维护"); + if (dt.Columns["Comments"] == null) + dt.Columns.Add("Comments", typeof(string)); + + var fields = new List + { + "讲师分类", + "工号", + "姓名", + "培训机构", + "讲师编号", + "讲师姓名", + "性别", + "邮箱", + "手机号码", + "讲师等级", + "课时费", + "擅长领域", + "备注" + }; + for (int i = 0; i < dt.Rows.Count; i++) + { + var comments = new List(); + + + bool isContinue = false; + + fields.ForEach(x => + { + if (!dt.Columns.Contains(x)) + { + comments.Add("未查询到【" + x + "】列!"); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + isContinue = true; + } + }); + + if (isContinue) + continue; + + var TeacherType = dt.Rows[i]["讲师分类"].ToString(); + var StaffNo = dt.Rows[i]["工号"].ToString(); + var StaffName = dt.Rows[i]["姓名"].ToString(); + var SchoolName = dt.Rows[i]["培训机构"].ToString(); + var Score = dt.Rows[i]["讲师编号"].ToString(); + var AdjustScore = dt.Rows[i]["讲师姓名"].ToString(); + var ActualScore = dt.Rows[i]["性别"].ToString(); + var IsPass = dt.Rows[i]["邮箱"].ToString(); + //var IsPass = dt.Rows[i]["手机号码"].ToString(); + //var IsPass = dt.Rows[i]["讲师等级"].ToString(); + //var IsPass = dt.Rows[i]["课时费"].ToString(); + //var IsPass = dt.Rows[i]["擅长领域"].ToString(); + + if (StaffNo.IsNullOrEmpty() && StaffName.IsNullOrEmpty()) + continue; + + var remarkSz = dt.Rows[i]["备注"].ToString(); + + var staff = await Db.Queryable().Where(x => x.StaffNo == StaffNo && x.StaffName == StaffName).FirstAsync(); + if (staff == null) + { + comments.Add($"未查询到该员工,工号或姓名填写错误!"); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + continue; + } + var exam = await Db.Queryable().Where(x => x.Id == MasterId).FirstAsync(); + + + + //if (ExamDate.IsNullOrEmpty()) + // ExamDate = DateTime.Now.ToString(); + if (Score.IsNullOrEmpty()) + Score = "0"; + + try + { + Convert.ToInt32(Score); + } + catch (Exception) + { + comments.Add($"考试分数填写有误!"); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + continue; + } + try + { + Convert.ToInt32(AdjustScore); + } + catch (Exception) + { + comments.Add($"调整分填写有误!"); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + continue; + } + try + { + Convert.ToInt32(ActualScore); + } + catch (Exception) + { + comments.Add($"实操分填写有误!"); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + continue; + } + //try + //{ + // Convert.ToDateTime(ExamDate); + //} + //catch (Exception) + //{ + // comments.Add($"考试日期填写有误!"); + // data.ErrorCount++; + // dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + // isExistError = true; + // continue; + //} + //if (await base.AnyAsync(x => x.CertificateRuleId == rule.Id && x.StaffId == staff.StaffID && x.CourseId == course.Id)) + //{ + // comments.Add($"系统已存在相同证照数据!"); + // data.ErrorCount++; + // dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + // isExistError = true; + // continue; + //} + var snap = await Db.Queryable().FirstAsync(x => x.CourseId == exam.CourseId); + var ExamRecordId = SnowFlakeSingle.Instance.NextId(); + var StudyRecordId = SnowFlakeSingle.Instance.NextId(); + var dict1 = new Dictionary + { + { "Id", StudyRecordId }, + { "CreateBy", App.User.ID }, + { "CreateTime", DateTime.Now }, + { "ExamId", MasterId }, + { "StaffId", staff.StaffID }, + { "CourseId", exam.CourseId }, + { "CourseSnapId", snap?.Id }, + { "CourseSceneId", exam.CourseSceneId }, + { "JoinTime", DateTime.Now }, + { "RemarkSz", "导入讲师维护生成" } + }; + var dict = new Dictionary + { + { "Id", ExamRecordId }, + { "CreateBy", App.User.ID }, + { "CreateTime", DateTime.Now }, + { "ExamId", MasterId }, + { "StudyRecordId", StudyRecordId }, + { "StaffId", staff.StaffID }, + //{ "CourseId", exam.CourseId }, + { "CourseSnapId", snap?.Id }, + { "Score", Score }, + { "AdjustScore", Score }, + { "ActualScore", ActualScore }, + //{ "ExamDate", ExamDate }, + { "IsPass", IsPass=="是"?true:false }, + { "ScoreStatus", "HasScore" }, + { "Source", "ExcelImport" }, + { "ExamPaperId",exam.ExamPaperId }, + { "RemarkSz", remarkSz } + }; + try + { + await Db.Insertable(dict1).AS("Ghre_StudyRecord").ExecuteCommandAsync(); + await Db.Insertable(dict).AS("Ghre_ExamRecord").ExecuteCommandAsync(); + data.SuccessCount++; + //data.SuccessCount += list.Count; + } + catch (Exception E) + { + comments.Add(E.Message); + data.ErrorCount++; + dt.Rows[i]["Comments"] = string.Join(";", comments.Select(a => a)); + isExistError = true; + continue; + } + + } + + if (isExistError) + { + NPOIHelper.ExportExcel(dt, null, "讲师维护", physicsPath + errorFileName); + data.filePath = errorFileName; + } + return ServiceResult.OprateSuccess("导入成功!", data); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs index 2fd7578e..5002ea0f 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs @@ -1,5 +1,4 @@ using AgileObjects.AgileMapper.Extensions.Internal; -using System.ComponentModel.Design; namespace Tiobon.Core.Services; @@ -192,7 +191,7 @@ public class Ghrh_OfferApplyOrderServices : BaseServices().Where(x => x.Id == resumeId).FirstAsync(); - entity.OrderNo = await GenerateContinuousSequence("Ghrh_OfferApplyOrder", "OrderNo", "LYSQ"); + entity.OrderNo = await GenerateContinuousSequence("Ghrh_OfferApplyOrder", "OrderNo", "L"); entity.ApplicantId = GetStaffId(); entity.ApplyTime = DateTime.Now; entity.WorkState = 1; diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index dda2d286..30260bab 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -4403,8 +4403,8 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 ) select {staffId},null, '{inTime.Value.Date}', - 30, -- - 1135, -- + 23, -- + 1130, -- 0,'Todo',1,'', 1,0,0,0, {App.User.ID},GETDATE(), 'SyncToStaff', diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 988d1941..c26be6aa 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1020,13 +1020,7 @@ 条件 - - - 获取考试记录明细扩展接口 - - - - + 提交评语接口