派生自 projectDept/qhighschool

EricsHu
2022-12-05 068fc7f2e81178e55fa191a13709af64b1a163f6
src/main/java/com/qxueyou/scc/exercise/service/impl/node/Item.java
@@ -92,7 +92,7 @@
   }
   /**
    * 转换为数据模型
    * 转换为数据模型
    * @return
    */
   public ExerciseItem convertExerciseItem() {
@@ -100,13 +100,13 @@
      //new ExerciseItem
      ExerciseItem item = new ExerciseItem();
      
      //转换 ExerciseItemOption
      //转换 ExerciseItemOption
      List<ExerciseItemOption> options = new ArrayList<ExerciseItemOption>();
      
      //确保判断题的OPTION
      //确保判断题的OPTION
      ensureTrueOrFalseOpt();
      
      //更新参考答案 最终的答案 格式如A,B,C
      //更新参考答案 最终的答案 格式如A,B,C
      String resultAnswer = updateAnswer();
      
      for(Option opt:getOptions()){
@@ -116,22 +116,22 @@
         options.add(opt.convertExerciseItemOption());
      }
      
      // 设置正确答案
      // 设置正确答案
      item.setAnswer(resultAnswer);
      item.setTitle(this.getTitle());
      item.setType(getExerciseType());
      item.setOptions(options);
      item.setItemNo(Integer.valueOf(getNo()));
      
      //转换解析内容
      //转换解析内容
      addAnalysis(item);
      
      //返回
      //返回
      return item;
   }
   
   /**
    * 增加解析实体
    * 增加解析实体
    * @param item
    */
   private void addAnalysis(ExerciseItem item) {
@@ -150,7 +150,7 @@
   }
   /**
    * 更新参考答案
    * 更新参考答案
    */
   private String updateAnswer() {
      
@@ -160,7 +160,7 @@
         return resultAnswer;
      }
      
      //判断题
      //判断题
      if(answer.equals("True")||answer.equals("False")){
         Node node = getChild("NO", answer);
         if(node==null){
@@ -169,7 +169,7 @@
         Option opt = (Option) node;
         opt.setCheck(true);
         resultAnswer = answer;
      }else{//单选或多选题
      }else{//单选或多选题
         for(int i=0;i<answer.length();i++){
            String optAnswer = String.valueOf(answer.charAt(i));
            Node node = getChild("NO", optAnswer);
@@ -179,9 +179,9 @@
            Option opt = (Option) node;
            opt.setCheck(true);
            
            // 拼接答案
            // 拼接答案
            resultAnswer += answer.charAt(i);
            if(i < answer.length()-1){//最后一次不添加
            if(i < answer.length()-1){//最后一次不添加
               resultAnswer += ",";
            }
            
@@ -193,7 +193,7 @@
   }
   /**
    * 特殊处理判断题的 option,自动添加 True 和 False 选项
    * 特殊处理判断题的 option,自动添加 True 和 False 选项
    */
   private void ensureTrueOrFalseOpt(){
      ItemType type = (ItemType) getParent();
@@ -216,7 +216,7 @@
   }
   
   /**
    * 获取习题类型
    * 获取习题类型
    * @return
    */
   public short getExerciseType(){