|
@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.questions.service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
@@ -174,6 +175,18 @@ public class PaperStructService {
|
|
|
* @return
|
|
|
*/
|
|
|
public PaperStruct save(PaperStruct paperStruct, User user) {
|
|
|
+ if (StringUtils.isNotBlank(paperStruct.getCourseNo())) {
|
|
|
+ GetCourseReq req = new GetCourseReq();
|
|
|
+ req.setRootOrgId(Long.valueOf(paperStruct.getOrgId()));
|
|
|
+ req.setCode(paperStruct.getCourseNo());
|
|
|
+ GetCourseResp resp = courseCloudService.getCourse(req);
|
|
|
+ if (resp.getCourseBean() == null) {
|
|
|
+ throw new StatusException("500","课程不存在");
|
|
|
+ }
|
|
|
+ paperStruct.setCourseId(resp.getCourseBean().getId());
|
|
|
+ } else {
|
|
|
+ paperStruct.setCourseId(null);
|
|
|
+ }
|
|
|
if (StringUtils.isNotBlank(paperStruct.getId())) {
|
|
|
PaperStruct oldPaperStruct = Model.of(paperStructRepo.findById(paperStruct.getId()));
|
|
|
PaperStruct rps = null;
|