教育资源修改
parent
f10d1b6a35
commit
5645336e71
|
|
@ -5,6 +5,7 @@ import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.edu.command.convertor.resource.QuestionCoConvertor;
|
import com.zcloud.edu.command.convertor.resource.QuestionCoConvertor;
|
||||||
import com.zcloud.edu.domain.enums.CoursewareTypeEnum;
|
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.gateway.resource.ExamPaperGateway;
|
||||||
import com.zcloud.edu.domain.model.resource.ExamPaperE;
|
import com.zcloud.edu.domain.model.resource.ExamPaperE;
|
||||||
import com.zcloud.edu.domain.model.resource.QuestionE;
|
import com.zcloud.edu.domain.model.resource.QuestionE;
|
||||||
|
|
@ -77,6 +78,7 @@ public class ExamPaperAddExe {
|
||||||
BeanUtils.copyProperties(cmd, examPaperE);
|
BeanUtils.copyProperties(cmd, examPaperE);
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
try {
|
try {
|
||||||
|
cmd.setType(ExamPaperTypeEnum.SELF_BUILD.getCode());
|
||||||
res = examPaperGateway.add(examPaperE);
|
res = examPaperGateway.add(examPaperE);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.zcloud.edu.command.resource;
|
package com.zcloud.edu.command.resource;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
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.gateway.resource.TeacherCertificateGateway;
|
||||||
import com.zcloud.edu.domain.model.resource.TeacherCertificateE;
|
import com.zcloud.edu.domain.model.resource.TeacherCertificateE;
|
||||||
import com.zcloud.edu.dto.resource.TeacherCertificateAddCmd;
|
import com.zcloud.edu.dto.resource.TeacherCertificateAddCmd;
|
||||||
|
|
@ -12,6 +13,9 @@ import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -37,6 +41,15 @@ public class TeacherCertificateAddExe {
|
||||||
if(CollUtil.isNotEmpty( list)){
|
if(CollUtil.isNotEmpty( list)){
|
||||||
throw new BizException("该职业证书编号已存在");
|
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;
|
boolean res = false;
|
||||||
try {
|
try {
|
||||||
res = teacherCertificateGateway.add(teacherCertificateE);
|
res = teacherCertificateGateway.add(teacherCertificateE);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class TeacherCertificateAddCmd extends Command {
|
||||||
private String vocationalCertificateNumber;
|
private String vocationalCertificateNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否永久有效:0-否,1-是", name = "effectiveFlag", required = true)
|
@ApiModelProperty(value = "是否永久有效:0-否,1-是", name = "effectiveFlag", required = true)
|
||||||
@NotNull(message = "是否永久有效:0-否,1-是不能为空")
|
@NotNull(message = "是否永久有效不能为空")
|
||||||
private Integer effectiveFlag;
|
private Integer effectiveFlag;
|
||||||
|
|
||||||
@ApiModelProperty(value = "证书有效期(开始)", name = "certificateDateStart", required = true)
|
@ApiModelProperty(value = "证书有效期(开始)", name = "certificateDateStart", required = true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue