Joburgess 5 years ago
parent
commit
cac0e9f665

+ 13 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomController.java

@@ -8,6 +8,7 @@ import com.keao.edu.user.dto.ExamRoomDto;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 import com.keao.edu.user.service.ExamRoomService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -32,4 +33,16 @@ public class ExamRoomController extends BaseController {
         examRoomService.update(examRoom);
         return succeed();
     }
+
+    @ApiModelProperty("创建教室")
+    @PostMapping(value = "/createExamRoom")
+    public HttpResponseResult<ExamRoom> createExamRoom(@RequestBody ExamRoom examRoom){
+        return succeed(examRoomService.createExamRoom(examRoom));
+    }
+
+    @ApiModelProperty("更新教室信息")
+    @PostMapping(value = "/updateExamRoom")
+    public HttpResponseResult<ExamRoom> updateExamRoom(@RequestBody ExamRoom examRoom){
+        return succeed(examRoomService.updateExamRoom(examRoom));
+    }
 }

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamRoomStudentRelationQueryInfo.java

@@ -0,0 +1,22 @@
+package com.keao.edu.user.page;
+
+import com.keao.edu.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.06.23
+ */
+public class ExamRoomStudentRelationQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "教室编号")
+    private Long examId;
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+}

+ 19 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java

@@ -15,4 +15,22 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @return
      */
     PageInfo<ExamRoomDto> queryExamRoomPage(ExamRoomQueryInfo queryInfo);
-}
+
+    /**
+     * @describe 创建教室
+     * @author Joburgess
+     * @date 2020.06.23
+     * @param examRoom:
+     * @return com.keao.edu.user.api.entity.ExamRoom
+     */
+    ExamRoom createExamRoom(ExamRoom examRoom);
+
+    /**
+     * @describe 更新教室信息
+     * @author Joburgess
+     * @date 2020.06.23
+     * @param examRoom:
+     * @return com.keao.edu.user.api.entity.ExamRoom
+     */
+    ExamRoom updateExamRoom(ExamRoom examRoom);
+}

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomStudentRelationService.java

@@ -0,0 +1,8 @@
+package com.keao.edu.user.service;
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.ExamRoomStudentRelation;
+
+public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRoomStudentRelation> {
+
+}

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java

@@ -0,0 +1,8 @@
+package com.keao.edu.user.service;
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.ExamTeacherSalary;
+
+public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherSalary> {
+
+}

+ 37 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -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;
+	}
+}

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -0,0 +1,22 @@
+package com.keao.edu.user.service.impl;
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
+import com.keao.edu.user.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.service.ExamRoomStudentRelationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, ExamRoomStudentRelation> implements ExamRoomStudentRelationService {
+	
+	@Autowired
+	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
+
+	@Override
+	public BaseDAO<Long, ExamRoomStudentRelation> getDAO() {
+		return examRoomStudentRelationDao;
+	}
+	
+}

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -0,0 +1,22 @@
+package com.keao.edu.user.service.impl;
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.ExamTeacherSalaryDao;
+import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.service.ExamTeacherSalaryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeacherSalary> implements ExamTeacherSalaryService {
+	
+	@Autowired
+	private ExamTeacherSalaryDao examTeacherSalaryDao;
+
+	@Override
+	public BaseDAO<Long, ExamTeacherSalary> getDAO() {
+		return examTeacherSalaryDao;
+	}
+	
+}