diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java index 814b65f..7228a2a 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.List; import java.util.Objects; +import com.inspur.common.exception.ServiceException; import com.inspur.common.utils.DateUtils; import com.inspur.common.utils.SecurityUtils; import com.inspur.common.utils.StringUtils; @@ -63,6 +64,11 @@ public class ExamInfoServiceImpl implements IExamInfoService { */ @Override public int insertExamInfo(ExamInfo examInfo) { + if(Objects.nonNull(examInfo.getTotalScore()) && Objects.nonNull(examInfo.getPassScore())){ + if (examInfo.getTotalScore().compareTo(examInfo.getPassScore()) < 0){ + throw new ServiceException("通过分数不能大于总分数"); + } + } examInfo.setId(IdUtils.fastSimpleUUID()); examInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId())); examInfo.setCreateTime(DateUtils.getNowDate()); @@ -77,6 +83,11 @@ public class ExamInfoServiceImpl implements IExamInfoService { */ @Override public int updateExamInfo(ExamInfo examInfo) { + if(Objects.nonNull(examInfo.getTotalScore()) && Objects.nonNull(examInfo.getPassScore())){ + if (examInfo.getTotalScore().compareTo(examInfo.getPassScore()) < 0){ + throw new ServiceException("通过分数不能大于总分数"); + } + } examInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId())); examInfo.setUpdateTime(DateUtils.getNowDate()); return examInfoMapper.updateExamInfo(examInfo);