diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_HumanRequestController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_HumanRequestController.cs index 9e65aa7e..83e24dc7 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_HumanRequestController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_HumanRequestController.cs @@ -52,4 +52,17 @@ public class Ghrh_HumanRequestController : BaseController + /// Excel导出 + /// + /// + /// + [HttpPost, Route("ExportSummaryExcel")] + public virtual async Task> ExportSummaryExcel([FromBody] QueryExport body) + { + return await _service.ExportSummaryExcel(body); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index ebbedffb..b335a3a7 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -562,4 +562,17 @@ public class Ghrh_ResumeController : BaseController + /// Excel导出录用名单 + /// + /// + /// + [HttpPost, Route("ExportHireExcel")] + public virtual async Task> ExportHireExcel([FromBody] QueryExport body) + { + return await _service.ExportHireExcel(body); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index e4bc20c5..6ec120b9 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1287,6 +1287,13 @@ status + + + Excel导出 + + + + 人力需求维护明细(Controller) diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_HumanRequestServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_HumanRequestServices.cs index 4c2c616d..ea5a7171 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_HumanRequestServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_HumanRequestServices.cs @@ -15,4 +15,6 @@ public interface IGhrh_HumanRequestServices : IBaseServices> InsertByStatus(InsertGhrh_HumanRequestInput insertModel, string status); Task> QueryFilterSummaryPage(QueryBody filter); + + Task> ExportSummaryExcel(QueryExport body); } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index 2bfa0e27..5af842eb 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -90,4 +90,6 @@ public interface IGhrh_ResumeServices : IBaseServices> QueryWorkStationStatisticsChart(int langId = 1); Task> QueryHireList(QueryBody filter); + + Task> ExportHireExcel(QueryExport body); } \ No newline at end of file diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index a28de508..f0206552 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -1416,9 +1416,18 @@ ORDER BY SortNo ASC"; conditions += $" AND ({name} NOT IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))}) OR {name} IS NULL)"; } break; + case "Range":// + if (jsonParam.columnValue != null) + { + var ids1 = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + + conditions += $" AND ({name}>='{ids1[0]} 00:00:00' AND {name}<='{ids1[1]} 23:59:59')"; + } + break; default: break; } + return conditions; } public string DealConditions1(string conditions, string name, string value) diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index d9583c77..69290ff1 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1810,9 +1810,7 @@ public partial class CommonServices : BaseServices>, ICommon // }); //} break; - case "F_InterviewHireList": case "F_OfferTemplate": - case "F_InterviewRequestSummary": toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); if (toolbar != null) toolbar.fnKey = "TBD1YN"; toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault(); @@ -1895,6 +1893,31 @@ public partial class CommonServices : BaseServices>, ICommon toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault(); if (toolbar != null) toolbar.fnKey = "TBD4YN"; break; + + case "F_InterviewRequestSummary": + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD1YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD2YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD3YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD4YN"; + + result.DT_Procedure.ExportExcel = "/api/Ghrh_HumanRequest/ExportSummaryExcel"; + break; + case "F_InterviewHireList": + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD1YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD2YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD3YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD4YN"; + + result.DT_Procedure.ExportExcel = "/api/Ghrh_Resume/ExportHireExcel"; + break; } #endregion diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs index 8ccdc7c5..cbfdd25a 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs @@ -246,7 +246,7 @@ WHERE A.IsEnable = 1 AND A.Id = {entitys[i].YearHumanId}"); var sql = @$" SELECT * FROM Ghrh_HumanRequestSummary_V A"; - string conditions = " WHERE 1=1 "; + string conditions = " WHERE 1=1 "; var properties = entityType.GetGenericProperties(); @@ -281,7 +281,7 @@ WHERE A.IsEnable = 1 AND A.Id = {entitys[i].YearHumanId}"); var tags = await Db.Queryable().Where(x => tagIds.Contains(x.Id)).ToListAsync(); for (int i = 0; i < list.Count; i++) { - + } return result; @@ -362,4 +362,60 @@ WHERE A.IsEnable = 1 AND A.Id = {entitys[i].YearHumanId}"); } #endregion + + public async Task> ExportSummaryExcel(QueryExport body) + { + QueryBody filter = new QueryBody(); + filter.pageNum = 1; + filter.jsonParam = body.jsonParam; + filter.pageSize = 1000000; + filter.langId = body.langId; + + var condition = "1=1"; + if (body.exportSet.SelectRowKeys != null && body.exportSet.SelectRowKeys.Any()) + condition += $" AND Id IN({string.Join(",", body.exportSet.SelectRowKeys)})"; + + var data = await QueryFilterSummaryPage(filter); + + string sql = $@"SELECT * + FROM Ghrs_PageSettingQuery + WHERE IsEnable = 1 + AND PageNo = '{body.menuName}' + AND (defaultHidden = 'false' OR defaultHidden is null) + ORDER BY SortNo ASC"; + + var columns = DbAccess.QueryList(sql); + + var fieldDescs = new Dictionary(); + if (body.exportSet.ExFields.Any()) + body.exportSet.ExFields.ForEach(x => + { + if (columns.Any(o => o.field == x)) + { + var label = columns.FirstOrDefault(o => o.field == x)?.label; + if (!fieldDescs.ContainsKey(x)) + fieldDescs.Add(x, label); + + } + }); + else + fieldDescs = columns.ToDictionary(item => item.field, item => item.label); + var dt = ToDataTable(data.result.DT_TableDataT1, fieldDescs, null); + // 获取所有列名 + var dtColumns = dt.Columns; + + var id = SnowFlakeSingle.instance.getID(); + var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; + var path = $"{$"{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}export{Path.DirectorySeparatorChar}{id}{Path.DirectorySeparatorChar}"}"; + if (!Directory.Exists(physicsPath + path)) + Directory.CreateDirectory(physicsPath + path); + + path = path + body.exportSet.TitleName + ".xlsx"; + NPOIHelper.ExportExcel(dt, body.exportSet.TitleName, "sheet1", physicsPath + path); + + var result = new ExcelData(); + result.filePath = "/Advanced" + path; + result.fileName = body.exportSet.TitleName + ".xlsx"; + return ServiceResult.OprateSuccess("导出成功", result); + } } \ 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 e0d801f5..c63a5174 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -4746,6 +4746,65 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 #endregion + #region 录用名单 + + public async Task> ExportHireExcel(QueryExport body) + { + QueryBody filter = new QueryBody(); + filter.pageNum = 1; + filter.jsonParam = body.jsonParam; + filter.pageSize = 1000000; + filter.langId = body.langId; + + var condition = "1=1"; + if (body.exportSet.SelectRowKeys != null && body.exportSet.SelectRowKeys.Any()) + condition += $" AND Id IN({string.Join(",", body.exportSet.SelectRowKeys)})"; + + var data = await QueryHireList(filter); + + string sql = $@"SELECT * + FROM Ghrs_PageSettingQuery + WHERE IsEnable = 1 + AND PageNo = '{body.menuName}' + AND (defaultHidden = 'false' OR defaultHidden is null) + ORDER BY SortNo ASC"; + + var columns = DbAccess.QueryList(sql); + + var fieldDescs = new Dictionary(); + if (body.exportSet.ExFields.Any()) + body.exportSet.ExFields.ForEach(x => + { + if (columns.Any(o => o.field == x)) + { + var label = columns.FirstOrDefault(o => o.field == x)?.label; + if (!fieldDescs.ContainsKey(x)) + fieldDescs.Add(x, label); + + } + }); + else + fieldDescs = columns.ToDictionary(item => item.field, item => item.label); + var dt = ToDataTable(data.result.DT_TableDataT1, fieldDescs, null); + // 获取所有列名 + var dtColumns = dt.Columns; + + var id = SnowFlakeSingle.instance.getID(); + var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; + var path = $"{$"{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}export{Path.DirectorySeparatorChar}{id}{Path.DirectorySeparatorChar}"}"; + if (!Directory.Exists(physicsPath + path)) + Directory.CreateDirectory(physicsPath + path); + + path = path + body.exportSet.TitleName + ".xlsx"; + NPOIHelper.ExportExcel(dt, body.exportSet.TitleName, "sheet1", physicsPath + path); + + var result = new ExcelData(); + result.filePath = "/Advanced" + path; + result.fileName = body.exportSet.TitleName + ".xlsx"; + return ServiceResult.OprateSuccess("导出成功", result); + } + #endregion + #region 通用方法 /// /// 记录日志 diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index e4bc20c5..6ec120b9 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1287,6 +1287,13 @@ status + + + Excel导出 + + + + 人力需求维护明细(Controller)