From 91074ee24d9cba9d05ea8f15f3108ab0189647c4 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 28 Apr 2025 16:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=BB=9F=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90=20=E6=96=B0=E5=A2=9E=E8=AF=8D=E4=BA=91=E5=9B=BE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Tiobon.Core.Model.xml | 5 ++++ .../Ghre/Ghre_StudyRecordServices.cs | 2 -- .../Ghre/Ghre_SurveyServices.cs | 27 ++++++++++++++++++- Tiobon.Core/Tiobon.Core.Model.xml | 5 ++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index dd4d978f..8abdd136 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -39093,6 +39093,11 @@ 必修规则 + + + 手动选修 + + 培训规则种类 diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index f38439fe..3fea4edf 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -4,8 +4,6 @@ using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.SS.Util; using NPOI.XSSF.UserModel; -using System.Drawing.Drawing2D; -using Tiobon.Core.IServices; using static Tiobon.Core.DataAccess.ReportHelper; using static Tiobon.Core.Model.Consts; diff --git a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs index 2973909e..39f05f1d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs @@ -1,4 +1,6 @@ -namespace Tiobon.Core.Services; +using System.Text.RegularExpressions; + +namespace Tiobon.Core.Services; /// /// 问卷调查 (服务) @@ -567,6 +569,29 @@ public class Ghre_SurveyServices : BaseServices a.SurveyQuestionId == x.Id).FirstOrDefault(); + var KeywordList = x.WordCloudKeywords.Split(','); + + x.Table = KeywordList.Select(x => new Ghre_SurveyStatisticQuestionTable + { + OptionContent = x, + Count = 0, + Percent1 = 0 + }).ToList(); + + x.Table.ForEach(o => + { + string keyword = o.OptionContent; + + // 使用正则表达式匹配关键字(忽略大小写) + o.Count = Regex.Matches(recordOption.OptionContent, Regex.Escape(keyword), RegexOptions.None).Count; + }); + } + } else { x.Table = Mapper.Map(options.Where(o => o.SurveyQuestionId == x.Id)).ToANew>(); diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index dd4d978f..8abdd136 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -39093,6 +39093,11 @@ 必修规则 + + + 手动选修 + + 培训规则种类