|
|
|
@ -1,4 +1,6 @@ |
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 问卷调查 (服务) |
|
|
|
@ -567,6 +569,29 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
o.Percent = $"0%"; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (x.QuestionType == "ShortAnswer") |
|
|
|
|
{ |
|
|
|
|
if (x.WordCloudKeywords.IsNotEmptyOrNull()) |
|
|
|
|
{ |
|
|
|
|
var recordOption = recordOptions.Where(a => 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<List<Ghre_SurveyStatisticQuestionTable>>(); |
|
|
|
|