diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_PlanController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_PlanController.cs index 4896d363..ebae157e 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_PlanController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_PlanController.cs @@ -58,4 +58,14 @@ public class Ghre_PlanController : BaseController> QueryUshioPlan([FromBody] QueryBody body) => await _service.QueryUshioPlan(body); #endregion + + #region 培训计划达成率——宝连通 + /// + /// 培训计划达成率——宝连通 + /// + /// 条件 + /// + [HttpPost, Route("QueryCompletionRateBLT")] + public async Task> QueryCompletionRateBLT([FromBody] QueryBody body) => await _service.QueryCompletionRateBLT(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 8661babf..4321306b 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1362,6 +1362,13 @@ 条件 + + + 培训计划达成率——宝连通 + + 条件 + + 题目答案(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_PlanServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_PlanServices.cs index 046e402c..527da052 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_PlanServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_PlanServices.cs @@ -14,4 +14,6 @@ public interface IGhre_PlanServices : IBaseServices UpdateStatus(InsertGhre_PlanInput input, string status); Task> QueryUshioPlan(QueryBody filter); + + Task> QueryCompletionRateBLT(QueryBody filter); } \ No newline at end of file diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_TrainFeeApplyOrder_Boltone.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_TrainFeeApplyOrder_Boltone.Dto.Base.cs index b663e491..e06648d0 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_TrainFeeApplyOrder_Boltone.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_TrainFeeApplyOrder_Boltone.Dto.Base.cs @@ -292,6 +292,7 @@ public class Ghre_TrainFeeApplyOrder_BoltoneBase [Display(Name = "PlanId"), Description("计划ID"), MaxLength(2000, ErrorMessage = "计划ID 不能超过 2000 个字符")] public string PlanId { get; set; } + public List PlanIds { get; set; } = new List(); public List Attachments { get; set; } = new List(); public List Details { get; set; } = new List(); } diff --git a/Tiobon.Core.Model/ViewModels/Extend/CompletionRateBLT.cs b/Tiobon.Core.Model/ViewModels/Extend/CompletionRateBLT.cs new file mode 100644 index 00000000..bf724118 --- /dev/null +++ b/Tiobon.Core.Model/ViewModels/Extend/CompletionRateBLT.cs @@ -0,0 +1,14 @@ +namespace Tiobon.Core.Model; + +public class CompletionRateBLT +{ + public int Id { get; set; } + public int RowNo { get; set; } + public string Month { get; set; } + public string DeptName { get; set; } + public string DeptFullName { get; set; } + public int CourseCount { get; set; } = 0; + public int SubmitCount { get; set; } = 0; + public int CompletionRate { get; set; } = 0; + public string CompletionRate1 { get; set; } +} \ No newline at end of file diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index f2043418..7ffc9e1e 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -4301,7 +4301,7 @@ public partial class CommonServices : BaseServices>, ICommon break; } #endregion - + break; case "F_ESS_ExternalTrainApplyOrder_Boltone": //外训申请_宝连通 @@ -4388,6 +4388,9 @@ public partial class CommonServices : BaseServices>, ICommon var dict = JsonHelper.JsonToObj(json); var dict1 = JsonHelper.JsonToObj(json); //dict.RequestNo = await GenerateContinuousSequence("Ghrh_HumanRequest", "RequestNo", "R"); + + if (dict1.PlanIds != null && dict1.PlanIds.Any()) + dict.PlanId = JsonHelper.ObjToJson(dict1.PlanIds); id = await Db.Insertable(dict).ExecuteReturnSnowflakeIdAsync(); diff --git a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs index d08fd66c..99a9ab8a 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs @@ -1,5 +1,7 @@ -using NPOI.SS.UserModel; +using NPOI.SS.Formula.Functions; +using NPOI.SS.UserModel; using NPOI.SS.Util; +using Tiobon.Core.Common; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -707,9 +709,138 @@ public class Ghre_PlanServices : BaseServices> QueryCompletionRateBLT(QueryBody filter) - //{ - //} + public async Task> QueryCompletionRateBLT(QueryBody filter) + { + + var data = new List(); + int totalCount = 0; + bool isFirst = true; + DateTime? startTime = null, endTime = null; + string seachType = string.Empty; + int? deptId_40 = null, deptId_30 = null, deptId_20 = null; + int? deptId = null; + if (filter.jsonParam != null) + foreach (JProperty jProperty in filter.jsonParam.Properties()) + { + isFirst = false; + var name = jProperty.Name; + var value = jProperty.Value.ToString(); + if (name == "page" || name == "pageSize") + continue; + + if (name == "Month") + { + var jsonParam = JsonConvert.DeserializeObject(value); + var ids1 = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + startTime = ids1[0]; + endTime = ids1[1]; + continue; + } + + if (name == "SeachType") + { + var jsonParam = JsonConvert.DeserializeObject(value); + seachType = jsonParam.columnValue.ToString(); + continue; + } + if (name == "DeptId_40") + { + var jsonParam = JsonConvert.DeserializeObject(value); + deptId_40 = jsonParam.columnValue.ObjToInt(); + continue; + } + if (name == "DeptId_30") + { + var jsonParam = JsonConvert.DeserializeObject(value); + deptId_30 = jsonParam.columnValue.ObjToInt(); + continue; + } + if (name == "DeptId_20") + { + var jsonParam = JsonConvert.DeserializeObject(value); + deptId_20 = jsonParam.columnValue.ObjToInt(); + continue; + } + } + + if (isFirst) return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); + + + filter.pageSize = 10000; + if (startTime.IsNullOrEmpty()) + throw new Exception("请先选择月份!"); + if (seachType.IsNullOrEmpty()) + throw new Exception("请先选择查询类别!"); + if (!(deptId_40.IsNotEmptyOrNull() || deptId_30.IsNotEmptyOrNull() || deptId_20.IsNotEmptyOrNull())) + throw new Exception("请先选择部门!"); + var aaa = 0; + if (deptId_40.IsNotEmptyOrNull()) + { + aaa++; + deptId = deptId_40; + } + if (deptId_30.IsNotEmptyOrNull()) + { + aaa++; + deptId = deptId_30; + } + if (deptId_20.IsNotEmptyOrNull()) + { + aaa++; + deptId = deptId_20; + } + + if (aaa > 1) + throw new Exception("部门层架筛选条件不可组合使用!"); + + var deptName = await Db.Queryable().Where(x => x.DeptID == deptId).Select(x => x.DeptName).FirstAsync(); + + var deptName1 = await Db.Ado.GetStringAsync(@$"SELECT GHR30.dbo.[FO_DeptInfo] ( + {deptId}, + getdate (), + 1, + 'DeptFullPateName');"); + + if (seachType == "Month") + { + for (DateTime? dt = startTime; dt <= endTime; dt = dt.Value.AddMonths(1)) + { + string formatted = dt.Value.ToString("yyyy-MM"); + data.Add(new CompletionRateBLT + { + Month = formatted + }); + } + } + else + { + data.Add(new CompletionRateBLT + { + Month = $"{startTime.Value.ToString("yyyy-MM")}~{endTime.Value.ToString("yyyy-MM")}" + }); + } + + + for (int i = 0; i < data.Count; i++) + { + + data[i].Id = i + 1; + data[i].Id = i + 1; + data[i].RowNo = i + 1; + data[i].DeptName = deptName; + data[i].DeptFullName = deptName1; + //var examCount = await Db.Queryable() + // .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)) + // .CountAsync(); + //var passCount = await Db.Queryable() + // .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value) && x.IsPass == true) + // .CountAsync(); + //if (passCount > 0 && examCount > 0) + // data[i].PassPercent = passCount / examCount; + } + + return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); + } #endregion } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 8661babf..4321306b 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1362,6 +1362,13 @@ 条件 + + + 培训计划达成率——宝连通 + + 条件 + + 题目答案(Controller)