hotfix - 修复撤回接口的参数校验逻辑

This commit is contained in:
wangli 2025-04-14 17:34:04 +08:00
parent 794d17e2a9
commit 494fab37d9
3 changed files with 4 additions and 5 deletions

View File

@ -38,14 +38,13 @@ public class CustomCancelProcessInstanceAsyncCmd extends AbstractCommand<Void> i
@Override @Override
public Void execute(CommandContext commandContext) { public Void execute(CommandContext commandContext) {
String processInstanceId = dto.getProcessInstanceId(), tenantId = dto.getTenantId(); String processInstanceId = dto.getProcessInstanceId();
BpmnTaskDelegateAssigner initiator = dto.getInitiator(); BpmnTaskDelegateAssigner initiator = dto.getInitiator();
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
HistoryService historyService = processEngineConfiguration.getHistoryService(); HistoryService historyService = processEngineConfiguration.getHistoryService();
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)
.processInstanceTenantId(tenantId)
.singleResult(); .singleResult();
if (Objects.isNull(instance)) { if (Objects.isNull(instance)) {
throw new WorkflowEngineException(PROCESS_INSTANCE_NOT_EXISTS); throw new WorkflowEngineException(PROCESS_INSTANCE_NOT_EXISTS);

View File

@ -102,7 +102,7 @@ public class CustomCancelProcessInstanceCmd extends AbstractCommand<Void> implem
throw new WorkflowEngineException(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS); throw new WorkflowEngineException(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS);
} }
if (Objects.isNull(initiator) || !initiator.comparePersonIdToOther(instance.getStartUserId())) { if (!Objects.equals(Boolean.TRUE, superAdmin) || !initiator.comparePersonIdToOther(instance.getStartUserId())) {
throw new WorkflowEngineException(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF); throw new WorkflowEngineException(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF);
} }

View File

@ -147,7 +147,7 @@ public class BpmnProcessInstanceController extends BasicPopulateAvatarController
@DeleteMapping("/cancel") @DeleteMapping("/cancel")
@Override @Override
@RepeatSubmit @RepeatSubmit
public CommonResponse<Boolean> cancelProcessInstance(@Validated(ValidGroup.Insert.class) @RequestBody BpmnProcessInstanceCancelDTO dto) { public CommonResponse<Boolean> cancelProcessInstance(@Validated(ValidGroup.Update.class) @RequestBody BpmnProcessInstanceCancelDTO dto) {
log.info("撤回审核cancelProcessInstant===>>>参数:{}", JSONUtil.toJsonStr(dto)); log.info("撤回审核cancelProcessInstant===>>>参数:{}", JSONUtil.toJsonStr(dto));
populateUsersAvatar(dto.getInitiator()); populateUsersAvatar(dto.getInitiator());
SuperBpmnProcessInstanceCancelDTO target = new SuperBpmnProcessInstanceCancelDTO(); SuperBpmnProcessInstanceCancelDTO target = new SuperBpmnProcessInstanceCancelDTO();
@ -159,7 +159,7 @@ public class BpmnProcessInstanceController extends BasicPopulateAvatarController
@DeleteMapping("/super/cancel") @DeleteMapping("/super/cancel")
@RepeatSubmit @RepeatSubmit
@Override @Override
public CommonResponse<Boolean> superCancelProcessInstance(@Validated(ValidGroup.Update.class) @RequestBody SuperBpmnProcessInstanceCancelDTO dto) { public CommonResponse<Boolean> superCancelProcessInstance(@Validated(ValidGroup.Insert.class) @RequestBody SuperBpmnProcessInstanceCancelDTO dto) {
log.info("超级撤回审核 superCancelProcessInstant===>>>参数:{}", JSONUtil.toJsonStr(dto)); log.info("超级撤回审核 superCancelProcessInstant===>>>参数:{}", JSONUtil.toJsonStr(dto));
populateUsersAvatar(dto.getInitiator()); populateUsersAvatar(dto.getInitiator());
return success(bpmnProcessInstanceService.cancelProcessInstance(dto)); return success(bpmnProcessInstanceService.cancelProcessInstance(dto));