|
|
|
@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.json.JSONArray; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.project.exam.domain.entity.ExamRecordEntity; |
|
|
|
import com.project.question.domain.entity.QuestionEntity; |
|
|
|
import com.project.question.domain.entity.TaskKnowledgePointEntity; |
|
|
|
@ -257,13 +259,35 @@ public class SaveSaveErrorProneStatisticsDomainServiceImpl implements SaveErrorP |
|
|
|
for (QuestionEntity.ScoringPoint scoringPoint : scoringPoints) { |
|
|
|
ErrorProneStatisticsEntity.OptionDetail od = new ErrorProneStatisticsEntity.OptionDetail(); |
|
|
|
od.setOption(scoringPoint.getIndex().toString()); |
|
|
|
od.setOptionContent(scoringPoint.getContent()); |
|
|
|
od.setOptionContent(formatScoringPointContent(scoringPoint.getContent())); |
|
|
|
od.setChoosenCount(0); |
|
|
|
list.add(od); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 格式化得分点内容:解析JSON中的example和keywords字段 |
|
|
|
* 格式:【标准答案】example\n【关键词】keyword1, keyword2, ... |
|
|
|
*/ |
|
|
|
private String formatScoringPointContent(String content) { |
|
|
|
if (StrUtil.isBlank(content)) { |
|
|
|
return content; |
|
|
|
} |
|
|
|
try { |
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(content); |
|
|
|
String example = json.getStr("example"); |
|
|
|
JSONArray keywords = json.getJSONArray("keywords"); |
|
|
|
if (StrUtil.isNotBlank(example) && keywords != null && !keywords.isEmpty()) { |
|
|
|
String keywordsStr = StrUtil.join(", ", keywords.toArray()); |
|
|
|
return StrUtil.format("【标准答案】{}\n【关键词】{}", example, keywordsStr); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("得分点JSON解析失败,使用原始内容: {}", e.getMessage()); |
|
|
|
} |
|
|
|
return content; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 构建客观题选项详情 |
|
|
|
*/ |
|
|
|
|