|
@@ -288,6 +288,7 @@ public class RealExamCollectionService extends Ele6RYBaseService {
|
|
public AjaxResult open(final Long examCollectionId, final String examCollectionType) {
|
|
public AjaxResult open(final Long examCollectionId, final String examCollectionType) {
|
|
// check
|
|
// check
|
|
|
|
|
|
|
|
+ // todo:暂时不做唯一性检查。
|
|
// if (existOpened()) {
|
|
// if (existOpened()) {
|
|
// return AjaxResult.error("已经有打开的考试或者练习!");
|
|
// return AjaxResult.error("已经有打开的考试或者练习!");
|
|
// }
|
|
// }
|
|
@@ -296,19 +297,39 @@ public class RealExamCollectionService extends Ele6RYBaseService {
|
|
// check datetime todo:时间到了
|
|
// check datetime todo:时间到了
|
|
// do.
|
|
// do.
|
|
|
|
|
|
- // todo:强制停掉所有的自主练习
|
|
|
|
|
|
|
|
- RealExamCollection f = selectRealExamCollectionByExamCollectionId(examCollectionId);
|
|
|
|
- if (f == null) {
|
|
|
|
|
|
+ // 打开socket
|
|
|
|
+ AjaxResult ar1 = commSendService.openSocket();
|
|
|
|
+ if (ar1.isError()) {
|
|
|
|
+ return ar1;
|
|
|
|
+ }
|
|
|
|
+ // 更新相关数据
|
|
|
|
+
|
|
|
|
+ // todo:强制停掉所有的自主练习 所有自主练习CLOSED
|
|
|
|
+ {
|
|
|
|
+ List<RealExamCollection> list = listAllByType(RealExamCollection.Type.SELF_EXERCISE);
|
|
|
|
+ for (RealExamCollection ec : list) {
|
|
|
|
+ ec.setExamCollectionState(RealExamCollection.State.CLOSED);
|
|
|
|
+ updateRealExamCollection(ec);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+ RealExamCollection ref = selectRealExamCollectionByExamCollectionId(examCollectionId);
|
|
|
|
+ if (ref == null) {
|
|
return AjaxResult.error("考试集合不存在!");
|
|
return AjaxResult.error("考试集合不存在!");
|
|
}
|
|
}
|
|
// 修改考试集合状态。
|
|
// 修改考试集合状态。
|
|
{
|
|
{
|
|
- f.setExamCollectionState(RealExamCollection.State.OPENED);
|
|
|
|
- updateRealExamCollection(f);
|
|
|
|
|
|
+ ref.setExamCollectionState(RealExamCollection.State.OPENED);
|
|
|
|
+ updateRealExamCollection(ref);
|
|
}
|
|
}
|
|
- // 打开socket
|
|
|
|
- return commSendService.openSocket();
|
|
|
|
|
|
+ return AjaxResult.success("开启连接成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<RealExamCollection> listAllByType(String examCollectionType) {
|
|
|
|
+ RealExamCollection q = new RealExamCollection();
|
|
|
|
+ q.setExamCollectionType(examCollectionType);
|
|
|
|
+ return selectRealExamCollectionList(q);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|