|
@@ -5,11 +5,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.common.dto.core.enums.CourseLevel;
|
|
|
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.SaveCourseReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Course;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.CourseService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
@@ -20,15 +19,15 @@ public class CourseCloudServiceProvider implements CourseCloudService {
|
|
|
@Autowired
|
|
|
CourseService courseService;
|
|
|
|
|
|
- @ApiOperation(value = "保存课程", notes = "保存课程")
|
|
|
+ @ApiOperation(value = "保存课程")
|
|
|
@PostMapping
|
|
|
@Override
|
|
|
public void saveCourse(SaveCourseReq courseReq) {
|
|
|
- Course course = courseService.findByOrgIdAndCode(courseReq.getOrgId(),
|
|
|
+ Course course = courseService.findByOrgIdAndCode(courseReq.getRootOrgId(),
|
|
|
courseReq.getCourseCode());
|
|
|
if (course == null) {
|
|
|
course = new Course();
|
|
|
- course.setOrgId(courseReq.getOrgId());
|
|
|
+ course.setOrgId(courseReq.getRootOrgId());
|
|
|
course.setName(courseReq.getCourseName());
|
|
|
course.setCode(courseReq.getCourseCode());
|
|
|
course.setLevel(getCourseLevelByCName(courseReq.getCourseLevel()));
|
|
@@ -41,10 +40,12 @@ public class CourseCloudServiceProvider implements CourseCloudService {
|
|
|
for (CourseLevel level : CourseLevel.values()) {
|
|
|
if (cname.equals(level.getName())) {
|
|
|
courseLevel = level;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (courseLevel == null) {
|
|
|
- throw new StatusException("CORE-BASIC-courseLevel not exists", "课程层次不存在");
|
|
|
+ return CourseLevel.ALL;
|
|
|
} else {
|
|
|
return courseLevel;
|
|
|
}
|