1、修改企业证照企业ID为token获取

2、修改人员证照用户ID为token获取
main
shenzhidan 2026-01-08 14:54:42 +08:00
parent 20222626a7
commit a20ef0df71
10 changed files with 29 additions and 22 deletions

View File

@ -2,6 +2,8 @@ package com.zcloud.certificate.command;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil; 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.gateway.CorpCertificateGateway;
import com.zcloud.certificate.domain.model.CorpCertificateE; import com.zcloud.certificate.domain.model.CorpCertificateE;
import com.zcloud.certificate.dto.CorpCertificateAddCmd; import com.zcloud.certificate.dto.CorpCertificateAddCmd;
@ -33,7 +35,8 @@ public class CorpCertificateAddExe {
if (!certificate) { if (!certificate) {
throw new BizException("证照编号已存在"); throw new BizException("证照编号已存在");
} }
SSOUser ssoUser = AuthContext.getCurrentUser();
corpCertificateE.corpinfo(ssoUser);
boolean res = false; boolean res = false;
try { try {
if (corpCertificateE.getCorpCertificateId() == null) { if (corpCertificateE.getCorpCertificateId() == null) {

View File

@ -26,10 +26,6 @@ public class CorpCertificateUpdateExe {
CorpCertificateE corpCertificateE = new CorpCertificateE(); CorpCertificateE corpCertificateE = new CorpCertificateE();
BeanUtils.copyProperties(cmd, corpCertificateE); BeanUtils.copyProperties(cmd, corpCertificateE);
Boolean certificate = corpCertificateGateway.checkCertificateExist(corpCertificateE);
if (!certificate) {
throw new BizException("证照编号已存在");
}
boolean res = corpCertificateGateway.update(corpCertificateE); boolean res = corpCertificateGateway.update(corpCertificateE);
if (!res) { if (!res) {
throw new BizException("修改失败"); throw new BizException("修改失败");

View File

@ -30,7 +30,7 @@ public class UserCertificateAddExe {
BeanUtils.copyProperties(cmd, userCertificateE); BeanUtils.copyProperties(cmd, userCertificateE);
SSOUser ssoUser = AuthContext.getCurrentUser(); SSOUser ssoUser = AuthContext.getCurrentUser();
userCertificateE.corpUserInfo(ssoUser);
Boolean certificate = userCertificateGateway.checkCertificateExist(userCertificateE); Boolean certificate = userCertificateGateway.checkCertificateExist(userCertificateE);
if (certificate) { if (certificate) {
throw new BizException("证书编号已存在"); throw new BizException("证书编号已存在");

View File

@ -27,12 +27,6 @@ public class UserCertificateUpdateExe {
UserCertificateE userCertificateE = new UserCertificateE(); UserCertificateE userCertificateE = new UserCertificateE();
BeanUtils.copyProperties(userCertificateUpdateCmd, userCertificateE); BeanUtils.copyProperties(userCertificateUpdateCmd, userCertificateE);
Boolean certificate = userCertificateGateway.checkCertificateExist(userCertificateE);
if (certificate) {
throw new BizException("证书编号已存在");
}
boolean res = userCertificateGateway.update(userCertificateE); boolean res = userCertificateGateway.update(userCertificateE);
if (!res) { if (!res) {
throw new BizException("修改失败"); throw new BizException("修改失败");

View File

@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.time.LocalDate;
import java.util.Date; import java.util.Date;
/** /**
@ -28,7 +29,7 @@ public class CorpCertificateAddCmd extends Command {
private String corpCertificateId; private String corpCertificateId;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) @ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空") // @NotNull(message = "企业id不能为空")
private Long corpinfoId; private Long corpinfoId;
@ApiModelProperty(value = "证书名称", name = "certificateName", required = true) @ApiModelProperty(value = "证书名称", name = "certificateName", required = true)
@ -42,12 +43,12 @@ public class CorpCertificateAddCmd extends Command {
@ApiModelProperty(value = "证书有效期-开始时间", name = "certificateDateStart", required = true) @ApiModelProperty(value = "证书有效期-开始时间", name = "certificateDateStart", required = true)
@NotNull(message = "证书有效期-开始时间不能为空") @NotNull(message = "证书有效期-开始时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date certificateDateStart; private LocalDate certificateDateStart;
@ApiModelProperty(value = "证书有效期-结束时间", name = "certificateDateEnd", required = true) @ApiModelProperty(value = "证书有效期-结束时间", name = "certificateDateEnd", required = true)
@NotNull(message = "证书有效期-结束时间不能为空") @NotNull(message = "证书有效期-结束时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date certificateDateEnd; private LocalDate certificateDateEnd;
@ApiModelProperty(value = "备注", name = "remark", required = true) @ApiModelProperty(value = "备注", name = "remark", required = true)
private String remark; private String remark;

View File

@ -28,10 +28,10 @@ public class CorpCertificateUpdateCmd extends Command {
@NotNull(message = "主键id不能为空") @NotNull(message = "主键id不能为空")
private Long id; private Long id;
@ApiModelProperty(value = "业务主键id", name = "corpCertificateId", required = true) @ApiModelProperty(value = "业务主键id", name = "corpCertificateId", required = true)
@NotEmpty(message = "业务主键id不能为空") // @NotEmpty(message = "业务主键id不能为空")
private String corpCertificateId; private String corpCertificateId;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) @ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空") // @NotNull(message = "企业id不能为空")
private Long corpinfoId; private Long corpinfoId;
@ApiModelProperty(value = "证书名称", name = "certificateName", required = true) @ApiModelProperty(value = "证书名称", name = "certificateName", required = true)
@NotEmpty(message = "证书名称不能为空") @NotEmpty(message = "证书名称不能为空")

View File

@ -22,11 +22,11 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
public class UserCertificateAddCmd extends Command { public class UserCertificateAddCmd extends Command {
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) @ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空") // @NotNull(message = "企业id不能为空")
private Long corpinfoId; private Long corpinfoId;
@ApiModelProperty(value = "用户id", name = "userId", required = true) @ApiModelProperty(value = "用户id", name = "userId", required = true)
@NotNull(message = "用户id不能为空") // @NotNull(message = "用户id不能为空")
private Long userId; private Long userId;
@ApiModelProperty(value = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员", name = "type", required = true) @ApiModelProperty(value = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员", name = "type", required = true)

View File

@ -25,13 +25,13 @@ public class UserCertificateUpdateCmd extends Command {
@NotNull(message = "主键id不能为空") @NotNull(message = "主键id不能为空")
private Long id; private Long id;
@ApiModelProperty(value = "业务主键id", name = "userCertificateId", required = true) @ApiModelProperty(value = "业务主键id", name = "userCertificateId", required = true)
@NotEmpty(message = "业务主键id不能为空") // @NotEmpty(message = "业务主键id不能为空")
private String userCertificateId; private String userCertificateId;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) @ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空") // @NotNull(message = "企业id不能为空")
private Long corpinfoId; private Long corpinfoId;
@ApiModelProperty(value = "用户id", name = "userId", required = true) @ApiModelProperty(value = "用户id", name = "userId", required = true)
@NotNull(message = "用户id不能为空") // @NotNull(message = "用户id不能为空")
private Long userId; private Long userId;
@ApiModelProperty(value = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员", name = "type", required = true) @ApiModelProperty(value = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员", name = "type", required = true)
@NotNull(message = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员不能为空") @NotNull(message = "1-特种作业2-特种设备3-主要负责人4-安全生产管理人员不能为空")

View File

@ -1,5 +1,6 @@
package com.zcloud.certificate.domain.model; package com.zcloud.certificate.domain.model;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.domain.model.BaseE; import com.jjb.saas.framework.domain.model.BaseE;
import lombok.Data; import lombok.Data;
@ -30,5 +31,10 @@ public class CorpCertificateE extends BaseE {
private LocalDate certificateDateEnd; private LocalDate certificateDateEnd;
//备注 //备注
private String remark; private String remark;
public void corpinfo(SSOUser ssoUser) {
if (ssoUser == null) return;
this.corpinfoId = ssoUser.getTenantId();
}
} }

View File

@ -1,6 +1,7 @@
package com.zcloud.certificate.domain.model; package com.zcloud.certificate.domain.model;
import com.alibaba.cola.domain.Entity; import com.alibaba.cola.domain.Entity;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.domain.model.BaseE; import com.jjb.saas.framework.domain.model.BaseE;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -72,5 +73,11 @@ public class UserCertificateE extends BaseE {
this.corpinfoName = userBasicInfo.getCorpinfoName(); this.corpinfoName = userBasicInfo.getCorpinfoName();
} }
public void corpUserInfo(SSOUser ssoUser) {
if (ssoUser == null) return;
this.corpinfoId = ssoUser.getTenantId();
this.userId = ssoUser.getUserId();
}
} }