parent
20222626a7
commit
a20ef0df71
|
|
@ -2,6 +2,8 @@ package com.zcloud.certificate.command;
|
|||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.certificate.domain.gateway.CorpCertificateGateway;
|
||||
import com.zcloud.certificate.domain.model.CorpCertificateE;
|
||||
import com.zcloud.certificate.dto.CorpCertificateAddCmd;
|
||||
|
|
@ -33,7 +35,8 @@ public class CorpCertificateAddExe {
|
|||
if (!certificate) {
|
||||
throw new BizException("证照编号已存在");
|
||||
}
|
||||
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
corpCertificateE.corpinfo(ssoUser);
|
||||
boolean res = false;
|
||||
try {
|
||||
if (corpCertificateE.getCorpCertificateId() == null) {
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ public class CorpCertificateUpdateExe {
|
|||
CorpCertificateE corpCertificateE = new CorpCertificateE();
|
||||
BeanUtils.copyProperties(cmd, corpCertificateE);
|
||||
|
||||
Boolean certificate = corpCertificateGateway.checkCertificateExist(corpCertificateE);
|
||||
if (!certificate) {
|
||||
throw new BizException("证照编号已存在");
|
||||
}
|
||||
boolean res = corpCertificateGateway.update(corpCertificateE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class UserCertificateAddExe {
|
|||
BeanUtils.copyProperties(cmd, userCertificateE);
|
||||
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
|
||||
userCertificateE.corpUserInfo(ssoUser);
|
||||
Boolean certificate = userCertificateGateway.checkCertificateExist(userCertificateE);
|
||||
if (certificate) {
|
||||
throw new BizException("证书编号已存在");
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@ public class UserCertificateUpdateExe {
|
|||
UserCertificateE userCertificateE = new UserCertificateE();
|
||||
BeanUtils.copyProperties(userCertificateUpdateCmd, userCertificateE);
|
||||
|
||||
Boolean certificate = userCertificateGateway.checkCertificateExist(userCertificateE);
|
||||
if (certificate) {
|
||||
throw new BizException("证书编号已存在");
|
||||
}
|
||||
|
||||
|
||||
boolean res = userCertificateGateway.update(userCertificateE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +29,7 @@ public class CorpCertificateAddCmd extends Command {
|
|||
private String corpCertificateId;
|
||||
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
// @NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "证书名称", name = "certificateName", required = true)
|
||||
|
|
@ -42,12 +43,12 @@ public class CorpCertificateAddCmd extends Command {
|
|||
@ApiModelProperty(value = "证书有效期-开始时间", name = "certificateDateStart", required = true)
|
||||
@NotNull(message = "证书有效期-开始时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date certificateDateStart;
|
||||
private LocalDate certificateDateStart;
|
||||
|
||||
@ApiModelProperty(value = "证书有效期-结束时间", name = "certificateDateEnd", required = true)
|
||||
@NotNull(message = "证书有效期-结束时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date certificateDateEnd;
|
||||
private LocalDate certificateDateEnd;
|
||||
|
||||
@ApiModelProperty(value = "备注", name = "remark", required = true)
|
||||
private String remark;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ public class CorpCertificateUpdateCmd extends Command {
|
|||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务主键id", name = "corpCertificateId", required = true)
|
||||
@NotEmpty(message = "业务主键id不能为空")
|
||||
// @NotEmpty(message = "业务主键id不能为空")
|
||||
private String corpCertificateId;
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
// @NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "证书名称", name = "certificateName", required = true)
|
||||
@NotEmpty(message = "证书名称不能为空")
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import java.util.Date;
|
|||
@AllArgsConstructor
|
||||
public class UserCertificateAddCmd extends Command {
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
// @NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
||||
@NotNull(message = "用户id不能为空")
|
||||
// @NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "1-特种作业,2-特种设备,3-主要负责人,4-安全生产管理人员", name = "type", required = true)
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ public class UserCertificateUpdateCmd extends Command {
|
|||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务主键id", name = "userCertificateId", required = true)
|
||||
@NotEmpty(message = "业务主键id不能为空")
|
||||
// @NotEmpty(message = "业务主键id不能为空")
|
||||
private String userCertificateId;
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
// @NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
||||
@NotNull(message = "用户id不能为空")
|
||||
// @NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
@ApiModelProperty(value = "1-特种作业,2-特种设备,3-主要负责人,4-安全生产管理人员", name = "type", required = true)
|
||||
@NotNull(message = "1-特种作业,2-特种设备,3-主要负责人,4-安全生产管理人员不能为空")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.certificate.domain.model;
|
||||
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -30,5 +31,10 @@ public class CorpCertificateE extends BaseE {
|
|||
private LocalDate certificateDateEnd;
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
public void corpinfo(SSOUser ssoUser) {
|
||||
if (ssoUser == null) return;
|
||||
this.corpinfoId = ssoUser.getTenantId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.certificate.domain.model;
|
||||
|
||||
import com.alibaba.cola.domain.Entity;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
@ -72,5 +73,11 @@ public class UserCertificateE extends BaseE {
|
|||
this.corpinfoName = userBasicInfo.getCorpinfoName();
|
||||
}
|
||||
|
||||
public void corpUserInfo(SSOUser ssoUser) {
|
||||
if (ssoUser == null) return;
|
||||
this.corpinfoId = ssoUser.getTenantId();
|
||||
this.userId = ssoUser.getUserId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue