update - 兼容版本处理

This commit is contained in:
wangli 2024-01-18 18:15:26 +08:00
parent e9925f6667
commit 8643486275
2 changed files with 35 additions and 8 deletions

View File

@ -55,6 +55,7 @@ import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.form.api.FormInfo;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -362,25 +363,32 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
processInstance.getProcessDefinitionId());
}
BpmnTaskDelegateAssigner assigner;
BpmnTaskDelegateAssigner assigner = null;
String version = null;
if (dto.getHasVariable()) {
assigner = (BpmnTaskDelegateAssigner) processInstance.getProcessVariables().get(INTERNAL_INITIATOR);
if (Objects.isNull(assigner)) {
assigner = (BpmnTaskDelegateAssigner) processInstance.getProcessVariables().get(OLD_INTERNAL_INITIATOR);
}
version = (String) processInstance.getProcessVariables().get(WORKFLOW_ENGINE_VERSION);
} else {
assigner = (BpmnTaskDelegateAssigner) runtimeService.getVariable(processInstance.getId(),
INTERNAL_INITIATOR);
if (Objects.isNull(assigner)) {
assigner = (BpmnTaskDelegateAssigner) runtimeService.getVariable(processInstance.getId(),
OLD_INTERNAL_INITIATOR);
List<HistoricVariableInstance> variableInstances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstance.getId()).list();
for (HistoricVariableInstance i : variableInstances) {
if (Objects.equals(i.getVariableName(), INTERNAL_INITIATOR) || Objects.equals(i.getVariableName(),
OLD_INTERNAL_INITIATOR)) {
assigner = (BpmnTaskDelegateAssigner) i.getValue();
}
if (Objects.equals(i.getVariableName(), WORKFLOW_ENGINE_VERSION)) {
version = (String) i.getValue();
}
}
}
String version = (String) runtimeService.getVariable(processInstance.getId(), WORKFLOW_ENGINE_VERSION);
if (Objects.isNull(version)) {
version = FLOW_SERVER_VERSION_121;
}
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
return instanceConverter.toVo(processInstance, processDefinition, getButtonConfig(bpmnModel.getMainProcess())
, assigner, version);

View File

@ -0,0 +1,19 @@
package cn.axzo.workflow.server.aspect;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
/**
* Controller 方法执行耗时
*
* @author wangli
* @since 2024/1/18 18:02
*/
@Aspect
@Component
public class ControllerTimingAspect {
@Pointcut("within(@org.springframework.web.bind.annotation.RestController *)")
public void controllerMethods() {}
}