feat(REQ-3769) - 测试流程审批过程中,替换文件变量
This commit is contained in:
parent
5f34a74b88
commit
1d40dca871
@ -234,4 +234,5 @@ public interface BpmnConstants {
|
|||||||
* 签署人
|
* 签署人
|
||||||
*/
|
*/
|
||||||
String SIGNATORIES = "[_SIGNATORIES_]";
|
String SIGNATORIES = "[_SIGNATORIES_]";
|
||||||
|
String TASK_SUBMIT_FORM_VARIABLE = "[_TASK_SUBMIT_FORM_VARIABLE_]";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_ADVICE
|
|||||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
||||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_SPECIFY_NEXT_APPROVER;
|
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_SPECIFY_NEXT_APPROVER;
|
||||||
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
|
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
|
||||||
|
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_SUBMIT_FORM_VARIABLE;
|
||||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
|
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
|
||||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addComment;
|
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addComment;
|
||||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.batchAddAttachment;
|
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.batchAddAttachment;
|
||||||
@ -209,6 +210,7 @@ public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implemen
|
|||||||
.deploymentId(relation.getFormDeploymentId())
|
.deploymentId(relation.getFormDeploymentId())
|
||||||
.singleResult();
|
.singleResult();
|
||||||
Authentication.setAuthenticatedUserId(approver.buildAssigneeId());
|
Authentication.setAuthenticatedUserId(approver.buildAssigneeId());
|
||||||
|
runtimeService.setVariableLocal(task.getProcessInstanceId(), TASK_SUBMIT_FORM_VARIABLE, formVariables);
|
||||||
taskService.completeTaskWithForm(taskId, formDefinition.getId(), null, formVariables);
|
taskService.completeTaskWithForm(taskId, formDefinition.getId(), null, formVariables);
|
||||||
Authentication.setAuthenticatedUserId(null);
|
Authentication.setAuthenticatedUserId(null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2,18 +2,20 @@ package cn.axzo.workflow.core.engine.cmd;
|
|||||||
|
|
||||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||||
|
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||||
import org.flowable.form.api.FormInstance;
|
import org.flowable.form.api.FormInstance;
|
||||||
import org.flowable.form.api.FormService;
|
import org.flowable.form.api.FormService;
|
||||||
import org.flowable.form.engine.FormEngineConfiguration;
|
import org.flowable.form.engine.FormEngineConfiguration;
|
||||||
import org.flowable.form.engine.impl.cmd.GetFormInstanceValuesCmd;
|
import org.flowable.form.engine.impl.cmd.GetFormInstanceValuesCmd;
|
||||||
import org.flowable.form.engine.impl.persistence.entity.FormInstanceEntityManager;
|
|
||||||
import org.flowable.form.engine.impl.util.CommandContextUtil;
|
import org.flowable.form.engine.impl.util.CommandContextUtil;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static cn.axzo.workflow.common.code.FormInstanceRespCode.FORM_INSTANCE_DATA_NOT_FOUND;
|
import static cn.axzo.workflow.common.code.FormInstanceRespCode.FORM_INSTANCE_DATA_NOT_FOUND;
|
||||||
|
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_SUBMIT_FORM_VARIABLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的获取表单实例数据的命令
|
* 自定义的获取表单实例数据的命令
|
||||||
@ -44,9 +46,10 @@ public class CustomGetFormInstanceLatestValuesCmd extends GetFormInstanceValuesC
|
|||||||
if (StringUtils.hasText(formInstanceId) && !StringUtils.hasText(processInstanceId)) {
|
if (StringUtils.hasText(formInstanceId) && !StringUtils.hasText(processInstanceId)) {
|
||||||
return super.execute(commandContext);
|
return super.execute(commandContext);
|
||||||
}
|
}
|
||||||
FormInstanceEntityManager formInstanceEntityManager = CommandContextUtil.getFormInstanceEntityManager(commandContext);
|
ProcessEngineConfigurationImpl processEngineConfiguration = org.flowable.engine.impl.util.CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||||
|
Map<String, Object> variableLocal = (Map<String, Object>) processEngineConfiguration.getRuntimeService().getVariableLocal(processInstanceId, TASK_SUBMIT_FORM_VARIABLE, Map.class);
|
||||||
|
if (CollectionUtils.isEmpty(variableLocal)) {
|
||||||
FormEngineConfiguration formEngineConfiguration = CommandContextUtil.getFormEngineConfiguration();
|
FormEngineConfiguration formEngineConfiguration = CommandContextUtil.getFormEngineConfiguration();
|
||||||
|
|
||||||
FormService formService = formEngineConfiguration.getFormService();
|
FormService formService = formEngineConfiguration.getFormService();
|
||||||
List<FormInstance> formInstances = formService.createFormInstanceQuery().processInstanceId(processInstanceId)
|
List<FormInstance> formInstances = formService.createFormInstanceQuery().processInstanceId(processInstanceId)
|
||||||
.orderBySubmittedDate().desc().listPage(0, 1);
|
.orderBySubmittedDate().desc().listPage(0, 1);
|
||||||
@ -59,4 +62,7 @@ public class CustomGetFormInstanceLatestValuesCmd extends GetFormInstanceValuesC
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO 测试会签场景下的表达提交数据 variableLocal 是什么结构
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,6 @@ public class TempFileArchiveActivityEvent_101_Listener extends AbstractBpmnEvent
|
|||||||
if (!signConfig.isPresent()) {
|
if (!signConfig.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||||
ExtAxProcessSign processSign = extAxProcessSignService.findByProcessInstanceId(execution.getProcessInstanceId());
|
ExtAxProcessSign processSign = extAxProcessSignService.findByProcessInstanceId(execution.getProcessInstanceId());
|
||||||
processSign.getFileArchive().stream().filter(i -> Objects.equals(i.getFileType(), FileTypeEnum.WORD)
|
processSign.getFileArchive().stream().filter(i -> Objects.equals(i.getFileType(), FileTypeEnum.WORD)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user