|
@@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
|
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
|
|
import vip.xiaonuo.common.exception.CommonException;
|
|
import vip.xiaonuo.common.exception.CommonException;
|
|
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
|
|
|
|
+import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.dev.api.DevJobApi;
|
|
import vip.xiaonuo.dev.api.DevJobApi;
|
|
|
import vip.xiaonuo.disk.api.NetDiskApi;
|
|
import vip.xiaonuo.disk.api.NetDiskApi;
|
|
|
import vip.xiaonuo.disk.mapper.CourseOpenMapper;
|
|
import vip.xiaonuo.disk.mapper.CourseOpenMapper;
|
|
@@ -106,7 +107,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@Override
|
|
|
- public void add(TExamAddParam tExamAddParam) {
|
|
|
|
|
|
|
+ public CommonResult<String> add(TExamAddParam tExamAddParam) {
|
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamAddParam.getPaperId()));
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamAddParam.getPaperId()));
|
|
|
|
|
|
|
|
ExamPaper newExamPaper=new ExamPaper();
|
|
ExamPaper newExamPaper=new ExamPaper();
|
|
@@ -132,7 +133,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
|
tExam.setStudentIds(studentIdsStr);
|
|
tExam.setStudentIds(studentIdsStr);
|
|
|
}else{
|
|
}else{
|
|
|
- throw new CommonException("没有找到学生信息!!!");
|
|
|
|
|
|
|
+ return CommonResult.error("没有查询到学生信息!!!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -150,22 +151,23 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
Date currentTime = new Date(System.currentTimeMillis());
|
|
Date currentTime = new Date(System.currentTimeMillis());
|
|
|
// 开始时间与结束时间不能小于当前时间
|
|
// 开始时间与结束时间不能小于当前时间
|
|
|
if(currentTime.after(tExamAddParam.getStartTime()) || currentTime.after(tExamAddParam.getEndTime())){
|
|
if(currentTime.after(tExamAddParam.getStartTime()) || currentTime.after(tExamAddParam.getEndTime())){
|
|
|
- throw new RuntimeException("开始时间与结束时间不能小于当前时间!!!");
|
|
|
|
|
|
|
+ return CommonResult.error("开始时间与结束时间不能小于当前时间!!!");
|
|
|
}
|
|
}
|
|
|
this.addJob(tExam, "start");
|
|
this.addJob(tExam, "start");
|
|
|
this.addJob(tExam, "end");
|
|
this.addJob(tExam, "end");
|
|
|
}
|
|
}
|
|
|
|
|
+ return CommonResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@Override
|
|
|
- public void edit(TExamEditParam tExamEditParam) {
|
|
|
|
|
|
|
+ public CommonResult<String> edit(TExamEditParam tExamEditParam) {
|
|
|
boolean updateJob = false;
|
|
boolean updateJob = false;
|
|
|
if(tExamEditParam.getStartTime() !=null || tExamEditParam.getEndTime() !=null){
|
|
if(tExamEditParam.getStartTime() !=null || tExamEditParam.getEndTime() !=null){
|
|
|
Date currentTime = new Date(System.currentTimeMillis());
|
|
Date currentTime = new Date(System.currentTimeMillis());
|
|
|
// 开始时间与结束时间不能小于当前时间
|
|
// 开始时间与结束时间不能小于当前时间
|
|
|
if(currentTime.after(tExamEditParam.getStartTime()) || currentTime.after(tExamEditParam.getEndTime())){
|
|
if(currentTime.after(tExamEditParam.getStartTime()) || currentTime.after(tExamEditParam.getEndTime())){
|
|
|
- throw new RuntimeException("开始时间与结束时间不能小于当前时间!!!");
|
|
|
|
|
|
|
+ return CommonResult.error("开始时间与结束时间不能小于当前时间!!!");
|
|
|
}
|
|
}
|
|
|
updateJob = true;
|
|
updateJob = true;
|
|
|
}
|
|
}
|
|
@@ -200,7 +202,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
|
tExamEditParam.setStudentIds(studentIdsStr);
|
|
tExamEditParam.setStudentIds(studentIdsStr);
|
|
|
}else{
|
|
}else{
|
|
|
- throw new CommonException("没有找到学生信息!!!");
|
|
|
|
|
|
|
+ return CommonResult.error("没有查询到学生信息!!!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -233,7 +235,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
tExam = this.addJob(tExam, "end");
|
|
tExam = this.addJob(tExam, "end");
|
|
|
}else{
|
|
}else{
|
|
|
log.error("任务修改失败,删除过期任务异常。{}",deleteJobResult);
|
|
log.error("任务修改失败,删除过期任务异常。{}",deleteJobResult);
|
|
|
- throw new CommonException("任务修改失败,删除过期任务异常。");
|
|
|
|
|
|
|
+ return CommonResult.error("任务修改失败,删除过期任务异常。");
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
// 任务不存在,创建任务
|
|
// 任务不存在,创建任务
|
|
@@ -244,6 +246,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(tExamEditParam, tExam);
|
|
BeanUtil.copyProperties(tExamEditParam, tExam);
|
|
|
this.updateById(tExam);
|
|
this.updateById(tExam);
|
|
|
|
|
+ return CommonResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|