wuwen 3 gadi atpakaļ
vecāks
revīzija
eb25a92236

+ 25 - 25
src/main/java/com/ssj/service/kmt/correctsys/KmtCorrectSysServiceImpl.java

@@ -1,5 +1,12 @@
 package com.ssj.service.kmt.correctsys;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -11,9 +18,6 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.ssj.api.request.RequestOpenApiUtils;
 import com.ssj.bean.sys.homework.domain.HomeworkPicture;
 import com.ssj.bean.sys.homework.domain.HomeworkPictureCorrect;
 import com.ssj.bean.sys.homework.domain.HomeworkPictureErrorCheck;
@@ -41,6 +45,7 @@ import com.ssj.service.kmt.correctsys.dto.HomeworkPictureCheckHowDetailDto;
 import com.ssj.service.kmt.correctsys.dto.HomeworkPictureDto;
 import com.ssj.service.kmt.correctsys.request.CorrectCheckReq;
 import com.ssj.service.kmt.correctsys.service.KmtCorrectSysService;
+import com.ssj.service.kmt.dto.ExerciseQuestionAnswer4CorrectDTO;
 import com.ssj.service.kmt.dto.ExerciseQuestionAnswerDto;
 import com.ssj.service.kmt.dto.ExerciseQuestionDto;
 import com.ssj.service.sys.homework.service.HomeworkPictureCorrectService;
@@ -234,28 +239,23 @@ public class KmtCorrectSysServiceImpl implements KmtCorrectSysService {
                 }
             }
 
-//            Map<String, Map<String, List<ExerciseQuestionDto>>> temp1 =
-//                    answerTmp.stream().collect(Collectors.groupingBy(ExerciseQuestionDto::getBookCourseId,
-//                            LinkedHashMap::new,
-//                            Collectors.groupingBy(ExerciseQuestionDto::getBigQuestionIndex, LinkedHashMap::new,
-//                                    Collectors.toList())));
-//        Map<String, List<ExerciseQuestionDto>> temp = exerciseQuestionDtoList.stream().collect(Collectors
-//        .groupingBy(ExerciseQuestionDto::getBigQuestionIndex, LinkedHashMap::new, Collectors.toList()));
-//            List<ExerciseQuestionAnswer4CorrectDTO> exerciseQuestionAnswer4CorrectDTOList = new ArrayList<>();
-//            temp1.forEach((bookCourseId, map) -> {
-//                map.forEach((bigQuestionIndex, questionList) -> {
-//                    ExerciseQuestionAnswer4CorrectDTO exerciseQuestionAnswer4CorrectDTO =
-//                            new ExerciseQuestionAnswer4CorrectDTO();
-//                    exerciseQuestionAnswer4CorrectDTO.setBigQuestionIndex(bigQuestionIndex);
-//                    exerciseQuestionAnswer4CorrectDTO.setQuestionList(questionList);
-//                    exerciseQuestionAnswer4CorrectDTOList.add(exerciseQuestionAnswer4CorrectDTO);
-//                });
-//            });
+            Map<String, Map<String, List<ExerciseQuestionDto>>> temp1 =
+                    answerTmp.stream().collect(Collectors.groupingBy(ExerciseQuestionDto::getBookCourseId,
+                            LinkedHashMap::new,
+                            Collectors.groupingBy(ExerciseQuestionDto::getBigQuestionIndex, LinkedHashMap::new,
+                                    Collectors.toList())));
+            List<ExerciseQuestionAnswer4CorrectDTO> exerciseQuestionAnswer4CorrectDTOList = new ArrayList<>();
+            temp1.forEach((bookCourseId, map) -> {
+                map.forEach((bigQuestionIndex, questionList) -> {
+                    ExerciseQuestionAnswer4CorrectDTO exerciseQuestionAnswer4CorrectDTO =
+                            new ExerciseQuestionAnswer4CorrectDTO();
+                    exerciseQuestionAnswer4CorrectDTO.setBigQuestionIndex(bigQuestionIndex);
+                    exerciseQuestionAnswer4CorrectDTO.setQuestionList(questionList);
+                    exerciseQuestionAnswer4CorrectDTOList.add(exerciseQuestionAnswer4CorrectDTO);
+                });
+            });
+            homeworkPictureCheckDto.setAnswers(exerciseQuestionAnswer4CorrectDTOList);
             
-            JSONObject json=RequestOpenApiUtils.openApiServiceRecognitionResult(homeworkPicture.getId(), accessToken);
-            json.put("homeworkPictureId", homeworkPicture.getId());
-            JSONArray jSONArray=RequestOpenApiUtils.openApiServiceAnswerList(json, accessToken);
-            homeworkPictureCheckDto.setAnswers(jSONArray);
         }
         //手动勾选的知识点
         List<HomeworkCheckKnowDetailDto> howDetailTmp = null;

+ 4 - 5
src/main/java/com/ssj/service/kmt/correctsys/dto/HomeworkPictureCheckDto.java

@@ -4,7 +4,6 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.alibaba.fastjson.JSONArray;
 import com.ssj.service.conch.parents.v1.dto.CompositionCommentModuleDTO;
 import com.ssj.service.kmt.dto.ExerciseQuestionAnswer4CorrectDTO;
 
@@ -39,7 +38,7 @@ public class HomeworkPictureCheckDto implements Serializable {
      */
     private String checkTime;
 
-    private JSONArray answers = new JSONArray();
+    private List<ExerciseQuestionAnswer4CorrectDTO>  answers = new ArrayList<>();
 
     private HomeworkPictureCheckHowDetailDto howDetail = null;
 
@@ -68,12 +67,12 @@ public class HomeworkPictureCheckDto implements Serializable {
     public void setType(int type) {
         this.type = type;
     }
-    
-    public JSONArray getAnswers() {
+  
+	public List<ExerciseQuestionAnswer4CorrectDTO> getAnswers() {
 		return answers;
 	}
 
-	public void setAnswers(JSONArray answers) {
+	public void setAnswers(List<ExerciseQuestionAnswer4CorrectDTO> answers) {
 		this.answers = answers;
 	}