feat(REQ-7125) - 调整 OMS 脱敏逻辑

This commit is contained in:
wangli 2026-03-05 14:58:15 +08:00
parent ad01f4f7e9
commit 509c417637
2 changed files with 54 additions and 48 deletions

View File

@ -61,7 +61,6 @@ import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceLogVO;
import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
import cn.axzo.workflow.core.common.utils.BpmnCollectionUtils;
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
import cn.axzo.workflow.core.conf.OmsWorkspaceProperty;
import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceAsyncCmd;
import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceCmd;
import cn.axzo.workflow.core.engine.cmd.CustomCancelProcessInstanceAsyncCmd;
@ -303,8 +302,6 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
private ExtAxProcessSignService extAxProcessSignService;
@Resource
private ExtAxReadRecordService extAxReadRecordService;
@Resource
private OmsWorkspaceProperty omsWorkspaceProperty;
@Override
public HistoricProcessInstance getProcessInstanceByBusinessKey(String businessKey, @Nullable String tenantId,
@ -1704,54 +1701,12 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
// 处理是否加密
handleEncrypt(dto.getEncrypt(), tasks);
// 处理 oms 审批人脱敏
handleOmsApproverDesensitization(dto.getOmsApproveDesensitization(), tasks);
// handleOmsApproverDesensitization(dto.getOmsApproveDesensitization(), tasks);
// reset field forecastAssignees Empty to null;
resetCollectionToNull(tasks);
return tasks;
}
private void handleOmsApproverDesensitization(Boolean omsApproveDesensitization, List<BpmnTaskInstanceLogVO> tasks) {
if (Boolean.FALSE.equals(omsApproveDesensitization)) {
return;
}
tasks.forEach(i -> {
if (Objects.nonNull(i.getResult())) {
if (Objects.equals(i.getResult(), PROCESSING)) {
// 脱敏头像
if (Objects.nonNull(i.getAssigneeSnapshot()) && Objects.equals(i.getAssigneeSnapshot().getTenantId(), String.valueOf(omsWorkspaceProperty.getTenantId()))) {
// 目前该节点是单人审批
i.getAssigneeSnapshot().setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
} else if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().forEach(j -> {
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
});
}
} else {
// 隐藏姓名脱敏头像
if (Objects.nonNull(i.getAssigneeSnapshot())) {
// 目前该节点是单人审批
i.getAssigneeSnapshot().setAssignerName("");
i.getAssigneeSnapshot().setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
} else if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().forEach(j -> {
j.setAssignerName("");
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
});
}
i.setOperationDesc(i.getResult().getDesc());
}
} else {
// 未来节点
if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().forEach(j -> {
j.setAssignerName("");
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
});
}
}
});
}
private void resetCollectionToNull(List<BpmnTaskInstanceLogVO> tasks) {
tasks.forEach(i -> {
if (ListUtils.emptyIfNull(i.getForecastAssignees()).isEmpty()) {

View File

@ -47,12 +47,12 @@ import cn.axzo.workflow.common.model.response.bpmn.process.doc.DocPendingVO;
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskButtonVo;
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceLogVO;
import cn.axzo.workflow.common.valid.group.ValidGroup;
import cn.axzo.workflow.core.conf.OmsWorkspaceProperty;
import cn.axzo.workflow.core.engine.cmd.CustomGetModelDocsCmd;
import cn.axzo.workflow.core.repository.entity.ExtAxProcessLog;
import cn.axzo.workflow.core.repository.mapper.ExtAxModelDocMapper;
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
import cn.axzo.workflow.core.service.BpmnProcessTaskService;
import cn.axzo.workflow.core.service.CategoryService;
import cn.axzo.workflow.core.service.ExtAxProcessLogService;
import cn.axzo.workflow.core.service.ExtAxProcessSignService;
import cn.axzo.workflow.core.service.ExtAxReModelService;
@ -100,6 +100,7 @@ import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_DOC_ID_N
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_DOC_READ_PARAM_ERROR;
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_EXT_LOG_PARAM_ERROR;
import static cn.axzo.workflow.common.constant.BpmnConstants.SIGN_BIZ_CUSTOM_DOCS;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.PROCESSING;
import static cn.azxo.framework.common.model.CommonResponse.success;
/**
@ -133,7 +134,7 @@ public class BpmnProcessInstanceController extends BasicPopulateAvatarController
@Resource
private ExtAxProcessLogService extAxProcessLogService;
@Resource
private CategoryService categoryService;
private OmsWorkspaceProperty omsWorkspaceProperty;
/**
* 超管查询所有流程实例
@ -440,9 +441,59 @@ public class BpmnProcessInstanceController extends BasicPopulateAvatarController
BpmnProcessInstanceLogVO log = bpmnProcessInstanceService.getProcessInstanceLog(dto);
parseSignatureUrl(log);
resetPersonInfo(log);
handleOmsApproverDesensitization(dto.getOmsApproveDesensitization(), log.getTaskDetails());
return success(log);
}
private void handleOmsApproverDesensitization(Boolean omsApproveDesensitization, List<BpmnTaskInstanceLogVO> tasks) {
if (Boolean.FALSE.equals(omsApproveDesensitization)) {
return;
}
tasks.forEach(i -> {
if (Objects.nonNull(i.getResult())) {
if (Objects.equals(i.getResult(), PROCESSING)) {
// 脱敏头像
if (Objects.nonNull(i.getAssigneeSnapshot()) && Objects.equals(i.getAssigneeSnapshot().getTenantId(), String.valueOf(omsWorkspaceProperty.getWorkspaceId()))) {
// 目前该节点是单人审批
i.getAssigneeSnapshot().setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
} else if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().stream()
.filter(j -> Objects.equals(j.getTenantId(), String.valueOf(omsWorkspaceProperty.getWorkspaceId())))
.forEach(j -> {
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
});
}
} else {
// 隐藏姓名脱敏头像
if (Objects.nonNull(i.getAssigneeSnapshot()) && Objects.equals(i.getAssigneeSnapshot().getTenantId(), String.valueOf(omsWorkspaceProperty.getWorkspaceId()))) {
// 目前该节点是单人审批
i.getAssigneeSnapshot().setAssignerName("");
i.getAssigneeSnapshot().setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
i.setOperationDesc(i.getResult().getDesc());
} else if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().stream()
.filter(j -> Objects.equals(j.getTenantId(), String.valueOf(omsWorkspaceProperty.getWorkspaceId())))
.forEach(j -> {
j.setAssignerName("");
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
i.setOperationDesc(i.getResult().getDesc());
});
}
}
} else {
// 未来节点
if (!CollectionUtils.isEmpty(i.getForecastAssignees())) {
i.getForecastAssignees().stream()
.filter(j -> Objects.equals(j.getTenantId(), String.valueOf(omsWorkspaceProperty.getWorkspaceId())))
.forEach(j -> {
j.setAssignerName("");
j.setAvatar("https://axzo-public.oss-cn-chengdu.aliyuncs.com/app/app/1d718eb672a44247a6e530548dc0100f.svg");
});
}
}
});
}
/**
* 根据任务id查询任务状态按钮详情