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; 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.TrainingApplyProcessGateway;
import com.zcloud.edu.domain.gateway.training.TrainingApplyRecordGateway; import com.zcloud.edu.domain.gateway.training.TrainingApplyRecordGateway;
import com.zcloud.edu.domain.gateway.training.TrainingApplyUserGateway; import com.zcloud.edu.domain.gateway.training.TrainingApplyUserGateway;
@ -35,7 +37,8 @@ public class TrainingApplyRecordAddExe {
public String execute(TrainingApplyRecordAddCmd cmd) { public String execute(TrainingApplyRecordAddCmd cmd) {
TrainingApplyRecordE record = assembleRecord(cmd); TrainingApplyRecordE record = assembleRecord(cmd);
// 保存主记录 // 保存主记录
record.initiate(); SSOUser ssoUser = AuthContext.getCurrentUser();
record.initiate(ssoUser);
boolean recordResult = trainingApplyRecordGateway.add(record); boolean recordResult = trainingApplyRecordGateway.add(record);
if (!recordResult) { if (!recordResult) {
throw new BizException("培训申请主记录保存失败"); throw new BizException("培训申请主记录保存失败");

View File

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

View File

@ -23,7 +23,7 @@ public class TrainingApplyUserAddCmd extends Command {
private String trainingApplyRecordId; private String trainingApplyRecordId;
@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 = "手机号", name = "phone", required = true) @ApiModelProperty(value = "手机号", name = "phone", required = true)
@ -31,7 +31,7 @@ public class TrainingApplyUserAddCmd extends Command {
private String phone; private String phone;
@ApiModelProperty(value = "身份证号" , name = "idCard", required = true) @ApiModelProperty(value = "身份证号" , name = "idCard", required = true)
@NotEmpty(message = "身份证号不能为空") // @NotEmpty(message = "身份证号不能为空")
private String idCard; private String idCard;
@ApiModelProperty(value = "申请状态1:待审批2:审批通过,3:审批不通过", name = "applyStatus", required = true) @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.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
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 com.zcloud.edu.domain.enums.ApplyStatusEnum; import com.zcloud.edu.domain.enums.ApplyStatusEnum;
import com.zcloud.edu.domain.enums.ApplyTypeEnum; 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.trainingApplyRecordId = StrUtil.isNotBlank(this.trainingApplyRecordId) ? this.trainingApplyRecordId : IdUtil.simpleUUID();
this.approvalStatus = ApprovalStatusEnum.PENDING.getCode(); this.approvalStatus = ApprovalStatusEnum.PENDING.getCode();