教育资源修改

dev
zhaokai 2026-02-07 16:33:28 +08:00
parent f10d1b6a35
commit 5645336e71
3 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.command.convertor.resource.QuestionCoConvertor;
import com.zcloud.edu.domain.enums.CoursewareTypeEnum;
import com.zcloud.edu.domain.enums.ExamPaperTypeEnum;
import com.zcloud.edu.domain.gateway.resource.ExamPaperGateway;
import com.zcloud.edu.domain.model.resource.ExamPaperE;
import com.zcloud.edu.domain.model.resource.QuestionE;
@ -77,6 +78,7 @@ public class ExamPaperAddExe {
BeanUtils.copyProperties(cmd, examPaperE);
boolean res = false;
try {
cmd.setType(ExamPaperTypeEnum.SELF_BUILD.getCode());
res = examPaperGateway.add(examPaperE);
} catch (Exception e) {
throw new RuntimeException(e);

View File

@ -1,6 +1,7 @@
package com.zcloud.edu.command.resource;
import cn.hutool.core.collection.CollUtil;
import com.zcloud.edu.domain.enums.CommonFlagEnum;
import com.zcloud.edu.domain.gateway.resource.TeacherCertificateGateway;
import com.zcloud.edu.domain.model.resource.TeacherCertificateE;
import com.zcloud.edu.dto.resource.TeacherCertificateAddCmd;
@ -12,6 +13,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
@ -37,6 +41,15 @@ public class TeacherCertificateAddExe {
if(CollUtil.isNotEmpty( list)){
throw new BizException("该职业证书编号已存在");
}
//证书结束时间不能小于当天
Instant todayStart = LocalDate.now()
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
if (CommonFlagEnum.NO.getCode().equals(cmd.getEffectiveFlag()) && cmd.getCertificateDateEnd().toInstant().isBefore(todayStart)) {
throw new BizException("证书有效期已失效");
}
boolean res = false;
try {
res = teacherCertificateGateway.add(teacherCertificateE);

View File

@ -42,7 +42,7 @@ public class TeacherCertificateAddCmd extends Command {
private String vocationalCertificateNumber;
@ApiModelProperty(value = "是否永久有效:0-否,1-是", name = "effectiveFlag", required = true)
@NotNull(message = "是否永久有效:0-否,1-是不能为空")
@NotNull(message = "是否永久有效不能为空")
private Integer effectiveFlag;
@ApiModelProperty(value = "证书有效期(开始)", name = "certificateDateStart", required = true)