1、修改申请培训申请信息token获取

dev
shenzhidan 2026-01-22 16:30:24 +08:00
parent 875f79154a
commit 3621d28701
4 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,7 @@
package com.zcloud.edu.command.training;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.domain.gateway.training.TrainingApplyProcessGateway;
import com.zcloud.edu.domain.gateway.training.TrainingApplyRecordGateway;
import com.zcloud.edu.domain.gateway.training.TrainingApplyUserGateway;
@ -35,7 +37,8 @@ public class TrainingApplyRecordAddExe {
public String execute(TrainingApplyRecordAddCmd cmd) {
TrainingApplyRecordE record = assembleRecord(cmd);
// 保存主记录
record.initiate();
SSOUser ssoUser = AuthContext.getCurrentUser();
record.initiate(ssoUser);
boolean recordResult = trainingApplyRecordGateway.add(record);
if (!recordResult) {
throw new BizException("培训申请主记录保存失败");

View File

@ -22,15 +22,15 @@ import java.util.List;
@AllArgsConstructor
public class TrainingApplyRecordAddCmd extends Command {
@ApiModelProperty(value = "申请企业id", name = "applyCorpinfoId", required = true)
@NotNull(message = "申请企业id不能为空")
// @NotNull(message = "申请企业id不能为空")
private Long applyCorpinfoId;
@ApiModelProperty(value = "申请部门id", name = "applyDepartmentId", required = true)
@NotNull(message = "申请部门id不能为空")
// @NotNull(message = "申请部门id不能为空")
private Long applyDepartmentId;
@ApiModelProperty(value = "申请用户id", name = "applyUserId", required = true)
@NotNull(message = "申请用户id不能为空")
// @NotNull(message = "申请用户id不能为空")
private Long applyUserId;
@ApiModelProperty(value = "审批企业id", name = "approvalCorpinfoId", required = true)

View File

@ -23,7 +23,7 @@ public class TrainingApplyUserAddCmd extends Command {
private String trainingApplyRecordId;
@ApiModelProperty(value = "用户id", name = "userId", required = true)
@NotNull(message = "用户id不能为空")
// @NotNull(message = "用户id不能为空")
private Long userId;
@ApiModelProperty(value = "手机号", name = "phone", required = true)
@ -31,7 +31,7 @@ public class TrainingApplyUserAddCmd extends Command {
private String phone;
@ApiModelProperty(value = "身份证号" , name = "idCard", required = true)
@NotEmpty(message = "身份证号不能为空")
// @NotEmpty(message = "身份证号不能为空")
private String idCard;
@ApiModelProperty(value = "申请状态1:待审批2:审批通过,3:审批不通过", name = "applyStatus", required = true)

View File

@ -3,6 +3,7 @@ package com.zcloud.edu.domain.model.training;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.domain.model.BaseE;
import com.zcloud.edu.domain.enums.ApplyStatusEnum;
import com.zcloud.edu.domain.enums.ApplyTypeEnum;
@ -70,7 +71,12 @@ public class TrainingApplyRecordE extends BaseE {
/**
*
*/
public void initiate() {
public void initiate(SSOUser ssoUser) {
if (ssoUser != null && ssoUser.getUserId() != null) {
this.applyUserId = ssoUser.getUserId();
this.applyDepartmentId = ssoUser.getOrgId();
this.applyCorpinfoId = ssoUser.getTenantId();
}
this.trainingApplyRecordId = StrUtil.isNotBlank(this.trainingApplyRecordId) ? this.trainingApplyRecordId : IdUtil.simpleUUID();
this.approvalStatus = ApprovalStatusEnum.PENDING.getCode();