|
@@ -30,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.servlet.http.Cookie;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.IOException;
|
|
@@ -628,7 +627,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
List<Object> objectList = iterator.next();
|
|
|
String content = String.valueOf(objectList.get(0));
|
|
|
char c = content.charAt(0);
|
|
|
- if (Character.isDigit(c)) {//字符串以数字开头
|
|
|
+ if (Character.isDigit(c)) {//字符串以数字开头(题目)
|
|
|
Question question = new Question();
|
|
|
String str = content.substring(content.indexOf(":") + 1, content.lastIndexOf(":")).replace("答案", "").trim();
|
|
|
question.setContent(str.startsWith(".") ? str.replace(".", "") : str);
|
|
@@ -638,10 +637,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
question.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
|
|
question.setAnswerList(new ArrayList<>());
|
|
|
questionList.add(question);
|
|
|
- } else if (Character.isLetter(c)) {//字符串以字母开头
|
|
|
- QuestionAnswer answer = new QuestionAnswer();
|
|
|
+ } else if (Character.isLetter(c)) {//字符串以字母开头(答案)
|
|
|
Question relateQuestion = questionList.get(questionList.size() - 1);
|
|
|
List<QuestionAnswer> answerList = relateQuestion.getAnswerList();
|
|
|
+ QuestionAnswer answer = new QuestionAnswer();
|
|
|
+ answer.setId(IdUtil.getSnowflake(2, 2).nextIdStr());
|
|
|
answer.setQuestionId(relateQuestion.getId());
|
|
|
answer.setTag(String.valueOf(c));
|
|
|
answer.setContent(content.substring(content.indexOf(".") + 1).trim());
|