|
@@ -165,7 +165,7 @@ public class QuestionFlowService {
|
|
|
userPaper.setTitle(assign.getTitle());
|
|
|
}
|
|
|
// 新paper绑定当前记录关系
|
|
|
- if (userPaper.getRecordId() == 0){
|
|
|
+ if (userPaper.getRecordId() ==null || userPaper.getRecordId() == 0){
|
|
|
// 获取用户当前课程记录
|
|
|
Integer recordId = previewService.getRecord(userPaper.getUserId(), id);
|
|
|
userPaper.setRecordId(recordId);
|
|
@@ -319,8 +319,15 @@ public class QuestionFlowService {
|
|
|
});
|
|
|
nextCallback.put(PaperModule.EXAMINATION, (question, report, lastQuestion)->{
|
|
|
ExaminationPaper paper = examinationPaperService.get(report.getOriginId());
|
|
|
- if (!examinationCompute(paper, report, lastQuestion, question)){
|
|
|
- return false;
|
|
|
+ if (paper.getIsAdapt() > 0){
|
|
|
+ if (!examinationCompute(paper, report, lastQuestion, question)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 固定顺序出题
|
|
|
+ if (!examinationCompute(paper, report, lastQuestion, question)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 保存report: 更新setting
|
|
@@ -917,8 +924,10 @@ public class QuestionFlowService {
|
|
|
default:
|
|
|
throw new ParameterException("模考出题流程错误:"+subject.key+"不支持适应性判断");
|
|
|
}
|
|
|
- }else{
|
|
|
+ }else if (paper.getIsAdapt() > 0){
|
|
|
questionNoId = randomCompute(subject, paper, questionTypes, setting, subnumber, ids, userQuestionList);
|
|
|
+ }else{
|
|
|
+ questionNoId = fixOrderCompute(subject, paper, questionTypes, setting, subnumber, ids, userQuestionList);
|
|
|
}
|
|
|
if (questionNoId ==null || questionNoId == 0) {
|
|
|
throw new ParameterException("模考出题流程错误:题目生成错误");
|
|
@@ -946,7 +955,7 @@ public class QuestionFlowService {
|
|
|
// 一共分为4个阶段:每个阶段9题,包含一题阅读
|
|
|
// 其中句改SC有14题,阅读RC有13题(共4篇阅读,每篇题数为3、3、3、4),逻辑CR为9题
|
|
|
// verbal: { "steps": [{"ids": [], "level": 0}, {}] }
|
|
|
- List questionNoIds = new ArrayList<>();
|
|
|
+ List<Integer> questionNoIds = new ArrayList<>();
|
|
|
JSONObject verbal = setting.getJSONObject("verbal");
|
|
|
if (verbal == null) {
|
|
|
verbal = new JSONObject();
|
|
@@ -955,7 +964,7 @@ public class QuestionFlowService {
|
|
|
}
|
|
|
JSONArray steps = verbal.getJSONArray("steps");
|
|
|
// 判断当前是第几阶段
|
|
|
- Integer step = subnumber / examinationService.verbalPre + 1;
|
|
|
+ Integer step = subnumber / examinationService.verbalPre;
|
|
|
Integer questionIndex = 0;
|
|
|
JSONObject info;
|
|
|
if (subnumber == 0){
|
|
@@ -977,7 +986,11 @@ public class QuestionFlowService {
|
|
|
questionIndex = subnumber % examinationService.verbalPre;
|
|
|
}
|
|
|
//获取下一题
|
|
|
- questionNoIds = info.getJSONArray("ids").toJavaObject(questionNoIds.getClass());
|
|
|
+ questionNoIds.clear();
|
|
|
+ JSONArray lastIds = info.getJSONArray("ids");
|
|
|
+ for(int i = 0; i<lastIds.size(); i++){
|
|
|
+ questionNoIds.add(lastIds.getInteger(i));
|
|
|
+ }
|
|
|
return (Integer) questionNoIds.get(questionIndex);
|
|
|
}
|
|
|
|
|
@@ -993,7 +1006,7 @@ public class QuestionFlowService {
|
|
|
// 一共分为4个阶段:每个阶段题分别为8、8、8、7题,合计31题
|
|
|
// 其中数学PS有17题,数学DS有14题
|
|
|
// quant: { "steps": [{"ids": [], "level": 0}, {}] }
|
|
|
- List questionNoIds = new ArrayList<>();
|
|
|
+ List<Integer> questionNoIds = new ArrayList<>();
|
|
|
JSONObject quant = setting.getJSONObject("quant");
|
|
|
if (quant == null) {
|
|
|
quant = new JSONObject();
|
|
@@ -1025,7 +1038,11 @@ public class QuestionFlowService {
|
|
|
questionIndex = subnumber - examinationService.quantNumber[step];
|
|
|
}
|
|
|
//获取下一题
|
|
|
- questionNoIds = info.getJSONArray("ids").toJavaObject(questionNoIds.getClass());
|
|
|
+ questionNoIds.clear();
|
|
|
+ JSONArray lastIds = info.getJSONArray("ids");
|
|
|
+ for(int i = 0; i<lastIds.size(); i++){
|
|
|
+ questionNoIds.add(lastIds.getInteger(i));
|
|
|
+ }
|
|
|
return (Integer) questionNoIds.get(questionIndex);
|
|
|
}
|
|
|
|
|
@@ -1077,6 +1094,17 @@ public class QuestionFlowService {
|
|
|
return questionNoService.randomExamination(paper.getStructThree(), targetTypes, ids);
|
|
|
}
|
|
|
|
|
|
+ public Integer fixOrderCompute(QuestionSubject subject, ExaminationPaper paper, List<String> questionTypes, JSONObject setting, Integer subnumber, Collection ids, List<UserQuestion> subQuestionList){
|
|
|
+ List<String> targetTypes = QuestionType.FromSubject(subject);
|
|
|
+ Integer prevNo = null;
|
|
|
+ if (subQuestionList != null && subQuestionList.size() > 0){
|
|
|
+ Integer questionNoId = subQuestionList.get(subQuestionList.size() - 1).getQuestionNoId();
|
|
|
+ QuestionNo questionNo = questionNoService.get(questionNoId);
|
|
|
+ prevNo = questionNo.getNo();
|
|
|
+ }
|
|
|
+ return questionNoService.nextQuestion(paper.getStructThree(), targetTypes, prevNo);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取报告题目列表
|
|
|
* @param userReportId
|
|
@@ -1160,12 +1188,15 @@ public class QuestionFlowService {
|
|
|
* @return
|
|
|
*/
|
|
|
private Boolean baseAnswer(JSONObject userAnswer, JSONObject answer, Question question){
|
|
|
+ if (userAnswer == null) return false;
|
|
|
String type = question.getContent().getString("type");
|
|
|
QuestionContentType contentType = QuestionContentType.ValueOf(type);
|
|
|
JSONArray userQuestions = userAnswer.getJSONArray("questions");
|
|
|
+ if (userQuestions == null) return false;
|
|
|
JSONArray questions = answer.getJSONArray("questions");
|
|
|
for(int i = 0; i< questions.size(); i++){
|
|
|
JSONObject userOne = userQuestions.getJSONObject(i);
|
|
|
+ if (userOne == null) return false;
|
|
|
JSONObject one = questions.getJSONObject(i);
|
|
|
switch(contentType){
|
|
|
case DOUBLE:
|
|
@@ -1263,6 +1294,9 @@ public class QuestionFlowService {
|
|
|
}
|
|
|
JSONObject answer = question.getAnswer();
|
|
|
JSONObject userAnswer = userQuestion.getUserAnswer();
|
|
|
+ if (userAnswer == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
String type = question.getContent().getString("type");
|
|
|
QuestionContentType contentType = QuestionContentType.ValueOf(type);
|
|
@@ -1641,6 +1675,7 @@ public class QuestionFlowService {
|
|
|
}
|
|
|
Map<Number, QuestionNoRelation> relationMap = questionNoService.mapWithRelationByIds(tmpIds);
|
|
|
|
|
|
+ ExaminationPaper examinationPaper = examinationPaperService.get(report.getOriginId());
|
|
|
// report
|
|
|
JSONObject detail = new JSONObject();
|
|
|
JSONObject score = new JSONObject();
|
|
@@ -1866,6 +1901,7 @@ public class QuestionFlowService {
|
|
|
info.put("questionNumber", report.getQuestionNumber());
|
|
|
info.put("userNumber", report.getUserNumber());
|
|
|
info.put("userCorrect", report.getUserCorrect());
|
|
|
+ info.put("cat", examinationService.isCat(examinationPaper));
|
|
|
detail.put("info", info);
|
|
|
|
|
|
report.setDetail(detail);
|
|
@@ -1874,8 +1910,7 @@ public class QuestionFlowService {
|
|
|
// 统计
|
|
|
UserService userService = null;
|
|
|
// 判断是否是cat模考:记录到第二次
|
|
|
- ExaminationPaper examinationPaper = examinationPaperService.get(report.getOriginId());
|
|
|
- if(examinationService.isCat(examinationPaper)){
|
|
|
+ if(examinationService.isQxCat(examinationPaper)){
|
|
|
userService = userServiceService.getService(report.getUserId(), ServiceKey.QX_CAT);
|
|
|
}
|
|
|
examinationPaperService.accumulation(report, userService != null && userService.getIsReset() > 0);
|