问卷题目增加字段 questionNameAlias

This commit is contained in:
zhuangyuanke 2024-12-18 17:33:02 +08:00
parent a972c21e81
commit e68836950c
3 changed files with 31 additions and 9 deletions

View File

@ -51,8 +51,8 @@ public class QuestionSubject extends BaseEntity {
* 组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT * 组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT
* 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT * 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT
*/ */
@ApiModelProperty(value = "题目类型单选题MULTIPLE_CHOICE多选题MULTIPLE_CHOICE_QUESTIONS填空题FILL_IN_THE_BLANKS打分题SCORING_QUESTIONS组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT") @ApiModelProperty(value = "题目类型单选题MULTIPLE_CHOICE多选题MULTIPLE_CHOICE_QUESTIONS填空题FILL_IN_THE_BLANKS打分题SCORING_QUESTIONS组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT;反馈填空题FEEDBACK_BLANKS_SUBJECT")
@Excel(name = "题目类型单选题MULTIPLE_CHOICE多选题MULTIPLE_CHOICE_QUESTIONS填空题FILL_IN_THE_BLANKS打分题SCORING_QUESTIONS 组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT") @Excel(name = "题目类型单选题MULTIPLE_CHOICE多选题MULTIPLE_CHOICE_QUESTIONS填空题FILL_IN_THE_BLANKS打分题SCORING_QUESTIONS 组合单选题COMBINATION_RADIO_SUBJECT组合多选题COMBINATION_MULTIPLE_SUBJECT组合填空题COMBINATION_BLANKS_SUBJECT 组合打分题COMBINATION_SCORING_SUBJECT日期填空题DATE_BLANKS_SUBJECT时间填空题TIME_BLANKS_SUBJECT;反馈填空题FEEDBACK_BLANKS_SUBJECT")
private String questionType; private String questionType;
/** /**
@ -62,6 +62,14 @@ public class QuestionSubject extends BaseEntity {
@Excel(name = "题目名称") @Excel(name = "题目名称")
private String questionName; private String questionName;
/**
* 题目名称别名
*/
@ApiModelProperty(value = "题目名称")
@Excel(name = "题目名称")
private String questionNameAlias;
/** /**
* 题目说明 * 题目说明
*/ */

View File

@ -591,12 +591,12 @@ public class AIOBServiceImpl implements IAIOBService {
List<QuestionSubjectVO> questionSubjectList = questionSubjectMapper.selectQuestionSubjectBy(node.getQuestionInfoId()); List<QuestionSubjectVO> questionSubjectList = questionSubjectMapper.selectQuestionSubjectBy(node.getQuestionInfoId());
questionSubjectList.forEach(questionSubjectVO -> { questionSubjectList.forEach(questionSubjectVO -> {
// 判断问题中有无变量有变量替换变量 // 判断问题中有无变量有变量替换变量
String questionName = replaceQuestionName(questionSubjectVO.getQuestionName(), labelFieldContentList); String questionNameAlias = replaceQuestionName(questionSubjectVO.getQuestionNameAlias(), labelFieldContentList);
// 根据通话记录筛查是否询问该问题 // 根据通话记录筛查是否询问该问题
boolean hasQuestion = false; boolean hasQuestion = false;
String aiobQuestionName = ""; String aiobQuestionName = "";
for (String questionContent : contextMap.keySet()) { for (String questionContent : contextMap.keySet()) {
if (questionContent.replaceAll("\\p{P}", "").contains(questionName.replaceAll("\\p{P}", ""))) { if (questionContent.replaceAll("\\p{P}", "").contains(questionNameAlias.replaceAll("\\p{P}", ""))) {
hasQuestion = true; hasQuestion = true;
aiobQuestionName = questionContent; aiobQuestionName = questionContent;
break; break;
@ -702,16 +702,16 @@ public class AIOBServiceImpl implements IAIOBService {
return null; return null;
} }
private String replaceQuestionName(String questionName, List<LabelFieldInfoContentVo> labelFieldContentList) { private String replaceQuestionName(String questionNameAlias, List<LabelFieldInfoContentVo> labelFieldContentList) {
Pattern pattern = Pattern.compile("\\{%\\s*&[\\s\\S]*?\\s*%}"); Pattern pattern = Pattern.compile("\\{%\\s*&[\\s\\S]*?\\s*%}");
Matcher matcher = pattern.matcher(questionName); Matcher matcher = pattern.matcher(questionNameAlias);
while (matcher.find()) { while (matcher.find()) {
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1).replaceAll("_", "").toUpperCase())).findFirst().orElse(null); LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1).replaceAll("_", "").toUpperCase())).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) { if (ObjectUtils.isNotEmpty(labelFieldContent)) {
questionName = questionName.replaceAll("\\{%\\s*&[\\s\\S]*?\\s*%}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); questionNameAlias = questionNameAlias.replaceAll("\\{%\\s*&[\\s\\S]*?\\s*%}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
} }
} }
return questionName; return questionNameAlias;
} }
/** /**

View File

@ -10,6 +10,7 @@
<result property="questionNumber" column="question_number"/> <result property="questionNumber" column="question_number"/>
<result property="questionType" column="question_type"/> <result property="questionType" column="question_type"/>
<result property="questionName" column="question_name"/> <result property="questionName" column="question_name"/>
<result property="questionNameAlias" column="question_name_alias"/>
<result property="questionDescription" column="question_description"/> <result property="questionDescription" column="question_description"/>
<result property="writeDescription" column="write_description"/> <result property="writeDescription" column="write_description"/>
<result property="fillBlanksAnswer" column="fill_blanks_answer"/> <result property="fillBlanksAnswer" column="fill_blanks_answer"/>
@ -35,6 +36,7 @@
question_number, question_number,
question_type, question_type,
question_name, question_name,
question_name_alias,
question_description, question_description,
write_description, write_description,
fill_blanks_answer, fill_blanks_answer,
@ -70,6 +72,9 @@
<if test="questionName != null and questionName != ''"> <if test="questionName != null and questionName != ''">
and question_name like concat('%', #{questionName}, '%') and question_name like concat('%', #{questionName}, '%')
</if> </if>
<if test="questionNameAlias != null and questionNameAlias != ''">
and question_name_alias like concat('%', #{questionNameAlias}, '%')
</if>
<if test="questionDescription != null and questionDescription != ''"> <if test="questionDescription != null and questionDescription != ''">
and question_description = #{questionDescription} and question_description = #{questionDescription}
</if> </if>
@ -130,6 +135,8 @@
</if> </if>
<if test="questionName != null">question_name, <if test="questionName != null">question_name,
</if> </if>
<if test="questionNameAlias != null">question_name_alias,
</if>
<if test="questionDescription != null">question_description, <if test="questionDescription != null">question_description,
</if> </if>
<if test="writeDescription != null">write_description, <if test="writeDescription != null">write_description,
@ -174,6 +181,8 @@
</if> </if>
<if test="questionName != null">#{questionName}, <if test="questionName != null">#{questionName},
</if> </if>
<if test="questionNameAlias != null">#{questionNameAlias},
</if>
<if test="questionDescription != null">#{questionDescription}, <if test="questionDescription != null">#{questionDescription},
</if> </if>
<if test="writeDescription != null">#{writeDescription}, <if test="writeDescription != null">#{writeDescription},
@ -226,6 +235,9 @@
<if test="questionName != null">question_name = <if test="questionName != null">question_name =
#{questionName}, #{questionName},
</if> </if>
<if test="questionNameAlias != null">question_name_alias =
#{questionNameAlias},
</if>
<if test="questionDescription != null">question_description = <if test="questionDescription != null">question_description =
#{questionDescription}, #{questionDescription},
</if> </if>
@ -300,6 +312,7 @@
question_number, question_number,
question_type, question_type,
question_name, question_name,
question_name_alias,
question_description, question_description,
write_description, write_description,
fill_blanks_answer, fill_blanks_answer,
@ -322,6 +335,7 @@
#{QuestionSubject.questionNumber}, #{QuestionSubject.questionNumber},
#{QuestionSubject.questionType}, #{QuestionSubject.questionType},
#{QuestionSubject.questionName}, #{QuestionSubject.questionName},
#{QuestionSubject.questionNameAlias},
#{QuestionSubject.questionDescription}, #{QuestionSubject.questionDescription},
#{QuestionSubject.writeDescription}, #{QuestionSubject.writeDescription},
#{QuestionSubject.fillBlanksAnswer}, #{QuestionSubject.fillBlanksAnswer},
@ -355,4 +369,4 @@
from question_subject from question_subject
where question_info_id = #{questionInfoId} where question_info_id = #{questionInfoId}
</delete> </delete>
</mapper> </mapper>