From 33d82860d93624e1865242be6aa752668a0c3c8d Mon Sep 17 00:00:00 2001
From: yn147 <2270338776@qq.com>
Date: 星期三, 10 五月 2023 16:47:24 +0800
Subject: [PATCH] 成绩管理bug

---
 src/main/java/com/qxueyou/scc/exam/service/impl/ExamPaperSectionService.java |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/exam/service/impl/ExamPaperSectionService.java b/src/main/java/com/qxueyou/scc/exam/service/impl/ExamPaperSectionService.java
index db82279..536044d 100644
--- a/src/main/java/com/qxueyou/scc/exam/service/impl/ExamPaperSectionService.java
+++ b/src/main/java/com/qxueyou/scc/exam/service/impl/ExamPaperSectionService.java
@@ -27,7 +27,7 @@
 import com.qxueyou.scc.exercise.service.IExerciseService;
 
 /**
- * 试卷部分管理服务层
+ * 璇曞嵎閮ㄥ垎绠$悊鏈嶅姟灞�
  *
  * @author kevin
  * @createTime 2017-11-1
@@ -60,14 +60,14 @@
     @Override
     public String addExamPaperSection(ExamPaperSectionInfo examPaperSectionInfo) {
         TraceUtils.setCreateTrace(examPaperSectionInfo);
-        // 查询当前最大的sectionOrder
+        // 鏌ヨ褰撳墠鏈�澶х殑sectionOrder
         String hql = "select max(sectionOrder) from ExamPaperSectionInfo where examPaperId=? and deleteFlag is false";
         Integer maxOrder = this.findUnique(hql, CollectionUtils.newList(examPaperSectionInfo.getExamPaperId()),
                 Integer.class);
         int beginOrder = maxOrder == null ? 0 : maxOrder.intValue();
         examPaperSectionInfo.setSectionOrder(++beginOrder);
 
-        // 获取当前section对应的开始index
+        // 鑾峰彇褰撳墠section瀵瑰簲鐨勫紑濮媔ndex
         int count = this.findCount("from ExerciseGroupItemRe r where r.deleteFlag is false and r.exerciseGroupId=?",
                 CollectionUtils.newList(examPaperSectionInfo.getGroupId()));
 
@@ -111,7 +111,7 @@
         ExamPaperSectionInfo examPaperSectionInfo = read(ExamPaperSectionInfo.class, sectionId);
         ExerciseGroup exerciseGroup = read(ExerciseGroup.class, examPaperSectionInfo.getGroupId());
 
-        // 获取试卷部分原开始位置和结束位置
+        // 鑾峰彇璇曞嵎閮ㄥ垎鍘熷紑濮嬩綅缃拰缁撴潫浣嶇疆
         int origStartIndex = examPaperSectionInfo.getItemStartOrder();
         int origEndIndex = examPaperSectionInfo.getItemEndOrder();
 
@@ -119,7 +119,7 @@
             this.deleteAllSectionItem(examPaperSectionInfo.getSectionId());
         }
 
-        // 将题库的题目复制到试卷题库
+        // 灏嗛搴撶殑棰樼洰澶嶅埗鍒拌瘯鍗烽搴�
         int itemIndex = origStartIndex;
         ExerciseGroup targetExerciseGroup = new ExerciseGroup();
         targetExerciseGroup.setGroupId(examPaperSectionInfo.getGroupId());
@@ -148,19 +148,19 @@
         ExamPaperSectionInfo examPaperSectionInfo = read(ExamPaperSectionInfo.class, sectionId);
         ExerciseGroup exerciseGroup = read(ExerciseGroup.class, examPaperSectionInfo.getGroupId());
 
-        // 获取试卷部分原开始位置和结束位置
+        // 鑾峰彇璇曞嵎閮ㄥ垎鍘熷紑濮嬩綅缃拰缁撴潫浣嶇疆
         int origStartIndex = examPaperSectionInfo.getItemStartOrder();
         int origEndIndex = examPaperSectionInfo.getItemEndOrder();
 
-        //如果试卷其他部分中已经存在该题目,则返回错误,重复的题目
+        //濡傛灉璇曞嵎鍏朵粬閮ㄥ垎涓凡缁忓瓨鍦ㄨ棰樼洰锛屽垯杩斿洖閿欒锛岄噸澶嶇殑棰樼洰
         int count = this.findCountByComplexHql("from ExerciseGroupItemRe r where r.deleteFlag is false and r.exerciseGroupId=:paperGroupId and (r.itemOrder<:startIdx or r.itemOrder>:endIdx)  and r.exerciseItemId in (:exerciseItemIds)",
                 CollectionUtils.newObjectMap("startIdx", origStartIndex, "endIdx", origEndIndex, "paperGroupId", examPaperSectionInfo.getGroupId(), "exerciseItemIds", selectedItemIds));
 
         if (count > 0) {
-            return new Result(false, "请检查选择的题目,同一份试卷中不允许存在相同的题目!");
+            return new Result(false, "璇锋鏌ラ�夋嫨鐨勯鐩紝鍚屼竴浠借瘯鍗蜂腑涓嶅厑璁稿瓨鍦ㄧ浉鍚岀殑棰樼洰锛�");
         }
 
-        // 将题库的题目复制到试卷题库
+        // 灏嗛搴撶殑棰樼洰澶嶅埗鍒拌瘯鍗烽搴�
         int copyStartIndex = origEndIndex > 0 ? origEndIndex : origStartIndex;
         ExerciseGroup targetExerciseGroup = new ExerciseGroup();
         targetExerciseGroup.setGroupId(examPaperSectionInfo.getGroupId());
@@ -169,7 +169,7 @@
                 copyStartIndex);
         long allCount = exerciseGroup.getAllCount() == null ? 0 : exerciseGroup.getAllCount().longValue() + (copyEndIndex - copyStartIndex);
         exerciseGroup.setAllCount(BigInteger.valueOf(allCount));
-        //如果有保存题目则处理索引,否则不处理
+        //濡傛灉鏈変繚瀛橀鐩垯澶勭悊绱㈠紩锛屽惁鍒欎笉澶勭悊
         if (copyEndIndex - copyStartIndex > 0) {
             examPaperSectionInfo.setItemEndOrder((short) (copyEndIndex));
         }
@@ -183,7 +183,7 @@
         ExamPaperSectionInfo examPaperSectionInfo = this.read(ExamPaperSectionInfo.class, examPaperSectionId);
         ExerciseGroup exerciseGroup = exerciseGroupService.queryExerciseGroupDetail(examPaperSectionInfo.getGroupId());
         List<ExerciseItem> items = null;
-        // 查询出section 对应的题目信息
+        // 鏌ヨ鍑簊ection 瀵瑰簲鐨勯鐩俊鎭�
         if (examPaperSectionInfo.getItemEndOrder() > 0) {
             int itemCount = examPaperSectionInfo.getItemEndOrder() - examPaperSectionInfo.getItemStartOrder();
             items = new ArrayList<ExerciseItem>(itemCount);
@@ -197,7 +197,7 @@
     @SuppressWarnings("unchecked")
     private Result updateSectionRangeIndex(String currentSectionid, int adjustNum) {
         ExamPaperSectionInfo currentSectionInfo = this.read(ExamPaperSectionInfo.class, currentSectionid);
-        // 如果部分对应的end为-1,则不需要更新endorder
+        // 濡傛灉閮ㄥ垎瀵瑰簲鐨別nd涓�-1锛屽垯涓嶉渶瑕佹洿鏂癳ndorder
         String hql = "from ExamPaperSectionInfo where examPaperId=? and sectionOrder>? and deleteFlag is false";
         List<ExamPaperSectionInfo> lstExamPaperSectionInfo = this.find(hql,
                 CollectionUtils.newList(currentSectionInfo.getExamPaperId(), currentSectionInfo.getSectionOrder()),
@@ -213,7 +213,7 @@
                 this.saveOrUpdateAll(lstExamPaperSectionInfo);
             }
         }
-        //清理试卷缓存
+        //娓呯悊璇曞嵎缂撳瓨
         this.redisTemplate.delete(currentSectionInfo.getGroupId());
         return new Result(true);
     }
@@ -237,7 +237,7 @@
             }
             this.deleteSectionItem(examPaperSectionInfo.getSectionId(), examPaperSectionInfo.getGroupId(),
                     exerciseItemIds);
-            // section坐标置空
+            // section鍧愭爣缃┖
             examPaperSectionInfo.setItemEndOrder((short) -1);
             this.save(examPaperSectionInfo);
 
@@ -247,7 +247,7 @@
     @Override
     public Result deleteSectionItem(String sectionId, String groupId, String[] exerciseItemIds) {
         if (exerciseItemIds != null && exerciseItemIds.length > 0) {
-            // 查询题库与题目的关系
+            // 鏌ヨ棰樺簱涓庨鐩殑鍏崇郴
             List<String> lstRelationIds = new ArrayList<String>(exerciseItemIds.length);
             ExamPaperSectionInfo currentSectionInfo = this.read(ExamPaperSectionInfo.class, sectionId);
 
@@ -267,7 +267,7 @@
                 lstRelationIds.add(itemReMap.get(strExerciseItemId).getRelationId());
             }
 
-            // 如果题目删除完了,则设置end为-1
+            // 濡傛灉棰樼洰鍒犻櫎瀹屼簡锛屽垯璁剧疆end涓�-1
             if (currentSectionInfo.getItemEndOrder() - exerciseItemIds.length == currentSectionInfo
                     .getItemStartOrder()) {
                 currentSectionInfo.setItemEndOrder((short) -1);
@@ -287,7 +287,7 @@
     }
 
     /**
-     * 删除试卷习题
+     * 鍒犻櫎璇曞嵎涔犻
      *
      *
      * @param reIds
@@ -298,15 +298,15 @@
 
         ExerciseGroup group = this.read(ExerciseGroup.class, groupId);
 
-        // 更新组试卷习题数量
+        // 鏇存柊缁勮瘯鍗蜂範棰樻暟閲�
         group.setAllCount(group.getAllCount().subtract(new BigInteger(String.valueOf(reIds.length))));
         TraceUtils.setUpdateTrace(group);
         this.save(group);
 
-        // 2.删除试卷题目组关联表数据
+        // 2.鍒犻櫎璇曞嵎棰樼洰缁勫叧鑱旇〃鏁版嵁
         this.bulkUpdateInLoop("delete from ExerciseGroupItemRe  where relationId=?", reIds);
 
-        // 更新item的顺序号
+        // 鏇存柊item鐨勯『搴忓彿
         String hql = "from ExerciseGroupItemRe re where re.exerciseGroupId=? and re.deleteFlag is false order by re.itemOrder asc ";
         List<ExerciseGroupItemRe> lstRe = this.find(hql, CollectionUtils.newList(groupId), ExerciseGroupItemRe.class);
         if (lstRe != null && lstRe.size() > 0) {
@@ -320,7 +320,7 @@
 
     @Override
     public Result saveSectionItem(ExerciseGroup exerciseGroup) {
-        //保存题目信息
+        //淇濆瓨棰樼洰淇℃伅
         return exerciseService.saveExerciseItemBatch(exerciseGroup.getGroupId(), exerciseGroup.getItems());
     }
 

--
Gitblit v1.8.0