Commit 3af75154 authored by 刘帅's avatar 刘帅

1.bug修复

parent 7fe0d011
......@@ -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()) + "】,考试未开始");
......
......@@ -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<TbCourse> 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<TbCourse> courseList = tbCourseService.getAllCourseList();
return AjaxResult.success(courseList);
}
}
......@@ -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
......
......@@ -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<TbExamBatch> 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();
......
......@@ -372,32 +372,15 @@ public class TbExamServiceImpl implements ITbExamService
public List<CourseListVO> getCourseListByEvaluateAgency(Long evaluateAgencyId) {
List<CourseListVO> 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<TbExamBatch> 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;
......
......@@ -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
......
......@@ -168,5 +168,13 @@
where ter.exam_id=#{examId} and ter.member_user_id=#{memberUserId}
order by create_time desc limit 1
</select>
<select id="selectCurrentExamBatch" resultMap="TbExamBatchResult">
SELECT *
FROM tb_exam_batch
WHERE exam_id = #{examId}
AND exam_end_time >= NOW()
ORDER BY exam_start_time ASC
LIMIT 1;
</select>
</mapper>
......@@ -322,15 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examNoticeId != null and examNoticeId !=''">
and ter.exam_batch_index = ten.batch_index
</if>
<choose>
<when test="examId != null and examId !=''">
INNER JOIN tb_exam_batch teb on te.exam_id = teb.exam_id and teb.batch_index = ter.exam_batch_index
</when>
<otherwise>
INNER JOIN tb_exam_batch teb on ten.exam_id = teb.exam_id and teb.batch_index = ten.batch_index
</otherwise>
</choose>
INNER JOIN tb_exam_batch teb on te.exam_id = teb.exam_id
<where>
<if test="examNoticeId != null and examNoticeId !=''">
and ten.exam_notice_id = #{examNoticeId}
......
......@@ -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
</select>
......
......@@ -69,3 +69,12 @@ export function getAllCourseList(query) {
params: query
})
}
// 所有课程列表(排除已被选择课程)
export function getAllCourseListByQuery(query) {
return request({
url: '/hezhi/course/getAllCourseListByQuery',
method: 'get',
params: query
})
}
......@@ -232,6 +232,14 @@
dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发布时间" prop="publicationTime">
<el-date-picker clearable v-model="form.publicationTime" type="date" value-format="yyyy-MM-dd"
placeholder="请选择发布时间">
</el-date-picker>
</el-form-item>
<el-form-item label="发布人" prop="publisher">
<el-input v-model="form.publisher" placeholder="请输入发布人" />
</el-form-item>
<el-form-item label="会议开始时间" prop="conferenceStartTime" v-if="form.type === 3">
<el-date-picker clearable v-model="form.conferenceStartTime" type="date" value-format="yyyy-MM-dd"
placeholder="请选择会议开始时间">
......@@ -279,14 +287,6 @@
}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发布时间" prop="publicationTime">
<el-date-picker clearable v-model="form.publicationTime" type="date" value-format="yyyy-MM-dd"
placeholder="请选择发布时间">
</el-date-picker>
</el-form-item>
<el-form-item label="发布人" prop="publisher">
<el-input v-model="form.publisher" placeholder="请输入发布人" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
......@@ -388,6 +388,9 @@ export default {
type: [
{ required: true, message: "通知类型不能为空", trigger: "blur" }
],
publicationTime: [
{ required: true, message: "发布时间不能为空", trigger: "blur" }
],
}
};
},
......
......@@ -496,7 +496,7 @@ import {addExam, delExam, getExam, listExam, updateExam, updateExamConfig} from
import ExamCourse from "@/components/ExamCourse/index.vue";
import ExamBatch from "@/views/hezhi/exam/examBatch.vue";
import {getSelectList} from "@/api/hezhi/evaluateAgency";
import {getAllCourseList} from "@/api/hezhi/link";
import {getAllCourseList, getAllCourseListByQuery} from "@/api/hezhi/link";
export default {
name: "Exam",
......@@ -628,7 +628,7 @@ export default {
},
methods: {
getAllCourse(careerId) {
getAllCourseList({careerId}).then(response => {
getAllCourseListByQuery({careerId}).then(response => {
this.courseOptions = response.data;
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment