xiatian 5 gadi atpakaļ
vecāks
revīzija
abb7577c7c

+ 4 - 4
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/PaperController.java

@@ -104,7 +104,7 @@ public class PaperController extends ControllerSupport {
         if ("success".equals(msgMap.get("msg"))) {
             return new ResponseEntity<>(msgMap, HttpStatus.OK);
         } else {
-            return new ResponseEntity<>(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
+            throw new StatusException("1000",msgMap.get("msg").toString());
         }
     }
 
@@ -210,7 +210,7 @@ public class PaperController extends ControllerSupport {
         if (msgMap.get("msg").equals("success")) {
             return new ResponseEntity<>(msgMap, HttpStatus.OK);
         } else {
-            return new ResponseEntity<>(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
+            throw new StatusException("1001","试卷["+msgMap.get("paperName")+"]中有试题被组卷使用,不能删除!");
         }
 
     }
@@ -553,13 +553,13 @@ public class PaperController extends ControllerSupport {
                 Paper oldpaper = cn.com.qmth.examcloud.core.questions.base.Model.of(paperRepo.findById(paperIdArray[i]));
                 boolean result = paperService.checkPaperName(oldpaper.getName(), PaperType.GENERATE, user.getRootOrgId() + "");
                 if (!result) {
-                    throw new StatusException("Q-160565", "考试试卷:" + oldpaper.getName() + "已经存在");
+                    throw new StatusException("160565", "考试试卷:" + oldpaper.getName() + "已经存在");
                 }
             }
             paperService.useBasePaper(paperIds, user.getDisplayName());
             return new ResponseEntity<>(HttpStatus.OK);
         } catch (Exception e) {
-            throw new StatusException("Q-160537", e.getMessage());
+            throw new StatusException("160537", e.getMessage());
         }
     }