|
|
@@ -389,7 +389,8 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
if(okExcel.getIsContent()){
|
|
|
String questionType = questionList.get(i).getQuestionType();
|
|
|
- if(questionType ==null || !questionType.equals("填空题")){
|
|
|
+ String bankType = questionList.get(i).getBankType();
|
|
|
+ if(bankType != null && !bankType.equals("问卷题目库") && questionType != null && !questionType.equals("填空题")){
|
|
|
String correctContent = questionList.get(i).getCorrectContent();
|
|
|
if(correctContent == null || correctContent.trim().isEmpty()){
|
|
|
errorQuestionList.add("题目序号: "+questionId+" , 答案内容为空请检查.");
|
|
|
@@ -401,24 +402,30 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
|
|
|
}
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
if(okExcel.getIsContent()){
|
|
|
- String itemScore = questionList.get(i).getItemScore();
|
|
|
- boolean isItemScore = positiveInteger(itemScore);
|
|
|
- if(!isItemScore){
|
|
|
- errorQuestionList.add("题目序号: "+questionId+" , 题目分数数据格式错误请检查.");
|
|
|
- errorIdSet.add(questionId);
|
|
|
- }else{
|
|
|
- okExcel.setItemScore(itemScore);
|
|
|
+ String bankType = questionList.get(i).getBankType();
|
|
|
+ if(bankType != null && !bankType.equals("问卷题目库")){
|
|
|
+ String itemScore = questionList.get(i).getItemScore();
|
|
|
+ boolean isItemScore = positiveInteger(itemScore);
|
|
|
+ if(!isItemScore){
|
|
|
+ errorQuestionList.add("题目序号: "+questionId+" , 题目分数数据格式错误请检查.");
|
|
|
+ errorIdSet.add(questionId);
|
|
|
+ }else{
|
|
|
+ okExcel.setItemScore(itemScore);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
if(okExcel.getIsContent()){
|
|
|
- String difficult = questionList.get(i).getDifficult();
|
|
|
- boolean isDifficult = positiveInteger(difficult);
|
|
|
- if(!isDifficult){
|
|
|
- errorQuestionList.add("题目序号: "+questionId+" , 题目难度数据格式错误请检查.");
|
|
|
- errorIdSet.add(questionId);
|
|
|
- }else{
|
|
|
- okExcel.setDifficult(difficult);
|
|
|
+ String bankType = questionList.get(i).getBankType();
|
|
|
+ if(bankType != null && !bankType.equals("问卷题目库")){
|
|
|
+ String difficult = questionList.get(i).getDifficult();
|
|
|
+ boolean isDifficult = positiveInteger(difficult);
|
|
|
+ if(!isDifficult){
|
|
|
+ errorQuestionList.add("题目序号: "+questionId+" , 题目难度数据格式错误请检查.");
|
|
|
+ errorIdSet.add(questionId);
|
|
|
+ }else{
|
|
|
+ okExcel.setDifficult(difficult);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
@@ -447,15 +454,18 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject saveFromLoad(List<QuestionExcel> questionOKList, String userId, JSONObject result) {
|
|
|
- List<String> saveIds = new ArrayList<>(); // 保存成功的序号ID
|
|
|
for(QuestionExcel okExcel : questionOKList){
|
|
|
- if(okExcel.getIsContent() && !saveIds.contains(okExcel.getId())){
|
|
|
+ if(okExcel.getIsContent()){
|
|
|
// 题目内容 条
|
|
|
List<QuestionExcel> itemList = questionOKList.stream().filter(item -> item.getId().equals(okExcel.getId())).collect(Collectors.toList());
|
|
|
List<String> correct = itemList.stream().map(QuestionExcel::getCorrectContent).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
int questionType = Integer.parseInt(okExcel.getQuestionType());
|
|
|
- int score = Integer.parseInt(okExcel.getItemScore());
|
|
|
- int difficult = Integer.parseInt(okExcel.getDifficult());
|
|
|
+ int score = 0, difficult = 0;
|
|
|
+ if(!"3".equals(okExcel.getBankType())){
|
|
|
+ score = Integer.parseInt(okExcel.getItemScore());
|
|
|
+ difficult = Integer.parseInt(okExcel.getDifficult());
|
|
|
+ }
|
|
|
+
|
|
|
Question question = new Question();
|
|
|
question.setBankType(okExcel.getBankType());
|
|
|
question.setQuestionType(questionType);
|
|
|
@@ -466,9 +476,6 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
|
|
|
question.setCreateTime(now());
|
|
|
question.setDeleted(false);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if(QuestionTypeEnum.GapFilling.getCode() == questionType){ // 填空题
|
|
|
int count = checkEmptyCount(okExcel.getTitleContent());
|
|
|
if(count == 0){
|