Răsfoiți Sursa

代码优化

wangliang 2 ani în urmă
părinte
comite
7a1eef9e89

+ 3 - 9
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamController.java

@@ -229,9 +229,7 @@ public class TEExamController {
                     teExamActivity.setUpdateId(tbUser.getId());
                 }
                 teExamActivityService.saveOrUpdate(teExamActivity);
-                if (Objects.isNull(teExamActivityService.updateExamActivityCacheBean(teExamActivity.getId()))) {
-                    teExamActivityService.deleteExamActivityCacheBean(teExamActivity.getId());
-                }
+                teExamActivityService.deleteExamActivityCacheBean(teExamActivity.getId());
             }
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
@@ -255,9 +253,7 @@ public class TEExamController {
                 throw new RuntimeException(e);
             }
         }
-        if (Objects.isNull(teExamService.updateExamCacheBean(teExam.getId()))) {
-            teExamService.deleteExamCacheBean(teExam.getId());
-        }
+        teExamService.deleteExamCacheBean(teExam.getId());
         examPaperService.disposeObjectiveAnswer(teExam.getId());
         return ResultUtil.ok(true);
     }
@@ -338,9 +334,7 @@ public class TEExamController {
         teExam.setEnable(enable);
         teExam.setUpdateId(tbUser.getId());
         teExamService.updateById(teExam);
-        if (Objects.isNull(teExamService.updateExamCacheBean(teExam.getId()))) {
-            teExamService.deleteExamCacheBean(teExam.getId());
-        }
+        teExamService.deleteExamCacheBean(teExam.getId());
         return ResultUtil.ok(true);
     }
 

+ 1 - 3
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamCourseController.java

@@ -70,9 +70,7 @@ public class TEExamCourseController {
                 throw new RuntimeException(e);
             }
         }
-        if (Objects.isNull(teExamCourseService.updateExamCourseCacheBean(teExamCourse.getExamId(), teExamCourse.getCourseCode()))) {
-            teExamCourseService.deleteExamCourseCacheBean(teExamCourse.getExamId(), teExamCourse.getCourseCode());
-        }
+        teExamCourseService.deleteExamCourseCacheBean(teExamCourse.getExamId(), teExamCourse.getCourseCode());
         return ResultUtil.ok(true);
     }
 

+ 1 - 3
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamPaperController.java

@@ -113,9 +113,7 @@ public class TEExamPaperController {
             }
         }
         teExamPaperList.forEach(s -> {
-            if (Objects.isNull(teExamPaperService.updateExamPaperCacheBean(s.getId()))) {
-                teExamPaperService.deleteExamPaperCacheBean(s.getId());
-            }
+            teExamPaperService.deleteExamPaperCacheBean(s.getId());
             ExamPaperCacheBean paper = teExamPaperService.getExamPaperCacheBean(s.getId());
             examCourseService.deleteExamCourseCacheBean(paper.getExamId(), paper.getCourseCode());
         });

+ 2 - 6
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamReexamController.java

@@ -152,9 +152,7 @@ public class TEExamReexamController {
                             teExamStudentUpdateWrapper.lambda().set(TEExamStudent::getAlreadyExamCount, alreadyExamCount)
                                     .eq(TEExamStudent::getId, s);
                             teExamStudentService.update(teExamStudentUpdateWrapper);
-                            if (Objects.isNull(teExamStudentService.updateExamStudentCacheBean(s))) {
-                                teExamStudentService.deleteExamStudentCacheBean(s);
-                            }
+                            teExamStudentService.deleteExamStudentCacheBean(s);
                         }
                     }
                 });
@@ -216,9 +214,7 @@ public class TEExamReexamController {
                                             teExamStudentUpdateWrapper.lambda().set(TEExamStudent::getAlreadyExamCount, alreadyExamCount)
                                                     .eq(TEExamStudent::getId, teExamReexam.getExamStudentId());
                                             teExamStudentService.update(teExamStudentUpdateWrapper);
-                                            if (Objects.isNull(teExamStudentService.updateExamStudentCacheBean(teExamReexam.getExamStudentId()))) {
-                                                teExamStudentService.deleteExamStudentCacheBean(teExamReexam.getExamStudentId());
-                                            }
+                                            teExamStudentService.deleteExamStudentCacheBean(teExamReexam.getExamStudentId());
                                         }
                                     }
                                 }

+ 2 - 6
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamStudentController.java

@@ -231,9 +231,7 @@ public class TEExamStudentController {
         }
         teExamStudentService.updateBatchById(teExamStudentList);
         teExamStudentList.forEach(s -> {
-            if (Objects.isNull(teExamStudentService.updateExamStudentCacheBean(s.getId()))) {
-                teExamStudentService.deleteExamStudentCacheBean(s.getId());
-            }
+            teExamStudentService.deleteExamStudentCacheBean(s.getId());
         });
         return ResultUtil.ok(true);
     }
@@ -306,9 +304,7 @@ public class TEExamStudentController {
             teExamStudentService.saveOrUpdate(s);
         });
         for (TEExamStudent es : teExamStudentList) {
-            if (Objects.isNull(teExamStudentService.updateExamStudentCacheBean(es.getId()))) {
-                teExamStudentService.deleteExamStudentCacheBean(es.getId());
-            }
+            teExamStudentService.deleteExamStudentCacheBean(es.getId());
         }
         return ResultUtil.ok(true);
     }

+ 1 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamActivityServiceImpl.java

@@ -413,9 +413,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
             teExamActivityService.saveOrUpdateBatch(teExamActivityList);
 
             for (TEExamActivity ac : teExamActivityList) {
-                if (Objects.isNull(teExamActivityService.updateExamActivityCacheBean(ac.getId()))) {
-                    teExamActivityService.deleteExamActivityCacheBean(ac.getId());
-                }
+                teExamActivityService.deleteExamActivityCacheBean(ac.getId());
             }
 
             if (!CollectionUtils.isEmpty(teAudioList)) {

+ 2 - 6
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -1504,9 +1504,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             TEExamService examService = SpringContextHolder.getBean(TEExamService.class);
             teExamMapper.updateScoreStatus(ScoreStatusEnum.CALCULATING, examId);
             teExamMapper.updateScoreProgress(0.0, examId);
-            if (Objects.isNull(examService.updateExamCacheBean(examId))) {
-                examService.deleteExamCacheBean(examId);
-            }
+            examService.deleteExamCacheBean(examId);
             task = tbTaskHistoryService.getById(taskId);
             task.setStatus(TaskStatusEnum.RUNNING);
             tbTaskHistoryService.saveOrUpdate(task);
@@ -1535,9 +1533,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             }
             teExamMapper.updateScoreStatus(ScoreStatusEnum.FINISH, examId);
             teExamMapper.updateScoreProgress(100.0, examId);
-            if (Objects.isNull(examService.updateExamCacheBean(examId))) {
-                examService.deleteExamCacheBean(examId);
-            }
+            examService.deleteExamCacheBean(examId);
             task.setSummary("处理成功");
             task.setProgress(100.0);
             task.setStatus(TaskStatusEnum.FINISH);