|
@@ -29,6 +29,8 @@ 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.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.dev.api.DevJobApi;
|
|
import vip.xiaonuo.dev.api.DevJobApi;
|
|
|
|
|
+import vip.xiaonuo.dev.modular.message.param.DevMessageSendParam;
|
|
|
|
|
+import vip.xiaonuo.dev.modular.message.service.DevMessageService;
|
|
|
import vip.xiaonuo.disk.api.NetDiskApi;
|
|
import vip.xiaonuo.disk.api.NetDiskApi;
|
|
|
import vip.xiaonuo.disk.mapper.CourseOpenMapper;
|
|
import vip.xiaonuo.disk.mapper.CourseOpenMapper;
|
|
|
import vip.xiaonuo.exam.domain.ExamPaper;
|
|
import vip.xiaonuo.exam.domain.ExamPaper;
|
|
@@ -83,7 +85,8 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
@Resource
|
|
@Resource
|
|
|
private CourseOpenMapper courseOpenMapper;
|
|
private CourseOpenMapper courseOpenMapper;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private DevMessageService devMessageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -112,17 +115,11 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@Override
|
|
|
public CommonResult<String> add(TExamAddParam tExamAddParam) {
|
|
public CommonResult<String> add(TExamAddParam tExamAddParam) {
|
|
|
- ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamAddParam.getPaperId()));
|
|
|
|
|
-
|
|
|
|
|
ExamPaper newExamPaper=new ExamPaper();
|
|
ExamPaper newExamPaper=new ExamPaper();
|
|
|
newExamPaper.setId(Integer.valueOf(tExamAddParam.getPaperId()));
|
|
newExamPaper.setId(Integer.valueOf(tExamAddParam.getPaperId()));
|
|
|
newExamPaper.setIsSelect(1);
|
|
newExamPaper.setIsSelect(1);
|
|
|
examPaperMapper.updateByPrimaryKeySelective(newExamPaper);
|
|
examPaperMapper.updateByPrimaryKeySelective(newExamPaper);
|
|
|
|
|
|
|
|
-// if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|
|
|
|
|
-// tExamAddParam.setStartTime(examPaper.getLimitStartTime());
|
|
|
|
|
-// tExamAddParam.setEndTime(examPaper.getLimitEndTime());
|
|
|
|
|
-// }
|
|
|
|
|
TExam tExam = BeanUtil.toBean(tExamAddParam, TExam.class);
|
|
TExam tExam = BeanUtil.toBean(tExamAddParam, TExam.class);
|
|
|
|
|
|
|
|
boolean query = false;
|
|
boolean query = false;
|
|
@@ -131,8 +128,9 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
map.put("courseId",tExamAddParam.getCourseId());
|
|
map.put("courseId",tExamAddParam.getCourseId());
|
|
|
query = true;
|
|
query = true;
|
|
|
}
|
|
}
|
|
|
|
|
+ List<String> studentAccounts=new ArrayList<>();
|
|
|
if(query){
|
|
if(query){
|
|
|
- List<String> studentAccounts=courseOpenMapper.selectAccount(tExamAddParam.getSemesterId(),tExamAddParam.getCourseId());
|
|
|
|
|
|
|
+ studentAccounts=courseOpenMapper.selectAccount(tExamAddParam.getSemesterId(),tExamAddParam.getCourseId());
|
|
|
if(CollectionUtil.isNotEmpty(studentAccounts)){
|
|
if(CollectionUtil.isNotEmpty(studentAccounts)){
|
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
|
tExam.setStudentIds(studentIdsStr);
|
|
tExam.setStudentIds(studentIdsStr);
|
|
@@ -153,6 +151,14 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
this.addJob(tExam, "start");
|
|
this.addJob(tExam, "start");
|
|
|
this.addJob(tExam, "end");
|
|
this.addJob(tExam, "end");
|
|
|
}
|
|
}
|
|
|
|
|
+ //给课程下关联的学生发送站内信消息
|
|
|
|
|
+ if(CollectionUtil.isNotEmpty(studentAccounts)&&"1".equals(tExamAddParam.getExamStatus())){
|
|
|
|
|
+ DevMessageSendParam devMessageSendParam=new DevMessageSendParam();
|
|
|
|
|
+ devMessageSendParam.setReceiverIdList(studentAccounts);
|
|
|
|
|
+ devMessageSendParam.setSubject(tExamAddParam.getExamName());
|
|
|
|
|
+ devMessageSendParam.setContent(tExamAddParam.getExamName()+"已开始!!!");
|
|
|
|
|
+ devMessageService.send(devMessageSendParam);
|
|
|
|
|
+ }
|
|
|
return CommonResult.ok();
|
|
return CommonResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -192,9 +198,9 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
query = true;
|
|
query = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ List<String> studentAccounts=new ArrayList<>();
|
|
|
if(query){
|
|
if(query){
|
|
|
- List<String> studentAccounts=courseOpenMapper.selectAccount(tExamEditParam.getSemesterId(),tExamEditParam.getCourseId());
|
|
|
|
|
|
|
+ studentAccounts=courseOpenMapper.selectAccount(tExamEditParam.getSemesterId(),tExamEditParam.getCourseId());
|
|
|
if(CollectionUtil.isNotEmpty(studentAccounts)){
|
|
if(CollectionUtil.isNotEmpty(studentAccounts)){
|
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
String studentIdsStr = String.join(",", studentAccounts);
|
|
|
tExamEditParam.setStudentIds(studentIdsStr);
|
|
tExamEditParam.setStudentIds(studentIdsStr);
|
|
@@ -203,19 +209,6 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// if(tExamEditParam.getPaperId() != null && !tExamEditParam.getPaperId().isEmpty()){
|
|
|
|
|
-// ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamEditParam.getPaperId()));
|
|
|
|
|
-// if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|
|
|
|
|
-// tExamEditParam.setStartTime(examPaper.getLimitStartTime());
|
|
|
|
|
-// tExamEditParam.setEndTime(examPaper.getLimitEndTime());
|
|
|
|
|
-// updateJob = true;
|
|
|
|
|
-// }
|
|
|
|
|
-// if(ExamPaperTypeEnum.Survey.getCode() == examPaper.getPaperType()){
|
|
|
|
|
-// tExam.setExamType("3"); // 3 调查问卷
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
tExam.setExamType(tExamEditParam.getExamType());
|
|
tExam.setExamType(tExamEditParam.getExamType());
|
|
|
|
|
|
|
|
|
|
|
|
@@ -242,6 +235,15 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(tExamEditParam, tExam);
|
|
BeanUtil.copyProperties(tExamEditParam, tExam);
|
|
|
this.updateById(tExam);
|
|
this.updateById(tExam);
|
|
|
|
|
+
|
|
|
|
|
+ //给课程下关联的学生发送站内信消息
|
|
|
|
|
+ if(CollectionUtil.isNotEmpty(studentAccounts)&&"1".equals(tExamEditParam.getExamStatus())){
|
|
|
|
|
+ DevMessageSendParam devMessageSendParam=new DevMessageSendParam();
|
|
|
|
|
+ devMessageSendParam.setReceiverIdList(studentAccounts);
|
|
|
|
|
+ devMessageSendParam.setSubject(tExamEditParam.getExamName());
|
|
|
|
|
+ devMessageSendParam.setContent(tExamEditParam.getExamName()+"已开始!!!");
|
|
|
|
|
+ devMessageService.send(devMessageSendParam);
|
|
|
|
|
+ }
|
|
|
return CommonResult.ok();
|
|
return CommonResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|