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

1.bug修复

parent 7fe0d011
...@@ -636,7 +636,7 @@ public class ApiExamController { ...@@ -636,7 +636,7 @@ public class ApiExamController {
// 比较时间 // 比较时间
if (currentTime.after(examEndTime)) { 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)) { 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()) + "】,考试未开始"); 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 ...@@ -143,11 +143,11 @@ public class TbCourseController extends BaseController
} }
/** /**
* 所有课程列表 * 所有课程列表(排除以被选择课程)
* @return * @return
*/ */
@GetMapping("/getAllCourseList") @GetMapping("/getAllCourseListByQuery")
public AjaxResult getAllCourseList(TbCourse tbCourse) { public AjaxResult getAllCourseListByQuery(TbCourse tbCourse) {
List<TbCourse> courseList = tbCourseService.getAllCourseList(); List<TbCourse> courseList = tbCourseService.getAllCourseList();
if (courseList == null || courseList.isEmpty()) { if (courseList == null || courseList.isEmpty()) {
return AjaxResult.success(new ArrayList<>()); return AjaxResult.success(new ArrayList<>());
...@@ -171,4 +171,14 @@ public class TbCourseController extends BaseController ...@@ -171,4 +171,14 @@ public class TbCourseController extends BaseController
return AjaxResult.success(result); 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 ...@@ -89,6 +89,13 @@ public interface TbExamBatchMapper
*/ */
public TbExamBatch getByexamBatch(@Param("examBatch") String examBatch); public TbExamBatch getByexamBatch(@Param("examBatch") String examBatch);
/**
* 根据考试ID和当前时间获取考试批次
* @param examId 考试ID
* @return 结果
*/
public TbExamBatch selectCurrentExamBatch(@Param("examId") Long examId);
/** /**
* 考试批次 * 考试批次
* @param examId 考试ID * @param examId 考试ID
......
...@@ -401,22 +401,21 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService ...@@ -401,22 +401,21 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService
throw new ServiceException("请选择课程"); throw new ServiceException("请选择课程");
} }
// 根据课程ID 获取考试ID // 根据课程ID 获取考试ID
TbExamCourse tbExamCourse = tbExamCourseMapper.getExamIdByCourseId(examRegistrationDTO.getCourseId()); TbCourse course = tbCourseMapper.selectTbCourseByCourseId(examRegistrationDTO.getCourseId());
if (ObjectUtils.isEmpty(tbExamCourse)){ if (ObjectUtils.isEmpty(course)){
throw new ServiceException("未查询到考试信息"); throw new ServiceException("未查询到课程信息");
} }
TbExam tbExam = examService.selectTbExamByExamId(tbExamCourse.getExamId()); TbExam tbExam = examService.selectTbExamByExamId(course.getExamId());
if (ObjectUtils.isEmpty(tbExam)) { if (ObjectUtils.isEmpty(tbExam)) {
return AjaxResult.error("考试信息异常,请联系管理员!!!"); return AjaxResult.error("未查询到考试信息,请联系管理员!!!");
} }
// 查询考试批次 // 查询考试批次
List<TbExamBatch> tbExamBatchList = tbExamBatchMapper.getEnableByExamId(tbExam.getExamId(), tbExam.getExamBatchEarly()); TbExamBatch tbExamBatch = tbExamBatchMapper.selectCurrentExamBatch(tbExam.getExamId());
if (tbExamBatchList.isEmpty()){ if (null == tbExamBatch){
throw new ServiceException("无可报名批次"); throw new ServiceException("无可报名批次");
} }
TbExamBatch tbExamBatch = tbExamBatchList.get(0);
// TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(examRegistrationDTO.getMemberUserId(), tbExam.getExamId()); // TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(examRegistrationDTO.getMemberUserId(), tbExam.getExamId());
TbExamRegistration registrationParam = new TbExamRegistration(); TbExamRegistration registrationParam = new TbExamRegistration();
......
...@@ -372,32 +372,15 @@ public class TbExamServiceImpl implements ITbExamService ...@@ -372,32 +372,15 @@ public class TbExamServiceImpl implements ITbExamService
public List<CourseListVO> getCourseListByEvaluateAgency(Long evaluateAgencyId) { public List<CourseListVO> getCourseListByEvaluateAgency(Long evaluateAgencyId) {
List<CourseListVO> courseListByEvaluateAgency = tbCourseMapper.getCourseListByEvaluateAgency(evaluateAgencyId); List<CourseListVO> courseListByEvaluateAgency = tbCourseMapper.getCourseListByEvaluateAgency(evaluateAgencyId);
if (!courseListByEvaluateAgency.isEmpty()){ if (!courseListByEvaluateAgency.isEmpty()){
try { for (CourseListVO courseListVO : courseListByEvaluateAgency) {
CountDownLatch countDownLatch = new CountDownLatch(courseListByEvaluateAgency.size()); TbExamBatch examBatch = tbExamBatchMapper.selectCurrentExamBatch(courseListVO.getExamId());
for (CourseListVO courseListVO : courseListByEvaluateAgency) { if (null != examBatch) {
threadPoolTaskExecutor.execute(()->{ courseListVO.setExamBatch(examBatch.getExamBatch());
Long courseId = courseListVO.getCourseId(); }
TbExamCourse tbExamCourse = tbExamCourseMapper.getExamIdByCourseId(courseId); TbExam exam = tbExamMapper.selectTbExamByExamId(courseListVO.getExamId());
if (ObjectUtils.isNotEmpty(tbExamCourse)){ if (null != exam) {
Long examId = tbExamCourse.getExamId(); courseListVO.setLevel(getLevel(exam.getLevel()));
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();
});
} }
countDownLatch.await();
}catch (Exception e){
e.printStackTrace();
} }
} }
return courseListByEvaluateAgency; return courseListByEvaluateAgency;
......
...@@ -346,7 +346,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -346,7 +346,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
course_id as courseId, course_id as courseId,
evaluate_agency_id as evaluateAgencyId, evaluate_agency_id as evaluateAgencyId,
course_name as courseName, course_name as courseName,
course_title as courseTitle course_title as courseTitle,
exam_id as examId
FROM FROM
tb_course tb_course
WHERE del_flag=0 WHERE del_flag=0
......
...@@ -168,5 +168,13 @@ ...@@ -168,5 +168,13 @@
where ter.exam_id=#{examId} and ter.member_user_id=#{memberUserId} where ter.exam_id=#{examId} and ter.member_user_id=#{memberUserId}
order by create_time desc limit 1 order by create_time desc limit 1
</select> </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> </mapper>
...@@ -322,15 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -322,15 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examNoticeId != null and examNoticeId !=''"> <if test="examNoticeId != null and examNoticeId !=''">
and ter.exam_batch_index = ten.batch_index and ter.exam_batch_index = ten.batch_index
</if> </if>
<choose> INNER JOIN tb_exam_batch teb on te.exam_id = teb.exam_id
<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>
<where> <where>
<if test="examNoticeId != null and examNoticeId !=''"> <if test="examNoticeId != null and examNoticeId !=''">
and ten.exam_notice_id = #{examNoticeId} and ten.exam_notice_id = #{examNoticeId}
......
...@@ -177,7 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -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_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_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 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 mo.pay_status = 0
AND t1.is_pay = 0 AND t1.is_pay = 0
</select> </select>
......
...@@ -69,3 +69,12 @@ export function getAllCourseList(query) { ...@@ -69,3 +69,12 @@ export function getAllCourseList(query) {
params: query params: query
}) })
} }
// 所有课程列表(排除已被选择课程)
export function getAllCourseListByQuery(query) {
return request({
url: '/hezhi/course/getAllCourseListByQuery',
method: 'get',
params: query
})
}
...@@ -232,6 +232,14 @@ ...@@ -232,6 +232,14 @@
dict.label }}</el-radio> dict.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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-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" <el-date-picker clearable v-model="form.conferenceStartTime" type="date" value-format="yyyy-MM-dd"
placeholder="请选择会议开始时间"> placeholder="请选择会议开始时间">
...@@ -279,14 +287,6 @@ ...@@ -279,14 +287,6 @@
}}</el-radio> }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
...@@ -388,6 +388,9 @@ export default { ...@@ -388,6 +388,9 @@ export default {
type: [ type: [
{ required: true, message: "通知类型不能为空", trigger: "blur" } { required: true, message: "通知类型不能为空", trigger: "blur" }
], ],
publicationTime: [
{ required: true, message: "发布时间不能为空", trigger: "blur" }
],
} }
}; };
}, },
......
...@@ -496,7 +496,7 @@ import {addExam, delExam, getExam, listExam, updateExam, updateExamConfig} from ...@@ -496,7 +496,7 @@ import {addExam, delExam, getExam, listExam, updateExam, updateExamConfig} from
import ExamCourse from "@/components/ExamCourse/index.vue"; import ExamCourse from "@/components/ExamCourse/index.vue";
import ExamBatch from "@/views/hezhi/exam/examBatch.vue"; import ExamBatch from "@/views/hezhi/exam/examBatch.vue";
import {getSelectList} from "@/api/hezhi/evaluateAgency"; import {getSelectList} from "@/api/hezhi/evaluateAgency";
import {getAllCourseList} from "@/api/hezhi/link"; import {getAllCourseList, getAllCourseListByQuery} from "@/api/hezhi/link";
export default { export default {
name: "Exam", name: "Exam",
...@@ -628,7 +628,7 @@ export default { ...@@ -628,7 +628,7 @@ export default {
}, },
methods: { methods: {
getAllCourse(careerId) { getAllCourse(careerId) {
getAllCourseList({careerId}).then(response => { getAllCourseListByQuery({careerId}).then(response => {
this.courseOptions = response.data; 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