增加工作流发起时间和comment到变量中

This commit is contained in:
guoshengxiong 2024-08-23 10:06:56 +08:00
parent 8242b3e2a5
commit 3ce4ef018e

View File

@ -6,7 +6,6 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import com.wflow.bean.do_.UserDeptDo;
import com.wflow.service.OrgRepositoryService;
import com.wflow.workflow.bean.dto.ProcessInstanceOwnerDto;
import com.wflow.workflow.bean.process.HttpDefinition;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.process.props.ConditionProps;
@ -25,6 +24,8 @@ import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -365,6 +366,8 @@ public class UELTools {
}
}
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
List<Comment> processInstanceComments = taskService.getProcessInstanceComments(instanceId);
variables.put("formName", definition.getName());
variables.put("instanceId", instanceId);
//获取流程发起人信息
@ -380,6 +383,8 @@ public class UELTools {
variables.put("owner.deptName", userDeptDo.getDeptName());
variables.put("tenantId", TenantContextHolder.getTenantId());
variables.put("op.user", opUserIds);
variables.put("startTime", processInstance.getStartTime());
variables.put("fullMessages", processInstanceComments.stream().map(comment -> comment.getFullMessage()).collect(Collectors.toList()));
return variables;
}