|
@@ -2,21 +2,22 @@ package com.keao.edu.user.service.impl;
|
|
|
|
|
|
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
+import com.keao.edu.common.exception.BizException;
|
|
|
import com.keao.edu.common.page.PageInfo;
|
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
|
+import com.keao.edu.common.tenant.TenantContextHolder;
|
|
|
import com.keao.edu.user.api.entity.ExamRoom;
|
|
|
import com.keao.edu.user.dao.ExamRoomDao;
|
|
|
import com.keao.edu.user.dto.ExamRoomDto;
|
|
|
+import com.keao.edu.user.enums.ExamModeEnum;
|
|
|
import com.keao.edu.user.page.ExamRoomQueryInfo;
|
|
|
import com.keao.edu.user.service.ExamRoomService;
|
|
|
import com.keao.edu.util.collection.MapUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> implements ExamRoomService {
|
|
@@ -48,4 +49,35 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
pageInfo.setRows(dataList);
|
|
|
return pageInfo;
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExamRoom createExamRoom(ExamRoom examRoom) {
|
|
|
+ examRoom.setTenantId(TenantContextHolder.getTenantId().toString());
|
|
|
+ examRoomDao.insert(examRoom);
|
|
|
+ return examRoom;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExamRoom updateExamRoom(ExamRoom examRoom) {
|
|
|
+ if(Objects.isNull(examRoom.getId())){
|
|
|
+ throw new BizException("未生成教室编号");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(examRoom.getExamMode())){
|
|
|
+ throw new BizException("请指定考试类型");
|
|
|
+ }
|
|
|
+ if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())&&Objects.isNull(examRoom.getExamLocationId())){
|
|
|
+ throw new BizException("线下考试请指定考试地址");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(examRoom.getSubjectIdList())){
|
|
|
+ throw new BizException("请指定考试专业");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(examRoom.getMainTeacherUserId())){
|
|
|
+ throw new BizException("请指定主考老师");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(examRoom.getExamTimeJson())){
|
|
|
+ throw new BizException("请指定考试时间");
|
|
|
+ }
|
|
|
+ examRoomDao.update(examRoom);
|
|
|
+ return examRoom;
|
|
|
+ }
|
|
|
+}
|