From 4a5c8f6e5962b1720fc57ba598862e79d6b6b61f Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 31 Mar 2025 15:56:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=8A=80=E8=83=BD=E7=9F=A9?= =?UTF-8?q?=E9=98=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Ghra/Ghra_TitleController.cs | 8 ++ .../Ghra/IGhra_TitleServices.cs | 4 +- .../ViewModels/Extend/TitleSkillMatrix.cs | 17 +++ Tiobon.Core.Services/CommonServices.cs | 19 ++- .../Ghra/Ghra_TitleServices.cs | 133 +++++++++++++++++- .../Ghre/Ghre_PlanServices.cs | 6 +- 6 files changed, 178 insertions(+), 9 deletions(-) create mode 100644 Tiobon.Core.Model/ViewModels/Extend/TitleSkillMatrix.cs diff --git a/Tiobon.Core.Api/Controllers/Ghra/Ghra_TitleController.cs b/Tiobon.Core.Api/Controllers/Ghra/Ghra_TitleController.cs index e6a2658b..e9e71122 100644 --- a/Tiobon.Core.Api/Controllers/Ghra/Ghra_TitleController.cs +++ b/Tiobon.Core.Api/Controllers/Ghra/Ghra_TitleController.cs @@ -11,4 +11,12 @@ public class Ghra_TitleController : BaseController QuerySkillMatrix([FromBody] QueryBody filter) + { + return await _service.QuerySkillMatrix(filter); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghra/IGhra_TitleServices.cs b/Tiobon.Core.IServices/Ghra/IGhra_TitleServices.cs index e917b487..d3dd2d00 100644 --- a/Tiobon.Core.IServices/Ghra/IGhra_TitleServices.cs +++ b/Tiobon.Core.IServices/Ghra/IGhra_TitleServices.cs @@ -1,5 +1,4 @@ -using Tiobon.Core.IServices.BASE; -using Tiobon.Core.Model.Models; +using Tiobon.Core.Common; namespace Tiobon.Core.IServices; @@ -8,4 +7,5 @@ namespace Tiobon.Core.IServices; /// public interface IGhra_TitleServices : IBaseServices { + Task QuerySkillMatrix(QueryBody filter); } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/TitleSkillMatrix.cs b/Tiobon.Core.Model/ViewModels/Extend/TitleSkillMatrix.cs new file mode 100644 index 00000000..dda2342c --- /dev/null +++ b/Tiobon.Core.Model/ViewModels/Extend/TitleSkillMatrix.cs @@ -0,0 +1,17 @@ +namespace Tiobon.Core.Model.ViewModels.Extend; + +public class TitleSkillMatrix +{ + + public long Id { get; set; } + public string CourseNo { get; set; } + public string CourseName { get; set; } + public string RemarkSz { get; set; } + public int SortNo { get; set; } + public int IsEnable { get; set; } + public string Type { get; set; } + public string CourseSceneName { get; set; } + +} + + diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index adcba07f..35207ab8 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -2317,7 +2317,7 @@ public partial class CommonServices : BaseServices>, ICommon { result.JM_TableColumnT1.TableColumn?.ForEach(x => { - if (x.label == "实际合计人天" && x.GroupName== num + "月") + if (x.label == "实际合计人天" && x.GroupName == num + "月") x.SortNo = sort; if (x.label == "进展率" && x.GroupName == num + "月") x.SortNo = sort + 1; @@ -2376,6 +2376,23 @@ public partial class CommonServices : BaseServices>, ICommon } } break; + + case "F_TitleSkillMatrix": + + var column = result.JM_TableColumnT1.TableColumn.Where(x => x.field == "Title_A01").SingleOrDefault(); + sort = column.SortNo; + result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.Where(x => x.field != "Title_A01").ToList(); + var titles = await Db.Queryable().OrderBy(x => x.SortNo).ToListAsync(); + index = 0; + titles.ForEach(x => + { + var copyColumn = Mapper.Map(column).ToANew(); + copyColumn.field = "Title_" + x.TitleNo; + copyColumn.label = x.TitleName; + result.JM_TableColumnT1.TableColumn.Insert(index + sort, copyColumn); + index++; + }); + break; } #endregion diff --git a/Tiobon.Core.Services/Ghra/Ghra_TitleServices.cs b/Tiobon.Core.Services/Ghra/Ghra_TitleServices.cs index c05b8594..7522d8e4 100644 --- a/Tiobon.Core.Services/Ghra/Ghra_TitleServices.cs +++ b/Tiobon.Core.Services/Ghra/Ghra_TitleServices.cs @@ -6,11 +6,13 @@ public class Ghra_TitleServices : BaseServices, IGhra_TitleServices { private readonly IBaseRepository _dal; - public Ghra_TitleServices(ICaching caching, IBaseRepository dal) + private readonly ICommonServices _commonServices; + public Ghra_TitleServices(ICaching caching, IBaseRepository dal, ICommonServices commonServices) { this._dal = dal; base.BaseDal = dal; base._caching = caching; + _commonServices = commonServices; } public override async Task QueryById(object objId) @@ -19,4 +21,133 @@ public class Ghra_TitleServices : BaseServices QuerySkillMatrix(QueryBody filter) + { + + dynamic obj = new ExpandoObject(); + dynamic result = new ExpandoObject(); + + if (string.IsNullOrWhiteSpace(filter.orderBy)) + filter.orderBy = "Type ASC"; + + string sql = $"SELECT * FROM Ghre_CourseScene_V WHERE IsEnable=1"; + + #region 处理查询条件 + //Expression> whereExpression = new Expression>(); + var whereExpression = Expressionable.Create(); + foreach (JProperty jProperty in filter.jsonParam.Properties()) + { + var name = jProperty.Name; + var value = jProperty.Value.ToString(); + if (name == "page" || name == "pageSize") + continue; + if (value.IsNotEmptyOrNull()) + { + //var jsonParam = JsonHelper.JsonToObj(value); + + //switch (name) + //{ + // case "WaitRecommend": + // if (jsonParam.columnValue.ObjToInt() == 1) + // sql += $" AND C.Status = '{DIC_INTERVIEW_ORDER_STATUS.WaitRecommended}'"; + // break; + // case "HasRecommended": + // if (jsonParam.columnValue.ObjToInt() == 1) + // sql += $" AND C.Status = '{DIC_INTERVIEW_ORDER_STATUS.HasRecommended}'"; + // break; + // case "WaitAppointment": + + // default: + // break; + //} + } + } + #endregion + if (filter.pageSize == 0) + filter.pageSize = 10000; + + var sql1 = GetQueryString(sql, filter.pageNum, filter.pageSize, filter.orderBy); + + var totalCount = await Db.Ado.GetIntAsync("select count(0) from ( " + sql + ") A"); + var list = DbAccess.QueryList(sql); + + ModuleParam param = new ModuleParam() + { + langId = filter.langId, + menuName = filter.menuName + }; + var module = await _commonServices.GetModuleInfoAsync(param); + var result1 = new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, list); + result1.result.JM_TableColumnT1 = module.Data.JM_TableColumnT1; + + var columns = new JArray(); + + var titles = await Db.Queryable().OrderBy(x => x.SortNo).ToListAsync(); + var rules = await Db.Queryable().Where(x => x.RuleType == "Required" && x.TrainType == "Title").ToListAsync(); + + var dict = new Dictionary>(); + + rules.ForEach(x => + { + if (x.TitleId.IsNotEmptyOrNull()) + { + + var key = (x.CourseId ?? x.CourseSceneId).ObjToString(); + if (dict.ContainsKey(key)) + { + var ids = dict[key]; + + ids.AddRange(JsonHelper.JsonToObj>(x.TitleId)); + ids = ids.Distinct().ToList(); + dict[key] = ids; + } + else + { + dict.Add(key, JsonHelper.JsonToObj>(x.TitleId)); + } + } + + }); + + for (int i = 0; i < list.Count; i++) + { + var column = list[i]; + + var item = new JObject + { + new JProperty("Id", column.Id), + new JProperty("CourseNo", column.CourseNo), + new JProperty("CourseName", column.CourseName), + new JProperty("Type", column.Type), + }; + + titles.ForEach(x => + { + if (dict.ContainsKey(column.Id.ObjToString())) + { + var ids = dict[column.Id.ObjToString()]; + if (ids.Where(id => id == x.TitleID).Any()) + item.Add(new JProperty("Title_" + x.TitleNo, "✔")); + else + item.Add(new JProperty("Title_" + x.TitleNo, "")); + } + else + item.Add(new JProperty("Title_" + x.TitleNo, "")); + }); + + columns.Add(item); + } + + result.JM_TableColumnT1 = module.Data.JM_TableColumnT1; + result.DT_TablePageInfoT1 = result1.result.DT_TablePageInfoT1; + result.DT_TableDataT1 = columns; + obj.result = result; + obj.Success = true; + obj.code = "0"; + obj.type = "success"; + obj.message = "查询成功!"; + return obj; + } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs index 10b94e83..ca4b6d41 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs @@ -1,8 +1,4 @@ -using NPOI.SS.Formula.Functions; -using NPOI.SS.Util; -using System.Linq; -using Tiobon.Core.Common.HttpContextUser; -using static Tiobon.Core.Model.Consts; +using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services;