|
@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.core.questions.api.controller;
|
|
|
import cn.com.qmth.examcloud.api.commons.enums.DataRuleType;
|
|
|
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.questions.base.question.enums.QuesStructType;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperStructRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStruct;
|
|
@@ -98,6 +99,7 @@ public class PaperStructController extends ControllerSupport {
|
|
|
@PutMapping(value = "/paperStruct")
|
|
|
public ResponseEntity<Object> updatePaperStruct(@RequestBody PaperStruct ps) {
|
|
|
User user = getAccessUser();
|
|
|
+ ps.setOrgId(user.getRootOrgId()+"");
|
|
|
PaperStruct paperStruct = paperStructService.save(ps, user);
|
|
|
if (paperStruct == null) {
|
|
|
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
@@ -116,9 +118,10 @@ public class PaperStructController extends ControllerSupport {
|
|
|
@PostMapping(value = "/paperStruct")
|
|
|
public ResponseEntity<Object> addPaperStruct(@RequestBody PaperStruct ps) {
|
|
|
User user = getAccessUser();
|
|
|
+ ps.setOrgId(user.getRootOrgId()+"");
|
|
|
PaperStruct paperStructTemp = paperStructService.checkNameUnique(ps.getName(), user.getRootOrgId().toString(), ps.getType());
|
|
|
if (paperStructTemp != null) {
|
|
|
- return new ResponseEntity<>("试卷结构名称重复,请重新命名!", HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ throw new StatusException("试卷结构名称重复,请重新命名!");
|
|
|
} else {
|
|
|
PaperStruct paperStruct = paperStructService.save(ps, user);
|
|
|
return new ResponseEntity<>(paperStruct, HttpStatus.OK);
|