From 3af751545840d1ac50d8441fbd613541124788e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Mon, 25 Aug 2025 19:16:28 +0800 Subject: [PATCH] =?UTF-8?q?1.bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hezhi/api/kaoshi/ApiExamController.java | 2 +- .../hezhi/controller/TbCourseController.java | 16 +++++++-- .../ruoyi/hezhi/mapper/TbExamBatchMapper.java | 7 ++++ .../impl/TbExamRegistrationServiceImpl.java | 15 ++++----- .../hezhi/service/impl/TbExamServiceImpl.java | 33 +++++-------------- .../resources/mapper/hezhi/TbCourseMapper.xml | 3 +- .../mapper/hezhi/TbExamBatchMapper.xml | 8 +++++ .../mapper/hezhi/TbExamNoticeMapper.xml | 10 +----- .../mapper/hezhi/TbMemberOrderMapper.xml | 2 +- ruoyi-ui/src/api/hezhi/link.js | 9 +++++ .../views/hezhi/conferenceNotice/index.vue | 19 ++++++----- ruoyi-ui/src/views/hezhi/exam/index.vue | 4 +-- 12 files changed, 70 insertions(+), 58 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiExamController.java b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiExamController.java index a4954bd..7d59c4f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiExamController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiExamController.java @@ -636,7 +636,7 @@ public class ApiExamController { // 比较时间 if (currentTime.after(examEndTime)) { - return AjaxResult.error("考试时间【" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamStartTime()) + "至" + DateUtils.parseDateToStr("", tbExamBatch.getExamEndTime()) + "】,考试已结束"); + return AjaxResult.error("考试时间【" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamStartTime()) + "至" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamEndTime()) + "】,考试已结束"); } if (currentTime.before(examStartTime)) { return AjaxResult.error("考试时间【" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamStartTime()) + "至" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamEndTime()) + "】,考试未开始"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbCourseController.java b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbCourseController.java index e613e11..87d508b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbCourseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbCourseController.java @@ -143,11 +143,11 @@ public class TbCourseController extends BaseController } /** - * 所有课程列表 + * 所有课程列表(排除以被选择课程) * @return */ - @GetMapping("/getAllCourseList") - public AjaxResult getAllCourseList(TbCourse tbCourse) { + @GetMapping("/getAllCourseListByQuery") + public AjaxResult getAllCourseListByQuery(TbCourse tbCourse) { List courseList = tbCourseService.getAllCourseList(); if (courseList == null || courseList.isEmpty()) { return AjaxResult.success(new ArrayList<>()); @@ -171,4 +171,14 @@ public class TbCourseController extends BaseController return AjaxResult.success(result); } + + /** + * 所有课程列表 + * @return + */ + @GetMapping("/getAllCourseList") + public AjaxResult getAllCourseList() { + List courseList = tbCourseService.getAllCourseList(); + return AjaxResult.success(courseList); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java index 61e38e1..a1e3d58 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java @@ -89,6 +89,13 @@ public interface TbExamBatchMapper */ public TbExamBatch getByexamBatch(@Param("examBatch") String examBatch); + /** + * 根据考试ID和当前时间获取考试批次 + * @param examId 考试ID + * @return 结果 + */ + public TbExamBatch selectCurrentExamBatch(@Param("examId") Long examId); + /** * 考试批次 * @param examId 考试ID diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java index 767ccb3..ca7d141 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java @@ -401,22 +401,21 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService throw new ServiceException("请选择课程"); } // 根据课程ID 获取考试ID - TbExamCourse tbExamCourse = tbExamCourseMapper.getExamIdByCourseId(examRegistrationDTO.getCourseId()); - if (ObjectUtils.isEmpty(tbExamCourse)){ - throw new ServiceException("未查询到考试信息"); + TbCourse course = tbCourseMapper.selectTbCourseByCourseId(examRegistrationDTO.getCourseId()); + if (ObjectUtils.isEmpty(course)){ + throw new ServiceException("未查询到课程信息"); } - TbExam tbExam = examService.selectTbExamByExamId(tbExamCourse.getExamId()); + TbExam tbExam = examService.selectTbExamByExamId(course.getExamId()); if (ObjectUtils.isEmpty(tbExam)) { - return AjaxResult.error("考试信息异常,请联系管理员!!!"); + return AjaxResult.error("未查询到考试信息,请联系管理员!!!"); } // 查询考试批次 - List tbExamBatchList = tbExamBatchMapper.getEnableByExamId(tbExam.getExamId(), tbExam.getExamBatchEarly()); - if (tbExamBatchList.isEmpty()){ + TbExamBatch tbExamBatch = tbExamBatchMapper.selectCurrentExamBatch(tbExam.getExamId()); + if (null == tbExamBatch){ throw new ServiceException("无可报名批次"); } - TbExamBatch tbExamBatch = tbExamBatchList.get(0); // TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(examRegistrationDTO.getMemberUserId(), tbExam.getExamId()); TbExamRegistration registrationParam = new TbExamRegistration(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java index 5a6a5b7..d949f8c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java @@ -372,32 +372,15 @@ public class TbExamServiceImpl implements ITbExamService public List getCourseListByEvaluateAgency(Long evaluateAgencyId) { List courseListByEvaluateAgency = tbCourseMapper.getCourseListByEvaluateAgency(evaluateAgencyId); if (!courseListByEvaluateAgency.isEmpty()){ - try { - CountDownLatch countDownLatch = new CountDownLatch(courseListByEvaluateAgency.size()); - for (CourseListVO courseListVO : courseListByEvaluateAgency) { - threadPoolTaskExecutor.execute(()->{ - Long courseId = courseListVO.getCourseId(); - TbExamCourse tbExamCourse = tbExamCourseMapper.getExamIdByCourseId(courseId); - if (ObjectUtils.isNotEmpty(tbExamCourse)){ - Long examId = tbExamCourse.getExamId(); - TbExam tbExam = tbExamMapper.selectTbExamByExamId(examId); - if (tbExam != null) { - List enableByExamId = tbExamBatchMapper.getEnableByExamId(examId, tbExam.getExamBatchEarly()); - if (!enableByExamId.isEmpty()){ - TbExamBatch tbExamBatch = enableByExamId.get(0); - courseListVO.setExamBatch(tbExamBatch.getExamBatch()); - courseListVO.setExamId(tbExam.getExamId()); - courseListVO.setLevel(getLevel(tbExam.getLevel()));//等级也查出来 - } - } - - } - countDownLatch.countDown(); - }); + for (CourseListVO courseListVO : courseListByEvaluateAgency) { + TbExamBatch examBatch = tbExamBatchMapper.selectCurrentExamBatch(courseListVO.getExamId()); + if (null != examBatch) { + courseListVO.setExamBatch(examBatch.getExamBatch()); + } + TbExam exam = tbExamMapper.selectTbExamByExamId(courseListVO.getExamId()); + if (null != exam) { + courseListVO.setLevel(getLevel(exam.getLevel())); } - countDownLatch.await(); - }catch (Exception e){ - e.printStackTrace(); } } return courseListByEvaluateAgency; diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbCourseMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbCourseMapper.xml index 1c7334e..7ebbd6d 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbCourseMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbCourseMapper.xml @@ -346,7 +346,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" course_id as courseId, evaluate_agency_id as evaluateAgencyId, course_name as courseName, - course_title as courseTitle + course_title as courseTitle, + exam_id as examId FROM tb_course WHERE del_flag=0 diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamBatchMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamBatchMapper.xml index 8d7ede0..23725bc 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamBatchMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamBatchMapper.xml @@ -168,5 +168,13 @@ where ter.exam_id=#{examId} and ter.member_user_id=#{memberUserId} order by create_time desc limit 1 + diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml index 5a63fff..3b6005a 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml @@ -322,15 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and ter.exam_batch_index = ten.batch_index - - - INNER JOIN tb_exam_batch teb on te.exam_id = teb.exam_id and teb.batch_index = ter.exam_batch_index - - - INNER JOIN tb_exam_batch teb on ten.exam_id = teb.exam_id and teb.batch_index = ten.batch_index - - - + INNER JOIN tb_exam_batch teb on te.exam_id = teb.exam_id and ten.exam_notice_id = #{examNoticeId} diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbMemberOrderMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbMemberOrderMapper.xml index 8188515..8a29073 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbMemberOrderMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbMemberOrderMapper.xml @@ -177,7 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" JOIN tb_member_order mo ON mo.data_id = t1.exam_registration_id JOIN tb_exam_batch t2 ON t2.exam_id = t1.exam_id AND t2.batch_index = t1.exam_batch_index JOIN tb_exam t3 ON t3.exam_id = t1.exam_id - WHERE NOW() > DATE_SUB(t2.exam_start_time, INTERVAL t3.exam_batch_early DAY) + WHERE NOW() > DATE_SUB(t2.exam_end_time, INTERVAL t3.exam_batch_early DAY) AND mo.pay_status = 0 AND t1.is_pay = 0 diff --git a/ruoyi-ui/src/api/hezhi/link.js b/ruoyi-ui/src/api/hezhi/link.js index c819687..9c1e390 100644 --- a/ruoyi-ui/src/api/hezhi/link.js +++ b/ruoyi-ui/src/api/hezhi/link.js @@ -69,3 +69,12 @@ export function getAllCourseList(query) { params: query }) } + +// 所有课程列表(排除已被选择课程) +export function getAllCourseListByQuery(query) { + return request({ + url: '/hezhi/course/getAllCourseListByQuery', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/hezhi/conferenceNotice/index.vue b/ruoyi-ui/src/views/hezhi/conferenceNotice/index.vue index a22f4e5..2154efb 100644 --- a/ruoyi-ui/src/views/hezhi/conferenceNotice/index.vue +++ b/ruoyi-ui/src/views/hezhi/conferenceNotice/index.vue @@ -232,6 +232,14 @@ dict.label }} + + + + + + + @@ -279,14 +287,6 @@ }} - - - - - - -