Browse Source

fix(service): 修复考点列表

Go 4 years ago
parent
commit
e3060a8df0

+ 7 - 1
server/data/src/main/java/com/qxgmat/data/relation/mapping/ExercisePaperRelationMapper.xml

@@ -7,6 +7,12 @@
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
   </resultMap>
+  <resultMap id="placeMap" type="com.qxgmat.data.dao.entity.ExercisePaper">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="logic_extend" jdbcType="VARCHAR" property="logicExtend" />
+  </resultMap>
   <sql id="Id_Column_List">
     <!--
       WARNING - @mbg.generated
@@ -15,7 +21,7 @@
   </sql>
 
   <!--获取考点分组所有考点信息-->
-  <select id="groupPlace" resultMap="IdMap">
+  <select id="groupPlace" resultMap="placeMap">
     select
     ep.`logic_extend`
     from `exercise_paper` ep

+ 6 - 3
server/gateway-api/src/main/java/com/qxgmat/service/extend/QuestionFlowService.java

@@ -1274,13 +1274,16 @@ public class QuestionFlowService {
                     for(int j = 0; j < doubleList.size(); j++){
                         JSONArray singleList = doubleList.getJSONArray(j);
                         JSONArray userSingleList = userDoubleList.getJSONArray(i);
-                        JSONArray singleResult = doubleResult.getJSONArray(j);
+                        JSONArray singleResult = null;
+                        if (doubleResult.size() > i){
+                            singleResult = doubleResult.getJSONArray(i);
+                        }
                         if (singleResult == null){
                             singleResult = new JSONArray(0);
                             doubleResult.set(j, singleResult);
                         }
                         for (int k = 0; k < singleList.size(); k++){
-                            if (singleResult.get(k) == null){
+                            if (singleResult.size()<=k || singleResult.get(k) == null){
                                 singleResult.set(k, 0);
                             }
                             if (userSingleList.getBoolean(k)){
@@ -1300,7 +1303,7 @@ public class QuestionFlowService {
                         target.put("single", singleResult);
                     }
                     for(int j = 0; j < singleList.size(); j++){
-                        if (singleResult.get(j) == null){
+                        if (singleResult.size()<=j || singleResult.get(j) == null){
                             singleResult.set(j, 0);
                         }
                         if (userSingleList.getBoolean(j)){