From 0964d803bcaa42a4811b4439f8ff0062833637ce Mon Sep 17 00:00:00 2001 From: xusd Date: Tue, 14 May 2024 17:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E8=AF=84=E4=BC=B0=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=80=83=E8=AF=95=E6=B7=BB=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=9A=E8=BF=87=E5=88=86=E6=95=B0=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E6=80=BB=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examine/service/impl/ExamInfoServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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);