浏览代码

fix:paperType

caozixuan 3 年之前
父节点
当前提交
87b235cd63

+ 4 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/BasicPaperInfo.java

@@ -4,7 +4,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Length;
 
+import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
@@ -38,6 +40,8 @@ public class BasicPaperInfo {
     private String paperNumber;
 
     @ApiModelProperty(value = "试卷类型(A,B)")
+    @NotNull(message = "请提供试卷类型")
+    @Length(min = 1,message = "请提供试卷类型")
     private String paperType;
 
     @ApiModelProperty(value = "状态")

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java

@@ -344,6 +344,9 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         String courseCode = basicPaperInfo.getCourseCode();
         String courseName = basicPaperInfo.getCourseName();
         String paperType = basicPaperInfo.getPaperType();
+        if (!SystemConstant.strNotNull(paperType)){
+            throw ExceptionResultEnum.ERROR.exception("试卷类型不存在");
+        }
         ExamPaperStructureStatusEnum status = basicPaperInfo.getStatus();
         String objectiveStructure = JSON.toJSONString(paperStructureInfo.getObjectiveQuestionList());
         String subjectiveStructure = JSON.toJSONString(paperStructureInfo.getSubjectiveQuestionList());