|
@@ -619,7 +619,7 @@ public class QuestionFlowService {
|
|
|
public UserQuestion next(Integer userId, Integer userReportId){
|
|
|
UserQuestion userQuestion = userQuestionService.getLastByReport(userId, userReportId);
|
|
|
// 查找未完成的questionId
|
|
|
- if (userQuestion==null || userQuestion.getUserTime() >0){
|
|
|
+ if (userQuestion==null || userQuestion.getUserTime() >0 || userQuestion.getIsAuto() == 1){
|
|
|
// 创建新的question
|
|
|
UserReport userReport = userReportService.get(userReportId);
|
|
|
if (!userReport.getUserId().equals(userId)){
|
|
@@ -718,12 +718,14 @@ public class QuestionFlowService {
|
|
|
UserQuestion question;
|
|
|
if(lastQuestion != null && lastQuestion.getUserTime() == 0){
|
|
|
lastQuestion.setUserTime(totalTime - useTime);
|
|
|
+ lastQuestion.setIsAuto(1);
|
|
|
this.submit(userId, lastQuestion);
|
|
|
}
|
|
|
// 判断未完成题目数,自动生成
|
|
|
question = userQuestionService.newByReport(userReport, lastQuestion);
|
|
|
while(number.getIntValue(stage) < totalNumber){
|
|
|
examinationCompute(paper, userReport, lastQuestion, question);
|
|
|
+ question.setIsAuto(1);
|
|
|
question = userQuestionService.add(question);
|
|
|
lastQuestion = question;
|
|
|
question = userQuestionService.newByReport(userReport, lastQuestion);
|
|
@@ -908,26 +910,30 @@ public class QuestionFlowService {
|
|
|
Integer subnumber = number.getIntValue(stage);
|
|
|
Integer surplus = totalNumber - subnumber;
|
|
|
QuestionSubject subject = QuestionSubject.ValueOf(stage);
|
|
|
- List<String> questionTypes = QuestionType.SpecialFromSubject(subject);
|
|
|
- List<UserQuestion> userQuestionList = userQuestionService.listByReportAndType(report.getUserId(), report.getId(), questionTypes);
|
|
|
- Collection ids = Transform.getIds(userQuestionList, UserQuestion.class, "questionNoId");
|
|
|
// 根据设置出题
|
|
|
Integer questionNoId = 0;
|
|
|
- if (paper.getIsAdapt() > 0 && QuestionSubject.SupportAdapt(subject)){
|
|
|
- switch(subject){
|
|
|
- case VERBAL:
|
|
|
- questionNoId = verbalCompute(paper, setting, subnumber, ids, userQuestionList);
|
|
|
- break;
|
|
|
- case QUANT:
|
|
|
- questionNoId = quantCompute(paper, setting, subnumber, ids, userQuestionList);
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new ParameterException("模考出题流程错误:"+subject.key+"不支持适应性判断");
|
|
|
+ if (paper.getIsAdapt() > 0){
|
|
|
+ List<String> questionTypes = QuestionType.SpecialFromSubject(subject);
|
|
|
+ List<UserQuestion> userQuestionList = userQuestionService.listByReportAndType(report.getUserId(), report.getId(), questionTypes);
|
|
|
+ Collection ids = Transform.getIds(userQuestionList, UserQuestion.class, "questionNoId");
|
|
|
+
|
|
|
+ if (QuestionSubject.SupportAdapt(subject)){
|
|
|
+ switch(subject){
|
|
|
+ case VERBAL:
|
|
|
+ questionNoId = verbalCompute(paper, setting, subnumber, ids, userQuestionList);
|
|
|
+ break;
|
|
|
+ case QUANT:
|
|
|
+ questionNoId = quantCompute(paper, setting, subnumber, ids, userQuestionList);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new ParameterException("模考出题流程错误:"+subject.key+"不支持适应性判断");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ questionNoId = randomCompute(subject, paper, questionTypes, setting, subnumber, ids, userQuestionList);
|
|
|
}
|
|
|
- }else if (paper.getIsAdapt() > 0){
|
|
|
- questionNoId = randomCompute(subject, paper, questionTypes, setting, subnumber, ids, userQuestionList);
|
|
|
}else{
|
|
|
- questionNoId = fixOrderCompute(subject, paper, questionTypes, setting, subnumber, ids, userQuestionList);
|
|
|
+ UserQuestion userQuestion = userQuestionService.getLastByReport(report.getUserId(), report.getId());
|
|
|
+ questionNoId = fixOrderCompute(subject, paper, userQuestion);
|
|
|
}
|
|
|
if (questionNoId ==null || questionNoId == 0) {
|
|
|
throw new ParameterException("模考出题流程错误:题目生成错误");
|
|
@@ -1094,11 +1100,11 @@ 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){
|
|
|
+ public Integer fixOrderCompute(QuestionSubject subject, ExaminationPaper paper, UserQuestion lastQuestion){
|
|
|
List<String> targetTypes = QuestionType.FromSubject(subject);
|
|
|
Integer prevNo = null;
|
|
|
- if (subQuestionList != null && subQuestionList.size() > 0){
|
|
|
- Integer questionNoId = subQuestionList.get(subQuestionList.size() - 1).getQuestionNoId();
|
|
|
+ if (lastQuestion != null){
|
|
|
+ Integer questionNoId = lastQuestion.getQuestionNoId();
|
|
|
QuestionNo questionNo = questionNoService.get(questionNoId);
|
|
|
prevNo = questionNo.getNo();
|
|
|
}
|