diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java index 01ec8ed68..476dbb7b4 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java @@ -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); - } - } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java index a99774bf9..fdb8abb30 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java @@ -67,7 +67,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ definitionQuery.processDefinitionKey(pageVO.getKey()); } // 执行查询 - List processDefinitions = definitionQuery.orderByProcessDefinitionId().desc() + List processDefinitions = definitionQuery.orderByProcessDefinitionVersion().desc() .listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); if (CollUtil.isEmpty(processDefinitions)) { return new PageResult<>(Collections.emptyList(), definitionQuery.count()); diff --git a/yudao-admin-ui/src/views/bpm/definition/index.vue b/yudao-admin-ui/src/views/bpm/definition/index.vue index 2b6554af5..6960c0a01 100644 --- a/yudao-admin-ui/src/views/bpm/definition/index.vue +++ b/yudao-admin-ui/src/views/bpm/definition/index.vue @@ -41,6 +41,13 @@ + + + @@ -56,6 +63,9 @@ + + + @@ -65,11 +75,13 @@ import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import {getForm} from "@/api/bpm/form"; import {decodeFields} from "@/utils/formGenerator"; import Parser from '@/components/parser/Parser' +import taskAssignRuleDialog from "../taskAssignRule/taskAssignRuleDialog"; export default { name: "processDefinition", components: { - Parser + Parser, + taskAssignRuleDialog }, data() { return { @@ -141,6 +153,10 @@ export default { this.showBpmnOpen = true }) }, + /** 处理任务分配规则列表的按钮操作 */ + handleAssignRule(row) { + this.$refs['taskAssignRuleDialog'].initProcessDefinition(row.id); + }, } }; diff --git a/yudao-admin-ui/src/views/bpm/task/done.vue b/yudao-admin-ui/src/views/bpm/task/done.vue index 9d63a2f7e..c738d2211 100644 --- a/yudao-admin-ui/src/views/bpm/task/done.vue +++ b/yudao-admin-ui/src/views/bpm/task/done.vue @@ -87,7 +87,7 @@ export default { showSearch: true, // 总条数 total: 0, - // 待办任务列表 + // 已办任务列表 list: [], // 查询参数 dateRangeCreateTime: [], diff --git a/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue b/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue index 654a2390e..093508599 100644 --- a/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue +++ b/yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue @@ -10,14 +10,14 @@ {{ getDictDataLabel(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE, scope.row.type) }} - + - +