From 9ba78e4ecdd864451886ce631628bcfbe8919b3b Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Tue, 31 Dec 2024 16:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=9B=E8=81=98=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=20=E6=8B=9B=E8=81=98=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Ghrh/Ghrh_ResumeController.cs | 26 +- Tiobon.Core.Api/Tiobon.Core.xml | 15 + .../Ghrh/IGhrh_ResumeServices.cs | 5 + .../Ghrh/Ghrh_ResumeServices.cs | 388 ++++++++++++++++++ Tiobon.Core/Tiobon.Core.xml | 15 + 5 files changed, 448 insertions(+), 1 deletion(-) diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index 401a5b45..7bd07a4d 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -1,4 +1,5 @@ -using Tiobon.Core.Model.ViewModels.Extend; +using Newtonsoft.Json.Linq; +using Tiobon.Core.Model.ViewModels.Extend; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Api.Controllers; @@ -530,4 +531,27 @@ public class Ghrh_ResumeController : BaseController await _service.Shihua_OA_Sync(); #endregion + + #region 招聘工作台初始化接口 + /// + /// 招聘工作台初始化接口 + /// + /// 语言别 + /// meuName + /// + [HttpPost, Route("QueryWorkStationInit/{langId}")] + public async Task> QueryWorkstationInit(int langId, string menuName) => await _service.QueryWorkstationInit(langId, menuName); + + #endregion + + #region 招聘工作台招聘统计 + /// + /// 招聘工作台招聘统计 + /// + /// 语言别 + /// + [HttpPost, Route("QueryWorkStationStatisticsChart/{langId}")] + public async Task> QueryWorkStationStatisticsChart(int langId) => await _service.QueryWorkStationStatisticsChart(langId); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 6509517b..f555169a 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1632,6 +1632,21 @@ 扩展栏位 + + + 招聘工作台初始化接口 + + 语言别 + meuName + + + + + 招聘工作台招聘统计 + + 语言别 + + 教育背景(Controller) diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index 3ade5ee5..86c553b2 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json.Linq; using Tiobon.Core.Common; using Tiobon.Core.IServices.BASE; using Tiobon.Core.Model; @@ -83,4 +84,8 @@ public interface IGhrh_ResumeServices : IBaseServices SyncToStaff(long id); + + Task> QueryWorkstationInit(int langId , string menuName); + + Task> QueryWorkStationStatisticsChart(int langId = 1); } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 0ff05abd..9444f4ac 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -1,9 +1,12 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; +using NPOI.SS.Formula.Functions; using System.IO.Compression; using WkHtmlToPdfDotNet; using WkHtmlToPdfDotNet.Contracts; +using static NPOI.POIFS.Crypt.CryptoFunctions; +using static System.Runtime.InteropServices.JavaScript.JSType; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -4230,6 +4233,391 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 } #endregion + #region 招聘工作台初始化接口 + public async Task> QueryWorkstationInit(int langId, string menuName) + { + + var columns = new JArray(); + var Detail = new JObject { }; + var item = new JObject { }; + + if (menuName == "F_ESS_RecruitmentBoard") + { + + var group = await Db.Queryable() + .Where(x => x.StaffId == GetStaffId()).GroupBy(x => x.Status) + .Select(g => new + { + g.Status, + Count = SqlFunc.AggregateCount(g.Id) + }).ToListAsync(); + + #region 待筛选 + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="HasRecommended").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ESS_Candidate"), + new JProperty("TabKey","HasRecommended"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 0), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112701"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "待筛选"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 待预约 + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="WaitAppointment").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ESS_Candidate"), + new JProperty("TabKey","WaitAppointment"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 2), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112702"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "待预约"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 待面试 + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="WaitInterview").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ESS_Candidate"), + new JProperty("TabKey","WaitInterview"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 4), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112703"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "待面试"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 已面试 + var sum = group.Where(x => x.Status == "HasInterview" || x.Status == "WaitSendOffer" || x.Status == "HasSendOffer").Sum(x => x.Count); + Detail = new JObject + { + new JProperty("Count", sum), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ESS_Candidate"), + new JProperty("TabKey","HasInterview"), + }; + item = new JObject + { + new JProperty("CanMore", 0), + new JProperty("ColNum", 6), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112704"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "已面试"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 已录用 + var group1 = await Db.Queryable() + .GroupBy(x => x.Status).Select(g => new + { + Status = g.Status, + Count = SqlFunc.AggregateCount(g.Id) + }).ToListAsync(); + Detail = new JObject { + new JProperty("Count", group1.Where(x=>x.Status=="HasOffer").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ESS_Candidate"), + new JProperty("TabKey","HasOffer"), + }; + item = new JObject + { + new JProperty("CanMore", 0), + new JProperty("ColNum", 8), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112705"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "已录用"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + } + else + { + var group = await Db.Queryable() + .GroupBy(x => x.Status).Select(g => new + { + Status = g.Status, + Count = SqlFunc.AggregateCount(g.Id) + }).ToListAsync(); + #region 已推荐 + + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="HasRecommended").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ResumeMaintenance"), + new JProperty("TabKey","HasRecommended"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 0), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112701"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "已推荐"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 待预约 + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="WaitAppointment").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ResumeMaintenance"), + new JProperty("TabKey","WaitAppointment"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 2), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112702"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "待预约"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 待面试 + Detail = new JObject + { + new JProperty("Count", group.Where(x=>x.Status=="WaitInterview").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ResumeMaintenance"), + new JProperty("TabKey","WaitInterview"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 4), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112703"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "待面试"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 已面试 + var sum = group.Where(x => x.Status == "HasInterview" || x.Status == "WaitSendOffer" || x.Status == "HasSendOffer").Sum(x => x.Count); + Detail = new JObject + { + new JProperty("Count", sum), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ResumeMaintenance"), + new JProperty("TabKey","HasInterview"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 6), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112704"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "已面试"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 已报到 + Detail = new JObject { + new JProperty("Count", group.Where(x=>x.Status=="HasOffer").FirstOrDefault()?.Count??0), + new JProperty("Unit","人"), + new JProperty("MenuName","F_ResumeMaintenance"), + new JProperty("TabKey","HasOffer"), + }; + item = new JObject + { + new JProperty("CanMore", 1), + new JProperty("ColNum", 8), + new JProperty("RowNum", 0), + new JProperty("Height", 17.2), + new JProperty("Width", 2), + new JProperty("Id", "112705"), + new JProperty("CardType", "RecruitmentCountCard"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "已报到"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + } + + #region 招聘统计 + Detail = new JObject + { + }; + item = new JObject + { + new JProperty("CanMore", 0), + new JProperty("ColNum", 0), + new JProperty("RowNum", 10), + new JProperty("Height", 43), + new JProperty("Width", 10), + new JProperty("Id", "112706"), + new JProperty("CardType", "RecruitStatisticsChart"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "招聘统计"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + #region 招聘平均耗费时长 + Detail = new JObject + { + }; + item = new JObject + { + new JProperty("CanMore", 0), + new JProperty("ColNum", 0), + new JProperty("RowNum", 20), + new JProperty("Height", 45), + new JProperty("Width", 10), + new JProperty("Id", "112707"), + new JProperty("CardType", "AverageTimeConsumption"), + new JProperty("IsStatic", "0"), + new JProperty("Title", "招聘平均耗费时长"), + new JProperty("Detail",Detail), + }; + columns.Add(item); + #endregion + + return ServiceResult.OprateSuccess("获取成功", columns); + } + #endregion + + #region 招聘工作台招聘统计 + public async Task> QueryWorkStationStatisticsChart(int langId = 1) + { + + dynamic data = new ExpandoObject(); + var series = new JArray(); + var XAxis = new List(); + var date = DateTime.Now.AddMonths(-11); + var data1 = new List(); + var data2 = new List(); + var data3 = new List(); + + var random = new Random(); + for (int i = 1; i <= 12; i++) + { + var date1 = DateTimeHelper.ConvertToMonthString(date); + XAxis.Add(date1); + + var group = await Db.Queryable() + .Where(x => x.RecommendTime != null && x.RecommendTime.Value.Date.Month == date.Month && x.RecommendTime.Value.Date.Year == date.Year) + .Select(g => new + { + g.Status + }).ToListAsync(); + + var count = group.Count; + var count1 = group.Where(x => x.Status == "HasOffer").Count(); + data1.Add(count); + data2.Add(count1); + decimal count3 = 0; + if (count1 > 0 && count > 0) + count3 = ((decimal)count1 / count) * 100; + data3.Add(StringHelper.TrimDecimal(count3, 2)); + date = date.AddMonths(1); + } + + var item = new JObject + { + new JProperty("color", "rgba(84, 112, 198, 1)"), + new JProperty("data", data1), + new JProperty("name", "面试人数"), + }; + series.Add(item); + + item = new JObject + { + new JProperty("color", "rgba(145, 204, 117, 1)"), + new JProperty("data", data2), + new JProperty("name", "录用人数"), + }; + series.Add(item); + + item = new JObject + { + new JProperty("color", "rgba(255, 147, 0, 1)"), + new JProperty("data", data3), + new JProperty("name", "面试成功率"), + }; + series.Add(item); + + data.XAxis = XAxis; + data.series = series; + return ServiceResult.OprateSuccess("获取成功", data); + } + #endregion + #region 通用方法 /// /// 记录日志 diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 6509517b..f555169a 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1632,6 +1632,21 @@ 扩展栏位 + + + 招聘工作台初始化接口 + + 语言别 + meuName + + + + + 招聘工作台招聘统计 + + 语言别 + + 教育背景(Controller)