1. 流程定义列表,增加任务分配规则的展示

2. 流程定义列表,按照 version 倒序
This commit is contained in:
YunaiV
2022-01-16 00:36:04 +08:00
parent a3d8e8726a
commit 3acb56f880
5 changed files with 38 additions and 17 deletions

View File

@ -52,6 +52,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
* 主要进行 Activiti {@link Model} 的维护
*
* @author yunlongn
* @author 芋道源码
*/
@Service
@Validated
@ -189,12 +190,7 @@ public class BpmModelServiceImpl implements BpmModelService {
String definitionId = processDefinitionService.createProcessDefinition(definitionCreateReqDTO);
// 将老的流程定义进行挂起。也就是说,只有最新部署的流程定义,才可以发起任务。
if (StrUtil.isNotEmpty(model.getDeploymentId())) {
ProcessDefinition oldDefinition = processDefinitionService.getProcessDefinitionByDeploymentId(model.getDeploymentId());
if (oldDefinition != null) {
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode());
}
}
updateProcessDefinitionSuspended(model.getDeploymentId());
// 更新 model 的 deploymentId进行关联
ProcessDefinition definition = processDefinitionService.getProcessDefinition(definitionId);
@ -226,6 +222,7 @@ public class BpmModelServiceImpl implements BpmModelService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteModel(String id) {
// 校验流程模型存在
Model model = repositoryService.getModel(id);
@ -234,6 +231,19 @@ public class BpmModelServiceImpl implements BpmModelService {
}
// 执行删除
repositoryService.deleteModel(id);
// 禁用流程实例
updateProcessDefinitionSuspended(model.getDeploymentId());
}
private void updateProcessDefinitionSuspended(String deploymentId) {
if (StrUtil.isEmpty(deploymentId)) {
return;
}
ProcessDefinition oldDefinition = processDefinitionService.getProcessDefinitionByDeploymentId(deploymentId);
if (oldDefinition == null) {
return;
}
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode());
}
@Override
@ -272,10 +282,4 @@ public class BpmModelServiceImpl implements BpmModelService {
}
}
public static void main(String[] args) {
// 创建转换对象
BpmnXMLConverter converter = new BpmnXMLConverter();
BpmnModel bpmnModel = converter.convertToBpmnModel(new StringStreamSource(""), true, true);
}
}

View File

@ -67,7 +67,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
definitionQuery.processDefinitionKey(pageVO.getKey());
}
// 执行查询
List<ProcessDefinition> processDefinitions = definitionQuery.orderByProcessDefinitionId().desc()
List<ProcessDefinition> processDefinitions = definitionQuery.orderByProcessDefinitionVersion().desc()
.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
if (CollUtil.isEmpty(processDefinitions)) {
return new PageResult<>(Collections.emptyList(), definitionQuery.count());