之前自定义业务表单只能关联自定义业务的流程应用类型,所以需要根据这个进行选择与显示
1、ProcessQuery 参数增加appType
public class ProcessQuery {
/**
* 流程标识
*/
private String processKey;
/**
* 流程名称
*/
private String processName;
/**
* 流程分类
*/
private String category;
/**
* 流程应用类型
*/
private String appType;
/**
* 状态
*/
private String state;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
2、同时queryPageList的发布流程列表修改如下,要根据应用类型来进行选择过滤
@Override
public TableDataInfo<WfDeployVo> queryPageList(ProcessQuery processQuery, PageQuery pageQuery) {
// 流程定义列表数据查询
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
.latestVersion()
.orderByProcessDefinitionKey()
.asc();
// 构建搜索条件
ProcessUtils.buildProcessSearch(processDefinitionQuery, processQuery);
long pageTotal = processDefinitionQuery.count();
if (pageTotal <= 0) {
return TableDataInfo.build();
}
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
List<ProcessDefinition> definitionList = processDefinitionQuery.listPage(offset, pageQuery.getPageSize());
List<WfDeployVo> deployVoList = new ArrayList<>(definitionList.size());
for (ProcessDefinition processDefinition : definitionList) {
if( StringUtils.isNotBlank(processQuery.getAppType())) {
if ( processQuery.getAppType().equalsIgnoreCase(categoryMapper.selectAppTypeByCode(processDefinition.getCategory()))) {
String deploymentId = processDefinition.getDeploymentId();
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
WfDeployVo vo = new WfDeployVo();
vo.setDefinitionId(processDefinition.getId());
vo.setProcessKey(processDefinition.getKey());
vo.setProcessName(processDefinition.getName());
vo.setVersion(processDefinition.getVersion());
vo.setCategory(processDefinition.getCategory());
vo.setAppType(categoryMapper.selectAppTypeByCode(processDefinition.getCategory()));
vo.setDeploymentId(processDefinition.getDeploymentId());
vo.setSuspended(processDefinition.isSuspended());
// 流程部署信息
vo.setCategory(deployment.getCategory());
vo.setDeploymentTime(deployment.getDeploymentTime());
deployVoList.add(vo);
}
}
else {
String deploymentId = processDefinition.getDeploymentId();
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
WfDeployVo vo = new WfDeployVo();
vo.setDefinitionId(processDefinition.getId());
vo.setProcessKey(processDefinition.getKey());
vo.setProcessName(processDefinition.getName());
vo.setVersion(processDefinition.getVersion());
vo.setCategory(processDefinition.getCategory());
vo.setAppType(categoryMapper.selectAppTypeByCode(processDefinition.getCategory()));
vo.setDeploymentId(processDefinition.getDeploymentId());
vo.setSuspended(processDefinition.isSuspended());
// 流程部署信息
vo.setCategory(deployment.getCategory());
vo.setDeploymentTime(deployment.getDeploymentTime());
deployVoList.add(vo);
}
}
Page<WfDeployVo> page = new Page<>();
page.setRecords(deployVoList);
page.setTotal(pageTotal);
return TableDataInfo.build(page);
}
3、效果如下: