|
@@ -669,7 +669,31 @@ public class RealExamService {
|
|
|
* @return
|
|
|
*/
|
|
|
public AjaxResult studentLoginSuccess(final Long userId, final String ip) {
|
|
|
-
|
|
|
- return AjaxResult.success();
|
|
|
+ RealExamCollection rec = realExamCollectionService.selectRealExamCollectionOpened();
|
|
|
+ if (rec == null || rec.getExamCollectionId() == 0L) {
|
|
|
+ return AjaxResult.success("没有打开的考试集合");
|
|
|
+ }
|
|
|
+ RealExam q = new RealExam();
|
|
|
+ q.setUserId(userId);
|
|
|
+ q.setExamCollectionId(rec.getExamCollectionId());
|
|
|
+ List<RealExam> list = selectRealExamList(q);
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ return AjaxResult.success("没有学生考试数据");
|
|
|
+ }
|
|
|
+ if (list.size() == 1) {
|
|
|
+ RealExam re = list.get(0);
|
|
|
+ if (StringUtils.equals(re.getExamStatus(), RealExam.State.NOT_LOGGED_IN) ||
|
|
|
+ StringUtils.equals(re.getExamStatus(), RealExam.State.LOGGED_IN)) {
|
|
|
+ Seat s = seatService.uniqueByBindIp(ip);
|
|
|
+ if (s == null || s.getSeatId() == 0L) {
|
|
|
+ return AjaxResult.success("没有座次信息");
|
|
|
+ }
|
|
|
+ re.setSeatId(s.getSeatId());
|
|
|
+ re.setExamStatus(RealExam.State.LOGGED_IN);
|
|
|
+ updateRealExam(re);
|
|
|
+ return AjaxResult.success("成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success("考试数据错误");
|
|
|
}
|
|
|
}
|