Jelajahi Sumber

题目图片处理

jinxia.mo 3 minggu lalu
induk
melakukan
fb39369fed

+ 14 - 15
ie-admin/src/main/java/com/ruoyi/web/service/PaperService.java

@@ -41,7 +41,7 @@ public class PaperService {
     Set<QuestionType> chooseTypes = Sets.newHashSet(QuestionType.Judgment, QuestionType.Multiple, QuestionType.Single);
     private final LearnPaperMapper paperMapper;
     private final LearnPaperQuestionMapper paperQuestionMapper;
-    private final LearnQuestionsMapper questionsMapper;
+    private final ILearnQuestionsService questionsService;
     private final ILearnQuestionsService learnQuestionsService;
     private final LearnDirectedKnowledgeMapper learnDirectedKnowledgeMapper;
     private final IBBusiWishUniversitiesService wishUniversitiesService;
@@ -50,10 +50,10 @@ public class PaperService {
     private final LearnCultureKnowledgeMapper learnCultureKnowledgeMapper;
     private final DzSubjectMapper dzSubjectMapper;
 
-    PaperService(LearnPaperMapper paperMapper, LearnPaperQuestionMapper paperQuestionMapper, LearnQuestionsMapper questionsMapper, ILearnQuestionsService learnQuestionsService, LearnDirectedKnowledgeMapper learnDirectedKnowledgeMapper, IBBusiWishUniversitiesService wishUniversitiesService, BBusiWishUniversitiesMapper bBusiWishUniversitiesMapper, LearnKnowledgeTreeMapper learnKnowledgeTreeMapper, LearnCultureKnowledgeMapper learnCultureKnowledgeMapper, DzSubjectMapper dzSubjectMapper) {
+    PaperService(LearnPaperMapper paperMapper, LearnPaperQuestionMapper paperQuestionMapper, ILearnQuestionsService questionsService, ILearnQuestionsService learnQuestionsService, LearnDirectedKnowledgeMapper learnDirectedKnowledgeMapper, IBBusiWishUniversitiesService wishUniversitiesService, BBusiWishUniversitiesMapper bBusiWishUniversitiesMapper, LearnKnowledgeTreeMapper learnKnowledgeTreeMapper, LearnCultureKnowledgeMapper learnCultureKnowledgeMapper, DzSubjectMapper dzSubjectMapper) {
         this.paperMapper = paperMapper;
         this.paperQuestionMapper = paperQuestionMapper;
-        this.questionsMapper = questionsMapper;
+        this.questionsService = questionsService;
         this.learnQuestionsService = learnQuestionsService;
         this.learnDirectedKnowledgeMapper = learnDirectedKnowledgeMapper;
         this.wishUniversitiesService = wishUniversitiesService;
@@ -94,7 +94,7 @@ public class PaperService {
         do {
             cond.setId(id);
             PageHelper.startPage(1, pageSize, null);
-            questionsList = questionsMapper.selectLearnQuestionsList(cond);
+            questionsList = questionsService.selectLearnQuestionsList(cond);
             for(LearnQuestions q : questionsList) {
                 boolean updated = false;
                 LearnQuestions up = new LearnQuestions();
@@ -165,7 +165,7 @@ public class PaperService {
                 }
                 if(updated) {
                     up.setIsUpdate(1L);
-                    questionsMapper.updateLearnQuestions(up);
+                    questionsService.updateLearnQuestions(up);
                 }
                 id = q.getId();
             }
@@ -342,7 +342,7 @@ public class PaperService {
      * @return
      */
     public List<PaperVO.QuestionSeq> loadPaperQuestions(Long paperId) {
-        List<LearnQuestions> questions = questionsMapper.selectQuestionByPaperId(paperId);
+        List<LearnQuestions> questions = questionsService.selectQuestionByPaperId(paperId);
         Map<String, PaperVO.QuestionSeq> gropuMap = Maps.newHashMap();
         List<PaperVO.QuestionSeq> paperQuestionList = Lists.newArrayList();
         for(LearnQuestions lqs : questions) {
@@ -376,8 +376,7 @@ public class PaperService {
     }
 
     public List<PaperVO.QuestionAnswer> loadPaperQuestionAnswers(Long userId, Long paperId, Map<Long, LearnAnswer> answerMap, boolean withParse) {
-        List<LearnQuestions> questions = questionsMapper.selectQuestionByPaperId(paperId);
-        learnQuestionsService.fillCollectInfo(userId, questions);
+        List<LearnQuestions> questions = questionsService.selectQuestionByPaperId(paperId);
         Map<String, PaperVO.QuestionAnswer> gropuMap = Maps.newHashMap();
         List<PaperVO.QuestionAnswer> paperQuestionList = Lists.newArrayList();
         LearnAnswer answer;
@@ -578,7 +577,7 @@ public class PaperService {
                     qCond.setId(studentId);
                     qCond.setNumber(knowTypeAssign.exclCount > 500 ? (long) random.nextInt(knowTypeAssign.exclCount.intValue() - 500) :  0L);
                     qCond.setIsSubType("2");
-                    questions = questionsMapper.selectQuestionsForPaper(qCond);
+                    questions = questionsService.selectQuestionsForPaper(qCond);
                     typeQuestionMap.put(knowTypeAssign.getType(), questions);
                 }
                 if(!questions.isEmpty()) {
@@ -928,7 +927,7 @@ public class PaperService {
                 if(ktc.exclAssign > 0){
                     qCond.setId(studentId);
                     qCond.setNumber(ktc.exclAssign > 500 ? (long) random.nextInt(ktc.exclAssign.intValue() - 500) :  0L);
-                    List<LearnQuestions> questions = questionsMapper.selectQuestionsForPaper(qCond);
+                    List<LearnQuestions> questions = questionsService.selectQuestionsForPaper(qCond);
                     ktc.exclAssign = addRandomList(knowId, qt, questions, random, paperDef.getTotal(), ktc.exclAssign, typeDef.getScore().doubleValue(), existQuestionSet, 1, pqList);
                     if(pqList.size() == total) {
                         break;
@@ -937,7 +936,7 @@ public class PaperService {
                 if(ktc.assign > 0L) {
                     qCond.setId(null);
                     qCond.setNumber(ktc.assign > 500 ? (long) random.nextInt(ktc.assign.intValue() - 500) :  0L);
-                    List<LearnQuestions> questions = questionsMapper.selectQuestionsForPaper(qCond);
+                    List<LearnQuestions> questions = questionsService.selectQuestionsForPaper(qCond);
                     ktc.assign = addRandomList(knowId, qt, questions, random, paperDef.getTotal(), ktc.assign, typeDef.getScore().doubleValue(), existQuestionSet, 1, pqList);
                     if(pqList.size() == total) {
                         break;
@@ -977,7 +976,7 @@ public class PaperService {
                 if(ktc.exclAssign > 0){
                     qCond.setId(studentId);
                     qCond.setNumber(ktc.exclAssign > 500 ? (long) random.nextInt(ktc.exclAssign.intValue() - 500) :  0L);
-                    List<LearnQuestions> questions = questionsMapper.selectQuestionsForPaper(qCond);
+                    List<LearnQuestions> questions = questionsService.selectQuestionsForPaper(qCond);
                     ktc.exclAssign = addRandomList(knowId, typeDef.getType(), questions, random, total.longValue(), ktc.exclAssign, typeDef.getScore(), existQuestionSet, seqId, pqList);
                     if(pqList.size() == total) {
                         break;
@@ -986,7 +985,7 @@ public class PaperService {
                 if(ktc.assign > 0L) {
                     qCond.setId(null);
                     qCond.setNumber(ktc.assign > 1000 ? (long) random.nextInt(ktc.assign.intValue() - 1000) :  0L);
-                    List<LearnQuestions> questions = questionsMapper.selectQuestionsForPaper(qCond);
+                    List<LearnQuestions> questions = questionsService.selectQuestionsForPaper(qCond);
                     ktc.assign = addRandomList(knowId, typeDef.getType(), questions, random, total.longValue(), ktc.assign, typeDef.getScore(), existQuestionSet, seqId, pqList);
                     if(pqList.size() == total) {
                         break;
@@ -1059,7 +1058,7 @@ public class PaperService {
                 if("1".equals(q.getIsSubType())) {
                     LearnQuestions subCond = new LearnQuestions();
                     subCond.setKnowId(q.getId());
-                    for(LearnQuestions sq : questionsMapper.selectLearnQuestionsList(subCond)) {
+                    for(LearnQuestions sq : questionsService.selectLearnQuestionsList(subCond)) {
                         LearnPaperQuestion pq = new LearnPaperQuestion();
                         pq.setSeq(baseSeq + pqList.size());
                         pq.setKnowledgeId(knowId);
@@ -1151,7 +1150,7 @@ public class PaperService {
      * @param index 1 free 2 used
      */
     private void setValue(Map<String, KnowTypeAssign> knowTypeAssignMap, Map cond, Integer index) {
-        for (LearnQuestions q : questionsMapper.statByKnowledgeType(cond)) {
+        for (LearnQuestions q : questionsService.statByKnowledgeType(cond)) {
             String key = q.getKnowledgeId() + "_" + q.getQtpye();
             KnowTypeAssign knowTypeAssign = knowTypeAssignMap.get(key);
             if (null == knowTypeAssign) {

+ 33 - 32
ie-common/src/main/java/com/ruoyi/common/utils/StringUtils.java

@@ -11,7 +11,7 @@ import com.ruoyi.common.core.text.StrFormatter;
 
 /**
  * 字符串工具类
- * 
+ *
  * @author ruoyi
  */
 public class StringUtils extends org.apache.commons.lang3.StringUtils
@@ -24,10 +24,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /** 星号 */
     private static final char ASTERISK = '*';
+    public static final String tikuimages= "tikuimages";
 
     /**
      * 获取参数不为空值
-     * 
+     *
      * @param value defaultValue 要判断的value
      * @return value 返回值
      */
@@ -38,7 +39,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个Collection是否为空, 包含List,Set,Queue
-     * 
+     *
      * @param coll 要判断的Collection
      * @return true:为空 false:非空
      */
@@ -49,7 +50,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个Collection是否非空,包含List,Set,Queue
-     * 
+     *
      * @param coll 要判断的Collection
      * @return true:非空 false:空
      */
@@ -60,7 +61,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个对象数组是否为空
-     * 
+     *
      * @param objects 要判断的对象数组
      ** @return true:为空 false:非空
      */
@@ -71,7 +72,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个对象数组是否非空
-     * 
+     *
      * @param objects 要判断的对象数组
      * @return true:非空 false:空
      */
@@ -82,7 +83,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个Map是否为空
-     * 
+     *
      * @param map 要判断的Map
      * @return true:为空 false:非空
      */
@@ -93,7 +94,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个Map是否为空
-     * 
+     *
      * @param map 要判断的Map
      * @return true:非空 false:空
      */
@@ -104,7 +105,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个字符串是否为空串
-     * 
+     *
      * @param str String
      * @return true:为空 false:非空
      */
@@ -115,7 +116,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个字符串是否为非空串
-     * 
+     *
      * @param str String
      * @return true:非空串 false:空串
      */
@@ -126,7 +127,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个对象是否为空
-     * 
+     *
      * @param object Object
      * @return true:为空 false:非空
      */
@@ -137,7 +138,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个对象是否非空
-     * 
+     *
      * @param object Object
      * @return true:非空 false:空
      */
@@ -148,7 +149,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * * 判断一个对象是否是数组类型(Java基本型别的数组)
-     * 
+     *
      * @param object 对象
      * @return true:是数组 false:不是数组
      */
@@ -210,7 +211,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 截取字符串
-     * 
+     *
      * @param str 字符串
      * @param start 开始
      * @return 结果
@@ -241,7 +242,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 截取字符串
-     * 
+     *
      * @param str 字符串
      * @param start 开始
      * @param end 结束
@@ -287,7 +288,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
-     * 
+     *
      * @param str 要截取的字符串
      * @param open 起始字符串
      * @param close 结束字符串
@@ -313,7 +314,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 判断是否为空,并且不是空白字符
-     * 
+     *
      * @param str 要判断的value
      * @return 结果
      */
@@ -343,7 +344,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
      * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
      * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
      * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
-     * 
+     *
      * @param template 文本模板,被替换的部分用 {} 表示
      * @param params 参数值
      * @return 格式化后的文本
@@ -359,7 +360,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 是否为http(s)://开头
-     * 
+     *
      * @param link 链接
      * @return 结果
      */
@@ -370,7 +371,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 字符串转set
-     * 
+     *
      * @param str 字符串
      * @param sep 分隔符
      * @return set集合
@@ -382,7 +383,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 字符串转list
-     * 
+     *
      * @param str 字符串
      * @param sep 分隔符
      * @return list集合
@@ -394,7 +395,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 字符串转list
-     * 
+     *
      * @param str 字符串
      * @param sep 分隔符
      * @param filterBlank 过滤纯空白
@@ -531,7 +532,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 是否包含字符串
-     * 
+     *
      * @param str 验证字符串
      * @param strs 字符串组
      * @return 包含返回true
@@ -553,7 +554,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
-     * 
+     *
      * @param name 转换前的下划线大写方式命名的字符串
      * @return 转换后的驼峰式命名的字符串
      */
@@ -627,7 +628,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
-     * 
+     *
      * @param str 指定字符串
      * @param strs 需要检查的字符串数组
      * @return 是否匹配
@@ -649,11 +650,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
     }
 
     /**
-     * 判断url是否与规则配置: 
-     * ? 表示单个字符; 
-     * * 表示一层路径内的任意字符串,不可跨层级; 
+     * 判断url是否与规则配置:
+     * ? 表示单个字符;
+     * * 表示一层路径内的任意字符串,不可跨层级;
      * ** 表示任意层路径;
-     * 
+     *
      * @param pattern 匹配规则
      * @param url 需要匹配的url
      * @return
@@ -672,7 +673,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。
-     * 
+     *
      * @param num 数字对象
      * @param size 字符串指定长度
      * @return 返回数字的字符串格式,该字符串为指定长度。
@@ -684,7 +685,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
 
     /**
      * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
-     * 
+     *
      * @param s 原始字符串
      * @param size 字符串指定长度
      * @param c 用于补齐的字符
@@ -827,4 +828,4 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
         System.out.println(reverseCourse("物理,化学,生物"));
     }
 
-}
+}

+ 16 - 0
ie-system/src/main/java/com/ruoyi/learn/service/ILearnQuestionsService.java

@@ -2,6 +2,8 @@ package com.ruoyi.learn.service;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
+
 import com.ruoyi.learn.domain.LearnQuestions;
 
 /**
@@ -65,4 +67,18 @@ public interface ILearnQuestionsService
     public List<LearnQuestions> selectCollectedList(LearnQuestions questions);
 
     public void fillCollectInfo(Long userId, List<LearnQuestions> questions);
+    public List<LearnQuestions> selectQuestionByPaperId(Long paperId);
+
+    public void fillQuestionInfo(List<LearnQuestions> list,Boolean isFillTitleOption);
+
+    public String correctImageUrl(String content);
+    public List<LearnQuestions> selectLearnQuestionsByIds(Long[] ids);
+
+    public List<LearnQuestions> statByKnowledgeType(Map cond);
+//    public List<LearnQuestions> statByKnowledge(Map cond);
+//    public List<LearnQuestions> selectCollectInfo(Map<String, Object> map);
+
+    public List<LearnQuestions> selectQuestionsForPaper(LearnQuestions cond);
+
+
 }

+ 160 - 3
ie-system/src/main/java/com/ruoyi/learn/service/impl/LearnQuestionsServiceImpl.java

@@ -4,6 +4,8 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysConfigService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,6 +24,8 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
 {
     @Autowired
     private LearnQuestionsMapper learnQuestionsMapper;
+    @Autowired
+    private ISysConfigService configService;
 
     /**
      * 查询试题
@@ -32,7 +36,11 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
     @Override
     public LearnQuestions selectLearnQuestionsById(Long id)
     {
-        return learnQuestionsMapper.selectLearnQuestionsById(id);
+        LearnQuestions q = learnQuestionsMapper.selectLearnQuestionsById(id);
+        List<LearnQuestions> questions = new ArrayList<>();
+        questions.add(q);
+        fillQuestionInfo(questions,false);
+        return CollectionUtils.isNotEmpty(questions)?questions.get(0):q;
     }
 
     /**
@@ -44,7 +52,9 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
     @Override
     public List<LearnQuestions> selectLearnQuestionsList(LearnQuestions learnQuestions)
     {
-        return learnQuestionsMapper.selectLearnQuestionsList(learnQuestions);
+        List<LearnQuestions> questions = learnQuestionsMapper.selectLearnQuestionsList(learnQuestions);
+        fillQuestionInfo(questions,false);
+        return questions;
     }
 
     /**
@@ -105,7 +115,9 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
 
     @Override
     public List<LearnQuestions> selectCollectedList(LearnQuestions questions) {
-        return learnQuestionsMapper.selectCollectedList(questions);
+        List<LearnQuestions> questionsList = learnQuestionsMapper.selectCollectedList(questions);
+        fillQuestionInfo(questionsList,false);
+        return questionsList;
     }
 
     @Override
@@ -125,4 +137,149 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
             });
         }
     }
+
+    @Override
+    public List<LearnQuestions> selectQuestionByPaperId(Long paperId){
+        List<LearnQuestions> questions = learnQuestionsMapper.selectQuestionByPaperId(paperId);
+        fillQuestionInfo(questions,false);
+        return questions;
+    }
+
+    @Override
+    public void fillQuestionInfo(List<LearnQuestions> list,Boolean isFillTitleOption) {
+        String value = configService.selectConfigByKey("file_pre");
+        if(StringUtils.isBlank(value)) {
+            value = "https://file.mingxue100.com/tikubao/";
+        }
+        if(StringUtils.isBlank(value)) {
+            value = "https://file.mingxuejinbang.com/tikubao/";
+        }
+        List<LearnQuestions> res = list;
+        List<Long> questionIds = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(res)) {
+            for(LearnQuestions questions: res) {
+                questions.setTitle(questions.getTitle().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages));
+                questions.setTitle(questions.getTitle().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'"+value+StringUtils.tikuimages));
+                if (StringUtils.isNotBlank(questions.getOptionA())) {
+                    questions.setOptionA(questions.getOptionA().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages));
+                    questions.setOptionA(questions.getOptionA().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages));
+                }
+                if (StringUtils.isNotBlank(questions.getOptionB())) {
+                    questions.setOptionB(questions.getOptionB().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages));
+                    questions.setOptionB(questions.getOptionB().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages));
+                }
+                if (StringUtils.isNotBlank(questions.getOptionC())) {
+                    questions.setOptionC(questions.getOptionC().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages));
+                    questions.setOptionC(questions.getOptionC().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages));
+                }
+                if (StringUtils.isNotBlank(questions.getOptionD())) {
+                    questions.setOptionD(questions.getOptionD().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages));
+                    questions.setOptionD(questions.getOptionD().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages));
+                }
+                if (StringUtils.isNotBlank(questions.getOptionE())) {
+                    questions.setOptionE(questions.getOptionE().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages));
+                    questions.setOptionE(questions.getOptionE().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages));
+                }
+                if(StringUtils.isNotBlank(questions.getAnswer1())) {
+                    questions.setAnswer1(questions.getAnswer1().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages));
+                    questions.setAnswer1(questions.getAnswer1().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'"+value+StringUtils.tikuimages));
+                }
+                if(StringUtils.isNotBlank(questions.getAnswer2())) {
+                    questions.setAnswer2(questions.getAnswer2().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages));
+                    questions.setAnswer2(questions.getAnswer2().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'"+value+StringUtils.tikuimages));
+                }
+                if(StringUtils.isNotBlank(questions.getParse())) {
+                    questions.setParse(questions.getParse().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages));
+                    questions.setParse(questions.getParse().replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'"+value+StringUtils.tikuimages));
+                }
+                if(null!=questions.getIsSub()&&questions.getIsSub()==1){
+                    questionIds.add(questions.getId());
+                }
+            }
+
+            for(LearnQuestions question : res) {
+                String title = question.getTitle();
+                if (null!=isFillTitleOption&&isFillTitleOption){
+                    if(StringUtils.isNotBlank(question .getOptionA())) {
+                        String option = question.getOptionA().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages);
+                        option = option.replaceAll("src=\'/", "src=\'"+StringUtils.tikuimages+value+StringUtils.tikuimages);
+                        title = title + "<br/>A." + option;
+                    }
+                    if(StringUtils.isNotBlank(question .getOptionB())) {
+                        String option = question.getOptionB().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages);
+                        option = option.replaceAll("src=\'/", "src=\'"+StringUtils.tikuimages+value+StringUtils.tikuimages);
+                        title = title + "<br/>B." + option;
+                    }
+                    if(StringUtils.isNotBlank(question .getOptionC())) {
+                        String option = question.getOptionC().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages);
+                        option = option.replaceAll("src=\'/", "src=\'"+StringUtils.tikuimages+value+StringUtils.tikuimages);
+                        title = title + "<br/>C." + option;
+                    }
+                    if(StringUtils.isNotBlank(question .getOptionD())) {
+                        String option = question.getOptionD().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages);
+                        option = option.replaceAll("src=\'/", "src=\'"+StringUtils.tikuimages+value+StringUtils.tikuimages);
+                        title = title + "<br/>D." + option;
+                    }
+                    if(StringUtils.isNotBlank(question .getOptionE())) {
+                        String option = question.getOptionE().replaceAll("src=\"/"+StringUtils.tikuimages, "src=\""+value+StringUtils.tikuimages);
+                        option = option.replaceAll("src=\'/", "src=\'"+StringUtils.tikuimages+value+StringUtils.tikuimages);
+                        title = title + "<br/>E." + option;
+                    }
+                }
+
+                question.setTitle(title);
+            }
+        }
+    }
+
+    @Override
+    public String correctImageUrl(String content) {
+        if (StringUtils.isNotBlank(content)) {
+            String value = configService.selectConfigByKey("file_pre");
+            if(StringUtils.isBlank(value)) {
+                value = "https://file.mingxue100.com/tikubao/";
+            }
+            if(StringUtils.isBlank(value)) {
+                value = "https://file.mingxuejinbang.com/tikubao/";
+            }
+
+            return content.replaceAll("src=\"/"+StringUtils.tikuimages, "src=\"" + value+StringUtils.tikuimages)
+                    .replaceAll("src=\'/"+StringUtils.tikuimages, "src=\'" + value+StringUtils.tikuimages);
+        }
+        return content;
+    }
+
+    public List<LearnQuestions> selectLearnQuestionsByIds(Long[] ids){
+        List<LearnQuestions> questions = learnQuestionsMapper.selectLearnQuestionsByIds(ids);
+        fillQuestionInfo(questions,false);
+        return questions;
+    }
+
+    @Override
+    public List<LearnQuestions> statByKnowledgeType(Map cond) {
+        List<LearnQuestions> questions = learnQuestionsMapper.statByKnowledgeType(cond);
+        fillQuestionInfo(questions,false);
+        return questions;
+    }
+//
+//    @Override
+//    public List<LearnQuestions> statByKnowledge(Map cond) {
+//        List<LearnQuestions> questions = learnQuestionsMapper.statByKnowledge(cond);
+//        fillQuestionInfo(questions,false);
+//        return questions;
+//    }
+
+//    @Override
+//    public List<LearnQuestions> selectCollectInfo(Map<String, Object> map) {
+//        List<LearnQuestions> questions = learnQuestionsMapper.selectCollectInfo(map);
+//        fillQuestionInfo(questions,false);
+//        return questions;
+//    }
+    @Override
+    public List<LearnQuestions> selectQuestionsForPaper(LearnQuestions cond) {
+        List<LearnQuestions> questions = learnQuestionsMapper.selectQuestionsForPaper(cond);
+        fillQuestionInfo(questions,false);
+        return questions;
+    }
+
 }

+ 7 - 2
ie-system/src/main/java/com/ruoyi/learn/service/impl/LearnWrongBookServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.enums.QuestionType;
 import com.ruoyi.learn.domain.LearnQuestions;
 import com.ruoyi.learn.mapper.LearnKnowledgeTreeMapper;
 import com.ruoyi.learn.mapper.LearnQuestionsMapper;
+import com.ruoyi.learn.service.ILearnQuestionsService;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -39,7 +40,7 @@ public class LearnWrongBookServiceImpl implements ILearnWrongBookService
     @Autowired
     private LearnKnowledgeTreeMapper knowledgeTreeMapper;
     @Autowired
-    private LearnQuestionsMapper questionsMapper;
+    private ILearnQuestionsService questionsService;
 
     /**
      * 查询学生错题本
@@ -125,7 +126,7 @@ public class LearnWrongBookServiceImpl implements ILearnWrongBookService
         cond.put("end", end);
         List<LearnWrongBook> wrongBookList = learnWrongBookMapper.findWrongQuestions(cond);
         if(wrongBookList.size() > 0) {
-            Map<Long, LearnQuestions> qMap = questionsMapper.selectLearnQuestionsByIds(wrongBookList.stream().map(LearnWrongBook::getQuestionId).toArray(Long[]::new)).stream().collect(Collectors.toMap(LearnQuestions::getId, t -> t));
+            Map<Long, LearnQuestions> qMap = questionsService.selectLearnQuestionsByIds(wrongBookList.stream().map(LearnWrongBook::getQuestionId).toArray(Long[]::new)).stream().collect(Collectors.toMap(LearnQuestions::getId, t -> t));
             wrongBookList.stream().forEach(t -> {
                 LearnQuestions q = qMap.get(t.getQuestionId());
                 t.setTitle(q.getTitle());
@@ -141,14 +142,18 @@ public class LearnWrongBookServiceImpl implements ILearnWrongBookService
         return wrongBookList;
     }
 
+    @Override
     public List<LearnWrongBook> findWrongExaminees(Long wrongId) {
         return learnWrongBookMapper.findWrongExaminees(wrongId);
     }
 
+    @Override
     public int deleteByQuestion(Long studentId, Long questionId) {
         LearnWrongBook b = new LearnWrongBook();
         b.setStudentId(studentId);
         b.setQuestionId(questionId);
         return learnWrongBookMapper.deleteByQuestion(b);
     }
+
+
 }