Explorar el Código

update constants.

deason hace 6 años
padre
commit
268e404cd4
Se han modificado 14 ficheros con 49 adiciones y 49 borrados
  1. 4 4
      examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/Constants.java
  2. 4 4
      examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/Result.java
  3. 5 5
      examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/upyun/UpYunClient.java
  4. 9 9
      examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/utils/Check.java
  5. 2 2
      examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CommonController.java
  6. 1 1
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java
  7. 2 2
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CourseStatisticServiceImpl.java
  8. 7 7
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ExamStructureServiceImpl.java
  9. 3 3
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectServiceImpl.java
  10. 4 4
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectStatisticServiceImpl.java
  11. 2 2
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingTemplateServiceImpl.java
  12. 2 2
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ProjectBackupSettingServiceImpl.java
  13. 2 2
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ProjectOtherSettingServiceImpl.java
  14. 2 2
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/QuestionStructureServiceImpl.java

+ 4 - 4
examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/Constants.java

@@ -18,22 +18,22 @@ public interface Constants {
     /**
      * 操作成功
      */
-    String PRT_CODE_200 = "PRT-000200";
+    String SYS_CODE_200 = "PRT-000200";
 
     /**
      * 系统错误
      */
-    String PRT_CODE_500 = "PRT-000500";
+    String SYS_CODE_500 = "PRT-000500";
 
     /**
      * 参数错误
      */
-    String PRT_CODE_400 = "PRT-000400";
+    String SYS_CODE_400 = "PRT-000400";
 
     /**
      * 权限错误
      */
-    String PRT_CODE_403 = "PRT-000403";
+    String SYS_CODE_403 = "PRT-000403";
 
     /* 导出文件默认名称 */
     String PAPER_PDF_NAME = "试卷.pdf";

+ 4 - 4
examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/Result.java

@@ -49,7 +49,7 @@ public class Result<T> implements Serializable {
     }
 
     public static <T> Result success(T data) {
-        return new Result(PRT_CODE_200, "操作成功!", data);
+        return new Result(SYS_CODE_200, "操作成功!", data);
     }
 
     public static Result error() {
@@ -57,17 +57,17 @@ public class Result<T> implements Serializable {
     }
 
     public static Result error(String desc) {
-        return new Result(PRT_CODE_500, desc);
+        return new Result(SYS_CODE_500, desc);
     }
 
     public static Result noAuth() {
-        return new Result(PRT_CODE_403, "无效认证信息,请先登录!");
+        return new Result(SYS_CODE_403, "无效认证信息,请先登录!");
     }
 
     @JsonIgnore
     @ApiIgnore
     public boolean isSuccess() {
-        if (PRT_CODE_200.equals(getCode())) {
+        if (SYS_CODE_200.equals(getCode())) {
             return true;
         }
         return false;

+ 5 - 5
examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/upyun/UpYunClient.java

@@ -19,8 +19,8 @@ import org.springframework.stereotype.Component;
 
 import java.io.File;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_400;
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_400;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -37,7 +37,7 @@ public class UpYunClient {
     public String upload(File file) {
         Check.isEmpty(file, "上传的文件不能为空!");
         if (!file.exists() || !file.isFile()) {
-            throw new StatusException(PRT_CODE_400, "上传的文件不存在!");
+            throw new StatusException(SYS_CODE_400, "上传的文件不存在!");
         }
 
         try {
@@ -49,7 +49,7 @@ public class UpYunClient {
             return upYunProperty.getFileUrl() + newFilePath;
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            throw new StatusException(PRT_CODE_500, "上传文件异常!");
+            throw new StatusException(SYS_CODE_500, "上传文件异常!");
         }
     }
 
@@ -66,7 +66,7 @@ public class UpYunClient {
             return upYunProperty.getFileUrl() + newFilePath;
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            throw new StatusException(PRT_CODE_500, "上传文件异常!");
+            throw new StatusException(SYS_CODE_500, "上传文件异常!");
         }
     }
 

+ 9 - 9
examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/utils/Check.java

@@ -13,7 +13,7 @@ import java.lang.reflect.Array;
 import java.util.Collection;
 import java.util.Map;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_400;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_400;
 
 /**
  * 参数校验类
@@ -25,49 +25,49 @@ public class Check {
 
     public static void isNull(Object obj, String message) {
         if (obj == null) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isEmpty(Object obj, String message) {
         if (isEmpty(obj)) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isEmpty(Object[] array, String message) {
         if (isEmpty(array)) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isEmpty(Collection<?> collection, String message) {
         if (isEmpty(collection)) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isEmpty(Map<?, ?> map, String message) {
         if (isEmpty(map)) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isBlank(CharSequence str, String message) {
         if (isBlank(str)) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isTrue(Boolean expression, String message) {
         if (expression != null && expression) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 
     public static void isFalse(Boolean expression, String message) {
         if (expression == null || !expression) {
-            throw new StatusException(PRT_CODE_400, message);
+            throw new StatusException(SYS_CODE_400, message);
         }
     }
 

+ 2 - 2
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CommonController.java

@@ -26,7 +26,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * 常用相关接口
@@ -61,7 +61,7 @@ public class CommonController extends ControllerSupport {
             return Result.success(fileUrl);
         }
 
-        throw new StatusException(PRT_CODE_500, "上传失败!");
+        throw new StatusException(SYS_CODE_500, "上传失败!");
     }
 
     @GetMapping("/download")

+ 1 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java

@@ -342,7 +342,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         //试卷不足时,反馈给前端
         if (errors.length() > 0) {
             errors.append("等课程的试卷数不足!");
-            throw new StatusException(PRT_CODE_500, errors.toString());
+            throw new StatusException(SYS_CODE_500, errors.toString());
         }
     }
 

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CourseStatisticServiceImpl.java

@@ -39,7 +39,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -118,7 +118,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
         Check.isNull(req.getExamId(), "考试ID不能为空!");
 
         if (RefreshInfo.coursesRefreshing) {
-            throw new StatusException(PRT_CODE_500, "尚有课程统计任务正在刷新中,请稍后再刷新!");
+            throw new StatusException(SYS_CODE_500, "尚有课程统计任务正在刷新中,请稍后再刷新!");
         }
 
         //目前限定仅一个刷新任务可执行

+ 7 - 7
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ExamStructureServiceImpl.java

@@ -30,7 +30,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: weiwenhai
@@ -122,12 +122,12 @@ public class ExamStructureServiceImpl implements ExamStructureService {
 
         ExamStructure newStructure = examStructureRepository.findByOrgIdAndExamId(info.getNewOrgId(), info.getNewExamId());
         if (newStructure != null) {
-            throw new StatusException(PRT_CODE_500, "目标学校考试下已有结构信息,不可复用!");
+            throw new StatusException(SYS_CODE_500, "目标学校考试下已有结构信息,不可复用!");
         }
 
         ExamStructure oldStructure = examStructureRepository.findByOrgIdAndExamId(info.getOrgId(), info.getExamId());
         if (oldStructure == null) {
-            throw new StatusException(PRT_CODE_500, "原考试结构信息不存在!");
+            throw new StatusException(SYS_CODE_500, "原考试结构信息不存在!");
         }
 
         newStructure = new ExamStructure();
@@ -164,7 +164,7 @@ public class ExamStructureServiceImpl implements ExamStructureService {
 
         ExamStructure entity = examStructureRepository.findByOrgIdAndExamId(orgId, examId);
         if (entity == null) {
-            throw new StatusException(PRT_CODE_500, "当前考试尚未创建考试结构!");
+            throw new StatusException(SYS_CODE_500, "当前考试尚未创建考试结构!");
         }
 
         //获取考试结构设置的客观题数量
@@ -173,15 +173,15 @@ public class ExamStructureServiceImpl implements ExamStructureService {
         //校验考试结构中单选题、多选题、判断题的数量
         /*long singleChoiceSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.SINGLE_ANSWER_QUESTION.getTitle());
         if (singleChoiceSize > questionStructure.getSingleChoiceTotal()) {
-            throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.SINGLE_ANSWER_QUESTION.getTitle()));
+            throw new StatusException(SYS_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.SINGLE_ANSWER_QUESTION.getTitle()));
         }
         long multipleChoiceSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.MULTIPLE_ANSWER_QUESTION.getTitle());
         if (multipleChoiceSize > questionStructure.getMultipleChoiceTotal()) {
-            throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.MULTIPLE_ANSWER_QUESTION.getTitle()));
+            throw new StatusException(SYS_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.MULTIPLE_ANSWER_QUESTION.getTitle()));
         }
         long boolQuestionSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.BOOL_ANSWER_QUESTION.getTitle());
         if (boolQuestionSize > questionStructure.getBoolQuestionTotal()) {
-            throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.BOOL_ANSWER_QUESTION.getTitle()));
+            throw new StatusException(SYS_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.BOOL_ANSWER_QUESTION.getTitle()));
         }*/
     }
 

+ 3 - 3
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectServiceImpl.java

@@ -36,7 +36,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * 印刷项目相关接口
@@ -85,7 +85,7 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
         Check.isNull(id, "印刷项目ID不能为空!");
         PrintingProject project = printingProjectRepository.findOne(id);
         if (project == null) {
-            throw new StatusException(PRT_CODE_500, "印刷项目信息不存在!");
+            throw new StatusException(SYS_CODE_500, "印刷项目信息不存在!");
         }
         return PrintingProjectConvert.of(project);
     }
@@ -115,7 +115,7 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
 
         PrintingProject entity = printingProjectRepository.findOne(info.getId());
         if (entity == null) {
-            throw new StatusException(PRT_CODE_500, "印刷项目信息不存在!");
+            throw new StatusException(SYS_CODE_500, "印刷项目信息不存在!");
         }
 
         entity.setSupplierId(info.getSupplierId());

+ 4 - 4
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectStatisticServiceImpl.java

@@ -35,7 +35,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -62,7 +62,7 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
 
         PrintingProject project = printingProjectService.getPrintingProjectByOrgIdAndExamId(orgId, examId);
         if (project == null) {
-            throw new StatusException(PRT_CODE_500, "当前项目不存在!");
+            throw new StatusException(SYS_CODE_500, "当前项目不存在!");
         }
 
         ProjectStatistic statistic = projectStatisticRepository.getProjectStatisticByProjectId(project.getId());
@@ -76,11 +76,11 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
 
         PrintingProject project = printingProjectService.getPrintingProjectByOrgIdAndExamId(orgId, examId);
         if (project == null) {
-            throw new StatusException(PRT_CODE_500, "当前项目不存在!");
+            throw new StatusException(SYS_CODE_500, "当前项目不存在!");
         }
 
         if (RefreshInfo.projectRefreshing) {
-            throw new StatusException(PRT_CODE_500, "尚有项目统计任务正在刷新中,请稍后再刷新!");
+            throw new StatusException(SYS_CODE_500, "尚有项目统计任务正在刷新中,请稍后再刷新!");
         }
 
         //目前限定仅一个刷新任务可执行

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingTemplateServiceImpl.java

@@ -26,7 +26,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -54,7 +54,7 @@ public class PrintingTemplateServiceImpl implements PrintingTemplateService {
     public PrintingTemplateInfo getPrintingTemplateById(Long id) {
         PrintingTemplate template = printingTemplateRepository.findOne(id);
         if (template == null) {
-            throw new StatusException(PRT_CODE_500, "当前模板信息不存在!");
+            throw new StatusException(SYS_CODE_500, "当前模板信息不存在!");
         }
         return PrintingTemplateConvert.of(template);
     }

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ProjectBackupSettingServiceImpl.java

@@ -21,7 +21,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.Date;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -38,7 +38,7 @@ public class ProjectBackupSettingServiceImpl implements ProjectBackupSettingServ
         Check.isNull(projectId, "项目ID不能为空!");
         ProjectBackupSetting setting = projectBackupSettingRepository.findByProjectId(projectId);
         if (setting == null) {
-            throw new StatusException(PRT_CODE_500, "当前项目的备份设置信息不存在!");
+            throw new StatusException(SYS_CODE_500, "当前项目的备份设置信息不存在!");
         }
         return setting;
     }

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ProjectOtherSettingServiceImpl.java

@@ -22,7 +22,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -45,7 +45,7 @@ public class ProjectOtherSettingServiceImpl implements ProjectOtherSettingServic
     public ProjectOtherSetting getProjectOtherSettingById(Long id) {
         ProjectOtherSetting setting = projectOtherSettingRepository.findOne(id);
         if (setting == null) {
-            throw new StatusException(PRT_CODE_500, "当前事项设置的信息不存在!");
+            throw new StatusException(SYS_CODE_500, "当前事项设置的信息不存在!");
         }
         return setting;
     }

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/QuestionStructureServiceImpl.java

@@ -33,7 +33,7 @@ import org.springframework.stereotype.Service;
 import javax.validation.constraints.NotNull;
 import java.util.*;
 
-import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
+import static cn.com.qmth.examcloud.core.print.common.Constants.SYS_CODE_500;
 
 /**
  * @author: fengdesheng
@@ -107,7 +107,7 @@ public class QuestionStructureServiceImpl implements ExamQuestionStructureServic
         //获取考试结构设置的客观题数量
         ExamStructureInfo info = examStructureService.getExamStructure(orgId, examId);
         if (info == null || info.getQuestionStructure() == null) {
-            throw new StatusException(PRT_CODE_500, "当前的考试结构设置不存在!");
+            throw new StatusException(SYS_CODE_500, "当前的考试结构设置不存在!");
         }
 
         //默认属性信息