|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.project.milvus.application.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.project.base.domain.exception.MissingParameterException; |
|
|
|
import com.project.classicpaper.domain.service.ClassicPaperQuestionCallbackService; |
|
|
|
@ -43,10 +44,10 @@ public class MilvusApplicationServiceImpl implements MilvusApplicationService { |
|
|
|
public void insertTitle(TitleVector title) { |
|
|
|
// 经典套卷分支:走备用池 + 提拔,跳过 Milvus
|
|
|
|
|
|
|
|
log.info(">>> [回调处理] 经典套卷生题回调, json={}", JSONUtil.toJsonStr(title)); |
|
|
|
|
|
|
|
if (title.getBizKey() != null && title.getBizKey().startsWith("PQ:")) { |
|
|
|
log.info(">>> [回调处理] 经典套卷生题回调, bizKey={}", title.getBizKey()); |
|
|
|
log.info(">>> [回调处理] 经典套卷生题回调, json={}", JSONUtil.toJsonStr(title)); |
|
|
|
|
|
|
|
handleClassicPaper(title); |
|
|
|
return; |
|
|
|
@ -135,6 +136,8 @@ public class MilvusApplicationServiceImpl implements MilvusApplicationService { |
|
|
|
private void handleClassicPaper(TitleVector title) { |
|
|
|
// 构造单题列表
|
|
|
|
QuestionDTO questionDTO = buildQuestionDTO(title); |
|
|
|
// 简答题:算法把得分点放在 options 中(key="1","2","3"...),转为 scoringPoints
|
|
|
|
convertShortAnswerScoringPoints(questionDTO); |
|
|
|
List<QuestionDTO> questions = Collections.singletonList(questionDTO); |
|
|
|
|
|
|
|
QuestionCallBackDTO callback = new QuestionCallBackDTO(); |
|
|
|
@ -151,4 +154,35 @@ public class MilvusApplicationServiceImpl implements MilvusApplicationService { |
|
|
|
String collect = poinIds.stream().map(String::valueOf).collect(Collectors.joining(",")); |
|
|
|
return LOCK_KEY + DigestUtils.md5Hex(collect); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 简答题转换:算法把得分点放在 options(key="1","2","3"...)中, |
|
|
|
* 转为 scoringPoints 格式,清空 options/rightAnswer |
|
|
|
*/ |
|
|
|
private void convertShortAnswerScoringPoints(QuestionDTO dto) { |
|
|
|
QuestionDTO.QuestionDetailDTO detail = dto.getQuestionDetailDTO(); |
|
|
|
if (detail == null || detail.getType() != 4) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (detail.getOptions() == null || detail.getOptions().isEmpty()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (detail.getScoringPoints() != null && !detail.getScoringPoints().isEmpty()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
List<QuestionDTO.ScoringPointDTO> spList = new ArrayList<>(); |
|
|
|
for (Map.Entry<String, String> entry : detail.getOptions().entrySet()) { |
|
|
|
String content = entry.getValue(); |
|
|
|
if (StrUtil.isNotBlank(content)) { |
|
|
|
QuestionDTO.ScoringPointDTO sp = new QuestionDTO.ScoringPointDTO(); |
|
|
|
sp.setIndex(Integer.parseInt(entry.getKey())); |
|
|
|
sp.setContent(content); |
|
|
|
spList.add(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
detail.setScoringPoints(spList); |
|
|
|
detail.setOptions(null); |
|
|
|
detail.setRightAnswer(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|