From c2dc08ae0b360081cfe897fafc35f62e36162cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=95=E6=8B=8951246?= <719602854@qq.com> Date: Mon, 16 Jun 2025 19:19:33 +0800 Subject: [PATCH] 1 --- .../hezhi/api/kaoshi/ApiExamController.java | 23 +++++++++++-------- .../impl/TbExamRegistrationServiceImpl.java | 9 ++++++-- .../mapper/hezhi/TbExamNoticeMapper.xml | 6 +++++ 3 files changed, 26 insertions(+), 12 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 28fe19d..a4954bd 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 @@ -198,18 +198,21 @@ public class ApiExamController { } } + }else{ + statisticsTrueRate = "33.33"; + statisticsFalseRate = "33.33"; + statisticsUnRate = "33.33"; } - HashMap map = new HashMap<>(); - map.put("statisticsTrue", statisticsTrue); - map.put("statisticsTrueRate", statisticsTrueRate); - map.put("statisticsFalse", statisticsFalse); - map.put("statisticsFalseRate", statisticsFalseRate); - map.put("statisticsUn", statisticsUn); - map.put("statisticsUnRate", statisticsUnRate); - map.put("accuracyRate", accuracyRate); - map.put("doneNum", doneNum); - map.put("allNum", allNum); + map.put("statisticsTrue", statisticsTrue);//做对数 + map.put("statisticsTrueRate", statisticsTrueRate);//做对比例 + map.put("statisticsFalse", statisticsFalse);//做错数 + map.put("statisticsFalseRate", statisticsFalseRate);//做错比例 + map.put("statisticsUn", statisticsUn);//未做数 + map.put("statisticsUnRate", statisticsUnRate);//未做比例 + map.put("accuracyRate", accuracyRate);//正确率 + map.put("doneNum", doneNum);//已做题目 + map.put("allNum", allNum);//题目总数 return AjaxResult.success().put("data", map); } catch (Exception e) { e.printStackTrace(); 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 1399515..767ccb3 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 @@ -418,8 +418,13 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService } TbExamBatch tbExamBatch = tbExamBatchList.get(0); - TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(examRegistrationDTO.getMemberUserId(), tbExam.getExamId()); - if (ObjectUtils.isNotEmpty(tbExamRegistration) && tbExamRegistration.getIsPay() == 1) { +// TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(examRegistrationDTO.getMemberUserId(), tbExam.getExamId()); + TbExamRegistration registrationParam = new TbExamRegistration(); + registrationParam.setMemberUserId(examRegistrationDTO.getMemberUserId()); + registrationParam.setExamId(tbExam.getExamId()); + registrationParam.setExamBatchIndex(tbExamBatch.getBatchIndex().intValue()); + TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByBatchIndex(registrationParam); + if (ObjectUtils.isNotEmpty(tbExamRegistration)) { return AjaxResult.error("已报名,请勿重复提交"); }else { TbExamRegistration registration = new TbExamRegistration(); diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml index 0ad4e30..dff839c 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml @@ -316,6 +316,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tb_exam te LEFT JOIN tb_exam_notice ten ON ten.exam_id = te.exam_id LEFT JOIN tb_exam_registration ter ON ter.exam_id = te.exam_id AND ter.is_pay = 1 AND ter.member_user_id = #{memberUserId} + + and ter.exam_batch_index = #{examBatchIndex} + + + 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 -- 2.22.0