From fe56d910aef7dd66dbb0032dc21bf9f5059b40c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Thu, 22 Aug 2024 16:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 23 +- .../flowable/domain/FlowCommentDto.java | 25 - .../flowable/domain/FlowFromFieldDTO.java | 15 - .../yanzhu/flowable/domain/FlowNextDto.java | 19 - .../yanzhu/flowable/domain/FlowSaveXmlVo.java | 43 - .../yanzhu/flowable/domain/FlowTaskDto.java | 103 -- .../yanzhu/flowable/domain/FlowViewerDto.java | 23 - ...sExpression.java => FlowableCategory.java} | 50 +- .../flowable/domain/FlowableDeploy.java | 70 + .../flowable/domain/FlowableFieldDef.java | 126 ++ .../flowable/domain/FlowableFieldRef.java | 97 ++ .../flowable/domain/FlowableFieldSearch.java | 13 + .../yanzhu/flowable/domain/FlowableModel.java | 165 +++ .../flowable/domain/FlowableModelPage.java | 97 ++ .../yanzhu/flowable/domain/SysDeployForm.java | 64 - .../com/yanzhu/flowable/domain/SysForm.java | 70 - .../yanzhu/flowable/domain/SysListener.java | 126 -- .../yanzhu/flowable/domain/SysTaskForm.java | 65 - .../domain/bo/FlowableMetaInfoBo.java | 30 + .../flowable/domain/bo/FlowableModelBo.java | 49 + .../domain/{vo => my}/FlowDeptVo.java | 2 +- .../domain/{ => my}/FlowProcDefDto.java | 3 +- .../domain/{ => my}/FlowTaskEntity.java | 2 +- .../flowable/domain/vo/FlowQueryVo.java | 49 - .../yanzhu/flowable/domain/vo/FlowTaskVo.java | 59 - .../flowable/domain/vo/ProcKeyRole.java | 50 - .../flowable/domain/vo/ReturnTaskNodeVo.java | 23 - .../flowable/domain/vo/StartTaskVO.java | 63 - .../mapper/FlowBusinessKeyMapper.java | 2 +- .../flowable/mapper/FlowDeployMapper.java | 76 - .../mapper/FlowableCategoryMapper.java | 61 + .../mapper/FlowableFieldDefMapper.java | 69 + .../mapper/FlowableFieldRefMapper.java | 61 + .../mapper/FlowableModelPageMapper.java | 61 + .../flowable/mapper/SysDeployFormMapper.java | 70 - .../flowable/mapper/SysExpressionMapper.java | 62 - .../yanzhu/flowable/mapper/SysFormMapper.java | 62 - .../flowable/mapper/SysListenerMapper.java | 62 - .../flowable/mapper/SysTaskFormMapper.java | 62 - .../mapper/flowable/FlowBusinessKeyMapper.xml | 152 +- .../mapper/flowable/FlowDeployMapper.xml | 125 -- ...nMapper.xml => FlowableCategoryMapper.xml} | 83 +- .../flowable/FlowableFieldDefMapper.xml | 113 ++ .../flowable/FlowableFieldRefMapper.xml | 89 ++ .../flowable/FlowableModelPageMapper.xml | 87 ++ .../mapper/flowable/SysDeployFormMapper.xml | 66 - .../mapper/flowable/SysFormMapper.xml | 82 -- .../mapper/flowable/SysListenerMapper.xml | 115 -- .../mapper/flowable/SysTaskFormMapper.xml | 61 - yanzhu-modules/yanzhu-flowable/pom.xml | 12 +- .../common/constant/ProcessConstants.java | 2 + .../flowable/common/enums/CacheType.java | 29 + .../flowable/common/enums/FormType.java | 33 + .../flowable/config/FlowableConfig.java | 64 +- .../flowable/config/FlowableEngineConfig.java | 63 + .../config/FlowableGlobalListenerConfig.java | 82 +- .../controller/FlowBusinessKeyController.java | 2 +- .../controller/FlowDefinitionController.java | 198 --- .../controller/FlowInstanceController.java | 63 - .../controller/FlowTaskController.java | 268 ---- .../FlowableCategoryController.java | 98 ++ .../controller/FlowableDeployController.java | 97 ++ .../FlowableFieldDefController.java | 109 ++ .../FlowableFieldRefController.java | 113 ++ .../controller/FlowableModelController.java | 172 +++ .../FlowableModelPageController.java | 152 ++ .../controller/SysFormController.java | 111 -- .../flow/CustomProcessDiagramCanvas.java | 1 - .../com/yanzhu/flowable/flow/ModelHelper.java | 143 ++ .../service/IFlowBusinessKeyService.java | 2 +- .../service/IFlowDefinitionService.java | 81 - .../service/IFlowInstanceService.java | 54 - .../flowable/service/IFlowTaskService.java | 208 --- .../service/IFlowableCategoryService.java | 69 + .../service/IFlowableDeployService.java | 68 + .../service/IFlowableFieldDefService.java | 70 + .../service/IFlowableFieldRefService.java | 62 + .../service/IFlowableModelPageService.java | 83 ++ .../service/IFlowableModelService.java | 96 ++ .../service/ISysDeployFormService.java | 70 - .../service/ISysExpressionService.java | 62 - .../flowable/service/ISysFormService.java | 61 - .../flowable/service/ISysTaskFormService.java | 62 - .../impl/FlowBusinessKeyServiceImpl.java | 3 +- .../impl/FlowDefinitionServiceImpl.java | 279 ---- .../service/impl/FlowInstanceServiceImpl.java | 117 -- .../service/impl/FlowTaskServiceImpl.java | 1307 ----------------- .../impl/FlowableCategoryServiceImpl.java | 126 ++ .../impl/FlowableDeployServiceImpl.java | 222 +++ .../impl/FlowableFieldDefServiceImpl.java | 109 ++ .../impl/FlowableFieldRefServiceImpl.java | 97 ++ .../impl/FlowableModelPageServiceImpl.java | 183 +++ .../impl/FlowableModelServiceImpl.java | 423 ++++++ .../impl/SysDeployFormServiceImpl.java | 112 -- .../impl/SysExpressionServiceImpl.java | 97 -- .../service/impl/SysFormServiceImpl.java | 97 -- .../service/impl/SysTaskFormServiceImpl.java | 94 -- yanzhu-ui-vue3/src/App.vue | 5 + yanzhu-ui-vue3/src/api/flowable/category.js | 44 + yanzhu-ui-vue3/src/api/flowable/def.js | 52 + .../src/api/flowable/deploy/index.ts | 45 - .../src/api/flowable/deploy/types.ts | 19 - yanzhu-ui-vue3/src/api/flowable/form/index.ts | 46 - yanzhu-ui-vue3/src/api/flowable/form/types.ts | 17 - .../src/api/flowable/identity/index.ts | 19 - .../src/api/flowable/identity/types.ts | 11 - .../src/api/flowable/listener/index.ts | 81 - .../src/api/flowable/listener/types.ts | 40 - yanzhu-ui-vue3/src/api/flowable/model.js | 83 ++ .../src/api/flowable/model/index.ts | 86 -- .../src/api/flowable/model/types.ts | 38 - yanzhu-ui-vue3/src/api/flowable/page.js | 53 + yanzhu-ui-vue3/src/api/flowable/ref.js | 52 + .../src/api/flowable/work/process.ts | 108 -- yanzhu-ui-vue3/src/api/flowable/work/task.ts | 73 - yanzhu-ui-vue3/src/api/flowable/work/types.ts | 32 - .../src/components/bpmn/PropertyPanel.vue | 304 ++++ .../context-pad/CustomContextPadProvider.ts | 512 +++++++ .../bpmn/extension/FlowableExtension.ts | 10 + .../components/bpmn/form/ApproverConfig.vue | 205 +++ .../src/components/bpmn/form/BasicSetting.vue | 100 ++ .../bpmn/form/ExecutionListener.vue | 290 ++++ .../bpmn/form/ExecutionListenerForm.vue | 74 + .../bpmn/form/ListenerFieldInject.vue | 277 ++++ .../src/components/bpmn/form/PageConfig.vue | 98 ++ .../components/bpmn/form/SeqFlowConfig.vue | 172 +++ .../src/components/bpmn/form/TaskListener.vue | 290 ++++ .../components/bpmn/form/TaskListenerForm.vue | 62 + .../src/components/bpmn/form/util.ts | 35 + .../components/bpmn/moddle/CustomModdle.ts | 6 + .../src/views/flowable/category/index.vue | 251 ++++ .../src/views/flowable/def/index.vue | 305 ++++ .../src/views/flowable/deploy/index.vue | 531 ++++--- .../src/views/flowable/form/index.vue | 258 ---- .../src/views/flowable/listener/index.vue | 480 ------ .../views/flowable/model/fieldmaintenance.vue | 281 ++++ .../src/views/flowable/model/index.vue | 781 +++++----- .../src/views/flowable/ref/index.vue | 280 ++++ .../src/views/flowable/work/claim.vue | 142 -- .../src/views/flowable/work/copy.vue | 133 -- .../src/views/flowable/work/detail.vue | 544 ------- .../src/views/flowable/work/finished.vue | 152 -- .../src/views/flowable/work/index.vue | 10 - .../src/views/flowable/work/initiate.vue | 164 --- .../src/views/flowable/work/own.vue | 202 --- .../src/views/flowable/work/start.vue | 77 - .../src/views/flowable/work/todo.vue | 146 -- 147 files changed, 8766 insertions(+), 8581 deletions(-) delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowCommentDto.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowFromFieldDTO.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowNextDto.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowSaveXmlVo.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskDto.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowViewerDto.java rename yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/{SysExpression.java => FlowableCategory.java} (62%) create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableDeploy.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldDef.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldRef.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldSearch.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModel.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModelPage.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysDeployForm.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysForm.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysListener.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysTaskForm.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableMetaInfoBo.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableModelBo.java rename yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/{vo => my}/FlowDeptVo.java (96%) rename yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/{ => my}/FlowProcDefDto.java (97%) rename yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/{ => my}/FlowTaskEntity.java (99%) delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowTaskVo.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ProcKeyRole.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ReturnTaskNodeVo.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/StartTaskVO.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableCategoryMapper.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldDefMapper.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldRefMapper.java create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableModelPageMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysDeployFormMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysExpressionMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysFormMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysListenerMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysTaskFormMapper.java delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml rename yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/{SysExpressionMapper.xml => FlowableCategoryMapper.xml} (57%) create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldDefMapper.xml create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldRefMapper.xml create mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableModelPageMapper.xml delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysDeployFormMapper.xml delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysFormMapper.xml delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysListenerMapper.xml delete mode 100644 yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysTaskFormMapper.xml create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/CacheType.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FormType.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableEngineConfig.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowInstanceController.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowTaskController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableCategoryController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableDeployController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldDefController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldRefController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelPageController.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/SysFormController.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelHelper.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowInstanceService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowTaskService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableCategoryService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableDeployService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldDefService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldRefService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelPageService.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysDeployFormService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysExpressionService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysFormService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysTaskFormService.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableCategoryServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableDeployServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldDefServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldRefServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelPageServiceImpl.java create mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysDeployFormServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysExpressionServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysFormServiceImpl.java delete mode 100644 yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysTaskFormServiceImpl.java create mode 100644 yanzhu-ui-vue3/src/api/flowable/category.js create mode 100644 yanzhu-ui-vue3/src/api/flowable/def.js delete mode 100644 yanzhu-ui-vue3/src/api/flowable/deploy/index.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/deploy/types.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/form/index.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/form/types.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/identity/index.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/identity/types.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/listener/index.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/listener/types.ts create mode 100644 yanzhu-ui-vue3/src/api/flowable/model.js delete mode 100644 yanzhu-ui-vue3/src/api/flowable/model/index.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/model/types.ts create mode 100644 yanzhu-ui-vue3/src/api/flowable/page.js create mode 100644 yanzhu-ui-vue3/src/api/flowable/ref.js delete mode 100644 yanzhu-ui-vue3/src/api/flowable/work/process.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/work/task.ts delete mode 100644 yanzhu-ui-vue3/src/api/flowable/work/types.ts create mode 100644 yanzhu-ui-vue3/src/components/bpmn/PropertyPanel.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/context-pad/CustomContextPadProvider.ts create mode 100644 yanzhu-ui-vue3/src/components/bpmn/extension/FlowableExtension.ts create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/ApproverConfig.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/BasicSetting.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListener.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListenerForm.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/ListenerFieldInject.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/PageConfig.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/SeqFlowConfig.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/TaskListener.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/TaskListenerForm.vue create mode 100644 yanzhu-ui-vue3/src/components/bpmn/form/util.ts create mode 100644 yanzhu-ui-vue3/src/components/bpmn/moddle/CustomModdle.ts create mode 100644 yanzhu-ui-vue3/src/views/flowable/category/index.vue create mode 100644 yanzhu-ui-vue3/src/views/flowable/def/index.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/form/index.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/listener/index.vue create mode 100644 yanzhu-ui-vue3/src/views/flowable/model/fieldmaintenance.vue create mode 100644 yanzhu-ui-vue3/src/views/flowable/ref/index.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/claim.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/copy.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/detail.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/finished.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/index.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/initiate.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/own.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/start.vue delete mode 100644 yanzhu-ui-vue3/src/views/flowable/work/todo.vue diff --git a/pom.xml b/pom.xml index 15a4b486..4d1a5d72 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,8 @@ 0.9.1 8.2.2 4.1.2 - 6.7.2 + 7.0.0 + 2.1.2 2.14.2 @@ -69,12 +70,6 @@ import - - org.flowable - flowable-spring-boot-starter - ${flowable.version} - - com.github.tobato @@ -150,6 +145,20 @@ ${transmittable-thread-local.version} + + + jakarta.mail + jakarta.mail-api + ${jakarta.version} + + + + + org.flowable + flowable-spring-boot-starter + ${flowable.version} + + com.yanzhu diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowCommentDto.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowCommentDto.java deleted file mode 100644 index 4b9d597c..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowCommentDto.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yanzhu.flowable.domain; - -import lombok.Builder; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author Tony - * @date 2021/3/28 15:50 - */ -@Data -@Builder -public class FlowCommentDto implements Serializable { - - /** - * 意见类别 0 正常意见 1 退回意见 2 驳回意见 - */ - private String type; - - /** - * 意见内容 - */ - private String comment; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowFromFieldDTO.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowFromFieldDTO.java deleted file mode 100644 index e5912074..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowFromFieldDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yanzhu.flowable.domain; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @author Tony - * @date 2021/3/31 23:20 - */ -@Data -public class FlowFromFieldDTO implements Serializable { - - private Object fields; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowNextDto.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowNextDto.java deleted file mode 100644 index 70b506a0..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowNextDto.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.yanzhu.flowable.domain; - -import lombok.Data; - -import java.io.Serializable; - -/** - * 动态人员、组 - * @author Tony - * @date 2021/4/17 22:59 - */ -@Data -public class FlowNextDto implements Serializable { - - private String type; - private String dataType; - private String vars; - -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowSaveXmlVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowSaveXmlVo.java deleted file mode 100644 index a06d435a..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowSaveXmlVo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.yanzhu.flowable.domain; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @author Tony - * @date 2021/3/28 19:48 - */ -@Data -public class FlowSaveXmlVo implements Serializable { - - /** - * 流程名称 - */ - private String name; - - /** - * 流程分类 - */ - private String category; - - /** - * 流程定义类型 - */ - private String prtype; - - /** - * 流程单位 - */ - private String ownerDeptId; - - /** - * 流程项目 - */ - private String OwnerProjectId; - - /** - * xml 文件 - */ - private String xml; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskDto.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskDto.java deleted file mode 100644 index 5db80e9b..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskDto.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.yanzhu.flowable.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.Setter; - -import java.io.Serializable; -import java.util.Date; - -/** - *

工作流任务

- * - * @author Tony - * @date 2021-04-03 - */ -@Getter -@Setter -@ApiModel("工作流任务相关-返回参数") -public class FlowTaskDto implements Serializable { - - @ApiModelProperty("任务编号") - private String taskId; - - @ApiModelProperty("任务执行编号") - private String executionId; - - @ApiModelProperty("任务名称") - private String taskName; - - @ApiModelProperty("任务Key") - private String taskDefKey; - - @ApiModelProperty("任务执行人Id") - private Long assigneeId; - - @ApiModelProperty("部门名称") - private String deptName; - - @ApiModelProperty("流程发起人部门名称") - private String startDeptName; - - @ApiModelProperty("任务执行人名称") - private String assigneeName; - - @ApiModelProperty("任务执行人部门") - private String assigneeDeptName;; - - @ApiModelProperty("流程发起人Id") - private String startUserId; - - @ApiModelProperty("流程发起人名称") - private String startUserName; - - @ApiModelProperty("流程类型") - private String category; - - @ApiModelProperty("流程变量信息") - private Object procVars; - - @ApiModelProperty("局部变量信息") - private Object taskLocalVars; - - @ApiModelProperty("流程部署编号") - private String deployId; - - @ApiModelProperty("流程ID") - private String procDefId; - - @ApiModelProperty("流程key") - private String procDefKey; - - @ApiModelProperty("流程定义名称") - private String procDefName; - - @ApiModelProperty("流程定义内置使用版本") - private int procDefVersion; - - @ApiModelProperty("流程实例ID") - private String procInsId; - - @ApiModelProperty("历史流程实例ID") - private String hisProcInsId; - - @ApiModelProperty("任务耗时") - private String duration; - - @ApiModelProperty("任务意见") - private FlowCommentDto comment; - - @ApiModelProperty("候选执行人") - private String candidate; - - @ApiModelProperty("任务创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - @ApiModelProperty("任务完成时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date finishTime; - -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowViewerDto.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowViewerDto.java deleted file mode 100644 index 60b221fb..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowViewerDto.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yanzhu.flowable.domain; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @author Tony - * @date 2021/4/21 20:55 - */ -@Data -public class FlowViewerDto implements Serializable { - - /** - * 流程key - */ - private String key; - - /** - * 是否完成(已经审批) - */ - private boolean completed; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysExpression.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableCategory.java similarity index 62% rename from yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysExpression.java rename to yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableCategory.java index ab8d405b..59dc37e0 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysExpression.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableCategory.java @@ -6,28 +6,28 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; /** - * 流程达式对象 sys_expression + * 流程分类对象 flowable_category * * @author ruoyi - * @date 2022-12-12 + * @date 2023-11-27 */ -public class SysExpression extends BaseEntity +public class FlowableCategory extends BaseEntity { private static final long serialVersionUID = 1L; - /** 表单主键 */ + /** 流程分类id */ private Long id; - /** 表达式名称 */ - @Excel(name = "表达式名称") + /** 流程分类名称 */ + @Excel(name = "流程分类名称") private String name; - /** 表达式内容 */ - @Excel(name = "表达式内容") - private String expression; + /** 分类编码 */ + @Excel(name = "分类编码") + private String code; - /** 状态 */ - private Integer status; + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; public void setId(Long id) { @@ -47,23 +47,23 @@ public class SysExpression extends BaseEntity { return name; } - public void setExpression(String expression) + public void setCode(String code) { - this.expression = expression; + this.code = code; } - public String getExpression() + public String getCode() { - return expression; + return code; } - public void setStatus(Integer status) + public void setDelFlag(String delFlag) { - this.status = status; + this.delFlag = delFlag; } - public Integer getStatus() + public String getDelFlag() { - return status; + return delFlag; } @Override @@ -71,13 +71,13 @@ public class SysExpression extends BaseEntity return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("name", getName()) - .append("expression", getExpression()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("updateBy", getUpdateBy()) - .append("status", getStatus()) + .append("code", getCode()) .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("delFlag", getDelFlag()) .toString(); } } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableDeploy.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableDeploy.java new file mode 100644 index 00000000..60ac42d8 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableDeploy.java @@ -0,0 +1,70 @@ +package com.yanzhu.flowable.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yanzhu.common.core.annotation.Excel; +import com.yanzhu.common.core.web.domain.BaseEntity; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 流程部署对象 flowable_deploy + * + * @author ruoyi + * @date 2023-12-18 + */ +@Data +public class FlowableDeploy extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流程定义ID */ + @Excel(name = "流程定义ID") + private String definitionId; + + /** 流程名称 */ + @Excel(name = "流程名称") + private String processName; + + /** 流程Key */ + @Excel(name = "流程Key") + private String processKey; + + /** 分类编码 */ + @Excel(name = "分类编码") + private String category; + + /** 版本 */ + @Excel(name = "版本") + private Integer version; + + /** 部署ID */ + @Excel(name = "部署ID") + private String deploymentId; + + /** 流程定义状态 */ + @Excel(name = "流程定义状态") + private Boolean suspended; + + /** 部署时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "部署时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date deploymentTime; + + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("definitionId", getDefinitionId()) + .append("processName", getProcessName()) + .append("processKey", getProcessKey()) + .append("category", getCategory()) + .append("version", getVersion()) + .append("deploymentId", getDeploymentId()) + .append("suspended", getSuspended()) + .append("deploymentTime", getDeploymentTime()) + .toString(); + } +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldDef.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldDef.java new file mode 100644 index 00000000..2349a9eb --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldDef.java @@ -0,0 +1,126 @@ +package com.yanzhu.flowable.domain; + +import com.yanzhu.common.core.annotation.Excel; +import com.yanzhu.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 流程字段定义对象 flowable_field_def + * + * @author ruoyi + * @date 2023-12-26 + */ +public class FlowableFieldDef extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String id; + + /** 数据库字段/表单字段 */ + @Excel(name = "数据库字段/表单字段") + private String field; + + /** 字段名/表单字段名 */ + @Excel(name = "字段名/表单字段名") + private String label; + + /** 字段宽度 */ + @Excel(name = "字段宽度") + private Long width; + + /** 字段组件类型 */ + @Excel(name = "字段组件类型") + private String type; + + /** 字段定义 */ + @Excel(name = "字段定义") + private String scheme; + + /** 字段范围 */ + @Excel(name = "字段范围") + private String scope; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setField(String field) + { + this.field = field; + } + + public String getField() + { + return field; + } + public void setLabel(String label) + { + this.label = label; + } + + public String getLabel() + { + return label; + } + public void setWidth(Long width) + { + this.width = width; + } + + public Long getWidth() + { + return width; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setScheme(String scheme) + { + this.scheme = scheme; + } + + public String getScheme() + { + return scheme; + } + public void setScope(String scope) + { + this.scope = scope; + } + + public String getScope() + { + return scope; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("field", getField()) + .append("label", getLabel()) + .append("remark", getRemark()) + .append("width", getWidth()) + .append("type", getType()) + .append("scheme", getScheme()) + .append("scope", getScope()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldRef.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldRef.java new file mode 100644 index 00000000..6d46b664 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldRef.java @@ -0,0 +1,97 @@ +package com.yanzhu.flowable.domain; + +import com.yanzhu.common.core.annotation.Excel; +import com.yanzhu.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 流程字段引用关系对象 flowable_field_ref + * + * @author ruoyi + * @date 2023-12-26 + */ +public class FlowableFieldRef extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String id; + + /** 模块 */ + @Excel(name = "模块") + private String module; + + /** 模型标识 */ + @Excel(name = "模型标识") + private String mkey; + + /** 字段ID */ + @Excel(name = "字段ID") + private String fieldId; + + /** 版本号 */ + @Excel(name = "版本号") + private Long version; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setModule(String module) + { + this.module = module; + } + + public String getModule() + { + return module; + } + public void setMkey(String mkey) + { + this.mkey = mkey; + } + + public String getMkey() + { + return mkey; + } + public void setFieldId(String fieldId) + { + this.fieldId = fieldId; + } + + public String getFieldId() + { + return fieldId; + } + public void setVersion(Long version) + { + this.version = version; + } + + public Long getVersion() + { + return version; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("module", getModule()) + .append("mkey", getMkey()) + .append("fieldId", getFieldId()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("version", getVersion()) + .toString(); + } +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldSearch.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldSearch.java new file mode 100644 index 00000000..095b3f3e --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableFieldSearch.java @@ -0,0 +1,13 @@ +package com.yanzhu.flowable.domain; + +import lombok.Data; + +/** + * 为了方便查询,提供一个组合类 + */ +@Data +public class FlowableFieldSearch extends FlowableFieldRef { + + /** 字段范围 */ + private String scope; +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModel.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModel.java new file mode 100644 index 00000000..8c15cdc0 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModel.java @@ -0,0 +1,165 @@ +package com.yanzhu.flowable.domain; + +import com.yanzhu.common.core.annotation.Excel; +import com.yanzhu.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 流程模型对象 flowable_model + * + * @author ruoyi + * @date 2023-11-28 + */ +public class FlowableModel extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 模型ID */ + @Excel(name = "模型ID") + private String modelId; + + /** 模型名称 */ + @Excel(name = "模型名称") + private String modelName; + + /** 模型Key */ + @Excel(name = "模型Key") + private String modelKey; + + /** 分类编码 */ + @Excel(name = "分类编码") + private String category; + + /** 版本 */ + @Excel(name = "版本") + private Integer version; + + /** 表单类型 */ + @Excel(name = "表单类型") + private Integer formType; + + /** 表单ID */ + @Excel(name = "表单ID") + private Long formId; + + /** 模型描述 */ + @Excel(name = "模型描述") + private String description; + + /** 流程xm */ + @Excel(name = "流程xm") + private String bpmnXml; + + /** 表单内容 */ + @Excel(name = "表单内容") + private String content; + + public void setModelId(String modelId) + { + this.modelId = modelId; + } + + public String getModelId() + { + return modelId; + } + public void setModelName(String modelName) + { + this.modelName = modelName; + } + + public String getModelName() + { + return modelName; + } + public void setModelKey(String modelKey) + { + this.modelKey = modelKey; + } + + public String getModelKey() + { + return modelKey; + } + public void setCategory(String category) + { + this.category = category; + } + + public String getCategory() + { + return category; + } + public void setVersion(Integer version) + { + this.version = version; + } + + public Integer getVersion() + { + return version; + } + public void setFormType(Integer formType) + { + this.formType = formType; + } + + public Integer getFormType() + { + return formType; + } + public void setFormId(Long formId) + { + this.formId = formId; + } + + public Long getFormId() + { + return formId; + } + public void setDescription(String description) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + public void setBpmnXml(String bpmnXml) + { + this.bpmnXml = bpmnXml; + } + + public String getBpmnXml() + { + return bpmnXml; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("modelId", getModelId()) + .append("modelName", getModelName()) + .append("modelKey", getModelKey()) + .append("category", getCategory()) + .append("version", getVersion()) + .append("formType", getFormType()) + .append("formId", getFormId()) + .append("description", getDescription()) + .append("createTime", getCreateTime()) + .append("bpmnXml", getBpmnXml()) + .append("content", getContent()) + .toString(); + } +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModelPage.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModelPage.java new file mode 100644 index 00000000..05d780da --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowableModelPage.java @@ -0,0 +1,97 @@ +package com.yanzhu.flowable.domain; + +import com.yanzhu.common.core.annotation.Excel; +import com.yanzhu.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 建模页面绑定对象 flowable_model_page + * + * @author ruoyi + * @date 2023-12-26 + */ +public class FlowableModelPage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String id; + + /** 模块 */ + @Excel(name = "模块") + private String module; + + /** 模型标识 */ + @Excel(name = "模型标识") + private String mkey; + + /** 页面名称 */ + @Excel(name = "页面名称") + private String name; + + /** 页面定义 */ + @Excel(name = "页面定义") + private String pageScheme; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setModule(String module) + { + this.module = module; + } + + public String getModule() + { + return module; + } + public void setMkey(String mkey) + { + this.mkey = mkey; + } + + public String getMkey() + { + return mkey; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setPageScheme(String pageScheme) + { + this.pageScheme = pageScheme; + } + + public String getPageScheme() + { + return pageScheme; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("module", getModule()) + .append("mkey", getMkey()) + .append("name", getName()) + .append("pageScheme", getPageScheme()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysDeployForm.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysDeployForm.java deleted file mode 100644 index f91d88ca..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysDeployForm.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.yanzhu.flowable.domain; - -import com.yanzhu.common.core.annotation.Excel; -import com.yanzhu.common.core.web.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 流程实例关联表单对象 sys_instance_form - * - * @author Tony - * @date 2021-03-30 - */ -public class SysDeployForm extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 表单主键 */ - @Excel(name = "表单主键") - private Long formId; - - /** 流程定义主键 */ - @Excel(name = "流程定义主键") - private String deployId; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setFormId(Long formId) - { - this.formId = formId; - } - - public Long getFormId() - { - return formId; - } - - public String getDeployId() { - return deployId; - } - - public void setDeployId(String deployId) { - this.deployId = deployId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("formId", getFormId()) - .append("deployId", getDeployId()) - .toString(); - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysForm.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysForm.java deleted file mode 100644 index c60b2f57..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysForm.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.yanzhu.flowable.domain; - -import com.yanzhu.common.core.annotation.Excel; -import com.yanzhu.common.core.web.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 流程表单对象 sys_task_form - * - * @author Tony - * @date 2021-03-30 - */ -public class SysForm extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 表单主键 */ - private Long formId; - - /** 表单名称 */ - @Excel(name = "表单名称") - private String formName; - - /** 表单内容 */ - @Excel(name = "表单内容") - private String formContent; - - public void setFormId(Long formId) - { - this.formId = formId; - } - - public Long getFormId() - { - return formId; - } - public void setFormName(String formName) - { - this.formName = formName; - } - - public String getFormName() - { - return formName; - } - public void setFormContent(String formContent) - { - this.formContent = formContent; - } - - public String getFormContent() - { - return formContent; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("formId", getFormId()) - .append("formName", getFormName()) - .append("formContent", getFormContent()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("updateBy", getUpdateBy()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysListener.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysListener.java deleted file mode 100644 index 488dc4bf..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysListener.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.yanzhu.flowable.domain; - -import com.yanzhu.common.core.annotation.Excel; -import com.yanzhu.common.core.web.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 流程监听对象 sys_listener - * - * @author Tony - * @date 2022-12-25 - */ -public class SysListener extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 表单主键 */ - private Long id; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** 监听类型 */ - @Excel(name = "监听类型") - private String type; - - /** 事件类型 */ - @Excel(name = "事件类型") - private String eventType; - - /** 值类型 */ - @Excel(name = "值类型") - private String valueType; - - /** 执行内容 */ - @Excel(name = "执行内容") - private String value; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setType(String type) - { - this.type = type; - } - - public String getType() - { - return type; - } - public void setEventType(String eventType) - { - this.eventType = eventType; - } - - public String getEventType() - { - return eventType; - } - public void setValueType(String valueType) - { - this.valueType = valueType; - } - - public String getValueType() - { - return valueType; - } - public void setValue(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("type", getType()) - .append("eventType", getEventType()) - .append("valueType", getValueType()) - .append("value", getValue()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("updateBy", getUpdateBy()) - .append("status", getStatus()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysTaskForm.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysTaskForm.java deleted file mode 100644 index 6a033889..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/SysTaskForm.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.yanzhu.flowable.domain; - -import com.yanzhu.common.core.annotation.Excel; -import com.yanzhu.common.core.web.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 流程任务关联单对象 sys_task_form - * - * @author Tony - * @date 2021-04-03 - */ -public class SysTaskForm extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 表单主键 */ - @Excel(name = "表单主键") - private Long formId; - - /** 所属任务 */ - @Excel(name = "所属任务") - private String taskId; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setFormId(Long formId) - { - this.formId = formId; - } - - public Long getFormId() - { - return formId; - } - public void setTaskId(String taskId) - { - this.taskId = taskId; - } - - public String getTaskId() - { - return taskId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("formId", getFormId()) - .append("taskId", getTaskId()) - .toString(); - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableMetaInfoBo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableMetaInfoBo.java new file mode 100644 index 00000000..cd0f8365 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableMetaInfoBo.java @@ -0,0 +1,30 @@ +package com.yanzhu.flowable.domain.bo; + +import lombok.Data; + +/** + * @author ruoyi + * @createTime 2023/11/28 + */ +@Data +public class FlowableMetaInfoBo { + + /** + * 创建者(username) + */ + private String createUser; + + /** + * 流程描述 + */ + private String description; + /** + * 表单类型 + */ + private Integer formType; + /** + * 表单编号 + */ + private Long formId; + +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableModelBo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableModelBo.java new file mode 100644 index 00000000..b95722f3 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/bo/FlowableModelBo.java @@ -0,0 +1,49 @@ +package com.yanzhu.flowable.domain.bo; + +import lombok.Data; + +/** + * flowable 流程模型对象 + * + * @author ruoyi + * @createtime 2023/11/28 + */ +@Data +public class FlowableModelBo { + /** + * 模型主键 + */ + private String modelId; + /** + * 模型名称 + */ + private String modelName; + /** + * 模型Key + */ + private String modelKey; + /** + * 流程分类 + */ + private String category; + /** + * 描述 + */ + private String description; + /** + * 表单类型 + */ + private Integer formType; + /** + * 表单主键 + */ + private Long formId; + /** + * 流程xml + */ + private String bpmnXml; + /** + * 是否保存为新版本 + */ + private Boolean newVersion; +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowDeptVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowDeptVo.java similarity index 96% rename from yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowDeptVo.java rename to yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowDeptVo.java index fb33f0d1..cf0824ff 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowDeptVo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowDeptVo.java @@ -1,4 +1,4 @@ -package com.yanzhu.flowable.domain.vo; +package com.yanzhu.flowable.domain.my; import com.yanzhu.common.core.web.domain.BaseEntity; import io.swagger.annotations.ApiModel; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowProcDefDto.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowProcDefDto.java similarity index 97% rename from yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowProcDefDto.java rename to yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowProcDefDto.java index 74d1fb1f..0d100339 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowProcDefDto.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowProcDefDto.java @@ -1,4 +1,5 @@ -package com.yanzhu.flowable.domain; +package com.yanzhu.flowable.domain.my; + import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskEntity.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java similarity index 99% rename from yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskEntity.java rename to yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java index 33f90b41..eeb10be4 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/FlowTaskEntity.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java @@ -1,4 +1,4 @@ -package com.yanzhu.flowable.domain; +package com.yanzhu.flowable.domain.my; import com.fasterxml.jackson.annotation.JsonFormat; import com.yanzhu.common.core.web.domain.BaseEntity; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java deleted file mode 100644 index 4b08f213..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.yanzhu.flowable.domain.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

流程任务

- * - * @author Tony - * @date 2021-04-03 - */ -@Data -@ApiModel("工作流任务相关--请求参数") -public class FlowQueryVo { - - @ApiModelProperty("流程名称") - private String name; - - @ApiModelProperty("流程类别") - private String category; - - @ApiModelProperty("开始时间") - private String startTime; - - @ApiModelProperty("结束时间") - private String endTime; - - @ApiModelProperty("当前页码") - private Integer pageNum; - - @ApiModelProperty("每页条数") - private Integer pageSize; - - @ApiModelProperty("单位主键") - private Long deptId; - - @ApiModelProperty("单位名称") - private String deptName; - - @ApiModelProperty("项目主键") - private Long projectId; - - @ApiModelProperty("项目名称") - private String projectName; - - @ApiModelProperty("单位祖籍列表") - private String deptAncestors; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowTaskVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowTaskVo.java deleted file mode 100644 index c05a8ba4..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowTaskVo.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.yanzhu.flowable.domain.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; -import java.util.Map; - -/** - *

流程任务

- * - * @author Tony - * @date 2021-04-03 - */ -@Data -@ApiModel("工作流任务相关--请求参数") -public class FlowTaskVo { - - @ApiModelProperty("任务Id") - private String taskId; - - @ApiModelProperty("用户Id") - private String userId; - - @ApiModelProperty("任务意见") - private String comment; - - @ApiModelProperty("流程实例Id") - private String instanceId; - - @ApiModelProperty("节点") - private String targetKey; - - private String deploymentId; - @ApiModelProperty("流程环节定义ID") - private String defId; - - @ApiModelProperty("子执行流ID") - private String currentChildExecutionId; - - @ApiModelProperty("子执行流是否已执行") - private Boolean flag; - - @ApiModelProperty("流程变量信息") - private Map variables; - - @ApiModelProperty("审批信息") - private Map applyInfos; - - @ApiModelProperty("审批人") - private String assignee; - - @ApiModelProperty("候选人") - private List candidateUsers; - - @ApiModelProperty("审批组") - private List candidateGroups; -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ProcKeyRole.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ProcKeyRole.java deleted file mode 100644 index e31a5612..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ProcKeyRole.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.yanzhu.flowable.domain.vo; - -import java.io.Serializable; -import java.util.List; - -public class ProcKeyRole implements Serializable -{ - - private static final long serialVersionUID = 1L; - - private String roleId; - - private String key; - - private String sort; - - private List keys; - - public String getRoleId() { - return roleId; - } - - public void setRoleId(String roleId) { - this.roleId = roleId; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public List getKeys() { - return keys; - } - - public void setKeys(List keys) { - this.keys = keys; - } - - public String getSort() { - return sort; - } - - public void setSort(String sort) { - this.sort = sort; - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ReturnTaskNodeVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ReturnTaskNodeVo.java deleted file mode 100644 index 0085e543..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/ReturnTaskNodeVo.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yanzhu.flowable.domain.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

可退回节点

- * - * @author tony - * @date 2022-04-23 11:01:52 - */ -@Data -@ApiModel("可退回节点") -public class ReturnTaskNodeVo { - - @ApiModelProperty("任务Id") - private String id; - - @ApiModelProperty("用户Id") - private String name; - -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/StartTaskVO.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/StartTaskVO.java deleted file mode 100644 index b5b29240..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/StartTaskVO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yanzhu.flowable.domain.vo; - -import java.io.Serializable; -import java.util.Map; - -/** - * 流程实例启动 - * - * @author JiangYuQi - * @date 2020-07-07 - */ -public class StartTaskVO implements Serializable -{ - - private static final long serialVersionUID = 1L; - - //流程实例ID - private String procDefId; - private String userId; - private String userName; - private String nickName; - private Map variables; - - public String getProcDefId() { - return procDefId; - } - - public void setProcDefId(String procDefId) { - this.procDefId = procDefId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public Map getVariables() { - return variables; - } - - public void setVariables(Map variables) { - this.variables = variables; - } -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java index 0f7afa58..d714ca7c 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java @@ -1,6 +1,6 @@ package com.yanzhu.flowable.mapper; -import com.yanzhu.flowable.domain.FlowTaskEntity; +import com.yanzhu.flowable.domain.my.FlowTaskEntity; import org.apache.ibatis.annotations.Param; import java.util.List; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java deleted file mode 100644 index 7d32f616..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.FlowProcDefDto; -import com.yanzhu.flowable.domain.vo.FlowDeptVo; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * 流程定义查询 - * - * @author Tony - * @email - * @date 2022/1/29 5:44 下午 - **/ -public interface FlowDeployMapper { - - /** - * 流程定义列表 - * @param roleId 发起角色 - * @param category 流程类别 - * @param name 流程名称 - * @return - */ - List selectDeployList(@Param("roleId")String roleId, @Param("category")String category, @Param("name")String name); - - /** - * 我的流程定义列表 - * @param username 登录用户 - * @param category 流程类别 - * @param name 流程名称 - * @return - */ - List selectMyDeployList(@Param("username")String username, @Param("category")String category, @Param("name")String name); - - /** - * 流程定义列表 - * @param flowQueryVo 流程查询 - * @return - */ - List selectDeployList(FlowQueryVo flowQueryVo); - - /** - * 新增单位流程关系 - * - * @param flowDeptVo 流程 单位关系 - * @return 结果 - */ - public int insertActReProcdefDept(FlowDeptVo flowDeptVo); - - /** - * 根据角色删除流程定义 - * @param roleId 橘色 - * @return - */ - int deleteDeployByRoleId(String roleId); - - - /** - * 批量新增流程定义角色配置 - * @param items 列表 - * @return - */ - int batchDeployRoleRole(List> items); - - /** - * 流程发起排序设置 - * @param roleId 角色主键 - * @param key 流程 - * @param sort 排序 - * @return - */ - int updateProcKeyRoleSort(@Param("roleId")String roleId, @Param("key")String key, @Param("sort")String sort); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableCategoryMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableCategoryMapper.java new file mode 100644 index 00000000..95948e16 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableCategoryMapper.java @@ -0,0 +1,61 @@ +package com.yanzhu.flowable.mapper; + +import java.util.List; +import com.yanzhu.flowable.domain.FlowableCategory; + +/** + * 流程分类Mapper接口 + * + * @author ruoyi + * @date 2023-11-27 + */ +public interface FlowableCategoryMapper +{ + /** + * 查询流程分类 + * + * @param id 流程分类主键 + * @return 流程分类 + */ + public FlowableCategory selectFlowableCategoryById(Long id); + + /** + * 查询流程分类列表 + * + * @param flowableCategory 流程分类 + * @return 流程分类集合 + */ + public List selectFlowableCategoryList(FlowableCategory flowableCategory); + + /** + * 新增流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + public int insertFlowableCategory(FlowableCategory flowableCategory); + + /** + * 修改流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + public int updateFlowableCategory(FlowableCategory flowableCategory); + + /** + * 删除流程分类 + * + * @param id 流程分类主键 + * @return 结果 + */ + public int deleteFlowableCategoryById(Long id); + + /** + * 批量删除流程分类 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteFlowableCategoryByIds(Long[] ids); +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldDefMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldDefMapper.java new file mode 100644 index 00000000..4e88ca5c --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldDefMapper.java @@ -0,0 +1,69 @@ +package com.yanzhu.flowable.mapper; + +import java.util.List; +import com.yanzhu.flowable.domain.FlowableFieldDef; +import com.yanzhu.flowable.domain.FlowableFieldSearch; + +/** + * 流程字段定义Mapper接口 + * + * @author ruoyi + * @date 2023-12-26 + */ +public interface FlowableFieldDefMapper +{ + /** + * 查询流程字段定义 + * + * @param id 流程字段定义主键 + * @return 流程字段定义 + */ + public FlowableFieldDef selectFlowableFieldDefById(String id); + + /** + * 查询流程字段定义列表 + * + * @param flowableFieldDef 流程字段定义 + * @return 流程字段定义集合 + */ + public List selectFlowableFieldDefList(FlowableFieldDef flowableFieldDef); + + /** + * 新增流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + public int insertFlowableFieldDef(FlowableFieldDef flowableFieldDef); + + /** + * 修改流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + public int updateFlowableFieldDef(FlowableFieldDef flowableFieldDef); + + /** + * 删除流程字段定义 + * + * @param id 流程字段定义主键 + * @return 结果 + */ + public int deleteFlowableFieldDefById(String id); + + /** + * 批量删除流程字段定义 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteFlowableFieldDefByIds(String[] ids); + + /** + * 查询流程字段引用关系列表(不翻页,关联字段定义表查询) + * @param flowableFieldSearch + * @return + */ + public List listCombination(FlowableFieldSearch flowableFieldSearch); +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldRefMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldRefMapper.java new file mode 100644 index 00000000..77ef1e6f --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableFieldRefMapper.java @@ -0,0 +1,61 @@ +package com.yanzhu.flowable.mapper; + +import java.util.List; +import com.yanzhu.flowable.domain.FlowableFieldRef; + +/** + * 流程字段引用关系Mapper接口 + * + * @author ruoyi + * @date 2023-12-26 + */ +public interface FlowableFieldRefMapper +{ + /** + * 查询流程字段引用关系 + * + * @param id 流程字段引用关系主键 + * @return 流程字段引用关系 + */ + public FlowableFieldRef selectFlowableFieldRefById(String id); + + /** + * 查询流程字段引用关系列表 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 流程字段引用关系集合 + */ + public List selectFlowableFieldRefList(FlowableFieldRef flowableFieldRef); + + /** + * 新增流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + public int insertFlowableFieldRef(FlowableFieldRef flowableFieldRef); + + /** + * 修改流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + public int updateFlowableFieldRef(FlowableFieldRef flowableFieldRef); + + /** + * 删除流程字段引用关系 + * + * @param id 流程字段引用关系主键 + * @return 结果 + */ + public int deleteFlowableFieldRefById(String id); + + /** + * 批量删除流程字段引用关系 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteFlowableFieldRefByIds(String[] ids); +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableModelPageMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableModelPageMapper.java new file mode 100644 index 00000000..f90c9714 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowableModelPageMapper.java @@ -0,0 +1,61 @@ +package com.yanzhu.flowable.mapper; + +import java.util.List; +import com.yanzhu.flowable.domain.FlowableModelPage; + +/** + * 建模页面绑定Mapper接口 + * + * @author ruoyi + * @date 2023-12-25 + */ +public interface FlowableModelPageMapper +{ + /** + * 查询建模页面绑定 + * + * @param id 建模页面绑定主键 + * @return 建模页面绑定 + */ + public FlowableModelPage selectFlowableModelPageById(String id); + + /** + * 查询建模页面绑定列表 + * + * @param flowableModelPage 建模页面绑定 + * @return 建模页面绑定集合 + */ + public List selectFlowableModelPageList(FlowableModelPage flowableModelPage); + + /** + * 新增建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + public int insertFlowableModelPage(FlowableModelPage flowableModelPage); + + /** + * 修改建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + public int updateFlowableModelPage(FlowableModelPage flowableModelPage); + + /** + * 删除建模页面绑定 + * + * @param id 建模页面绑定主键 + * @return 结果 + */ + public int deleteFlowableModelPageById(String id); + + /** + * 批量删除建模页面绑定 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteFlowableModelPageByIds(String[] ids); +} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysDeployFormMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysDeployFormMapper.java deleted file mode 100644 index 1f7bd205..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysDeployFormMapper.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.SysDeployForm; -import com.yanzhu.flowable.domain.SysForm; - -import java.util.List; - -/** - * 流程实例关联表单Mapper接口 - * - * @author Tony - * @date 2021-03-30 - */ -public interface SysDeployFormMapper -{ - /** - * 查询流程实例关联表单 - * - * @param id 流程实例关联表单ID - * @return 流程实例关联表单 - */ - public SysDeployForm selectSysDeployFormById(Long id); - - /** - * 查询流程实例关联表单列表 - * - * @param SysDeployForm 流程实例关联表单 - * @return 流程实例关联表单集合 - */ - public List selectSysDeployFormList(SysDeployForm SysDeployForm); - - /** - * 新增流程实例关联表单 - * - * @param SysDeployForm 流程实例关联表单 - * @return 结果 - */ - public int insertSysDeployForm(SysDeployForm SysDeployForm); - - /** - * 修改流程实例关联表单 - * - * @param SysDeployForm 流程实例关联表单 - * @return 结果 - */ - public int updateSysDeployForm(SysDeployForm SysDeployForm); - - /** - * 删除流程实例关联表单 - * - * @param id 流程实例关联表单ID - * @return 结果 - */ - public int deleteSysDeployFormById(Long id); - - /** - * 批量删除流程实例关联表单 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteSysDeployFormByIds(Long[] ids); - - /** - * 查询流程挂着的表单 - * @param deployId - * @return - */ - SysForm selectSysDeployFormByDeployId(String deployId); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysExpressionMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysExpressionMapper.java deleted file mode 100644 index bdeef941..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysExpressionMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.SysExpression; - -import java.util.List; - -/** - * 流程达式Mapper接口 - * - * @author ruoyi - * @date 2022-12-12 - */ -public interface SysExpressionMapper -{ - /** - * 查询流程达式 - * - * @param id 流程达式主键 - * @return 流程达式 - */ - public SysExpression selectSysExpressionById(Long id); - - /** - * 查询流程达式列表 - * - * @param sysExpression 流程达式 - * @return 流程达式集合 - */ - public List selectSysExpressionList(SysExpression sysExpression); - - /** - * 新增流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - public int insertSysExpression(SysExpression sysExpression); - - /** - * 修改流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - public int updateSysExpression(SysExpression sysExpression); - - /** - * 删除流程达式 - * - * @param id 流程达式主键 - * @return 结果 - */ - public int deleteSysExpressionById(Long id); - - /** - * 批量删除流程达式 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteSysExpressionByIds(Long[] ids); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysFormMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysFormMapper.java deleted file mode 100644 index 183f9630..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysFormMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.SysForm; - -import java.util.List; - -/** - * 流程表单Mapper接口 - * - * @author Tony - * @date 2021-03-30 - */ -public interface SysFormMapper -{ - /** - * 查询流程表单 - * - * @param formId 流程表单ID - * @return 流程表单 - */ - public SysForm selectSysFormById(Long formId); - - /** - * 查询流程表单列表 - * - * @param sysForm 流程表单 - * @return 流程表单集合 - */ - public List selectSysFormList(SysForm sysForm); - - /** - * 新增流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - public int insertSysForm(SysForm sysForm); - - /** - * 修改流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - public int updateSysForm(SysForm sysForm); - - /** - * 删除流程表单 - * - * @param formId 流程表单ID - * @return 结果 - */ - public int deleteSysFormById(Long formId); - - /** - * 批量删除流程表单 - * - * @param formIds 需要删除的数据ID - * @return 结果 - */ - public int deleteSysFormByIds(Long[] formIds); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysListenerMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysListenerMapper.java deleted file mode 100644 index c4b43efe..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysListenerMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.SysListener; - -import java.util.List; - -/** - * 流程监听Mapper接口 - * - * @author Tony - * @date 2022-12-25 - */ -public interface SysListenerMapper -{ - /** - * 查询流程监听 - * - * @param id 流程监听主键 - * @return 流程监听 - */ - public SysListener selectSysListenerById(Long id); - - /** - * 查询流程监听列表 - * - * @param sysListener 流程监听 - * @return 流程监听集合 - */ - public List selectSysListenerList(SysListener sysListener); - - /** - * 新增流程监听 - * - * @param sysListener 流程监听 - * @return 结果 - */ - public int insertSysListener(SysListener sysListener); - - /** - * 修改流程监听 - * - * @param sysListener 流程监听 - * @return 结果 - */ - public int updateSysListener(SysListener sysListener); - - /** - * 删除流程监听 - * - * @param id 流程监听主键 - * @return 结果 - */ - public int deleteSysListenerById(Long id); - - /** - * 批量删除流程监听 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteSysListenerByIds(Long[] ids); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysTaskFormMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysTaskFormMapper.java deleted file mode 100644 index 0d0a1d68..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/SysTaskFormMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.mapper; - -import com.yanzhu.flowable.domain.SysTaskForm; - -import java.util.List; - -/** - * 流程任务关联单Mapper接口 - * - * @author Tony - * @date 2021-04-03 - */ -public interface SysTaskFormMapper -{ - /** - * 查询流程任务关联单 - * - * @param id 流程任务关联单ID - * @return 流程任务关联单 - */ - public SysTaskForm selectSysTaskFormById(Long id); - - /** - * 查询流程任务关联单列表 - * - * @param sysTaskForm 流程任务关联单 - * @return 流程任务关联单集合 - */ - public List selectSysTaskFormList(SysTaskForm sysTaskForm); - - /** - * 新增流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - public int insertSysTaskForm(SysTaskForm sysTaskForm); - - /** - * 修改流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - public int updateSysTaskForm(SysTaskForm sysTaskForm); - - /** - * 删除流程任务关联单 - * - * @param id 流程任务关联单ID - * @return 结果 - */ - public int deleteSysTaskFormById(Long id); - - /** - * 批量删除流程任务关联单 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteSysTaskFormByIds(Long[] ids); -} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml index df7e58d3..3506bea9 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml @@ -24,7 +24,7 @@ - SELECT * FROM vw_flow_all fa @@ -52,7 +52,7 @@ - select vf.* as startUserPhone from vw_flow_all vf where vf.procInsId = #{procInsId} @@ -72,7 +72,7 @@ - select fa.* from vw_flow_await fa where 1=1 @@ -107,7 +107,7 @@ - select fa.category,count(1) as total from vw_flow_await fa where 1=1 @@ -141,7 +141,7 @@ - select fa.* from vw_flow_finished fa where fa.ASSIGNEE_=#{nowUser} @@ -153,7 +153,7 @@ order by fa.endTime desc - SELECT a.dict_label taskName,b.cnt assigneeId,c.cnt procDefVersion FROM ( SELECT * FROM sys_dict_data WHERE dict_type = 'sys_process_category') a LEFT JOIN (SELECT category,COUNT(1) cnt FROM vw_flow_all WHERE finishTime IS NOT NULL @@ -182,7 +182,7 @@ GROUP BY category) c ON a.dict_value=c.category - SELECT cat taskName, COUNT(1) assigneeId FROM ( SELECT *,'总包单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '总包%' and businessDeptId=#{projectDeptId} @@ -242,7 +242,7 @@ GROUP BY cat - SELECT cat taskName, COUNT(1) assigneeId FROM ( SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and finishTime IS not NULL and businessDeptId=#{projectDeptId} @@ -302,7 +302,7 @@ GROUP BY cat - SELECT cat taskName, COUNT(1) assigneeId FROM ( SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and businessDeptId=#{projectDeptId} @@ -362,7 +362,7 @@ GROUP BY cat - SELECT * FROM vw_flow_all and category = #{category} @@ -378,7 +378,7 @@ - SELECT * FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '总包%' @@ -398,7 +398,7 @@ - SELECT * FROM vw_flow_all @@ -418,7 +418,7 @@ - SELECT a.businessKey,a.cnt duration ,b.projectName businessKeyName FROM ( SELECT businessKey,COUNT(1) cnt FROM vw_flow_all WHERE taskName!='提交申请' and businessDeptId=#{deptId} @@ -427,7 +427,7 @@ ORDER BY a.cnt DESC - SELECT fa.procInsId, fa.deployId, @@ -465,7 +465,7 @@ select * from sur_project where id = #{proId} - select x.dict_label taskName,y.taskId from ( select dict_value,dict_label from sys_dict_data where dict_type='flow_sub_dept_type' @@ -491,7 +491,7 @@ group by d.dict_value,d.dict_label ) y on x.dict_value=y.dict_value - SELECT a.procInsId,a.deployId,a.createTime,a.finishTime,a.businessKey,a.businessKeyName,a.startDeptName,b.TEXT_ as taskId, c.TEXT_ as deptName,d.dict_label taskName FROM vw_flow_all a LEFT JOIN act_hi_varinst b ON a.procInsId=b.PROC_INST_ID_ AND b.NAME_='subDeptType' @@ -510,6 +510,124 @@ and sp.projectType = #{proType} - + + + + + + + delete from act_re_procdef_role where ROLE_ID_ = #{roleId} + + + + insert into act_re_procdef_role( PROCDEF_KEY_, ROLE_ID_) values + + ( #{item.key}, #{item.roleId}) + + + + + update act_re_procdef_role set SORT_=#{sort} where PROCDEF_KEY_=#{key} and ROLE_ID_=#{roleId} + + + + + insert into act_re_procdef_dept + + PROCDEF_ID_, + TYPE_, + DEPT_ID_, + PROJ_ID_, + SORT_, + + + #{procdefId}, + #{prtype}, + #{deptId}, + #{projId}, + #{sort}, + + + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml deleted file mode 100644 index f8a188d2..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - delete from act_re_procdef_role where ROLE_ID_ = #{roleId} - - - - insert into act_re_procdef_role( PROCDEF_KEY_, ROLE_ID_) values - - ( #{item.key}, #{item.roleId}) - - - - - update act_re_procdef_role set SORT_=#{sort} where PROCDEF_KEY_=#{key} and ROLE_ID_=#{roleId} - - - - - insert into act_re_procdef_dept - - PROCDEF_ID_, - TYPE_, - DEPT_ID_, - PROJ_ID_, - SORT_, - - - #{procdefId}, - #{prtype}, - #{deptId}, - #{projId}, - #{sort}, - - - - \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysExpressionMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableCategoryMapper.xml similarity index 57% rename from yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysExpressionMapper.xml rename to yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableCategoryMapper.xml index 504e522c..d6a64504 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysExpressionMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableCategoryMapper.xml @@ -2,83 +2,82 @@ - + - + - - - - - - + + + + + + - - select id, name, expression, create_time, update_time, create_by, update_by, status, remark from sys_expression + + select id, name, code, remark, create_by, create_time, update_by, update_time, del_flag from flowable_category - + and name like concat('%', #{name}, '%') - and expression = #{expression} - and status = #{status} + and code = #{code} - + where id = #{id} - - insert into sys_expression + + insert into flowable_category name, - expression, - create_time, - update_time, - create_by, - update_by, - status, + code, remark, + create_by, + create_time, + update_by, + update_time, + del_flag, #{name}, - #{expression}, - #{createTime}, - #{updateTime}, - #{createBy}, - #{updateBy}, - #{status}, + #{code}, #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{delFlag}, - - update sys_expression + + update flowable_category name = #{name}, - expression = #{expression}, - create_time = #{createTime}, - update_time = #{updateTime}, - create_by = #{createBy}, - update_by = #{updateBy}, - status = #{status}, + code = #{code}, remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag}, where id = #{id} - - delete from sys_expression where id = #{id} + + delete from flowable_category where id = #{id} - - delete from sys_expression where id in + + delete from flowable_category where id in #{id} diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldDefMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldDefMapper.xml new file mode 100644 index 00000000..26d501ce --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldDefMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + select id, field, label, remark, width, type, scheme, scope, update_by, update_time, create_by, create_time from flowable_field_def + + + + + + + + + + insert into flowable_field_def + + id, + field, + label, + remark, + width, + type, + scheme, + scope, + update_by, + update_time, + create_by, + create_time, + + + #{id}, + #{field}, + #{label}, + #{remark}, + #{width}, + #{type}, + #{scheme}, + #{scope}, + #{updateBy}, + #{updateTime}, + #{createBy}, + #{createTime}, + + + + + update flowable_field_def + + field = #{field}, + label = #{label}, + remark = #{remark}, + width = #{width}, + type = #{type}, + scheme = #{scheme}, + scope = #{scope}, + update_by = #{updateBy}, + update_time = #{updateTime}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from flowable_field_def where id = #{id} + + + + delete from flowable_field_def where id in + + #{id} + + + diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldRefMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldRefMapper.xml new file mode 100644 index 00000000..42a7a100 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableFieldRefMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + select id, module, mkey, field_id, create_by, create_time, update_by, update_time, version from flowable_field_ref + + + + + + + + insert into flowable_field_ref + + id, + module, + mkey, + field_id, + create_by, + create_time, + update_by, + update_time, + version, + + + #{id}, + #{module}, + #{mkey}, + #{fieldId}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{version}, + + + + + update flowable_field_ref + + module = #{module}, + mkey = #{mkey}, + field_id = #{fieldId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + version = #{version}, + + where id = #{id} + + + + delete from flowable_field_ref where id = #{id} + + + + delete from flowable_field_ref where id in + + #{id} + + + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableModelPageMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableModelPageMapper.xml new file mode 100644 index 00000000..dbcbef53 --- /dev/null +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowableModelPageMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + select id, module, mkey, name, page_scheme, update_by, update_time, create_by, create_time from flowable_model_page + + + + + + + + insert into flowable_model_page + + module, + mkey, + name, + page_scheme, + update_by, + update_time, + create_by, + create_time, + + + #{module}, + #{mkey}, + #{name}, + #{pageScheme}, + #{updateBy}, + #{updateTime}, + #{createBy}, + #{createTime}, + + + + + update flowable_model_page + + module = #{module}, + mkey = #{mkey}, + name = #{name}, + page_scheme = #{pageScheme}, + update_by = #{updateBy}, + update_time = #{updateTime}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from flowable_model_page where id = #{id} + + + + delete from flowable_model_page where id in + + #{id} + + + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysDeployFormMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysDeployFormMapper.xml deleted file mode 100644 index f3423af4..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysDeployFormMapper.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - select id, form_id, deploy_id from sys_deploy_form - - - - - - - - - - insert into sys_deploy_form - - form_id, - deploy_id, - - - #{formId}, - #{deployId}, - - - - - update sys_deploy_form - - form_id = #{formId}, - deploy_id = #{deployId}, - - where id = #{id} - - - - delete from sys_deploy_form where id = #{id} - - - - delete from sys_deploy_form where id in - - #{id} - - - \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysFormMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysFormMapper.xml deleted file mode 100644 index 6e686742..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysFormMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - select form_id, form_name, form_content, create_time, update_time, create_by, update_by, remark from sys_form - - - - - - - - insert into sys_form - - form_name, - form_content, - create_time, - update_time, - create_by, - update_by, - remark, - - - #{formName}, - #{formContent}, - #{createTime}, - #{updateTime}, - #{createBy}, - #{updateBy}, - #{remark}, - - - - - update sys_form - - form_name = #{formName}, - form_content = #{formContent}, - create_time = #{createTime}, - update_time = #{updateTime}, - create_by = #{createBy}, - update_by = #{updateBy}, - remark = #{remark}, - - where form_id = #{formId} - - - - delete from sys_form where form_id = #{formId} - - - - delete from sys_form where form_id in - - #{formId} - - - \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysListenerMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysListenerMapper.xml deleted file mode 100644 index a8403a06..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysListenerMapper.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - select id, - name, - type, - event_type, - value_type, - value, - create_time, - update_time, - create_by, - update_by, - status, - remark - from sys_listener - - - - - - - - insert into sys_listener - - name, - type, - event_type, - value_type, - value, - create_time, - update_time, - create_by, - update_by, - status, - remark, - - - #{name}, - #{type}, - #{eventType}, - #{valueType}, - #{value}, - #{createTime}, - #{updateTime}, - #{createBy}, - #{updateBy}, - #{status}, - #{remark}, - - - - - update sys_listener - - name = #{name}, - type = #{type}, - event_type = #{eventType}, - value_type = #{valueType}, - value = #{value}, - create_time = #{createTime}, - update_time = #{updateTime}, - create_by = #{createBy}, - update_by = #{updateBy}, - status = #{status}, - remark = #{remark}, - - where id = #{id} - - - - delete - from sys_listener - where id = #{id} - - - - delete from sys_listener where id in - - #{id} - - - \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysTaskFormMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysTaskFormMapper.xml deleted file mode 100644 index b7ec90fe..00000000 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/SysTaskFormMapper.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - select id, form_id, task_id from sys_task_form - - - - - - - - insert into sys_task_form - - form_id, - task_id, - - - #{formId}, - #{taskId}, - - - - - update sys_task_form - - form_id = #{formId}, - task_id = #{taskId}, - - where id = #{id} - - - - delete from sys_task_form where id = #{id} - - - - delete from sys_task_form where id in - - #{id} - - - \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-flowable/pom.xml b/yanzhu-modules/yanzhu-flowable/pom.xml index a94efdf1..24f8ca0c 100644 --- a/yanzhu-modules/yanzhu-flowable/pom.xml +++ b/yanzhu-modules/yanzhu-flowable/pom.xml @@ -105,16 +105,14 @@ 5.3.3 + + jakarta.mail + jakarta.mail-api + + org.flowable flowable-spring-boot-starter - - - - org.flowable - flowable-spring-security - - diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/constant/ProcessConstants.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/constant/ProcessConstants.java index 54488c3e..f8439143 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/constant/ProcessConstants.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/constant/ProcessConstants.java @@ -8,6 +8,8 @@ package com.yanzhu.flowable.common.constant; */ public class ProcessConstants { + public static final String SUFFIX = ".bpmn"; + /** * 动态数据 */ diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/CacheType.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/CacheType.java new file mode 100644 index 00000000..3d989eeb --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/CacheType.java @@ -0,0 +1,29 @@ +package com.yanzhu.flowable.common.enums; + +/** + * 缓存key + */ +public enum CacheType { + + FLOWCATEGORY("flowcategory","流程分类"); + public String getCode() { + return code; + } + + public String getRemark() { + return remark; + } + + /** + * 编码 + */ + private String code; + /** + * 说明 + */ + private String remark; + CacheType(String code,String remark){ + this.code = code; + this.remark = remark; + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FormType.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FormType.java new file mode 100644 index 00000000..27a854d4 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FormType.java @@ -0,0 +1,33 @@ +package com.yanzhu.flowable.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ruoyi + * @createTime 2023/11/28 + */ +@Getter +@AllArgsConstructor +public enum FormType { + + /** + * 流程表单 + */ + PROCESS(0), + + /** + * 外置表单 + */ + EXTERNAL(1), + + /** + * 节点独立表单 + */ + INDEPENDENT(2); + + /** + * 表单类型 + */ + private final Integer type; +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableConfig.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableConfig.java index 414d2d04..fbff538d 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableConfig.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableConfig.java @@ -1,32 +1,32 @@ -package com.yanzhu.flowable.config; - -import org.flowable.engine.impl.db.DbIdGenerator; -import org.flowable.spring.SpringProcessEngineConfiguration; -import org.flowable.spring.boot.EngineConfigurationConfigurer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.AsyncListenableTaskExecutor; -import org.springframework.core.task.SimpleAsyncTaskExecutor; - -/** - * 流程id生成处理 - * @author Tony - * @date 2022-12-26 10:24 - */ -@Configuration -public class FlowableConfig implements EngineConfigurationConfigurer { - - @Bean - public AsyncListenableTaskExecutor applicationTaskExecutor() { - return new SimpleAsyncTaskExecutor(); - } - - @Override - public void configure(SpringProcessEngineConfiguration engineConfiguration) { - engineConfiguration.setActivityFontName("宋体"); - engineConfiguration.setLabelFontName("宋体"); - engineConfiguration.setAnnotationFontName("宋体"); - engineConfiguration.setIdGenerator(new DbIdGenerator()); - } - -} +//package com.yanzhu.flowable.config; +// +//import org.flowable.engine.impl.db.DbIdGenerator; +//import org.flowable.spring.SpringProcessEngineConfiguration; +//import org.flowable.spring.boot.EngineConfigurationConfigurer; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.core.task.AsyncListenableTaskExecutor; +//import org.springframework.core.task.SimpleAsyncTaskExecutor; +// +///** +// * 流程id生成处理 +// * @author Tony +// * @date 2022-12-26 10:24 +// */ +////@Configuration +//public class FlowableConfig implements EngineConfigurationConfigurer { +// +// @Bean +// public AsyncListenableTaskExecutor applicationTaskExecutor() { +// return new SimpleAsyncTaskExecutor(); +// } +// +// @Override +// public void configure(SpringProcessEngineConfiguration engineConfiguration) { +// engineConfiguration.setActivityFontName("宋体"); +// engineConfiguration.setLabelFontName("宋体"); +// engineConfiguration.setAnnotationFontName("宋体"); +// engineConfiguration.setIdGenerator(new DbIdGenerator()); +// } +// +//} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableEngineConfig.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableEngineConfig.java new file mode 100644 index 00000000..2e0f9ae7 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableEngineConfig.java @@ -0,0 +1,63 @@ +package com.yanzhu.flowable.config; + +import lombok.Data; +import org.flowable.spring.SpringProcessEngineConfiguration; +import org.flowable.spring.boot.EngineConfigurationConfigurer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * @author ruoyi + * @date 2023/11/28 + */ +@Data +@Configuration +public class FlowableEngineConfig implements EngineConfigurationConfigurer { + /** + * jdbc 驱动类 + */ + @Value("${spring.datasource.driver-class-name}") + private String jdbcDriver; + /** + * jdbc url + */ + @Value("${spring.datasource.url}") + private String jdbcUrl; + /** + * jdbc 用户名 + */ + @Value("${spring.datasource.username}") + private String jdbcUsername; + /** + * jdbc 密码 + */ + @Value("${spring.datasource.password}") + private String jdbcPassword; + /** + * 设置在进程引擎启动和关闭时处理数据库模式的策略 + * false(默认值):在创建流程引擎时,根据库检查DB架构的版本,如果版本不匹配,则抛出异常。 + * true:在构建流程引擎时,将执行检查,并在必要时执行模式更新。如果该架构不存在,则创建该架构。 + * create-drop:在创建流程引擎时创建架构,在关闭流程引擎时删除架构。 + */ + @Value("${spring.datasource.databaseSchemaUpdate}") + private String databaseSchemaUpdate; + /** + * 指示Flowable引擎在启动时启动异步执行器。用于定时任务 + */ + @Value("${spring.datasource.asyncExecutorActivate}") + private boolean asyncExecutorActivate; + + @Override + public void configure(SpringProcessEngineConfiguration engineConfiguration) { + engineConfiguration.setActivityFontName("宋体"); + engineConfiguration.setLabelFontName("宋体"); + engineConfiguration.setAnnotationFontName("宋体"); + engineConfiguration.setJdbcDriver(this.jdbcDriver); + engineConfiguration.setJdbcUrl(this.jdbcUrl); + engineConfiguration.setJdbcUsername(this.jdbcUsername); + engineConfiguration.setJdbcPassword(this.jdbcPassword); + engineConfiguration.setDatabaseSchemaUpdate(this.databaseSchemaUpdate); + engineConfiguration.setAsyncExecutorActivate(this.asyncExecutorActivate); + } +} + diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java index 227de838..fb772b62 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java @@ -1,41 +1,41 @@ -package com.yanzhu.flowable.config; - -import com.yanzhu.flowable.listener.GlobalEventListener; -import lombok.RequiredArgsConstructor; -import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType; -import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher; -import org.flowable.spring.SpringProcessEngineConfiguration; -import org.springframework.context.ApplicationListener; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Flowable添加全局监听器 - * - * @author JiangYuQi - */ -@Configuration -@RequiredArgsConstructor -public class FlowableGlobalListenerConfig implements ApplicationListener { - - private final SpringProcessEngineConfiguration configuration; - - private final GlobalEventListener globalEventListener; - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) { - FlowableEventDispatcher dispatcher = configuration.getEventDispatcher(); - /** - * 任务创建全局监听-待办消息发送 - * PROCESS_CREATED 流程创建 - * TASK_CREATED 任务创建 - * TASK_COMPLETED 任务完成 - * PROCESS_COMPLETED 流程完成 - * 流程创建、任务创建、任务完成、流程完成 - */ - dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.TASK_CREATED); - dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.PROCESS_COMPLETED); - } - -} - +//package com.yanzhu.flowable.config; +// +//import com.yanzhu.flowable.listener.GlobalEventListener; +//import lombok.RequiredArgsConstructor; +//import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType; +//import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher; +//import org.flowable.spring.SpringProcessEngineConfiguration; +//import org.springframework.context.ApplicationListener; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.event.ContextRefreshedEvent; +// +///** +// * Flowable添加全局监听器 +// * +// * @author JiangYuQi +// */ +////@Configuration +//@RequiredArgsConstructor +//public class FlowableGlobalListenerConfig implements ApplicationListener { +// +// private final SpringProcessEngineConfiguration configuration; +// +// private final GlobalEventListener globalEventListener; +// +// @Override +// public void onApplicationEvent(ContextRefreshedEvent event) { +// FlowableEventDispatcher dispatcher = configuration.getEventDispatcher(); +// /** +// * 任务创建全局监听-待办消息发送 +// * PROCESS_CREATED 流程创建 +// * TASK_CREATED 任务创建 +// * TASK_COMPLETED 任务完成 +// * PROCESS_COMPLETED 流程完成 +// * 流程创建、任务创建、任务完成、流程完成 +// */ +// dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.TASK_CREATED); +// dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.PROCESS_COMPLETED); +// } +// +//} +// diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java index e577e39c..ed622464 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java @@ -4,7 +4,7 @@ import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; import com.yanzhu.common.core.web.page.TableDataInfo; import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.flowable.domain.FlowTaskEntity; +import com.yanzhu.flowable.domain.my.FlowTaskEntity; import com.yanzhu.flowable.service.IFlowBusinessKeyService; import com.yanzhu.system.api.domain.SysUser; import io.swagger.annotations.Api; diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java deleted file mode 100644 index f75c330c..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.yanzhu.flowable.controller; - -import com.yanzhu.common.core.text.Convert; -import com.yanzhu.common.core.web.controller.BaseController; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.log.annotation.Log; -import com.yanzhu.common.log.enums.BusinessType; -import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.flowable.domain.FlowProcDefDto; -import com.yanzhu.flowable.domain.FlowSaveXmlVo; -import com.yanzhu.flowable.domain.SysExpression; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import com.yanzhu.flowable.service.IFlowDefinitionService; -import com.yanzhu.flowable.service.ISysExpressionService; -import com.yanzhu.system.api.RemoteFlowService; -import com.yanzhu.system.api.RemoteRoleService; -import com.yanzhu.system.api.RemoteUserService; -import com.yanzhu.system.api.domain.SysRole; -import com.yanzhu.system.api.domain.SysUser; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.imageio.ImageIO; -import javax.servlet.http.HttpServletResponse; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; - -/** - *

- * 工作流程定义 - *

- * - * @author Tony - * @date 2021-04-03 - */ -@Slf4j -@Api(tags = "流程定义") -@RestController -@RequestMapping("/definition") -public class FlowDefinitionController extends BaseController { - - @Autowired - private IFlowDefinitionService flowDefinitionService; - - @Resource - private ISysExpressionService sysExpressionService; - - /** - * 流程定义列表 - * - * @param flowQueryVo 流程查询 - * @return 流程定义分页列表数据 - */ - @GetMapping(value = "/list") - @ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class) - public TableDataInfo list(FlowQueryVo flowQueryVo) { - SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - //超管查询所有数据 - if(!SecurityUtils.isAdmin(sysUser.getUserId())){ - flowQueryVo.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId()); - } - return flowDefinitionService.list(flowQueryVo); - } - - @ApiOperation(value = "导入流程文件", notes = "上传bpmn20的xml文件") - @Log(title = "导入流程文件", businessType = BusinessType.INSERT) - @PostMapping("/import") - public AjaxResult importFile(@RequestParam(required = false) String name, - @RequestParam(required = false) String category, - MultipartFile file) { - InputStream in = null; - try { - in = file.getInputStream(); - flowDefinitionService.importFile(name, category, null, null, null, in); - } catch (Exception e) { - log.error("导入失败:", e); - return AjaxResult.success(e.getMessage()); - } finally { - try { - if (in != null) { - in.close(); - } - } catch (IOException e) { - log.error("关闭输入流出错", e); - } - } - - return AjaxResult.success("导入成功"); - } - - @ApiOperation(value = "读取xml文件") - @GetMapping("/readXml/{deployId}") - public AjaxResult readXml(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) { - try { - return flowDefinitionService.readXml(deployId); - } catch (Exception e) { - return AjaxResult.error("加载xml文件异常"); - } - } - - @ApiOperation(value = "读取图片文件") - @GetMapping("/readImage/{deployId}") - public void readImage(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId, HttpServletResponse response) { - OutputStream os = null; - BufferedImage image = null; - try { - image = ImageIO.read(flowDefinitionService.readImage(deployId)); - response.setContentType("image/png"); - os = response.getOutputStream(); - if (image != null) { - ImageIO.write(image, "png", os); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (os != null) { - os.flush(); - os.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - @ApiOperation(value = "保存流程设计器内的xml文件") - @Log(title = "保存流程设计", businessType = BusinessType.INSERT) - @PostMapping("/save") - public AjaxResult save(@RequestBody FlowSaveXmlVo vo) { - InputStream in = null; - try { - in = new ByteArrayInputStream(vo.getXml().getBytes(StandardCharsets.UTF_8)); - flowDefinitionService.importFile(vo.getName(), vo.getCategory(), vo.getPrtype(), vo.getOwnerDeptId(), vo.getOwnerProjectId(), in); - } catch (Exception e) { - log.error("导入失败:", e); - return AjaxResult.error(e.getMessage()); - } finally { - try { - if (in != null) { - in.close(); - } - } catch (IOException e) { - log.error("关闭输入流出错", e); - } - } - return AjaxResult.success("导入成功"); - } - - - @ApiOperation(value = "发起流程") - @Log(title = "发起流程申请", businessType = BusinessType.INSERT) - @PostMapping("/start/{procDefId}") - public AjaxResult start(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId, - @ApiParam(value = "申请表单") @RequestBody Map applyInfos) { - return flowDefinitionService.startProcessInstanceById(procDefId, applyInfos); - } - - @ApiOperation(value = "激活或挂起流程定义") - @Log(title = "激活/挂起流程", businessType = BusinessType.UPDATE) - @PutMapping(value = "/updateState") - public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state, - @ApiParam(value = "流程部署ID", required = true) @RequestParam String deployId) { - flowDefinitionService.updateState(state, deployId); - return AjaxResult.success(); - } - - @ApiOperation(value = "删除流程") - @Log(title = "删除流程定义", businessType = BusinessType.UPDATE) - @DeleteMapping(value = "/{deployIds}") - public AjaxResult delete(@PathVariable String[] deployIds) { - for (String deployId : deployIds) { - flowDefinitionService.delete(deployId); - } - return AjaxResult.success(); - } - - @ApiOperation(value = "指定流程达式列表") - @GetMapping("/expList") - public AjaxResult expList(SysExpression sysExpression) { - List list = sysExpressionService.selectSysExpressionList(sysExpression); - return AjaxResult.success(list); - } - -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowInstanceController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowInstanceController.java deleted file mode 100644 index 4e53b163..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowInstanceController.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yanzhu.flowable.controller; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import com.yanzhu.flowable.service.IFlowInstanceService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - *

工作流流程实例管理

- * - * @author Tony - * @date 2021-04-03 - */ -@Slf4j -@Api(tags = "工作流流程实例管理") -@RestController -@RequestMapping("/instance") -public class FlowInstanceController { - - @Autowired - private IFlowInstanceService flowInstanceService; - - @ApiOperation(value = "根据流程定义id启动流程实例") - @PostMapping("/startBy/{procDefId}") - public AjaxResult startById(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId, - @ApiParam(value = "变量集合,json对象") @RequestBody Map variables) { - return flowInstanceService.startProcessInstanceById(procDefId, variables); - - } - - - @ApiOperation(value = "激活或挂起流程实例") - @PostMapping(value = "/updateState") - public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state, - @ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceId) { - flowInstanceService.updateState(state,instanceId); - return AjaxResult.success(); - } - - @ApiOperation("结束流程实例") - @PostMapping(value = "/stopProcessInstance") - public AjaxResult stopProcessInstance(@RequestBody FlowTaskVo flowTaskVo) { - flowInstanceService.stopProcessInstance(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "删除流程实例") - @DeleteMapping(value = "/delete/{instanceIds}") - public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String[] instanceIds, - @ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) { - for (String instanceId : instanceIds) { - flowInstanceService.delete(instanceId,deleteReason); - } - return AjaxResult.success(); - } -} \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowTaskController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowTaskController.java deleted file mode 100644 index 1d897d17..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowTaskController.java +++ /dev/null @@ -1,268 +0,0 @@ -package com.yanzhu.flowable.controller; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.log.annotation.Log; -import com.yanzhu.common.log.enums.BusinessType; -import com.yanzhu.flowable.domain.FlowTaskDto; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import com.yanzhu.flowable.service.IFlowTaskService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.imageio.ImageIO; -import javax.servlet.http.HttpServletResponse; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - *

工作流任务管理

- * - * @author Tony - * @date 2021-04-03 - */ -@Slf4j -@Api(tags = "工作流流程任务管理") -@RestController -@RequestMapping("/task") -public class FlowTaskController { - - @Autowired - private IFlowTaskService flowTaskService; - - @ApiOperation(value = "我发起的流程", response = FlowTaskDto.class) - @GetMapping(value = "/myProcess") - public AjaxResult myProcess(FlowQueryVo queryVo) { - return flowTaskService.myProcess(queryVo); - } - - @ApiOperation(value = "取消申请", response = FlowTaskDto.class) - @Log(title = "终止申请", businessType = BusinessType.UPDATE) - @PostMapping(value = "/stopProcess") - public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.stopProcess(flowTaskVo); - } - - @ApiOperation(value = "撤回流程", response = FlowTaskDto.class) - @Log(title = "撤回流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/revokeProcess") - public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.revokeProcess(flowTaskVo); - } - - @ApiOperation(value = "获取待办列表", response = FlowTaskDto.class) - @GetMapping(value = "/todoList") - public AjaxResult todoList(FlowQueryVo queryVo) { - return flowTaskService.todoList(queryVo); - } - - @ApiOperation(value = "获取已办任务", response = FlowTaskDto.class) - @GetMapping(value = "/finishedList") - public AjaxResult finishedList(FlowQueryVo queryVo) { - return flowTaskService.finishedList(queryVo); - } - - - @ApiOperation(value = "流程历史流转记录", response = FlowTaskDto.class) - @GetMapping(value = "/flowRecord") - public AjaxResult flowRecord(String procInsId, String deployId) { - return flowTaskService.flowRecord(procInsId, deployId); - } - - - @ApiOperation(value = "流程初始化表单", response = FlowTaskDto.class) - @GetMapping(value = "/flowFormData") - public AjaxResult flowFormData(String deployId) { - return flowTaskService.flowFormData(deployId); - } - - @ApiOperation(value = "获取流程变量", response = FlowTaskDto.class) - @GetMapping(value = "/processVariables/{taskId}") - public AjaxResult processVariables(@ApiParam(value = "流程任务Id") @PathVariable(value = "taskId") String taskId) { - return flowTaskService.processVariables(taskId); - } - - @ApiOperation(value = "审批任务") - @Log(title = "审批流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/complete") - public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.complete(flowTaskVo); - } - - @ApiOperation(value = "重新提交流程") - @Log(title = "重新提交流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/completeAndModify") - public AjaxResult completeAndModify(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.complete(flowTaskVo); - } - - @ApiOperation(value = "驳回任务") - @Log(title = "驳回流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/reject") - public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.taskReject(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "退回任务") - @Log(title = "退回流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/return") - public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.taskReturn(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "获取所有可回退的节点") - @PostMapping(value = "/returnList") - public AjaxResult findReturnTaskList(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.findReturnTaskList(flowTaskVo); - } - - @ApiOperation(value = "删除任务") - @Log(title = "删除流程", businessType = BusinessType.DELETE) - @DeleteMapping(value = "/delete") - public AjaxResult delete(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.deleteTask(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "认领/签收任务") - @Log(title = "认领/签收流程", businessType = BusinessType.INSERT) - @PostMapping(value = "/claim") - public AjaxResult claim(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.claim(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "取消认领/签收任务") - @Log(title = "取消认领/签收流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/unClaim") - public AjaxResult unClaim(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.unClaim(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "委派任务") - @Log(title = "委派流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/delegateTask") - public AjaxResult delegate(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.delegateTask(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "任务归还") - @Log(title = "归还流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/resolveTask") - public AjaxResult resolveTask(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.resolveTask(flowTaskVo); - return AjaxResult.success(); - } - - @ApiOperation(value = "转办任务") - @Log(title = "转办流程", businessType = BusinessType.UPDATE) - @PostMapping(value = "/assignTask") - public AjaxResult assign(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.assignTask(flowTaskVo); - return AjaxResult.success(); - } - - @PostMapping(value = "/addMultiInstanceExecution") - @ApiOperation(value = "多实例加签") - public AjaxResult addMultiInstanceExecution(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.addMultiInstanceExecution(flowTaskVo); - return AjaxResult.success("加签成功"); - } - - @PostMapping(value = "/deleteMultiInstanceExecution") - @ApiOperation(value = "多实例减签") - public AjaxResult deleteMultiInstanceExecution(@RequestBody FlowTaskVo flowTaskVo) { - flowTaskService.deleteMultiInstanceExecution(flowTaskVo); - return AjaxResult.success("减签成功"); - } - - @ApiOperation(value = "获取下一节点") - @PostMapping(value = "/nextFlowNode") - public AjaxResult getNextFlowNode(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.getNextFlowNode(flowTaskVo); - } - - @ApiOperation(value = "流程发起时获取下一节点") - @PostMapping(value = "/nextFlowNodeByStart") - public AjaxResult getNextFlowNodeByStart(@RequestBody FlowTaskVo flowTaskVo) { - return flowTaskService.getNextFlowNodeByStart(flowTaskVo); - } - - /** - * 生成流程图 - * - * @param processId 任务ID - */ - @GetMapping("/diagram/{processId}") - public void genProcessDiagram(HttpServletResponse response, - @PathVariable("processId") String processId) { - InputStream inputStream = flowTaskService.diagram(processId); - OutputStream os = null; - BufferedImage image = null; - try { - image = ImageIO.read(inputStream); - response.setContentType("image/png"); - os = response.getOutputStream(); - if (image != null) { - ImageIO.write(image, "png", os); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (os != null) { - os.flush(); - os.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 获取流程执行节点 - * - * @param procInsId 流程实例编号 - * @param procInsId 任务执行编号 - */ - @GetMapping("/flowViewer/{procInsId}/{executionId}") - public AjaxResult getFlowViewer(@PathVariable("procInsId") String procInsId, - @PathVariable("executionId") String executionId) { - return flowTaskService.getFlowViewer(procInsId, executionId); - } - - /** - * 流程节点信息 - * - * @param procInsId 流程实例id - * @return - */ - @GetMapping("/flowXmlAndNode") - public AjaxResult flowXmlAndNode(@RequestParam(value = "procInsId", required = false) String procInsId, - @RequestParam(value = "deployId", required = false) String deployId) { - return flowTaskService.flowXmlAndNode(procInsId, deployId); - } - - /** - * 流程节点表单 - * - * @param taskId 流程任务编号 - * @return - */ - @GetMapping("/flowTaskForm") - public AjaxResult flowTaskForm(@RequestParam(value = "taskId", required = false) String taskId) throws Exception { - return flowTaskService.flowTaskForm(taskId); - } - -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableCategoryController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableCategoryController.java new file mode 100644 index 00000000..5dbd2ee9 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableCategoryController.java @@ -0,0 +1,98 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.utils.poi.ExcelUtil; +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableCategory; +import com.yanzhu.flowable.service.IFlowableCategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 流程分类Controller + * + * @author ruoyi + * @date 2023-11-27 + */ +@RestController +@RequestMapping("/category") +public class FlowableCategoryController extends BaseController +{ + @Autowired + private IFlowableCategoryService flowableCategoryService; + + /** + * 查询流程分类列表 + */ + @RequiresPermissions("flow:flow_classify:list") + @GetMapping("/list") + public TableDataInfo list(FlowableCategory flowableCategory) + { + startPage(); + List list = flowableCategoryService.selectFlowableCategoryList(flowableCategory); + return getDataTable(list); + } + + /** + * 导出流程分类列表 + */ + @RequiresPermissions("flow:flow_classify:export") + @Log(title = "流程分类", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FlowableCategory flowableCategory) + { + List list = flowableCategoryService.selectFlowableCategoryList(flowableCategory); + ExcelUtil util = new ExcelUtil(FlowableCategory.class); + util.exportExcel(response, list, "流程分类数据"); + } + + /** + * 获取流程分类详细信息 + */ + @RequiresPermissions("flow:flow_classify:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(flowableCategoryService.selectFlowableCategoryById(id)); + } + + /** + * 新增流程分类 + */ + @RequiresPermissions("flow:flow_classify:add") + @Log(title = "流程分类", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FlowableCategory flowableCategory) + { + return toAjax(flowableCategoryService.insertFlowableCategory(flowableCategory)); + } + + /** + * 修改流程分类 + */ + @RequiresPermissions("flow:flow_classify:update") + @Log(title = "流程分类", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FlowableCategory flowableCategory) + { + return toAjax(flowableCategoryService.updateFlowableCategory(flowableCategory)); + } + + /** + * 删除流程分类 + */ + @RequiresPermissions("flow:flow_classify:delete") + @Log(title = "流程分类", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(flowableCategoryService.deleteFlowableCategoryByIds(ids)); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableDeployController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableDeployController.java new file mode 100644 index 00000000..9604ac18 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableDeployController.java @@ -0,0 +1,97 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableDeploy; +import com.yanzhu.flowable.service.IFlowableDeployService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 流程部署Controller + * + * @author ruoyi + * @date 2023-12-18 + */ +@RestController +@RequestMapping("/deploy") +public class FlowableDeployController extends BaseController +{ + @Autowired + private IFlowableDeployService flowableDeployService; + + /** + * 查询流程部署列表 + */ + @RequiresPermissions("flowable:deploy:list") + @GetMapping("/list") + public TableDataInfo list(FlowableDeploy flowableDeploy) + { + startPage(); + List list = flowableDeployService.selectFlowableDeployList(flowableDeploy); + return getDataTable(list); + } + + /** + * 获取流程部署详细信息 + */ + @RequiresPermissions("flowable:deploy:query") + @GetMapping(value = "/{definitionId}") + public AjaxResult getInfo(@PathVariable("definitionId") String definitionId) + { + return success(flowableDeployService.selectFlowableDeployByDefinitionId(definitionId)); + } + + + /** + * 删除流程部署 + */ + @RequiresPermissions("flowable:deploy:remove") + @Log(title = "流程部署", businessType = BusinessType.DELETE) + @DeleteMapping("/{definitionIds}") + public AjaxResult remove(@PathVariable String[] definitionIds) + { + return toAjax(flowableDeployService.deleteFlowableDeployByDefinitionIds(definitionIds)); + } + /** + * 查询流程部署版本列表 + */ + @RequiresPermissions("flowable:deploy:publishList") + @GetMapping("/publishList") + public TableDataInfo publishList(@RequestParam String processKey) { + startPage(); + + List list = flowableDeployService.queryPublishList(processKey); + return getDataTable(list); + } + + /** + * 激活或挂起流程 + * + * @param state 状态(active:激活 suspended:挂起) + * @param definitionId 流程定义ID + */ + @RequiresPermissions("flowable:deploy:state") + @PutMapping(value = "/changeState") + public AjaxResult changeState(@RequestParam String state, @RequestParam String definitionId) { + flowableDeployService.updateState(definitionId,state); + return success(); + } + + /** + * 读取xml文件 + * @param definitionId 流程定义ID + * @return + */ + @RequiresPermissions("flowable:deploy:bpmnXml") + @GetMapping("/bpmnXml/{definitionId}") + public AjaxResult getBpmnXml(@PathVariable(value = "definitionId") String definitionId) { + return AjaxResult.success("查询成功", flowableDeployService.queryBpmnXmlById(definitionId)); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldDefController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldDefController.java new file mode 100644 index 00000000..43a830fc --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldDefController.java @@ -0,0 +1,109 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.utils.poi.ExcelUtil; +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableFieldDef; +import com.yanzhu.flowable.service.IFlowableFieldDefService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 流程字段定义Controller + * + * @author ruoyi + * @date 2023-12-26 + */ +@RestController +@RequestMapping("/def") +public class FlowableFieldDefController extends BaseController +{ + @Autowired + private IFlowableFieldDefService flowableFieldDefService; + + /** + * 查询流程字段定义列表 + */ + @RequiresPermissions("flowable:def:list") + @GetMapping("/list") + public TableDataInfo list(FlowableFieldDef flowableFieldDef) + { + startPage(); + List list = flowableFieldDefService.selectFlowableFieldDefList(flowableFieldDef); + return getDataTable(list); + } + + /** + * 导出流程字段定义列表 + */ + @RequiresPermissions("flowable:def:export") + @Log(title = "流程字段定义", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FlowableFieldDef flowableFieldDef) + { + List list = flowableFieldDefService.selectFlowableFieldDefList(flowableFieldDef); + ExcelUtil util = new ExcelUtil(FlowableFieldDef.class); + util.exportExcel(response, list, "流程字段定义数据"); + } + + /** + * 获取流程字段定义详细信息 + */ + @RequiresPermissions("flowable:def:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(flowableFieldDefService.selectFlowableFieldDefById(id)); + } + + /** + * 新增流程字段定义 + */ + @RequiresPermissions("flowable:def:add") + @Log(title = "流程字段定义", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FlowableFieldDef flowableFieldDef) + { + return toAjax(flowableFieldDefService.insertFlowableFieldDef(flowableFieldDef)); + } + + /** + * 修改流程字段定义 + */ + @RequiresPermissions("flowable:def:edit") + @Log(title = "流程字段定义", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FlowableFieldDef flowableFieldDef) + { + return toAjax(flowableFieldDefService.updateFlowableFieldDef(flowableFieldDef)); + } + + /** + * 删除流程字段定义 + */ + @RequiresPermissions("flowable:def:remove") + @Log(title = "流程字段定义", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(flowableFieldDefService.deleteFlowableFieldDefByIds(ids)); + } + /** + * 查询流程字段定义列表(不翻页) + */ + @RequiresPermissions("flowable:def:listAll") + @GetMapping("/listAll") + public AjaxResult listAll(FlowableFieldDef flowableFieldDef) + { + List list = flowableFieldDefService.selectFlowableFieldDefList(flowableFieldDef); + return success(list); + } + +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldRefController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldRefController.java new file mode 100644 index 00000000..2d7faf9a --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableFieldRefController.java @@ -0,0 +1,113 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.utils.poi.ExcelUtil; +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableFieldDef; +import com.yanzhu.flowable.domain.FlowableFieldRef; +import com.yanzhu.flowable.domain.FlowableFieldSearch; +import com.yanzhu.flowable.service.IFlowableFieldDefService; +import com.yanzhu.flowable.service.IFlowableFieldRefService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 流程字段引用关系Controller + * + * @author ruoyi + * @date 2023-12-26 + */ +@RestController +@RequestMapping("/ref") +public class FlowableFieldRefController extends BaseController +{ + @Autowired + private IFlowableFieldRefService flowableFieldRefService; + + @Autowired + private IFlowableFieldDefService flowableFieldDefService; + /** + * 查询流程字段引用关系列表 + */ + @RequiresPermissions("flowable:ref:list") + @GetMapping("/list") + public TableDataInfo list(FlowableFieldRef flowableFieldRef) + { + startPage(); + List list = flowableFieldRefService.selectFlowableFieldRefList(flowableFieldRef); + return getDataTable(list); + } + + /** + * 导出流程字段引用关系列表 + */ + @RequiresPermissions("flowable:ref:export") + @Log(title = "流程字段引用关系", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FlowableFieldRef flowableFieldRef) + { + List list = flowableFieldRefService.selectFlowableFieldRefList(flowableFieldRef); + ExcelUtil util = new ExcelUtil(FlowableFieldRef.class); + util.exportExcel(response, list, "流程字段引用关系数据"); + } + + /** + * 获取流程字段引用关系详细信息 + */ + @RequiresPermissions("flowable:ref:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(flowableFieldRefService.selectFlowableFieldRefById(id)); + } + + /** + * 新增流程字段引用关系 + */ + @RequiresPermissions("flowable:ref:add") + @Log(title = "流程字段引用关系", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FlowableFieldRef flowableFieldRef) + { + return toAjax(flowableFieldRefService.insertFlowableFieldRef(flowableFieldRef)); + } + + /** + * 修改流程字段引用关系 + */ + @RequiresPermissions("flowable:ref:edit") + @Log(title = "流程字段引用关系", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FlowableFieldRef flowableFieldRef) + { + return toAjax(flowableFieldRefService.updateFlowableFieldRef(flowableFieldRef)); + } + + /** + * 删除流程字段引用关系 + */ + @RequiresPermissions("flowable:ref:remove") + @Log(title = "流程字段引用关系", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(flowableFieldRefService.deleteFlowableFieldRefByIds(ids)); + } + /** + * 查询流程字段引用关系列表(不翻页,关联字段定义表查询) + */ + @RequiresPermissions("flowable:ref:listCombination") + @GetMapping("/listCombination") + public AjaxResult listCombination(FlowableFieldSearch flowableFieldSearch) + { + List list = flowableFieldDefService.listCombination(flowableFieldSearch); + return success(list); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelController.java new file mode 100644 index 00000000..60312c88 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelController.java @@ -0,0 +1,172 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.utils.poi.ExcelUtil; +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableModel; +import com.yanzhu.flowable.domain.bo.FlowableModelBo; +import com.yanzhu.flowable.service.IFlowableModelService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotNull; +import java.io.UnsupportedEncodingException; +import java.util.List; + +/** + * 流程模型Controller + * + * @author ruoyi + * @date 2023-11-28 + */ +@RestController +@RequestMapping("/model") +@Slf4j +public class FlowableModelController extends BaseController +{ + @Autowired + private IFlowableModelService flowableModelService; + + /** + * 查询流程模型列表 + */ + @RequiresPermissions("flow:flow_model:list") + @GetMapping("/list") + public TableDataInfo list(FlowableModelBo flowableModelBo) + { + startPage(); + List list = flowableModelService.selectFlowableModelList(flowableModelBo); + return getDataTable(list); + } + + /** + * 导出流程模型列表 + */ + @RequiresPermissions("flow:flow_model:export") + @Log(title = "流程模型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FlowableModelBo flowableModel) + { + List list = flowableModelService.selectFlowableModelList(flowableModel); + ExcelUtil util = new ExcelUtil(FlowableModel.class); + util.exportExcel(response, list, "流程模型数据"); + } + + /** + * 获取流程模型详细信息 + */ + @RequiresPermissions("flow:flow_model:query") + @GetMapping(value = "/{modelId}") + public AjaxResult getInfo(@PathVariable("modelId") String modelId) + { + return success(flowableModelService.selectFlowableModelByModelId(modelId)); + } + + /** + * 新增流程模型 + */ + @RequiresPermissions("flow:flow_model:add") + @Log(title = "流程模型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FlowableModel flowableModel) + { + return toAjax(flowableModelService.insertFlowableModel(flowableModel)); + } + + /** + * 修改流程模型 + */ + @RequiresPermissions("flow:flow_model:update") + @Log(title = "流程模型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FlowableModel flowableModel) + { + return toAjax(flowableModelService.updateFlowableModel(flowableModel)); + } + + /** + * 删除流程模型 + */ + @RequiresPermissions("flow:flow_model:delete") + @Log(title = "流程模型", businessType = BusinessType.DELETE) + @DeleteMapping("/{modelIds}") + public AjaxResult remove(@PathVariable String[] modelIds) + { + return toAjax(flowableModelService.deleteFlowableModelByModelIds(modelIds)); + } + /** + * 部署流程模型 + * + * @param modelId 流程模型主键 + */ + @RequiresPermissions("flow:flow_model:deploy") + @Log(title = "部署流程模型", businessType = BusinessType.OTHER) + @PostMapping("/deploy") + public AjaxResult deployModel(@RequestParam String modelId) { + try { + flowableModelService.deployModel(modelId); + } catch (UnsupportedEncodingException e) { + log.error("部署失败!",e); + } + return success(); + } + /** + * 获取流程表单详细信息 + * + * @param modelId 模型id + */ + @RequiresPermissions("flow:flow_model:queryXml") + @GetMapping(value = "/getBpmnXml/{modelId}") + public AjaxResult getBpmnXml(@NotNull(message = "主键不能为空") @PathVariable("modelId") String modelId) { + try { + return AjaxResult.success("查询成功",flowableModelService.queryBpmnXmlById(modelId)); + } catch (UnsupportedEncodingException e) { + log.error("获取模型xml失败!模型id:"+modelId,e); + return AjaxResult.error("获取模型xml失败!"); + } + } + /** + * 查询流程模型版本历史列表 + * + * @param modelBo 流程模型对象 + */ + @RequiresPermissions("flow:flow_model:historyList") + @GetMapping("/historyList") + public TableDataInfo historyList(FlowableModelBo modelBo) { + startPage(); + List list = flowableModelService.historyList(modelBo); + return getDataTable(list); + } + /** + * 保存(更新或插入新版本)流程模型 + */ + @RequiresPermissions("flow:flow_model::save") + @PostMapping("/save") + public AjaxResult save(@RequestBody FlowableModelBo modelBo) { + flowableModelService.saveModel(modelBo); + return success(); + } + /** + * 设为最新流程模型 + * @param modelId + * @return + */ + @RequiresPermissions("flow:flow_model:lastest") + @PostMapping("/latest/") + public AjaxResult latest(@RequestParam String modelId) { + try { + flowableModelService.latestModel(modelId); + return success(); + } catch (UnsupportedEncodingException e) { + log.error("设置最新版本失败!",e); + return error("设置最新版本失败!"); + } + + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelPageController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelPageController.java new file mode 100644 index 00000000..74056f87 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowableModelPageController.java @@ -0,0 +1,152 @@ +package com.yanzhu.flowable.controller; + +import com.yanzhu.common.core.utils.poi.ExcelUtil; +import com.yanzhu.common.core.web.controller.BaseController; +import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.core.web.page.TableDataInfo; +import com.yanzhu.common.log.annotation.Log; +import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.RequiresPermissions; +import com.yanzhu.flowable.domain.FlowableModelPage; +import com.yanzhu.flowable.service.IFlowableModelPageService; +import io.jsonwebtoken.lang.Collections; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 建模页面绑定Controller + * + * @author ruoyi + * @date 2023-12-25 + */ +@RestController +@RequestMapping("/page") +public class FlowableModelPageController extends BaseController +{ + @Autowired + private IFlowableModelPageService flowableModelPageService; + + /** + * 查询建模页面绑定列表 + */ + @RequiresPermissions("flowable:page:list") + @GetMapping("/list") + public TableDataInfo list(FlowableModelPage flowableModelPage) + { + startPage(); + List list = flowableModelPageService.selectFlowableModelPageList(flowableModelPage); + return getDataTable(list); + } + + /** + * 导出建模页面绑定列表 + */ + @RequiresPermissions("flowable:page:export") + @Log(title = "建模页面绑定", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FlowableModelPage flowableModelPage) + { + List list = flowableModelPageService.selectFlowableModelPageList(flowableModelPage); + ExcelUtil util = new ExcelUtil(FlowableModelPage.class); + util.exportExcel(response, list, "建模页面绑定数据"); + } + + /** + * 获取建模页面绑定详细信息 + */ + @RequiresPermissions("flowable:page:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(flowableModelPageService.selectFlowableModelPageById(id)); + } + + /** + * 新增建模页面绑定 + */ + @RequiresPermissions("flowable:page:add") + @Log(title = "建模页面绑定", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FlowableModelPage flowableModelPage) + { + return toAjax(flowableModelPageService.insertFlowableModelPage(flowableModelPage)); + } + + /** + * 修改建模页面绑定 + */ + @RequiresPermissions("flowable:page:edit") + @Log(title = "建模页面绑定", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FlowableModelPage flowableModelPage) + { + return toAjax(flowableModelPageService.updateFlowableModelPage(flowableModelPage)); + } + + /** + * 删除建模页面绑定 + */ + @RequiresPermissions("flowable:page:remove") + @Log(title = "建模页面绑定", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(flowableModelPageService.deleteFlowableModelPageByIds(ids)); + } + /** + * 建模页面绑定 + */ + @RequiresPermissions("flowable:page:bind") + @Log(title = "建模页面绑定", businessType = BusinessType.UPDATE) + @PutMapping(value="/bind") + public AjaxResult bind(@RequestBody FlowableModelPage flowableModelPage) + { + List list = flowableModelPageService.selectFlowableModelPageListByBind(flowableModelPage); + if(Collections.isEmpty(list)){ + return toAjax(flowableModelPageService.insertFlowableModelPage(flowableModelPage)); + }else { + flowableModelPage.setId(list.get(0).getId()); + return toAjax(flowableModelPageService.updateFlowableModelPage(flowableModelPage)); + } + } + /** + * 建模页面单页面查询(根据模块,流程标识,页面名称查询) + */ + @RequiresPermissions("flowable:page:findPage") + @Log(title = "建模页面单页面查询", businessType = BusinessType.UPDATE) + @PostMapping(value="/findPage") + public AjaxResult findPage(@RequestBody FlowableModelPage flowableModelPage) + { + FlowableModelPage page = flowableModelPageService.selectFlowableModelPageSingle(flowableModelPage); + return success(page); + } + /** + * 建模页面模块页面查询(按模块,流程标识查询) + */ + @RequiresPermissions("flowable:page:findModulePage") + @Log(title = "建模页面模块页面查询", businessType = BusinessType.UPDATE) + @PostMapping(value="/findModulePage") + public AjaxResult findModulePage(@RequestBody FlowableModelPage flowableModelPage) + { + List list = flowableModelPageService.selectFlowableModelPage(flowableModelPage); + return success(list); + } + /** + * 建模页面解绑 + */ + @RequiresPermissions("flowable:page:unbind") + @Log(title = "建模页面解绑", businessType = BusinessType.UPDATE) + @PutMapping(value="/unbind") + public AjaxResult unbind(@RequestBody FlowableModelPage flowableModelPage) + { + List list = flowableModelPageService.selectFlowableModelPageListByBind(flowableModelPage); + if(Collections.isEmpty(list)){ + return error("页面没找到!"); + }else { + return toAjax(flowableModelPageService.deleteFlowableModelPageById(list.get(0).getId())); + } + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/SysFormController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/SysFormController.java deleted file mode 100644 index 3c819b30..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/SysFormController.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.yanzhu.flowable.controller; - -import com.yanzhu.common.core.utils.poi.ExcelUtil; -import com.yanzhu.common.core.web.controller.BaseController; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.log.annotation.Log; -import com.yanzhu.common.log.enums.BusinessType; -import com.yanzhu.common.security.annotation.RequiresPermissions; -import com.yanzhu.flowable.domain.SysDeployForm; -import com.yanzhu.flowable.domain.SysForm; -import com.yanzhu.flowable.service.ISysDeployFormService; -import com.yanzhu.flowable.service.ISysFormService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 流程表单Controller - * - * @author Tony - * @date 2021-04-03 - */ -@RestController -@RequestMapping("/form") -public class SysFormController extends BaseController { - - @Autowired - private ISysFormService SysFormService; - - @Autowired - private ISysDeployFormService sysDeployFormService; - - /** - * 查询流程表单列表 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:list')") - @GetMapping("/list") - public TableDataInfo list(SysForm sysForm) { - startPage(); - List list = SysFormService.selectSysFormList(sysForm); - return getDataTable(list); - } - - @GetMapping("/formList") - public AjaxResult formList(SysForm sysForm) { - List list = SysFormService.selectSysFormList(sysForm); - return AjaxResult.success(list); - } - /** - * 导出流程表单列表 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:export')") - @Log(title = "流程表单", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public void export(HttpServletResponse response, SysForm sysForm) { - List list = SysFormService.selectSysFormList(sysForm); - ExcelUtil util = new ExcelUtil(SysForm.class); - util.exportExcel(response, list, "form"); - } - - /** - * 获取流程表单详细信息 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:query')") - @GetMapping(value = "/{formId}") - public AjaxResult getInfo(@PathVariable("formId") Long formId) { - return AjaxResult.success(SysFormService.selectSysFormById(formId)); - } - - /** - * 新增流程表单 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:add')") - @Log(title = "流程表单", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody SysForm sysForm) { - return toAjax(SysFormService.insertSysForm(sysForm)); - } - - /** - * 修改流程表单 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:edit')") - @Log(title = "流程表单", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody SysForm sysForm) { - return toAjax(SysFormService.updateSysForm(sysForm)); - } - - /** - * 删除流程表单 - */ - @RequiresPermissions("@ss.hasPermi('flowable:form:remove')") - @Log(title = "流程表单", businessType = BusinessType.DELETE) - @DeleteMapping("/{formIds}") - public AjaxResult remove(@PathVariable Long[] formIds) { - return toAjax(SysFormService.deleteSysFormByIds(formIds)); - } - - /** - * 挂载流程表单 - */ - @Log(title = "流程表单", businessType = BusinessType.INSERT) - @PostMapping("/addDeployForm") - public AjaxResult addDeployForm(@RequestBody SysDeployForm sysDeployForm) { - return toAjax(sysDeployFormService.insertSysDeployForm(sysDeployForm)); - } -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/CustomProcessDiagramCanvas.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/CustomProcessDiagramCanvas.java index 7a0baca5..c84766ca 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/CustomProcessDiagramCanvas.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/CustomProcessDiagramCanvas.java @@ -135,7 +135,6 @@ public class CustomProcessDiagramCanvas extends DefaultProcessDiagramCanvas { SHELL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/shellTask.png", this.customClassLoader)); DMN_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/dmnTask.png", this.customClassLoader)); CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/camelTask.png", this.customClassLoader)); - MULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/muleTask.png", this.customClassLoader)); HTTP_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/httpTask.png", this.customClassLoader)); TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/timer.png", this.customClassLoader)); COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/compensate-throw.png", this.customClassLoader)); diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelHelper.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelHelper.java new file mode 100644 index 00000000..5636c39b --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelHelper.java @@ -0,0 +1,143 @@ +package com.yanzhu.flowable.flow; + +import org.flowable.bpmn.converter.BpmnXMLConverter; +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.*; +import org.flowable.common.engine.impl.util.io.StringStreamSource; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * @author ruoyi + * @createTime 2023/11/29 19:04 + */ +public class ModelHelper { + + private static final BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter(); + + /** + * xml转bpmnModel对象 + * + * @param xml xml + * @return bpmnModel对象 + */ + public static BpmnModel getBpmnModel(String xml) { + return bpmnXMLConverter.convertToBpmnModel(new StringStreamSource(xml), false, false); + } + + /** + * bpmnModel转xml对象 + * + * @param bpmnModel bpmnModel对象 + * @return xml + */ + public static byte[] getBpmnXml(BpmnModel bpmnModel) { + return bpmnXMLConverter.convertToXML(bpmnModel); + } + + /** + * 获取开始节点 + * + * @param model bpmnModel对象 + * @return 开始节点(未找到开始节点,返回null) + */ + public static StartEvent getStartEvent(BpmnModel model) { + Process process = model.getMainProcess(); + FlowElement startElement = process.getInitialFlowElement(); + if (startElement instanceof StartEvent) { + return (StartEvent) startElement; + } + return getStartEvent(process.getFlowElements()); + } + + /** + * 获取开始节点 + * + * @param flowElements 流程元素集合 + * @return 开始节点(未找到开始节点,返回null) + */ + public static StartEvent getStartEvent(Collection flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof StartEvent) { + return (StartEvent) flowElement; + } + } + return null; + } + + /** + * 获取结束节点 + * + * @param model bpmnModel对象 + * @return 结束节点(未找到开始节点,返回null) + */ + public static EndEvent getEndEvent(BpmnModel model) { + Process process = model.getMainProcess(); + return getEndEvent(process.getFlowElements()); + } + + /** + * 获取结束节点 + * + * @param flowElements 流程元素集合 + * @return 结束节点(未找到开始节点,返回null) + */ + public static EndEvent getEndEvent(Collection flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof EndEvent) { + return (EndEvent) flowElement; + } + } + return null; + } + + public static UserTask getUserTaskByKey(BpmnModel model, String taskKey) { + Process process = model.getMainProcess(); + FlowElement flowElement = process.getFlowElement(taskKey); + if (flowElement instanceof UserTask) { + return (UserTask) flowElement; + } + return null; + } + + public static boolean isMultiInstance(BpmnModel model, String taskKey) { + UserTask userTask = getUserTaskByKey(model, taskKey); + if (userTask==null) { + return userTask.hasMultiInstanceLoopCharacteristics(); + } + return false; + } + + /** + * 获取所有用户任务节点 + * + * @param model bpmnModel对象 + * @return 用户任务节点列表 + */ + public static Collection getAllUserTaskEvent(BpmnModel model) { + Process process = model.getMainProcess(); + Collection flowElements = process.getFlowElements(); + return getAllUserTaskEvent(flowElements, null); + } + + /** + * 获取所有用户任务节点 + * @param flowElements 流程元素集合 + * @param allElements 所有流程元素集合 + * @return 用户任务节点列表 + */ + public static Collection getAllUserTaskEvent(Collection flowElements, Collection allElements) { + allElements = allElements == null ? new ArrayList<>() : allElements; + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof UserTask) { + allElements.add((UserTask) flowElement); + } + if (flowElement instanceof SubProcess) { + // 继续深入子流程,进一步获取子流程 + allElements = getAllUserTaskEvent(((SubProcess) flowElement).getFlowElements(), allElements); + } + } + return allElements; + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java index 1e6f1f7d..79358592 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java @@ -1,6 +1,6 @@ package com.yanzhu.flowable.service; -import com.yanzhu.flowable.domain.FlowTaskEntity; +import com.yanzhu.flowable.domain.my.FlowTaskEntity; import java.util.List; import java.util.Map; diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java deleted file mode 100644 index 80258211..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -/** - * @author Tony - * @date 2021-04-03 14:41 - */ -public interface IFlowDefinitionService { - - boolean exist(String processDefinitionKey); - - /** - * 流程定义列表 - * - * @param flowQueryVo 流程查询 - * @return 流程定义分页列表数据 - */ - TableDataInfo list(FlowQueryVo flowQueryVo); - - /** - * 导入流程文件 - * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义, - * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义 - * @param name - * @param category - * @param prtype 流程定义类型 - * @param OwnerDeptId 流程单位 - * @param OwnerProjectId 流程项目 - * @param in - */ - void importFile(String name, String category, String prtype, String OwnerDeptId, String OwnerProjectId, InputStream in); - - /** - * 读取xml - * @param deployId - * @return - */ - AjaxResult readXml(String deployId) throws IOException; - - /** - * 根据流程定义ID启动流程实例 - * - * @param procDefId 流程ID - * @param applyInfos 申请表单 - * @return - */ - AjaxResult startProcessInstanceById(String procDefId, Map applyInfos); - - - /** - * 激活或挂起流程定义 - * - * @param state 状态 - * @param deployId 流程部署ID - */ - void updateState(Integer state, String deployId); - - - /** - * 删除流程定义 - * - * @param deployId 流程部署ID act_ge_bytearray 表中 deployment_id值 - */ - void delete(String deployId); - - - /** - * 读取图片文件 - * @param deployId - * @return - */ - InputStream readImage(String deployId); - -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowInstanceService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowInstanceService.java deleted file mode 100644 index acc69698..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowInstanceService.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import org.flowable.engine.history.HistoricProcessInstance; - -import java.util.Map; - -/** - * @author Tony - * @date 2021-04-03 14:40 - */ -public interface IFlowInstanceService { - - /** - * 结束流程实例 - * - * @param vo - */ - void stopProcessInstance(FlowTaskVo vo); - - /** - * 激活或挂起流程实例 - * - * @param state 状态 - * @param instanceId 流程实例ID - */ - void updateState(Integer state, String instanceId); - - /** - * 删除流程实例ID - * - * @param instanceId 流程实例ID - * @param deleteReason 删除原因 - */ - void delete(String instanceId, String deleteReason); - - /** - * 根据实例ID查询历史实例数据 - * - * @param processInstanceId - * @return - */ - HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId); - - /** - * 根据流程定义ID启动流程实例 - * - * @param procDefId 流程定义Id - * @param variables 流程变量 - * @return - */ - AjaxResult startProcessInstanceById(String procDefId, Map variables); -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowTaskService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowTaskService.java deleted file mode 100644 index c23dd4ec..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowTaskService.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import org.flowable.task.api.Task; - -import java.io.InputStream; - -/** - * @author Tony - * @date 2021-04-03 14:42 - */ -public interface IFlowTaskService { - - /** - * 审批任务 - * - * @param task 请求实体参数 - */ - AjaxResult complete(FlowTaskVo task); - - /** - * 驳回任务 - * - * @param flowTaskVo - */ - void taskReject(FlowTaskVo flowTaskVo); - - - /** - * 退回任务 - * - * @param flowTaskVo 请求实体参数 - */ - void taskReturn(FlowTaskVo flowTaskVo); - - /** - * 获取所有可回退的节点 - * - * @param flowTaskVo - * @return - */ - AjaxResult findReturnTaskList(FlowTaskVo flowTaskVo); - - /** - * 删除任务 - * - * @param flowTaskVo 请求实体参数 - */ - void deleteTask(FlowTaskVo flowTaskVo); - - /** - * 认领/签收任务 - * - * @param flowTaskVo 请求实体参数 - */ - void claim(FlowTaskVo flowTaskVo); - - /** - * 取消认领/签收任务 - * - * @param flowTaskVo 请求实体参数 - */ - void unClaim(FlowTaskVo flowTaskVo); - - /** - * 委派任务 - * - * @param flowTaskVo 请求实体参数 - */ - void delegateTask(FlowTaskVo flowTaskVo); - - /** - * 任务归还 - * - * @param flowTaskVo 请求实体参数 - */ - void resolveTask(FlowTaskVo flowTaskVo); - - - /** - * 转办任务 - * - * @param flowTaskVo 请求实体参数 - */ - void assignTask(FlowTaskVo flowTaskVo); - - - /** - * 多实例加签 - * @param flowTaskVo - */ - void addMultiInstanceExecution(FlowTaskVo flowTaskVo); - - /** - * 多实例减签 - * @param flowTaskVo - */ - void deleteMultiInstanceExecution(FlowTaskVo flowTaskVo); - - /** - * 我发起的流程 - * @param queryVo 请求参数 - * @return - */ - AjaxResult myProcess(FlowQueryVo queryVo); - - /** - * 取消申请 - * 目前实现方式: 直接将当前流程变更为已完成 - * @param flowTaskVo - * @return - */ - AjaxResult stopProcess(FlowTaskVo flowTaskVo); - - /** - * 撤回流程 - * @param flowTaskVo - * @return - */ - AjaxResult revokeProcess(FlowTaskVo flowTaskVo); - - - /** - * 代办任务列表 - * - * @param queryVo 请求参数 - * @return - */ - AjaxResult todoList(FlowQueryVo queryVo); - - - /** - * 已办任务列表 - * - * @param queryVo 请求参数 - * @return - */ - AjaxResult finishedList(FlowQueryVo queryVo); - - /** - * 流程历史流转记录 - * - * @param procInsId 流程实例Id - * @return - */ - AjaxResult flowRecord(String procInsId,String deployId); - - /** - * 根据任务ID查询挂载的表单信息 - * - * @param taskId 任务Id - * @return - */ - Task getTaskForm(String taskId); - - /** - * 获取流程过程图 - * @param processId - * @return - */ - InputStream diagram(String processId); - - /** - * 获取流程执行节点 - * @param procInsId - * @return - */ - AjaxResult getFlowViewer(String procInsId,String executionId); - - /** - * 获取流程变量 - * @param taskId - * @return - */ - AjaxResult processVariables(String taskId); - - /** - * 获取下一节点 - * @param flowTaskVo 任务 - * @return - */ - AjaxResult getNextFlowNode(FlowTaskVo flowTaskVo); - - AjaxResult getNextFlowNodeByStart(FlowTaskVo flowTaskVo); - - /** - * 流程初始化表单 - * @param deployId - * @return - */ - AjaxResult flowFormData(String deployId); - - /** - * 流程节点信息 - * @param procInsId - * @return - */ - AjaxResult flowXmlAndNode(String procInsId,String deployId); - - /** - * 流程节点表单 - * @param taskId 流程任务编号 - * @return - */ - AjaxResult flowTaskForm(String taskId) throws Exception; -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableCategoryService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableCategoryService.java new file mode 100644 index 00000000..6cd98a46 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableCategoryService.java @@ -0,0 +1,69 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableCategory; + +import java.util.List; +import java.util.Map; + +/** + * 流程分类Service接口 + * + * @author ruoyi + * @date 2023-11-27 + */ +public interface IFlowableCategoryService +{ + /** + * 查询流程分类 + * + * @param id 流程分类主键 + * @return 流程分类 + */ + public FlowableCategory selectFlowableCategoryById(Long id); + + /** + * 查询流程分类列表 + * + * @param flowableCategory 流程分类 + * @return 流程分类集合 + */ + public List selectFlowableCategoryList(FlowableCategory flowableCategory); + + /** + * 新增流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + public int insertFlowableCategory(FlowableCategory flowableCategory); + + /** + * 修改流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + public int updateFlowableCategory(FlowableCategory flowableCategory); + + /** + * 批量删除流程分类 + * + * @param ids 需要删除的流程分类主键集合 + * @return 结果 + */ + public int deleteFlowableCategoryByIds(Long[] ids); + + /** + * 删除流程分类信息 + * + * @param id 流程分类主键 + * @return 结果 + */ + public int deleteFlowableCategoryById(Long id); + + /** + * 更新缓存 + * @param flowableCategories + */ + public Map updateRedis(List flowableCategories); +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableDeployService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableDeployService.java new file mode 100644 index 00000000..735452d1 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableDeployService.java @@ -0,0 +1,68 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableDeploy; + +import java.util.List; + +/** + * 流程部署Service接口 + * + * @author ruoyi + * @date 2023-12-18 + */ +public interface IFlowableDeployService +{ + /** + * 查询流程部署 + * + * @param definitionId 流程部署主键 + * @return 流程部署 + */ + public FlowableDeploy selectFlowableDeployByDefinitionId(String definitionId); + + /** + * 查询流程部署列表 + * + * @param flowableDeploy 流程部署 + * @return 流程部署集合 + */ + public List selectFlowableDeployList(FlowableDeploy flowableDeploy); + + + /** + * 批量删除流程部署 + * + * @param definitionIds 需要删除的流程部署主键集合 + * @return 结果 + */ + public int deleteFlowableDeployByDefinitionIds(String[] definitionIds); + + /** + * 删除流程部署信息 + * + * @param definitionId 流程部署主键 + * @return 结果 + */ + public int deleteFlowableDeployByDefinitionId(String definitionId); + + /** + * 查询所有部署的历史版本 + * @param processKey 流程key + * @return + */ + public List queryPublishList(String processKey); + + /** + * 改变部署状态 + * @param definitionId + * @param stateCode + */ + public void updateState(String definitionId, String stateCode); + + /** + * 查询流程图 + * @param definitionId + * @return + */ + public String queryBpmnXmlById(String definitionId); +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldDefService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldDefService.java new file mode 100644 index 00000000..91044591 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldDefService.java @@ -0,0 +1,70 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableFieldDef; +import com.yanzhu.flowable.domain.FlowableFieldSearch; + +import java.util.List; + +/** + * 流程字段定义Service接口 + * + * @author ruoyi + * @date 2023-12-26 + */ +public interface IFlowableFieldDefService +{ + /** + * 查询流程字段定义 + * + * @param id 流程字段定义主键 + * @return 流程字段定义 + */ + public FlowableFieldDef selectFlowableFieldDefById(String id); + + /** + * 查询流程字段定义列表 + * + * @param flowableFieldDef 流程字段定义 + * @return 流程字段定义集合 + */ + public List selectFlowableFieldDefList(FlowableFieldDef flowableFieldDef); + + /** + * 新增流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + public int insertFlowableFieldDef(FlowableFieldDef flowableFieldDef); + + /** + * 修改流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + public int updateFlowableFieldDef(FlowableFieldDef flowableFieldDef); + + /** + * 批量删除流程字段定义 + * + * @param ids 需要删除的流程字段定义主键集合 + * @return 结果 + */ + public int deleteFlowableFieldDefByIds(String[] ids); + + /** + * 删除流程字段定义信息 + * + * @param id 流程字段定义主键 + * @return 结果 + */ + public int deleteFlowableFieldDefById(String id); + + /** + * 查询流程字段引用关系列表(不翻页,关联字段定义表查询) + * @param flowableFieldSearch + * @return + */ + List listCombination(FlowableFieldSearch flowableFieldSearch); +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldRefService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldRefService.java new file mode 100644 index 00000000..1edcb29b --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableFieldRefService.java @@ -0,0 +1,62 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableFieldRef; + +import java.util.List; + +/** + * 流程字段引用关系Service接口 + * + * @author ruoyi + * @date 2023-12-26 + */ +public interface IFlowableFieldRefService +{ + /** + * 查询流程字段引用关系 + * + * @param id 流程字段引用关系主键 + * @return 流程字段引用关系 + */ + public FlowableFieldRef selectFlowableFieldRefById(String id); + + /** + * 查询流程字段引用关系列表 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 流程字段引用关系集合 + */ + public List selectFlowableFieldRefList(FlowableFieldRef flowableFieldRef); + + /** + * 新增流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + public int insertFlowableFieldRef(FlowableFieldRef flowableFieldRef); + + /** + * 修改流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + public int updateFlowableFieldRef(FlowableFieldRef flowableFieldRef); + + /** + * 批量删除流程字段引用关系 + * + * @param ids 需要删除的流程字段引用关系主键集合 + * @return 结果 + */ + public int deleteFlowableFieldRefByIds(String[] ids); + + /** + * 删除流程字段引用关系信息 + * + * @param id 流程字段引用关系主键 + * @return 结果 + */ + public int deleteFlowableFieldRefById(String id); +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelPageService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelPageService.java new file mode 100644 index 00000000..5dfa47e1 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelPageService.java @@ -0,0 +1,83 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableModelPage; + +import java.util.List; + +/** + * 建模页面绑定Service接口 + * + * @author ruoyi + * @date 2023-12-25 + */ +public interface IFlowableModelPageService +{ + /** + * 查询建模页面绑定 + * + * @param id 建模页面绑定主键 + * @return 建模页面绑定 + */ + public FlowableModelPage selectFlowableModelPageById(String id); + + /** + * 查询建模页面绑定列表 + * + * @param flowableModelPage 建模页面绑定 + * @return 建模页面绑定集合 + */ + public List selectFlowableModelPageList(FlowableModelPage flowableModelPage); + + /** + * 新增建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + public int insertFlowableModelPage(FlowableModelPage flowableModelPage); + + /** + * 修改建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + public int updateFlowableModelPage(FlowableModelPage flowableModelPage); + + /** + * 批量删除建模页面绑定 + * + * @param ids 需要删除的建模页面绑定主键集合 + * @return 结果 + */ + public int deleteFlowableModelPageByIds(String[] ids); + + /** + * 删除建模页面绑定信息 + * + * @param id 建模页面绑定主键 + * @return 结果 + */ + public int deleteFlowableModelPageById(String id); + + /** + * 查询需要绑定的建模页面 + * @param flowableModelPage + * @return + */ + List selectFlowableModelPageListByBind(FlowableModelPage flowableModelPage); + + /*** + * 建模页面单页面查询(根据模块,流程标识,页面名称查询) + * @param flowableModelPage + * @return + */ + FlowableModelPage selectFlowableModelPageSingle(FlowableModelPage flowableModelPage); + + /** + * 建模页面模块页面查询(按模块,流程标识查询) + * @param flowableModelPage + * @return + */ + List selectFlowableModelPage(FlowableModelPage flowableModelPage); +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelService.java new file mode 100644 index 00000000..99deea99 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowableModelService.java @@ -0,0 +1,96 @@ +package com.yanzhu.flowable.service; + +import com.yanzhu.flowable.domain.FlowableModel; +import com.yanzhu.flowable.domain.bo.FlowableModelBo; + +import java.io.UnsupportedEncodingException; +import java.util.List; + +/** + * 流程模型Service接口 + * + * @author ruoyi + * @date 2023-11-28 + */ +public interface IFlowableModelService +{ + /** + * 查询流程模型 + * + * @param modelId 流程模型主键 + * @return 流程模型 + */ + public FlowableModel selectFlowableModelByModelId(String modelId); + + /** + * 查询流程模型列表 + * + * @param flowableModel 流程模型 + * @return 流程模型集合 + */ + public List selectFlowableModelList(FlowableModelBo flowableModel); + + /** + * 新增流程模型 + * + * @param flowableModel 流程模型 + * @return + */ + public int insertFlowableModel(FlowableModel flowableModel); + + /** + * 修改流程模型 + * + * @param flowableModel 流程模型 + * @return + */ + public int updateFlowableModel(FlowableModel flowableModel); + + /** + * 批量删除流程模型 + * + * @param modelIds 需要删除的流程模型主键集合 + * @return + */ + public int deleteFlowableModelByModelIds(String[] modelIds); + + /** + * 删除流程模型信息 + * + * @param modelId 流程模型主键 + */ + public void deleteFlowableModelByModelId(String modelId); + + /** + * 部署流程 + * @param modelId 模型id + */ + public void deployModel(String modelId) throws UnsupportedEncodingException; + + /** + * 获取模型xml + * @param modelId + * @return + * @throws UnsupportedEncodingException + */ + public String queryBpmnXmlById(String modelId) throws UnsupportedEncodingException; + + /** + * 查询模型历史版本 + * @param modelBo + * @return + */ + List historyList(FlowableModelBo modelBo); + + /** + * 新增或更新模型xml + * @param modelBo + */ + void saveModel(FlowableModelBo modelBo); + + /** + * 设置为最新版本 + * @param modelId + */ + void latestModel(String modelId) throws UnsupportedEncodingException; +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysDeployFormService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysDeployFormService.java deleted file mode 100644 index 01ff72bc..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysDeployFormService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.flowable.domain.SysDeployForm; -import com.yanzhu.flowable.domain.SysForm; - -import java.util.List; - -/** - * 流程实例关联表单Service接口 - * - * @author Tony - * @date 2021-04-03 - */ -public interface ISysDeployFormService -{ - /** - * 查询流程实例关联表单 - * - * @param id 流程实例关联表单ID - * @return 流程实例关联表单 - */ - public SysDeployForm selectSysDeployFormById(Long id); - - /** - * 查询流程实例关联表单列表 - * - * @param sysDeployForm 流程实例关联表单 - * @return 流程实例关联表单集合 - */ - public List selectSysDeployFormList(SysDeployForm sysDeployForm); - - /** - * 新增流程实例关联表单 - * - * @param sysDeployForm 流程实例关联表单 - * @return 结果 - */ - public int insertSysDeployForm(SysDeployForm sysDeployForm); - - /** - * 修改流程实例关联表单 - * - * @param sysDeployForm 流程实例关联表单 - * @return 结果 - */ - public int updateSysDeployForm(SysDeployForm sysDeployForm); - - /** - * 批量删除流程实例关联表单 - * - * @param ids 需要删除的流程实例关联表单ID - * @return 结果 - */ - public int deleteSysDeployFormByIds(Long[] ids); - - /** - * 删除流程实例关联表单信息 - * - * @param id 流程实例关联表单ID - * @return 结果 - */ - public int deleteSysDeployFormById(Long id); - - /** - * 查询流程挂着的表单 - * @param deployId - * @return - */ - SysForm selectSysDeployFormByDeployId(String deployId); -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysExpressionService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysExpressionService.java deleted file mode 100644 index 4f230788..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysExpressionService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.flowable.domain.SysExpression; - -import java.util.List; - -/** - * 流程达式Service接口 - * - * @author yanZhu - * @date 2022-12-12 - */ -public interface ISysExpressionService -{ - /** - * 查询流程达式 - * - * @param id 流程达式主键 - * @return 流程达式 - */ - public SysExpression selectSysExpressionById(Long id); - - /** - * 查询流程达式列表 - * - * @param sysExpression 流程达式 - * @return 流程达式集合 - */ - public List selectSysExpressionList(SysExpression sysExpression); - - /** - * 新增流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - public int insertSysExpression(SysExpression sysExpression); - - /** - * 修改流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - public int updateSysExpression(SysExpression sysExpression); - - /** - * 批量删除流程达式 - * - * @param ids 需要删除的流程达式主键集合 - * @return 结果 - */ - public int deleteSysExpressionByIds(Long[] ids); - - /** - * 删除流程达式信息 - * - * @param id 流程达式主键 - * @return 结果 - */ - public int deleteSysExpressionById(Long id); -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysFormService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysFormService.java deleted file mode 100644 index 98a844ad..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysFormService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.flowable.domain.SysForm; - -import java.util.List; - -/** - * 表单 - * @author Tony - * @date 2021-04-03 - */ -public interface ISysFormService -{ - /** - * 查询流程表单 - * - * @param formId 流程表单ID - * @return 流程表单 - */ - public SysForm selectSysFormById(Long formId); - - /** - * 查询流程表单列表 - * - * @param sysForm 流程表单 - * @return 流程表单集合 - */ - public List selectSysFormList(SysForm sysForm); - - /** - * 新增流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - public int insertSysForm(SysForm sysForm); - - /** - * 修改流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - public int updateSysForm(SysForm sysForm); - - /** - * 批量删除流程表单 - * - * @param formIds 需要删除的流程表单ID - * @return 结果 - */ - public int deleteSysFormByIds(Long[] formIds); - - /** - * 删除流程表单信息 - * - * @param formId 流程表单ID - * @return 结果 - */ - public int deleteSysFormById(Long formId); -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysTaskFormService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysTaskFormService.java deleted file mode 100644 index c269e24b..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/ISysTaskFormService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yanzhu.flowable.service; - -import com.yanzhu.flowable.domain.SysTaskForm; - -import java.util.List; - -/** - * 流程任务关联单Service接口 - * - * @author Tony - * @date 2021-04-03 - */ -@Deprecated -public interface ISysTaskFormService { - /** - * 查询流程任务关联单 - * - * @param id 流程任务关联单ID - * @return 流程任务关联单 - */ - public SysTaskForm selectSysTaskFormById(Long id); - - /** - * 查询流程任务关联单列表 - * - * @param sysTaskForm 流程任务关联单 - * @return 流程任务关联单集合 - */ - public List selectSysTaskFormList(SysTaskForm sysTaskForm); - - /** - * 新增流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - public int insertSysTaskForm(SysTaskForm sysTaskForm); - - /** - * 修改流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - public int updateSysTaskForm(SysTaskForm sysTaskForm); - - /** - * 批量删除流程任务关联单 - * - * @param ids 需要删除的流程任务关联单ID - * @return 结果 - */ - public int deleteSysTaskFormByIds(Long[] ids); - - /** - * 删除流程任务关联单信息 - * - * @param id 流程任务关联单ID - * @return 结果 - */ - public int deleteSysTaskFormById(Long id); -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java index f5150cbb..d826912a 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java @@ -1,7 +1,7 @@ package com.yanzhu.flowable.service.impl; import com.yanzhu.common.core.text.Convert; -import com.yanzhu.flowable.domain.FlowTaskEntity; +import com.yanzhu.flowable.domain.my.FlowTaskEntity; import com.yanzhu.flowable.mapper.FlowBusinessKeyMapper; import com.yanzhu.flowable.service.IFlowBusinessKeyService; import lombok.extern.slf4j.Slf4j; @@ -25,6 +25,7 @@ public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService { @Resource private FlowBusinessKeyMapper flowBusinessKeyMapper; + /** * 根据条件查询所有流任务 * @param flowTaskEntity diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java deleted file mode 100644 index 0d9f656f..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.yanzhu.common.core.constant.HttpStatus; -import com.yanzhu.common.core.constant.SecurityConstants; -import com.yanzhu.common.core.domain.R; -import com.yanzhu.common.core.enums.FlowableEnums; -import com.yanzhu.common.core.exception.ServiceException; -import com.yanzhu.common.core.text.Convert; -import com.yanzhu.common.core.utils.StringUtils; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.redis.service.RedisService; -import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.flowable.common.constant.ProcessConstants; -import com.yanzhu.flowable.common.enums.FlowComment; -import com.yanzhu.flowable.domain.FlowProcDefDto; -import com.yanzhu.flowable.domain.SysExpression; -import com.yanzhu.flowable.domain.vo.FlowDeptVo; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import com.yanzhu.flowable.factory.FlowServiceFactory; -import com.yanzhu.flowable.mapper.FlowDeployMapper; -import com.yanzhu.flowable.service.IFlowDefinitionService; -import com.yanzhu.flowable.service.ISysDeployFormService; -import com.yanzhu.system.api.RemoteFlowService; -import com.yanzhu.system.api.domain.SysUser; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; -import org.flowable.bpmn.model.BpmnModel; -import org.flowable.engine.repository.Deployment; -import org.flowable.engine.repository.ProcessDefinition; -import org.flowable.engine.repository.ProcessDefinitionQuery; -import org.flowable.engine.runtime.ProcessInstance; -import org.flowable.image.impl.DefaultProcessDiagramGenerator; -import org.flowable.task.api.Task; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * 流程定义 - * - * @author Tony - * @date 2021-04-03 - */ -@Service -@Slf4j -public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService { - - @Autowired - private RedisService redisService; - - @Resource - private FlowDeployMapper flowDeployMapper; - - @Autowired - private RemoteFlowService remoteFlowService; - - @Resource - private ISysDeployFormService sysDeployFormService; - - private static final String BPMN_FILE_SUFFIX = ".bpmn"; - - @Override - public boolean exist(String processDefinitionKey) { - ProcessDefinitionQuery processDefinitionQuery - = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey); - long count = processDefinitionQuery.count(); - return count > 0 ? true : false; - } - - - /** - * 流程定义列表 - * - * @param flowQueryVo 流程查询 - * @return 流程定义分页列表数据 - */ - @Override - public TableDataInfo list(FlowQueryVo flowQueryVo) { - TableDataInfo rspData = new TableDataInfo(); - PageHelper.startPage(flowQueryVo.getPageNum(), flowQueryVo.getPageSize()); - List list = flowDeployMapper.selectDeployList(flowQueryVo); - rspData.setCode(HttpStatus.SUCCESS); - rspData.setMsg("查询成功"); - rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); - return rspData; - } - - - /** - * 导入流程文件 - * - * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义, - * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义 - * @param name 流程名称 - * @param category 流程类型 - * @param prtype 流程定义类型 - * @param OwnerDeptId 流程单位 - * @param OwnerProjectId 流程项目 - * @param in 流程文件流 - */ - @Override - @Transactional - public void importFile(String name, String category, String prtype, String OwnerDeptId, String OwnerProjectId, InputStream in) { - if(SecurityUtils.isAdmin(SecurityUtils.getUserId())){ - throw new ServiceException("请选择项目后导入流程文件..."); - } - Deployment deploy = repositoryService.createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in).name(name).category(category).deploy(); - ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); - repositoryService.setProcessDefinitionCategory(definition.getId(), category); - /**新增流程单位关系**/ - FlowDeptVo flowDeptVo = new FlowDeptVo(); - flowDeptVo.setProcdefId(definition.getId()); - //超管不能导入流程文件 - if(SecurityUtils.isGSAdmin()){ - if(StringUtils.isNotEmpty(OwnerDeptId)){ - // OwnerDeptId转换Long失败...默认返回null - flowDeptVo.setDeptId(Convert.toLong(OwnerDeptId)); - } - if(StringUtils.isNotEmpty(OwnerDeptId)){ - // OwnerDeptId转换Long失败...默认返回null - flowDeptVo.setProjId(Convert.toLong(OwnerProjectId)); - } - }else{ - // 从用户信息中获取项目单位信息... - flowDeptVo.setPrtype(prtype); - flowDeptVo.setProjId(SecurityUtils.getLoginUser().getProjectId()); - flowDeptVo.setDeptId(SecurityUtils.getLoginUser().getProjectDeptId()); - } - if(flowDeptVo.getDeptId()!=null){ - flowDeployMapper.insertActReProcdefDept(flowDeptVo); - } - } - - /** - * 读取xml - * - * @param deployId - * @return - */ - @Override - public AjaxResult readXml(String deployId) throws IOException { - ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); - InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); - String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); - return AjaxResult.success("", result); - } - - /** - * 读取xml - * - * @param deployId - * @return - */ - @Override - public InputStream readImage(String deployId) { - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); - //获得图片流 - DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator(); - BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); - //输出为图片 - return diagramGenerator.generateDiagram( - bpmnModel, - "png", - Collections.emptyList(), - Collections.emptyList(), - "宋体", - "宋体", - "宋体", - null, - 1.0, - false); - - } - - /** - * 根据流程定义ID启动流程实例 - * - * @param procDefId 流程模板ID - * @param applyInfos 流程表单 - * @return - */ - @Override - public AjaxResult startProcessInstanceById(String procDefId, Map applyInfos) { - try { - /**保存流程表单**/ - Map procDefData = redisService.getCacheObject(FlowableEnums.FLOW_KEY_CACHE+procDefId); - R res; - if(StringUtils.isNotNull(procDefData)){ - String procType = Convert.toStr(procDefData.get("TYPE_")); - if(StringUtils.isNotNull(procType)){ - if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - res = remoteFlowService.addSubdeptsEntity(applyInfos, SecurityConstants.INNER); - }else if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - res = remoteFlowService.addSubdeptsGroupEntity(applyInfos, SecurityConstants.INNER); - }else if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - res = remoteFlowService.addSubdeptsUsersEntity(applyInfos, SecurityConstants.INNER); - }else{ - return AjaxResult.error("审批流程配置异常,请联系管理员配置"); - } - }else{ - return AjaxResult.error("审批流程配置异常,请联系管理员配置"); - } - }else{ - return AjaxResult.error("未配置审批流程信息,请联系管理员配置"); - } - if(StringUtils.isNotNull(res.getData())){ - Map variables = new HashMap<>(); - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId) - .latestVersion().singleResult(); - if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) { - return AjaxResult.error("流程已被挂起,请联系管理员激活流程"); - } - SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - String userId = Convert.toStr(sysUser.getUserId()); - // 设置流程发起人Id到流程中 - identityService.setAuthenticatedUserId(userId); - variables.put(ProcessConstants.PROCESS_INITIATOR, userId); - variables.put("businessKey", res.getData()); - ProcessInstance processInstance; - processInstance = runtimeService.startProcessInstanceById(procDefId, Convert.toStr(res.getData()),variables); - // 给第一步申请人节点设置任务执行人和意见 - Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult(); - if (Objects.nonNull(task)) { - taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getNickName() + "发起流程申请"); - taskService.setAssignee(task.getId(), Convert.toStr(userId)); - taskService.complete(task.getId(), variables); - } - return AjaxResult.success("流程启动成功"); - }else{ - return AjaxResult.error("流程表单保存失败"); - } - } catch (Exception e) { - e.printStackTrace(); - return AjaxResult.error("流程启动错误"); - } - } - - /** - * 激活或挂起流程定义 - * - * @param state 状态 - * @param deployId 流程部署ID - */ - @Override - public void updateState(Integer state, String deployId) { - ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); - // 激活 - if (state == 1) { - repositoryService.activateProcessDefinitionById(procDef.getId(), true, null); - } - // 挂起 - if (state == 2) { - repositoryService.suspendProcessDefinitionById(procDef.getId(), true, null); - } - } - - - /** - * 删除流程定义 - * - * @param deployId 流程部署ID act_ge_bytearray 表中 deployment_id值 - */ - @Override - public void delete(String deployId) { - // true 允许级联删除 ,不设置会导致数据库外键关联异常 - repositoryService.deleteDeployment(deployId, true); - } - -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java deleted file mode 100644 index 4facc05d..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import com.yanzhu.flowable.factory.FlowServiceFactory; -import com.yanzhu.flowable.service.IFlowInstanceService; -import lombok.extern.slf4j.Slf4j; -import org.flowable.common.engine.api.FlowableObjectNotFoundException; -import org.flowable.engine.history.HistoricProcessInstance; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Map; -import java.util.Objects; - -/** - *

工作流流程实例管理

- * - * @author Tony - * @date 2021-04-03 - */ -@Service -@Slf4j -public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlowInstanceService { - - /** - * 结束流程实例 - * - * @param vo - */ - @Override - public void stopProcessInstance(FlowTaskVo vo) { - String taskId = vo.getTaskId(); - - } - - /** - * 激活或挂起流程实例 - * - * @param state 状态 - * @param instanceId 流程实例ID - */ - @Override - public void updateState(Integer state, String instanceId) { - - // 激活 - if (state == 1) { - runtimeService.activateProcessInstanceById(instanceId); - } - // 挂起 - if (state == 2) { - runtimeService.suspendProcessInstanceById(instanceId); - } - } - - /** - * 删除流程实例ID - * - * @param instanceId 流程实例ID - * @param deleteReason 删除原因 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String instanceId, String deleteReason) { - - // 查询历史数据 - HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId); - if (historicProcessInstance.getEndTime() != null) { - historyService.deleteHistoricProcessInstance(historicProcessInstance.getId()); - return; - } - // 删除流程实例 - runtimeService.deleteProcessInstance(instanceId, deleteReason); - // 删除历史流程实例 - historyService.deleteHistoricProcessInstance(instanceId); - } - - /** - * 根据实例ID查询历史实例数据 - * - * @param processInstanceId - * @return - */ - @Override - public HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId) { - HistoricProcessInstance historicProcessInstance = - historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); - if (Objects.isNull(historicProcessInstance)) { - throw new FlowableObjectNotFoundException("流程实例不存在: " + processInstanceId); - } - return historicProcessInstance; - } - - /** - * 根据流程定义ID启动流程实例 - * - * @param procDefId 流程定义Id - * @param variables 流程变量 - * @return - */ - @Override - public AjaxResult startProcessInstanceById(String procDefId, Map variables) { - - try { - // 设置流程发起人Id到流程中 - Long userId = SecurityUtils.getUserId(); - variables.put("initiator",userId); - variables.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true); - runtimeService.startProcessInstanceById(procDefId, variables); - return AjaxResult.success("流程启动成功"); - } catch (Exception e) { - e.printStackTrace(); - return AjaxResult.error("流程启动错误"); - } - } -} \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java deleted file mode 100644 index 50208812..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java +++ /dev/null @@ -1,1307 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.TypeReference; -import com.yanzhu.common.core.constant.SecurityConstants; -import com.yanzhu.common.core.domain.R; -import com.yanzhu.common.core.enums.FlowableEnums; -import com.yanzhu.common.core.exception.CustomException; -import com.yanzhu.common.core.text.Convert; -import com.yanzhu.common.core.utils.StringUtils; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.redis.service.RedisService; -import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.flowable.common.constant.ProcessConstants; -import com.yanzhu.flowable.common.enums.FlowComment; -import com.yanzhu.flowable.domain.*; -import com.yanzhu.flowable.domain.vo.FlowQueryVo; -import com.yanzhu.flowable.domain.vo.FlowTaskVo; -import com.yanzhu.flowable.factory.FlowServiceFactory; -import com.yanzhu.flowable.flow.CustomProcessDiagramGenerator; -import com.yanzhu.flowable.flow.FindNextNodeUtil; -import com.yanzhu.flowable.flow.FlowableUtils; -import com.yanzhu.flowable.flow.ModelUtils; -import com.yanzhu.flowable.service.IFlowTaskService; -import com.yanzhu.flowable.service.ISysDeployFormService; -import com.yanzhu.flowable.service.ISysFormService; -import com.yanzhu.system.api.RemoteFlowService; -import com.yanzhu.system.api.RemoteRoleService; -import com.yanzhu.system.api.RemoteUserService; -import com.yanzhu.system.api.domain.SysRole; -import com.yanzhu.system.api.domain.SysUser; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.io.IOUtils; -import org.flowable.bpmn.model.Process; -import org.flowable.bpmn.model.*; -import org.flowable.common.engine.api.FlowableException; -import org.flowable.common.engine.api.FlowableObjectNotFoundException; -import org.flowable.common.engine.impl.identity.Authentication; -import org.flowable.engine.ProcessEngineConfiguration; -import org.flowable.engine.history.HistoricActivityInstance; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.history.HistoricProcessInstanceQuery; -import org.flowable.engine.impl.cmd.AddMultiInstanceExecutionCmd; -import org.flowable.engine.impl.cmd.DeleteMultiInstanceExecutionCmd; -import org.flowable.engine.repository.ProcessDefinition; -import org.flowable.engine.runtime.Execution; -import org.flowable.engine.runtime.ProcessInstance; -import org.flowable.engine.task.Comment; -import org.flowable.identitylink.api.history.HistoricIdentityLink; -import org.flowable.image.ProcessDiagramGenerator; -import org.flowable.task.api.DelegationState; -import org.flowable.task.api.Task; -import org.flowable.task.api.TaskQuery; -import org.flowable.task.api.history.HistoricTaskInstance; -import org.flowable.task.api.history.HistoricTaskInstanceQuery; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -/** - * @author Tony - * @date 2021-04-03 - **/ -@Service -@Slf4j -public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTaskService { - - @Autowired - private RedisService redisService; - - @Resource - private ISysFormService sysFormService; - - @Autowired - private RemoteFlowService remoteFlowService; - - @Resource - private RemoteUserService remoteUserService; - - @Resource - private RemoteRoleService remoteRoleService; - - @Resource - private ISysDeployFormService sysInstanceFormService; - - /** - * 完成任务 - * - * @param taskVo 请求实体参数 - */ - @Transactional(rollbackFor = Exception.class) - @Override - public AjaxResult complete(FlowTaskVo taskVo) { - Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult(); - /**表单不为空时,重新修改表单**/ - if(StringUtils.isNotNull(taskVo.getApplyInfos())){ - Map procDefData = redisService.getCacheObject(FlowableEnums.FLOW_KEY_CACHE+task.getProcessDefinitionId()); - if(StringUtils.isNotNull(procDefData)){ - String procType = Convert.toStr(procDefData.get("TYPE_")); - if(StringUtils.isNotNull(procType)){ - if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - remoteFlowService.addSubdeptsEntity(taskVo.getApplyInfos(), SecurityConstants.INNER); - }else if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - remoteFlowService.addSubdeptsGroupEntity(taskVo.getApplyInfos(), SecurityConstants.INNER); - }else if(Objects.equals(procType,FlowableEnums.SUB_DEPTS.getCode())){ - remoteFlowService.addSubdeptsUsersEntity(taskVo.getApplyInfos(), SecurityConstants.INNER); - }else{ - return AjaxResult.error("审批流程配置异常,请联系管理员配置"); - } - }else{ - return AjaxResult.error("审批流程配置异常,请联系管理员配置"); - } - }else{ - return AjaxResult.error("未配置审批流程信息,请联系管理员配置"); - } - } - if (Objects.isNull(task)) { - return AjaxResult.error("任务不存在"); - } - if (DelegationState.PENDING.equals(task.getDelegationState())) { - taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); - taskService.resolveTask(taskVo.getTaskId()); - } else { - Long userId = SecurityUtils.getUserId(); - taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment()); - taskService.setAssignee(taskVo.getTaskId(), Convert.toStr(userId)); - taskService.complete(taskVo.getTaskId()); - } - return AjaxResult.success(); - } - - /** - * 驳回任务 - * - * @param flowTaskVo - */ - @Override - public void taskReject(FlowTaskVo flowTaskVo) { - if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { - throw new CustomException("任务处于挂起状态!"); - } - // 当前任务 task - Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); - // 获取流程定义信息 - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); - // 获取所有节点信息 - Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); - // 获取全部节点列表,包含子节点 - Collection allElements = FlowableUtils.getAllElements(process.getFlowElements(), null); - // 获取当前任务节点元素 - FlowElement source = null; - if (allElements != null) { - for (FlowElement flowElement : allElements) { - // 类型为用户节点 - if (flowElement.getId().equals(task.getTaskDefinitionKey())) { - // 获取节点信息 - source = flowElement; - } - } - } - - // 目的获取所有跳转到的节点 targetIds - // 获取当前节点的所有父级用户任务节点 - // 深度优先算法思想:延边迭代深入 - List parentUserTaskList = FlowableUtils.iteratorFindParentUserTasks(source, null, null); - if (parentUserTaskList == null || parentUserTaskList.size() == 0) { - throw new CustomException("当前节点为初始任务节点,不能驳回"); - } - // 获取活动 ID 即节点 Key - List parentUserTaskKeyList = new ArrayList<>(); - parentUserTaskList.forEach(item -> parentUserTaskKeyList.add(item.getId())); - // 获取全部历史节点活动实例,即已经走过的节点历史,数据采用开始时间升序 - List historicTaskInstanceList = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).orderByHistoricTaskInstanceStartTime().asc().list(); - // 数据清洗,将回滚导致的脏数据清洗掉 - List lastHistoricTaskInstanceList = FlowableUtils.historicTaskInstanceClean(allElements, historicTaskInstanceList); - // 此时历史任务实例为倒序,获取最后走的节点 - List targetIds = new ArrayList<>(); - // 循环结束标识,遇到当前目标节点的次数 - int number = 0; - StringBuilder parentHistoricTaskKey = new StringBuilder(); - for (String historicTaskInstanceKey : lastHistoricTaskInstanceList) { - // 当会签时候会出现特殊的,连续都是同一个节点历史数据的情况,这种时候跳过 - if (parentHistoricTaskKey.toString().equals(historicTaskInstanceKey)) { - continue; - } - parentHistoricTaskKey = new StringBuilder(historicTaskInstanceKey); - if (historicTaskInstanceKey.equals(task.getTaskDefinitionKey())) { - number++; - } - // 在数据清洗后,历史节点就是唯一一条从起始到当前节点的历史记录,理论上每个点只会出现一次 - // 在流程中如果出现循环,那么每次循环中间的点也只会出现一次,再出现就是下次循环 - // number == 1,第一次遇到当前节点 - // number == 2,第二次遇到,代表最后一次的循环范围 - if (number == 2) { - break; - } - // 如果当前历史节点,属于父级的节点,说明最后一次经过了这个点,需要退回这个点 - if (parentUserTaskKeyList.contains(historicTaskInstanceKey)) { - targetIds.add(historicTaskInstanceKey); - } - } - - - // 目的获取所有需要被跳转的节点 currentIds - // 取其中一个父级任务,因为后续要么存在公共网关,要么就是串行公共线路 - UserTask oneUserTask = parentUserTaskList.get(0); - // 获取所有正常进行的任务节点 Key,这些任务不能直接使用,需要找出其中需要撤回的任务 - List runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); - List runTaskKeyList = new ArrayList<>(); - runTaskList.forEach(item -> runTaskKeyList.add(item.getTaskDefinitionKey())); - // 需驳回任务列表 - List currentIds = new ArrayList<>(); - // 通过父级网关的出口连线,结合 runTaskList 比对,获取需要撤回的任务 - List currentUserTaskList = FlowableUtils.iteratorFindChildUserTasks(oneUserTask, runTaskKeyList, null, null); - currentUserTaskList.forEach(item -> currentIds.add(item.getId())); - - - // 规定:并行网关之前节点必须需存在唯一用户任务节点,如果出现多个任务节点,则并行网关节点默认为结束节点,原因为不考虑多对多情况 - if (targetIds.size() > 1 && currentIds.size() > 1) { - throw new CustomException("任务出现多对多情况,无法撤回"); - } - - // 循环获取那些需要被撤回的节点的ID,用来设置驳回原因 - List currentTaskIds = new ArrayList<>(); - currentIds.forEach(currentId -> runTaskList.forEach(runTask -> { - if (currentId.equals(runTask.getTaskDefinitionKey())) { - currentTaskIds.add(runTask.getId()); - } - })); - // 设置驳回意见 - currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment())); - - try { - // 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况 - if (targetIds.size() > 1) { - // 1 对 多任务跳转,currentIds 当前节点(1),targetIds 跳转到的节点(多) - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()). - moveSingleActivityIdToActivityIds(currentIds.get(0), targetIds).changeState(); - } - // 如果父级任务只有一个,因此当前任务可能为网关中的任务 - if (targetIds.size() == 1) { - // 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetIds.get(0) 跳转到的节点(1) - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdsToSingleActivityId(currentIds, targetIds.get(0)).changeState(); - } - } catch (FlowableObjectNotFoundException e) { - throw new CustomException("未找到流程实例,流程可能已发生变化"); - } catch (FlowableException e) { - throw new CustomException("无法取消或开始活动"); - } - - } - - /** - * 退回任务 - * - * @param flowTaskVo 请求实体参数 - */ - @Transactional(rollbackFor = Exception.class) - @Override - public void taskReturn(FlowTaskVo flowTaskVo) { - if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { - throw new CustomException("任务处于挂起状态"); - } - // 当前任务 task - Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); - // 获取流程定义信息 - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); - // 获取所有节点信息 - Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); - // 获取全部节点列表,包含子节点 - Collection allElements = FlowableUtils.getAllElements(process.getFlowElements(), null); - // 获取当前任务节点元素 - FlowElement source = null; - // 获取跳转的节点元素 - FlowElement target = null; - if (allElements != null) { - for (FlowElement flowElement : allElements) { - // 当前任务节点元素 - if (flowElement.getId().equals(task.getTaskDefinitionKey())) { - source = flowElement; - } - // 跳转的节点元素 - if (flowElement.getId().equals(flowTaskVo.getTargetKey())) { - target = flowElement; - } - } - } - - // 从当前节点向前扫描 - // 如果存在路线上不存在目标节点,说明目标节点是在网关上或非同一路线上,不可跳转 - // 否则目标节点相对于当前节点,属于串行 - Boolean isSequential = FlowableUtils.iteratorCheckSequentialReferTarget(source, flowTaskVo.getTargetKey(), null, null); - if (!isSequential) { - throw new CustomException("当前节点相对于目标节点,不属于串行关系,无法回退"); - } - - - // 获取所有正常进行的任务节点 Key,这些任务不能直接使用,需要找出其中需要撤回的任务 - List runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); - List runTaskKeyList = new ArrayList<>(); - runTaskList.forEach(item -> runTaskKeyList.add(item.getTaskDefinitionKey())); - // 需退回任务列表 - List currentIds = new ArrayList<>(); - // 通过父级网关的出口连线,结合 runTaskList 比对,获取需要撤回的任务 - List currentUserTaskList = FlowableUtils.iteratorFindChildUserTasks(target, runTaskKeyList, null, null); - currentUserTaskList.forEach(item -> currentIds.add(item.getId())); - - // 循环获取那些需要被撤回的节点的ID,用来设置驳回原因 - List currentTaskIds = new ArrayList<>(); - currentIds.forEach(currentId -> runTaskList.forEach(runTask -> { - if (currentId.equals(runTask.getTaskDefinitionKey())) { - currentTaskIds.add(runTask.getId()); - } - })); - // 设置回退意见 - currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment())); - - try { - // 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1) - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdsToSingleActivityId(currentIds, flowTaskVo.getTargetKey()).changeState(); - } catch (FlowableObjectNotFoundException e) { - throw new CustomException("未找到流程实例,流程可能已发生变化"); - } catch (FlowableException e) { - throw new CustomException("无法取消或开始活动"); - } - } - - - /** - * 获取所有可回退的节点 - * - * @param flowTaskVo - * @return - */ - @Override - public AjaxResult findReturnTaskList(FlowTaskVo flowTaskVo) { -// // 当前任务 task -// Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); -// // 从流程历史任务中获取可退回节点 -//// List hisActIns = historyService.createHistoricActivityInstanceQuery() -//// .executionId(task.getExecutionId()) -//// .activityType("userTask") -//// .orderByHistoricActivityInstanceStartTime() -//// .finished() -//// .desc() -//// .list(); -//// -//// // 可回退的节点列表 -//// List returnTaskNodeList = new ArrayList<>(); -//// ReturnTaskNodeVo returnTaskNodeVo; -//// for (HistoricActivityInstance activityInstance : hisActIns) { -//// returnTaskNodeVo = new ReturnTaskNodeVo(); -//// returnTaskNodeVo.setId(activityInstance.getActivityId()); -//// // 根据流程节点处理时间校验改节点是否已完成 -//// returnTaskNodeVo.setName(activityInstance.getActivityName()); -//// returnTaskNodeList.add(returnTaskNodeVo); -//// } -// List userTaskList = new ArrayList<>(); -// // 获取流程定义信息 -// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); -// // 获取所有节点信息,暂不考虑子流程情况 -// Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); -// Collection flowElements = process.getFlowElements(); -// // 获取当前任务节点元素 -// UserTask source = null; -// if (flowElements != null) { -// for (FlowElement flowElement : flowElements) { -// // 类型为用户节点 -// if (flowElement.getId().equals(task.getTaskDefinitionKey())) { -// source = (UserTask) flowElement; -// } -// } -// } -// // 获取节点的所有路线 -// List> roads = FlowableUtils.findRoad(source, null, null, null); -// -// for (List road : roads) { -// if (userTaskList.size() == 0) { -// // 还没有可回退节点直接添加 -// userTaskList = road; -// } else { -// // 如果已有回退节点,则比对取交集部分 -// userTaskList.retainAll(road); -// } -// } -// return AjaxResult.success(userTaskList); - // 当前任务 task - Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); - // 获取流程定义信息 - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); - // 获取所有节点信息,暂不考虑子流程情况 - Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); - Collection flowElements = process.getFlowElements(); - // 获取当前任务节点元素 - UserTask source = null; - if (flowElements != null) { - for (FlowElement flowElement : flowElements) { - // 类型为用户节点 - if (flowElement.getId().equals(task.getTaskDefinitionKey())) { - source = (UserTask) flowElement; - } - } - } - // 获取节点的所有路线 - List> roads = FlowableUtils.findRoad(source, null, null, null); - // 可回退的节点列表 - List userTaskList = new ArrayList<>(); - for (List road : roads) { - if (userTaskList.size() == 0) { - // 还没有可回退节点直接添加 - userTaskList = road; - } else { - // 如果已有回退节点,则比对取交集部分 - userTaskList.retainAll(road); - } - } - return AjaxResult.success(userTaskList); - } - - /** - * 删除任务 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - public void deleteTask(FlowTaskVo flowTaskVo) { - // todo 待确认删除任务是物理删除任务 还是逻辑删除,让这个任务直接通过? - taskService.deleteTask(flowTaskVo.getTaskId(), flowTaskVo.getComment()); - } - - /** - * 认领/签收任务 - * 认领以后,这个用户就会成为任务的执行人,任务会从其他成员的任务列表中消失 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void claim(FlowTaskVo flowTaskVo) { - taskService.claim(flowTaskVo.getTaskId(), flowTaskVo.getUserId()); - } - - /** - * 取消认领/签收任务 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void unClaim(FlowTaskVo flowTaskVo) { - taskService.unclaim(flowTaskVo.getTaskId()); - } - - /** - * 委派任务 - * 任务委派只是委派人将当前的任务交给被委派人进行审批,处理任务后又重新回到委派人身上。 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void delegateTask(FlowTaskVo flowTaskVo) { - taskService.addComment(flowTaskVo.getTaskId(), flowTaskVo.getInstanceId(), FlowComment.DELEGATE.getType(), flowTaskVo.getComment()); - taskService.delegateTask(flowTaskVo.getTaskId(), flowTaskVo.getAssignee()); - } - - /** - * 任务归还 - * 被委派人完成任务之后,将任务归还委派人 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void resolveTask(FlowTaskVo flowTaskVo) { - taskService.resolveTask(flowTaskVo.getTaskId()); - } - - - /** - * 转办任务 - * 直接将办理人换成别人,这时任务的拥有者不再是转办人 - * - * @param flowTaskVo 请求实体参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void assignTask(FlowTaskVo flowTaskVo) { - taskService.addComment(flowTaskVo.getTaskId(), flowTaskVo.getInstanceId(), FlowComment.ASSIGN.getType(), flowTaskVo.getComment()); - // 直接转派就可以覆盖掉之前的 - taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getAssignee()); -// // 删除指派人重新指派 -// taskService.deleteCandidateUser(flowTaskVo.getTaskId(),flowTaskVo.getAssignee()); -// taskService.addCandidateUser(flowTaskVo.getTaskId(),flowTaskVo.getAssignee()); -// // 如果要查询转给他人处理的任务,可以同时将OWNER进行设置: -// taskService.setOwner(flowTaskVo.getTaskId(), flowTaskVo.getAssignee()); - - } - - /** - * 多实例加签 - * act_ru_task、act_ru_identitylink各生成一条记录 - * - * @param flowTaskVo - */ - @Override - public void addMultiInstanceExecution(FlowTaskVo flowTaskVo) { - managementService.executeCommand(new AddMultiInstanceExecutionCmd(flowTaskVo.getDefId(), flowTaskVo.getInstanceId(), flowTaskVo.getVariables())); - } - - /** - * 多实例减签 - * act_ru_task减1、act_ru_identitylink不变 - * - * @param flowTaskVo - */ - @Override - public void deleteMultiInstanceExecution(FlowTaskVo flowTaskVo) { - managementService.executeCommand(new DeleteMultiInstanceExecutionCmd(flowTaskVo.getCurrentChildExecutionId(), flowTaskVo.getFlag())); - } - - /** - * 我发起的流程 - * - * @param queryVo 请求参数 - * @return - */ - @Override - public AjaxResult myProcess(FlowQueryVo queryVo) { - TableDataInfo page = new TableDataInfo(); - Long userId = SecurityUtils.getUserId(); - HistoricProcessInstanceQuery historicProcessInstanceQuery; - //超管查询所有数据据 - if(SecurityUtils.isAdmin(userId)){ - historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery() - .orderByProcessInstanceStartTime() - .desc(); - }else{ - historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery() - .startedBy(userId.toString()) - .orderByProcessInstanceStartTime() - .desc(); - } - List historicProcessInstances = historicProcessInstanceQuery.listPage(queryVo.getPageSize() * (queryVo.getPageNum() - 1), queryVo.getPageSize()); - page.setTotal(historicProcessInstanceQuery.count()); - List flowList = new ArrayList<>(); - for (HistoricProcessInstance hisIns : historicProcessInstances) { - FlowTaskDto flowTask = new FlowTaskDto(); - flowTask.setCreateTime(hisIns.getStartTime()); - flowTask.setFinishTime(hisIns.getEndTime()); - flowTask.setProcInsId(hisIns.getId()); - - // 计算耗时 - if (Objects.nonNull(hisIns.getEndTime())) { - long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime(); - flowTask.setDuration(getDate(time)); - } else { - long time = System.currentTimeMillis() - hisIns.getStartTime().getTime(); - flowTask.setDuration(getDate(time)); - } - // 流程定义信息 - ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() - .processDefinitionId(hisIns.getProcessDefinitionId()) - .singleResult(); - flowTask.setDeployId(pd.getDeploymentId()); - flowTask.setProcDefName(pd.getName()); - flowTask.setProcDefVersion(pd.getVersion()); - flowTask.setCategory(pd.getCategory()); - flowTask.setProcDefVersion(pd.getVersion()); - // 当前所处流程 - List taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list(); - if (CollectionUtils.isNotEmpty(taskList)) { - flowTask.setTaskId(taskList.get(0).getId()); - flowTask.setTaskName(taskList.get(0).getName()); - if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) { - // 当前任务节点办理人信息 - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(taskList.get(0).getAssignee()), SecurityConstants.INNER); - if (Objects.nonNull(userResult)) { - SysUser sysUser = userResult.getData(); - flowTask.setAssigneeId(sysUser.getUserId()); - flowTask.setAssigneeName(sysUser.getNickName()); - flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : ""); - } - } - } else { - List historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list(); - flowTask.setTaskId(historicTaskInstance.get(0).getId()); - flowTask.setTaskName(historicTaskInstance.get(0).getName()); - if (StringUtils.isNotBlank(historicTaskInstance.get(0).getAssignee())) { - // 当前任务节点办理人信息 - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(historicTaskInstance.get(0).getAssignee()), SecurityConstants.INNER); - if (Objects.nonNull(userResult)) { - SysUser sysUser = userResult.getData(); - flowTask.setAssigneeId(sysUser.getUserId()); - flowTask.setAssigneeName(sysUser.getNickName()); - flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : ""); - } - } - } - flowList.add(flowTask); - } - page.setRows(flowList); - return AjaxResult.success(page); - } - - /** - * 取消申请 - * 目前实现方式: 直接将当前流程变更为已完成 - * - * @param flowTaskVo - * @return - */ - @Override - @Transactional - public AjaxResult stopProcess(FlowTaskVo flowTaskVo) { - List task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).list(); - if (CollectionUtils.isEmpty(task)) { - throw new CustomException("流程未启动或已执行完成,取消申请失败"); - } - // 获取当前流程实例 - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() - .processInstanceId(flowTaskVo.getInstanceId()) - .singleResult(); - BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); - if (Objects.nonNull(bpmnModel)) { - Process process = bpmnModel.getMainProcess(); - List endNodes = process.findFlowElementsOfType(EndEvent.class, false); - if (CollectionUtils.isNotEmpty(endNodes)) { - String userIdStr = Convert.toStr(SecurityUtils.getUserId()); - if(StringUtils.isNotEmpty(userIdStr)){ - Authentication.setAuthenticatedUserId(userIdStr); - taskService.addComment(task.get(0).getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), - StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment()); - // 设置流程经办人为当前登录人员 - taskService.setAssignee(task.get(0).getId(), userIdStr); - // 获取当前流程最后一个节点 - String endId = endNodes.get(0).getId(); - List executions = runtimeService.createExecutionQuery() - .parentId(processInstance.getProcessInstanceId()).list(); - List executionIds = new ArrayList<>(); - executions.forEach(execution -> executionIds.add(execution.getId())); - // 变更流程为已结束状态 - runtimeService.createChangeActivityStateBuilder() - .moveExecutionsToSingleActivityId(executionIds, endId).changeState(); - return AjaxResult.success(); - } - } - } - return AjaxResult.error(); - } - - /** - * 撤回流程 目前存在错误 - * - * @param flowTaskVo - * @return - */ - @Override - @Transactional - public AjaxResult revokeProcess(FlowTaskVo flowTaskVo) { - String procInsId = flowTaskVo.getInstanceId(); - String taskId = flowTaskVo.getTaskId(); - // 校验流程是否结束 - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() - .processInstanceId(procInsId) - .active() - .singleResult(); - if(Objects.isNull(processInstance)) { - throw new RuntimeException("流程已结束或已挂起,无法执行撤回操作"); - } - // 获取待撤回任务实例 - HistoricTaskInstance currTaskIns = historyService.createHistoricTaskInstanceQuery() - .taskId(taskId) - .taskAssignee(flowTaskVo.getUserId()) - .singleResult(); - if (Objects.isNull(currTaskIns)) { - throw new RuntimeException("当前任务不存在,无法执行撤回操作"); - } - // 获取 bpmn 模型 - BpmnModel bpmnModel = repositoryService.getBpmnModel(currTaskIns.getProcessDefinitionId()); - UserTask currUserTask = ModelUtils.getUserTaskByKey(bpmnModel, currTaskIns.getTaskDefinitionKey()); - // 查找下一级用户任务列表 - List nextUserTaskList = ModelUtils.findNextUserTasks(currUserTask); - List nextUserTaskKeys = nextUserTaskList.stream().map(UserTask::getId).collect(Collectors.toList()); - - // 获取当前节点之后已完成的流程历史节点 - List finishedTaskInsList = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(procInsId) - .taskCreatedAfter(currTaskIns.getEndTime()) - .finished() - .list(); - for (HistoricTaskInstance finishedTaskInstance : finishedTaskInsList) { - // 检查已完成流程历史节点是否存在下一级中 - if (StringUtils.contains(nextUserTaskKeys, finishedTaskInstance.getTaskDefinitionKey())) { - throw new RuntimeException("下一流程已处理,无法执行撤回操作"); - } - } - // 获取所有激活的任务节点,找到需要撤回的任务 - List activateTaskList = taskService.createTaskQuery().processInstanceId(procInsId).list(); - List revokeExecutionIds = new ArrayList<>(); - for (Task task : activateTaskList) { - // 检查激活的任务节点是否存在下一级中,如果存在,则加入到需要撤回的节点 - if (StringUtils.contains(nextUserTaskKeys, task.getTaskDefinitionKey())) { - // 添加撤回审批信息 - taskService.setAssignee(task.getId(), flowTaskVo.getUserId()); - taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), flowTaskVo.getAssignee() + "撤回流程审批"); - revokeExecutionIds.add(task.getExecutionId()); - } - } - try { - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(procInsId) - .moveExecutionsToSingleActivityId(revokeExecutionIds, currTaskIns.getTaskDefinitionKey()).changeState(); - } catch (FlowableObjectNotFoundException e) { - throw new RuntimeException("未找到流程实例,流程可能已发生变化"); - } catch (FlowableException e) { - throw new RuntimeException("执行撤回操作失败"); - } - return AjaxResult.success(); - } - - /** - * 代办任务列表 - * - * @param queryVo 请求参数 - * @return - */ - @Override - public AjaxResult todoList(FlowQueryVo queryVo) { - TableDataInfo page = new TableDataInfo(); - // 只查看自己的数据 - SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - TaskQuery taskQuery = taskService.createTaskQuery() - .active() - .includeProcessVariables() - .taskCandidateGroupIn(sysUser.getRoles().stream().map(role -> role.getRoleId().toString()).collect(Collectors.toList())) - .taskCandidateOrAssigned(sysUser.getUserId().toString()) - .orderByTaskCreateTime().desc(); - - page.setTotal(taskQuery.count()); - List taskList = taskQuery.listPage(queryVo.getPageSize() * (queryVo.getPageNum() - 1), queryVo.getPageSize()); - List flowList = new ArrayList<>(); - for (Task task : taskList) { - FlowTaskDto flowTask = new FlowTaskDto(); - // 当前流程信息 - flowTask.setTaskId(task.getId()); - flowTask.setTaskDefKey(task.getTaskDefinitionKey()); - flowTask.setCreateTime(task.getCreateTime()); - flowTask.setProcDefId(task.getProcessDefinitionId()); - flowTask.setExecutionId(task.getExecutionId()); - flowTask.setTaskName(task.getName()); - // 流程定义信息 - ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() - .processDefinitionId(task.getProcessDefinitionId()) - .singleResult(); - flowTask.setDeployId(pd.getDeploymentId()); - flowTask.setProcDefName(pd.getName()); - flowTask.setProcDefVersion(pd.getVersion()); - flowTask.setProcInsId(task.getProcessInstanceId()); - - // 流程发起人信息 - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(task.getProcessInstanceId()) - .singleResult(); - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(historicProcessInstance.getStartUserId()), SecurityConstants.INNER); - if(Objects.nonNull(userResult)){ - SysUser startUser = userResult.getData(); - flowTask.setStartUserId(startUser.getUserId().toString()); - flowTask.setStartUserName(startUser.getNickName()); - flowTask.setStartDeptName(Objects.nonNull(startUser.getDept()) ? startUser.getDept().getDeptName() : ""); - flowList.add(flowTask); - } - } - - page.setRows(flowList); - return AjaxResult.success(page); - } - - - /** - * 已办任务列表 - * - * @param queryVo 请求参数 - * @return - */ - @Override - public AjaxResult finishedList(FlowQueryVo queryVo) { - TableDataInfo page = new TableDataInfo(); - Long userId = SecurityUtils.getUserId(); - HistoricTaskInstanceQuery taskInstanceQuery = historyService.createHistoricTaskInstanceQuery() - .includeProcessVariables() - .finished() - .taskAssignee(userId.toString()) - .orderByHistoricTaskInstanceEndTime() - .desc(); - List historicTaskInstanceList = taskInstanceQuery.listPage(queryVo.getPageSize() * (queryVo.getPageNum() - 1), queryVo.getPageSize()); - List hisTaskList = new ArrayList<>(); - for (HistoricTaskInstance histTask : historicTaskInstanceList) { - FlowTaskDto flowTask = new FlowTaskDto(); - // 当前流程信息 - flowTask.setTaskId(histTask.getId()); - // 审批人员信息 - flowTask.setCreateTime(histTask.getCreateTime()); - flowTask.setFinishTime(histTask.getEndTime()); - flowTask.setDuration(getDate(histTask.getDurationInMillis())); - flowTask.setProcDefId(histTask.getProcessDefinitionId()); - flowTask.setTaskDefKey(histTask.getTaskDefinitionKey()); - flowTask.setTaskName(histTask.getName()); - - // 流程定义信息 - ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() - .processDefinitionId(histTask.getProcessDefinitionId()) - .singleResult(); - flowTask.setDeployId(pd.getDeploymentId()); - flowTask.setProcDefName(pd.getName()); - flowTask.setProcDefVersion(pd.getVersion()); - flowTask.setProcInsId(histTask.getProcessInstanceId()); - flowTask.setHisProcInsId(histTask.getProcessInstanceId()); - - // 流程发起人信息 - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(histTask.getProcessInstanceId()) - .singleResult(); - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(historicProcessInstance.getStartUserId()), SecurityConstants.INNER); - SysUser startUser = userResult.getData(); - flowTask.setStartUserId(startUser.getNickName()); - flowTask.setStartUserName(startUser.getNickName()); - flowTask.setStartDeptName(startUser.getDept().getDeptName()); - hisTaskList.add(flowTask); - } - page.setTotal(taskInstanceQuery.count()); - page.setRows(hisTaskList); - return AjaxResult.success(page); - } - - private static Predicate distinctByKey(Function keyExtractor) { - Set seen = ConcurrentHashMap.newKeySet(); - return t -> seen.add(keyExtractor.apply(t)); - } - - /** - * 流程历史流转记录 - * - * @param procInsId 流程实例Id - * @return - */ - @Override - public AjaxResult flowRecord(String procInsId, String deployId) { - Map map = new HashMap(); - if (StringUtils.isNotBlank(procInsId)) { - List list = historyService - .createHistoricActivityInstanceQuery() - .processInstanceId(procInsId) - .orderByHistoricActivityInstanceStartTime() - .desc().list(); - List hisFlowList = new ArrayList<>(); - for (HistoricActivityInstance histIns : list) { - if (StringUtils.isNotBlank(histIns.getTaskId())) { - FlowTaskDto flowTask = new FlowTaskDto(); - flowTask.setTaskId(histIns.getTaskId()); - flowTask.setTaskName(histIns.getActivityName()); - flowTask.setCreateTime(histIns.getStartTime()); - flowTask.setFinishTime(histIns.getEndTime()); - if (StringUtils.isNotBlank(histIns.getAssignee())) { - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(histIns.getAssignee()), SecurityConstants.INNER); - if(Objects.nonNull(userResult)){ - SysUser sysUser = userResult.getData(); - flowTask.setAssigneeId(sysUser.getUserId()); - flowTask.setAssigneeName(sysUser.getNickName()); - flowTask.setDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : ""); - } - } - // 展示审批人员 - List linksForTask = historyService.getHistoricIdentityLinksForTask(histIns.getTaskId()); - StringBuilder stringBuilder = new StringBuilder(); - for (HistoricIdentityLink identityLink : linksForTask) { - // 获选人,候选组/角色(多个) - if ("candidate".equals(identityLink.getType())) { - if (StringUtils.isNotBlank(identityLink.getUserId())) { - R userResult = remoteUserService.getSysUserInfo(Long.parseLong(histIns.getAssignee()), SecurityConstants.INNER); - if(Objects.nonNull(userResult)){ - stringBuilder.append(userResult.getData().getNickName()).append(","); - } - } - if (StringUtils.isNotBlank(identityLink.getGroupId())) { - R roleResult = remoteRoleService.getRoleInfo(Long.parseLong(identityLink.getGroupId()), SecurityConstants.INNER); - if(Objects.nonNull(roleResult)){ - stringBuilder.append(roleResult.getData().getRoleName()).append(","); - } - } - } - } - if (StringUtils.isNotBlank(stringBuilder)) { - flowTask.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1)); - } - - flowTask.setDuration(histIns.getDurationInMillis() == null || histIns.getDurationInMillis() == 0 ? null : getDate(histIns.getDurationInMillis())); - // 获取意见评论内容 - List commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId()); - commentList.forEach(comment -> { - if (histIns.getTaskId().equals(comment.getTaskId())) { - flowTask.setComment(FlowCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build()); - } - }); - hisFlowList.add(flowTask); - } - } - map.put("flowList", hisFlowList); - } - // 第一次申请获取初始化表单 - if (StringUtils.isNotBlank(deployId)) { - SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId); - if (Objects.isNull(sysForm)) { - return AjaxResult.error("请先配置流程表单"); - } - map.put("formData", JSONObject.parseObject(sysForm.getFormContent())); - } - return AjaxResult.success(map); - } - - /** - * 根据任务ID查询挂载的表单信息 - * - * @param taskId 任务Id - * @return - */ - @Override - public Task getTaskForm(String taskId) { - Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); - return task; - } - - /** - * 获取流程过程图 - * - * @param processId - * @return - */ - @Override - public InputStream diagram(String processId) { - String processDefinitionId; - // 获取当前的流程实例 - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); - // 如果流程已经结束,则得到结束节点 - if (Objects.isNull(processInstance)) { - HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processId).singleResult(); - - processDefinitionId = pi.getProcessDefinitionId(); - } else {// 如果流程没有结束,则取当前活动节点 - // 根据流程实例ID获得当前处于活动状态的ActivityId合集 - ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); - processDefinitionId = pi.getProcessDefinitionId(); - } - - // 获得活动的节点 - List highLightedFlowList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processId).orderByHistoricActivityInstanceStartTime().asc().list(); - - List highLightedFlows = new ArrayList<>(); - List highLightedNodes = new ArrayList<>(); - //高亮线 - for (HistoricActivityInstance tempActivity : highLightedFlowList) { - if ("sequenceFlow".equals(tempActivity.getActivityType())) { - //高亮线 - highLightedFlows.add(tempActivity.getActivityId()); - } else { - //高亮节点 - highLightedNodes.add(tempActivity.getActivityId()); - } - } - - //获取流程图 - BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); - ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration(); - //获取自定义图片生成器 - ProcessDiagramGenerator diagramGenerator = new CustomProcessDiagramGenerator(); - InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedNodes, highLightedFlows, configuration.getActivityFontName(), - configuration.getLabelFontName(), configuration.getAnnotationFontName(), configuration.getClassLoader(), 1.0, true); - return in; - - } - - /** - * 获取流程执行节点 - * - * @param procInsId 流程实例id - * @return - */ - @Override - public AjaxResult getFlowViewer(String procInsId, String executionId) { - List flowViewerList = new ArrayList<>(); - FlowViewerDto flowViewerDto; - // 获取任务开始节点(临时处理方式) - List startNodeList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInsId) - .orderByHistoricActivityInstanceStartTime() - .asc().listPage(0, 3); - for (HistoricActivityInstance startInstance : startNodeList) { - if (!"sequenceFlow".equals(startInstance.getActivityType())) { - flowViewerDto = new FlowViewerDto(); - if (!"sequenceFlow".equals(startInstance.getActivityType())) { - flowViewerDto.setKey(startInstance.getActivityId()); - // 根据流程节点处理时间校验改节点是否已完成 - flowViewerDto.setCompleted(!Objects.isNull(startInstance.getEndTime())); - flowViewerList.add(flowViewerDto); - } - } - } - // 历史节点 - List hisActIns = historyService.createHistoricActivityInstanceQuery() - .executionId(executionId) - .orderByHistoricActivityInstanceStartTime() - .asc().list(); - for (HistoricActivityInstance activityInstance : hisActIns) { - if (!"sequenceFlow".equals(activityInstance.getActivityType())) { - flowViewerDto = new FlowViewerDto(); - flowViewerDto.setKey(activityInstance.getActivityId()); - // 根据流程节点处理时间校验改节点是否已完成 - flowViewerDto.setCompleted(!Objects.isNull(activityInstance.getEndTime())); - flowViewerList.add(flowViewerDto); - } - } - return AjaxResult.success(flowViewerList); - } - - /** - * 获取流程变量 - * - * @param taskId - * @return - */ - @Override - public AjaxResult processVariables(String taskId) { -// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() -// .processInstanceId(task.getProcessInstanceId()) -// .singleResult(); -// SysUser startUser = sysUserService.selectUserById(Long.parseLong(historicProcessInstance.getStartUserId())); - - // 流程变量 - HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskId(taskId).singleResult(); - if (Objects.nonNull(historicTaskInstance)) { - return AjaxResult.success(historicTaskInstance.getProcessVariables()); - } else { - Map variables = taskService.getVariables(taskId); - return AjaxResult.success(variables); - } - } - - /** - * 获取下一节点 - * - * @param flowTaskVo 任务 - * @return - */ - @Override - public AjaxResult getNextFlowNode(FlowTaskVo flowTaskVo) { - // Step 1. 获取当前节点并找到下一步节点 - Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); - FlowNextDto flowNextDto = new FlowNextDto(); - if (Objects.nonNull(task)) { - // Step 2. 获取当前流程所有流程变量(网关节点时需要校验表达式) - Map variables = taskService.getVariables(task.getId()); - List nextUserTask = FindNextNodeUtil.getNextUserTasks(repositoryService, task, variables); - if (CollectionUtils.isNotEmpty(nextUserTask)) { - for (UserTask userTask : nextUserTask) { - MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); - // 会签节点 - if (Objects.nonNull(multiInstance)) { - flowNextDto.setVars(multiInstance.getInputDataItem()); - flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); - flowNextDto.setDataType(ProcessConstants.DYNAMIC); - } else { - // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 - String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); - String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE); - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(userType); - flowNextDto.setDataType(dataType); - } - } - } else { - return AjaxResult.success("流程已完结", null); - } - } - return AjaxResult.success(flowNextDto); - } - - /** - * 获取下一节点 - * - * @param flowTaskVo 任务 - * @return - */ - @Override - public AjaxResult getNextFlowNodeByStart(FlowTaskVo flowTaskVo) { - ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(flowTaskVo.getDeploymentId()).singleResult(); - // Step 1. 获取当前节点并找到下一步节点 - FlowNextDto flowNextDto = new FlowNextDto(); - // Step 2. 获取当前流程所有流程变量(网关节点时需要校验表达式) - List nextUserTask = FindNextNodeUtil.getNextUserTasksByStart(repositoryService, processDefinition, flowTaskVo.getVariables()); - if (CollectionUtils.isNotEmpty(nextUserTask)) { - for (UserTask userTask : nextUserTask) { - MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); - // 会签节点 - if (Objects.nonNull(multiInstance)) { - flowNextDto.setVars(multiInstance.getInputDataItem()); - flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); - flowNextDto.setDataType(ProcessConstants.DYNAMIC); - } else { - // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 - String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); - String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE); - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(userType); - flowNextDto.setDataType(dataType); - } - } - } - return AjaxResult.success(flowNextDto); - } - - /** - * 流程初始化表单 - * - * @param deployId - * @return - */ - @Override - public AjaxResult flowFormData(String deployId) { - // 第一次申请获取初始化表单 - if (StringUtils.isNotBlank(deployId)) { - SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId); - if (Objects.isNull(sysForm)) { - return AjaxResult.error("请先配置流程表单!"); - } - return AjaxResult.success(JSONObject.parseObject(sysForm.getFormContent())); - } else { - return AjaxResult.error("参数错误!"); - } - } - - /** - * 流程节点信息 - * - * @param procInsId - * @return - */ - @Override - public AjaxResult flowXmlAndNode(String procInsId, String deployId) { - try { - List flowViewerList = new ArrayList<>(); - // 获取已经完成的节点 - List listFinished = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInsId) - .finished() - .list(); - - // 保存已经完成的流程节点编号 - listFinished.forEach(s -> { - FlowViewerDto flowViewerDto = new FlowViewerDto(); - flowViewerDto.setKey(s.getActivityId()); - flowViewerDto.setCompleted(true); - flowViewerList.add(flowViewerDto); - }); - - // 获取代办节点 - List listUnFinished = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInsId) - .unfinished() - .list(); - - // 保存需要代办的节点编号 - listUnFinished.forEach(s -> { - FlowViewerDto flowViewerDto = new FlowViewerDto(); - flowViewerDto.setKey(s.getActivityId()); - flowViewerDto.setCompleted(false); - flowViewerList.add(flowViewerDto); - }); - Map result = new HashMap(); - // xmlData 数据 - ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); - InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); - String xmlData = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - result.put("nodeData", flowViewerList); - result.put("xmlData", xmlData); - return AjaxResult.success(result); - } catch (Exception e) { - return AjaxResult.error("高亮历史任务失败"); - } - } - - /** - * 流程节点表单 - * - * @param taskId 流程任务编号 - * @return - */ - @Override - public AjaxResult flowTaskForm(String taskId) throws Exception { - JSONObject result = new JSONObject(); - result.put("formKeyExist", false); - Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); - BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - FlowElement flowElement = bpmnModel.getFlowElement(task.getTaskDefinitionKey()); - // 流程变量 - Map parameters = new HashMap<>(); - HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskId(taskId).singleResult(); - if (Objects.nonNull(historicTaskInstance)) { - parameters = historicTaskInstance.getProcessVariables(); - } else { - parameters = taskService.getVariables(taskId); - } - // TODO 暂时只处理用户任务上的表单 - if (flowElement instanceof UserTask) { - String formKey = ((UserTask) flowElement).getFormKey(); - if (StringUtils.isNotBlank(formKey)) { - SysForm sysForm = sysFormService.selectSysFormById(Long.parseLong(formKey)); - - JSONObject oldVariables = JSONObject.parseObject(JSON.toJSONString(parameters.get("variables"))); - List oldFields = JSON.parseObject(JSON.toJSONString(oldVariables.get("fields")), new TypeReference>() { - }); - oldFields.forEach(obj -> obj.put("disabled", true)); - - JSONObject data = JSONObject.parseObject(sysForm.getFormContent()); - List newFields = JSON.parseObject(JSON.toJSONString(data.get("fields")), new TypeReference>() { - }); - - oldFields.addAll(newFields); - oldVariables.put("fields", oldFields); - oldVariables.put("disabled", false); - oldVariables.put("formBtns", true); - result.put("formData", oldVariables); - result.put("formKeyExist", true); - return AjaxResult.success("", result); - } else { - result.put("formData", parameters.get("variables")); - return AjaxResult.success("", result); - } - } else { - result.put("formData", parameters.get("variables")); - return AjaxResult.success("", result); - } - } - - /** - * 将Object类型的数据转化成Map - * - * @param obj - * @return - * @throws Exception - */ - public Map obj2Map(Object obj) throws Exception { - Map map = new HashMap(); - Field[] fields = obj.getClass().getDeclaredFields(); - for (Field field : fields) { - field.setAccessible(true); - map.put(field.getName(), field.get(obj)); - } - return map; - } - - /** - * 流程完成时间处理 - * - * @param ms - * @return - */ - private String getDate(long ms) { - - long day = ms / (24 * 60 * 60 * 1000); - long hour = (ms / (60 * 60 * 1000) - day * 24); - long minute = ((ms / (60 * 1000)) - day * 24 * 60 - hour * 60); - long second = (ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60); - - if (day > 0) { - return day + "天" + hour + "小时" + minute + "分钟"; - } - if (hour > 0) { - return hour + "小时" + minute + "分钟"; - } - if (minute > 0) { - return minute + "分钟"; - } - if (second > 0) { - return second + "秒"; - } else { - return 0 + "秒"; - } - } -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableCategoryServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableCategoryServiceImpl.java new file mode 100644 index 00000000..79144324 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableCategoryServiceImpl.java @@ -0,0 +1,126 @@ +package com.yanzhu.flowable.service.impl; + +import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.redis.service.RedisService; +import com.yanzhu.flowable.common.enums.CacheType; +import com.yanzhu.flowable.domain.FlowableCategory; +import com.yanzhu.flowable.mapper.FlowableCategoryMapper; +import com.yanzhu.flowable.service.IFlowableCategoryService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 流程分类Service业务层处理 + * + * @author ruoyi + * @date 2023-11-27 + */ +@Service +public class FlowableCategoryServiceImpl implements IFlowableCategoryService { + + private static final Logger log = LoggerFactory.getLogger(FlowableCategoryServiceImpl.class); + + @Autowired + private RedisService redisService; + + @Autowired + private FlowableCategoryMapper flowableCategoryMapper; + + /** + * 查询流程分类 + * + * @param id 流程分类主键 + * @return 流程分类 + */ + @Override + public FlowableCategory selectFlowableCategoryById(Long id) + { + return flowableCategoryMapper.selectFlowableCategoryById(id); + } + + /** + * 查询流程分类列表 + * + * @param flowableCategory 流程分类 + * @return 流程分类 + */ + @Override + public List selectFlowableCategoryList(FlowableCategory flowableCategory) + { + log.debug("enter selectFlowableCategoryList!"); + List flowableCategories = flowableCategoryMapper.selectFlowableCategoryList(flowableCategory); + updateRedis(flowableCategories); + return flowableCategories; + } + + /** + * 更新缓存 + * @param flowableCategories + */ + @Override + public Map updateRedis(List flowableCategories) { + if(flowableCategories==null ){ + flowableCategories = selectFlowableCategoryList(new FlowableCategory()); + } + //更新缓存 + Map categoryMap = flowableCategories.stream().collect(Collectors.toMap(FlowableCategory::getCode, FlowableCategory::getName)); + redisService.setCacheObject(CacheType.FLOWCATEGORY.getCode(), categoryMap); + return categoryMap; + } + + /** + * 新增流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + @Override + public int insertFlowableCategory(FlowableCategory flowableCategory) + { + flowableCategory.setCreateTime(DateUtils.getNowDate()); + return flowableCategoryMapper.insertFlowableCategory(flowableCategory); + } + + /** + * 修改流程分类 + * + * @param flowableCategory 流程分类 + * @return 结果 + */ + @Override + public int updateFlowableCategory(FlowableCategory flowableCategory) + { + flowableCategory.setUpdateTime(DateUtils.getNowDate()); + return flowableCategoryMapper.updateFlowableCategory(flowableCategory); + } + + /** + * 批量删除流程分类 + * + * @param ids 需要删除的流程分类主键 + * @return 结果 + */ + @Override + public int deleteFlowableCategoryByIds(Long[] ids) + { + return flowableCategoryMapper.deleteFlowableCategoryByIds(ids); + } + + /** + * 删除流程分类信息 + * + * @param id 流程分类主键 + * @return 结果 + */ + @Override + public int deleteFlowableCategoryById(Long id) + { + return flowableCategoryMapper.deleteFlowableCategoryById(id); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableDeployServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableDeployServiceImpl.java new file mode 100644 index 00000000..a256a2fe --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableDeployServiceImpl.java @@ -0,0 +1,222 @@ +package com.yanzhu.flowable.service.impl; + +import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.core.web.page.PageDomain; +import com.yanzhu.common.core.web.page.TableSupport; +import com.yanzhu.flowable.domain.FlowableDeploy; +import com.yanzhu.flowable.factory.FlowServiceFactory; +import com.yanzhu.flowable.service.IFlowableDeployService; +import org.flowable.common.engine.impl.db.SuspensionState; +import org.flowable.engine.repository.Deployment; +import org.flowable.engine.repository.ProcessDefinition; +import org.flowable.engine.repository.ProcessDefinitionQuery; +import org.springframework.stereotype.Service; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 流程部署Service业务层处理 + * + * @author ruoyi + * @date 2023-12-18 + */ +@Service +public class FlowableDeployServiceImpl extends FlowServiceFactory implements IFlowableDeployService +{ + /** + * 查询流程部署 + * + * @param definitionId 流程部署主键 + * @return 流程部署 + */ + @Override + public FlowableDeploy selectFlowableDeployByDefinitionId(String definitionId) + { + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() + .latestVersion() + .orderByProcessDefinitionKey() + .asc(); + processDefinitionQuery.deploymentId(definitionId); + if(processDefinitionQuery.count()==0){ + return new FlowableDeploy(); + } + FlowableDeploy flowableDeploy = new FlowableDeploy(); + ProcessDefinition result = processDefinitionQuery.singleResult(); + + flowableDeploy.setDefinitionId(result.getId()); + flowableDeploy.setDeploymentId(result.getDeploymentId()); + flowableDeploy.setVersion(result.getVersion()); + Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(definitionId).singleResult(); + flowableDeploy.setDeploymentTime(deployment.getDeploymentTime()); + flowableDeploy.setSuspended(result.isSuspended()); + flowableDeploy.setProcessKey(result.getKey()); + flowableDeploy.setProcessName(result.getName()); + flowableDeploy.setCategory(deployment.getCategory()); + return flowableDeploy; + } + + /** + * 查询流程部署列表 + * + * @param flowableDeploy 流程部署 + * @return 流程部署 + */ + @Override + public List selectFlowableDeployList(FlowableDeploy flowableDeploy) + { + List retList = null; + // 流程定义列表数据查询 + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() + .latestVersion() + .orderByProcessDefinitionKey() + .asc(); + if (StringUtils.isNotBlank(flowableDeploy.getProcessKey())) { + processDefinitionQuery.processDefinitionKeyLike("%" + flowableDeploy.getProcessKey() + "%"); + } + if (StringUtils.isNotBlank(flowableDeploy.getProcessName())) { + processDefinitionQuery.processDefinitionNameLike("%" + flowableDeploy.getProcessName() + "%"); + } + if (StringUtils.isNotBlank(flowableDeploy.getCategory())) { + processDefinitionQuery.processDefinitionCategory(flowableDeploy.getCategory()); + } + if (flowableDeploy.getSuspended()!=null) { + if(!flowableDeploy.getSuspended()){ + processDefinitionQuery.active(); + } else { + processDefinitionQuery.suspended(); + } + } + long pageTotal = processDefinitionQuery.count(); + if (pageTotal <= 0) { + return new ArrayList<>(); + } + PageDomain pageDomain = TableSupport.getPageDomain(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + int offset = pageSize * (pageNum - 1); + List definitionList = processDefinitionQuery.listPage(offset, pageSize); + + retList = new ArrayList<>(definitionList.size()); + for (ProcessDefinition processDefinition : definitionList) { + String deploymentId = processDefinition.getDeploymentId(); + + Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); + FlowableDeploy vo = new FlowableDeploy(); + vo.setDefinitionId(processDefinition.getId()); + vo.setProcessKey(processDefinition.getKey()); + vo.setProcessName(processDefinition.getName()); + vo.setVersion(processDefinition.getVersion()); + vo.setCategory(processDefinition.getCategory()); + vo.setDeploymentId(processDefinition.getDeploymentId()); + vo.setSuspended(processDefinition.isSuspended()); + // 流程部署信息 + vo.setCategory(deployment.getCategory()); + vo.setDeploymentTime(deployment.getDeploymentTime()); + retList.add(vo); + } + return retList; + } + + /** + * 批量删除流程部署 + * + * @param definitionIds 需要删除的流程部署主键 + * @return 结果 + */ + @Override + public int deleteFlowableDeployByDefinitionIds(String[] definitionIds) + { + for (String deployId : definitionIds) { + repositoryService.deleteDeployment(deployId, true); + //deployFormMapper.delete(new LambdaQueryWrapper().eq(WfDeployForm::getDeployId, deployId)); + } + return definitionIds.length; + } + + /** + * 删除流程部署信息 + * + * @param definitionId 流程部署主键 + * @return 结果 + */ + @Override + public int deleteFlowableDeployByDefinitionId(String definitionId) + { + repositoryService.deleteDeployment(definitionId, true); + return 1; + } + + /** + * 查询部署的所有历史版本 + * @param processKey + * @return + */ + @Override + public List queryPublishList(String processKey) { + // 创建查询条件 + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey(processKey) + .orderByProcessDefinitionVersion() + .desc(); + long pageTotal = processDefinitionQuery.count(); + if (pageTotal <= 0) { + return new ArrayList<>(); + } + // 根据查询条件,查询所有版本 + PageDomain pageDomain = TableSupport.getPageDomain(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + int offset = pageSize * (pageNum - 1); + List processDefinitionList = processDefinitionQuery + .listPage(offset, pageSize); + List retList = processDefinitionList.stream().map(item -> { + FlowableDeploy vo = new FlowableDeploy(); + vo.setDefinitionId(item.getId()); + vo.setProcessKey(item.getKey()); + vo.setProcessName(item.getName()); + vo.setVersion(item.getVersion()); + vo.setCategory(item.getCategory()); + vo.setDeploymentId(item.getDeploymentId()); + vo.setSuspended(item.isSuspended()); + return vo; + }).collect(Collectors.toList()); + return retList; + } + + /** + * 改变部署状态 + * + * @param definitionId + * @param stateCode + */ + @Override + public void updateState(String definitionId, String stateCode) { + if (SuspensionState.ACTIVE.toString().equals(stateCode)) { + // 激活 + repositoryService.activateProcessDefinitionById(definitionId, true, null); + } else if (SuspensionState.SUSPENDED.toString().equals(stateCode)) { + // 挂起 + repositoryService.suspendProcessDefinitionById(definitionId, true, null); + } + } + + /** + * 查询流程图 + * + * @param definitionId + * @return + */ + @Override + public String queryBpmnXmlById(String definitionId) { + InputStream inputStream = repositoryService.getProcessModel(definitionId); + try { + return StringUtils.utf8Str(inputStream); + } catch (Exception exception) { + throw new RuntimeException("加载xml文件异常"); + } + } + +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldDefServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldDefServiceImpl.java new file mode 100644 index 00000000..0ceecfb3 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldDefServiceImpl.java @@ -0,0 +1,109 @@ +package com.yanzhu.flowable.service.impl; + +import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.flowable.domain.FlowableFieldDef; +import com.yanzhu.flowable.domain.FlowableFieldSearch; +import com.yanzhu.flowable.mapper.FlowableFieldDefMapper; +import com.yanzhu.flowable.service.IFlowableFieldDefService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 流程字段定义Service业务层处理 + * + * @author ruoyi + * @date 2023-12-26 + */ +@Service +public class FlowableFieldDefServiceImpl implements IFlowableFieldDefService +{ + @Autowired + private FlowableFieldDefMapper flowableFieldDefMapper; + + /** + * 查询流程字段定义 + * + * @param id 流程字段定义主键 + * @return 流程字段定义 + */ + @Override + public FlowableFieldDef selectFlowableFieldDefById(String id) + { + return flowableFieldDefMapper.selectFlowableFieldDefById(id); + } + + /** + * 查询流程字段定义列表 + * + * @param flowableFieldDef 流程字段定义 + * @return 流程字段定义 + */ + @Override + public List selectFlowableFieldDefList(FlowableFieldDef flowableFieldDef) + { + return flowableFieldDefMapper.selectFlowableFieldDefList(flowableFieldDef); + } + + /** + * 新增流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + @Override + public int insertFlowableFieldDef(FlowableFieldDef flowableFieldDef) + { + flowableFieldDef.setCreateTime(DateUtils.getNowDate()); + return flowableFieldDefMapper.insertFlowableFieldDef(flowableFieldDef); + } + + /** + * 修改流程字段定义 + * + * @param flowableFieldDef 流程字段定义 + * @return 结果 + */ + @Override + public int updateFlowableFieldDef(FlowableFieldDef flowableFieldDef) + { + flowableFieldDef.setUpdateTime(DateUtils.getNowDate()); + return flowableFieldDefMapper.updateFlowableFieldDef(flowableFieldDef); + } + + /** + * 批量删除流程字段定义 + * + * @param ids 需要删除的流程字段定义主键 + * @return 结果 + */ + @Override + public int deleteFlowableFieldDefByIds(String[] ids) + { + return flowableFieldDefMapper.deleteFlowableFieldDefByIds(ids); + } + + /** + * 删除流程字段定义信息 + * + * @param id 流程字段定义主键 + * @return 结果 + */ + @Override + public int deleteFlowableFieldDefById(String id) + { + return flowableFieldDefMapper.deleteFlowableFieldDefById(id); + } + + /** + * 查询流程字段引用关系列表(不翻页,关联字段定义表查询) + * + * @param flowableFieldSearch + * @return + */ + @Override + public List listCombination(FlowableFieldSearch flowableFieldSearch) { + return flowableFieldDefMapper.listCombination(flowableFieldSearch); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldRefServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldRefServiceImpl.java new file mode 100644 index 00000000..a1a2a2ec --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableFieldRefServiceImpl.java @@ -0,0 +1,97 @@ +package com.yanzhu.flowable.service.impl; + +import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.flowable.domain.FlowableFieldRef; +import com.yanzhu.flowable.mapper.FlowableFieldRefMapper; +import com.yanzhu.flowable.service.IFlowableFieldRefService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 流程字段引用关系Service业务层处理 + * + * @author ruoyi + * @date 2023-12-26 + */ +@Service +public class FlowableFieldRefServiceImpl implements IFlowableFieldRefService +{ + @Autowired + private FlowableFieldRefMapper flowableFieldRefMapper; + + /** + * 查询流程字段引用关系 + * + * @param id 流程字段引用关系主键 + * @return 流程字段引用关系 + */ + @Override + public FlowableFieldRef selectFlowableFieldRefById(String id) + { + return flowableFieldRefMapper.selectFlowableFieldRefById(id); + } + + /** + * 查询流程字段引用关系列表 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 流程字段引用关系 + */ + @Override + public List selectFlowableFieldRefList(FlowableFieldRef flowableFieldRef) + { + return flowableFieldRefMapper.selectFlowableFieldRefList(flowableFieldRef); + } + + /** + * 新增流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + @Override + public int insertFlowableFieldRef(FlowableFieldRef flowableFieldRef) + { + flowableFieldRef.setCreateTime(DateUtils.getNowDate()); + return flowableFieldRefMapper.insertFlowableFieldRef(flowableFieldRef); + } + + /** + * 修改流程字段引用关系 + * + * @param flowableFieldRef 流程字段引用关系 + * @return 结果 + */ + @Override + public int updateFlowableFieldRef(FlowableFieldRef flowableFieldRef) + { + flowableFieldRef.setUpdateTime(DateUtils.getNowDate()); + return flowableFieldRefMapper.updateFlowableFieldRef(flowableFieldRef); + } + + /** + * 批量删除流程字段引用关系 + * + * @param ids 需要删除的流程字段引用关系主键 + * @return 结果 + */ + @Override + public int deleteFlowableFieldRefByIds(String[] ids) + { + return flowableFieldRefMapper.deleteFlowableFieldRefByIds(ids); + } + + /** + * 删除流程字段引用关系信息 + * + * @param id 流程字段引用关系主键 + * @return 结果 + */ + @Override + public int deleteFlowableFieldRefById(String id) + { + return flowableFieldRefMapper.deleteFlowableFieldRefById(id); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelPageServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelPageServiceImpl.java new file mode 100644 index 00000000..60f017b3 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelPageServiceImpl.java @@ -0,0 +1,183 @@ +package com.yanzhu.flowable.service.impl; + +import com.yanzhu.common.core.exception.ServiceException; +import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.flowable.domain.FlowableModelPage; +import com.yanzhu.flowable.mapper.FlowableModelPageMapper; +import com.yanzhu.flowable.service.IFlowableModelPageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * 建模页面绑定Service业务层处理 + * + * @author ruoyi + * @date 2023-12-25 + */ +@Service +public class FlowableModelPageServiceImpl implements IFlowableModelPageService +{ + @Autowired + private FlowableModelPageMapper flowableModelPageMapper; + + /** + * 查询建模页面绑定 + * + * @param id 建模页面绑定主键 + * @return 建模页面绑定 + */ + @Override + public FlowableModelPage selectFlowableModelPageById(String id) + { + return flowableModelPageMapper.selectFlowableModelPageById(id); + } + + /** + * 查询建模页面绑定列表 + * + * @param flowableModelPage 建模页面绑定 + * @return 建模页面绑定 + */ + @Override + public List selectFlowableModelPageList(FlowableModelPage flowableModelPage) + { + return flowableModelPageMapper.selectFlowableModelPageList(flowableModelPage); + } + + /** + * 新增建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + @Override + public int insertFlowableModelPage(FlowableModelPage flowableModelPage) + { + flowableModelPage.setCreateTime(DateUtils.getNowDate()); + //设置创建用户id及用户名 + flowableModelPage.setCreateBy(SecurityUtils.getUsername()); + return flowableModelPageMapper.insertFlowableModelPage(flowableModelPage); + } + + /** + * 修改建模页面绑定 + * + * @param flowableModelPage 建模页面绑定 + * @return 结果 + */ + @Override + public int updateFlowableModelPage(FlowableModelPage flowableModelPage) + { + flowableModelPage.setUpdateTime(DateUtils.getNowDate()); + //设置更新用户用户名 + flowableModelPage.setUpdateBy(SecurityUtils.getUsername()); + return flowableModelPageMapper.updateFlowableModelPage(flowableModelPage); + } + + /** + * 批量删除建模页面绑定 + * + * @param ids 需要删除的建模页面绑定主键 + * @return 结果 + */ + @Override + public int deleteFlowableModelPageByIds(String[] ids) + { + return flowableModelPageMapper.deleteFlowableModelPageByIds(ids); + } + + /** + * 删除建模页面绑定信息 + * + * @param id 建模页面绑定主键 + * @return 结果 + */ + @Override + public int deleteFlowableModelPageById(String id) + { + return flowableModelPageMapper.deleteFlowableModelPageById(id); + } + + /** + * 查询需要绑定的建模页面 + * + * @param flowableModelPage + * @return + */ + @Override + public List selectFlowableModelPageListByBind(FlowableModelPage flowableModelPage) { + FlowableModelPage searchModelPage = new FlowableModelPage(); + //参数检查 + //模块不能为空 + if(StringUtils.isEmpty(flowableModelPage.getModule())) + throw new ServiceException("模块名称不能为空!"); + //流程标识不能为空 + if(StringUtils.isEmpty(flowableModelPage.getMkey())) + throw new ServiceException("流程标识不能空!"); + //页面名称不能为空 + if(StringUtils.isEmpty(flowableModelPage.getName())) + throw new ServiceException("页面名称不能为空!"); + searchModelPage.setModule(flowableModelPage.getModule()); + searchModelPage.setMkey(flowableModelPage.getMkey()); + searchModelPage.setName(flowableModelPage.getName()); + return flowableModelPageMapper.selectFlowableModelPageList(searchModelPage); + } + + /*** + * 建模页面单页面查询(根据模块,流程标识,页面名称查询) + * @param flowableModelPage + * @return + */ + @Override + public FlowableModelPage selectFlowableModelPageSingle(FlowableModelPage flowableModelPage) { + FlowableModelPage searchModelPage = new FlowableModelPage(); + //参数检查 + //模块不能为空 + if(StringUtils.isEmpty(flowableModelPage.getModule())) { + return null; + } + //流程标识不能为空 + if(StringUtils.isEmpty(flowableModelPage.getMkey())){ + return null; + } + //页面名称不能为空 + if(StringUtils.isEmpty(flowableModelPage.getName())){ + return null; + } + searchModelPage.setModule(flowableModelPage.getModule()); + searchModelPage.setMkey(flowableModelPage.getMkey()); + searchModelPage.setName(flowableModelPage.getName()); + List list = flowableModelPageMapper.selectFlowableModelPageList(searchModelPage); + if(CollectionUtils.isEmpty(list)){ + return null; + }else{ + return list.get(0); + } + } + + /** + * 建模页面模块页面查询(按模块,流程标识查询) + * + * @param flowableModelPage + * @return + */ + @Override + public List selectFlowableModelPage(FlowableModelPage flowableModelPage) { + FlowableModelPage searchModelPage = new FlowableModelPage(); + //参数检查 + //模块不能为空 + if(StringUtils.isEmpty(flowableModelPage.getModule())) + throw new ServiceException("模块名称不能为空!"); + //流程标识不能为空 + if(StringUtils.isEmpty(flowableModelPage.getMkey())) + throw new ServiceException("流程标识不能空!"); + searchModelPage.setModule(flowableModelPage.getModule()); + searchModelPage.setMkey(flowableModelPage.getMkey()); + return flowableModelPageMapper.selectFlowableModelPageList(searchModelPage); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelServiceImpl.java new file mode 100644 index 00000000..5adc8df5 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowableModelServiceImpl.java @@ -0,0 +1,423 @@ +package com.yanzhu.flowable.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.core.web.page.PageDomain; +import com.yanzhu.common.core.web.page.TableSupport; +import com.yanzhu.common.redis.service.RedisService; +import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.flowable.common.constant.ProcessConstants; +import com.yanzhu.flowable.common.enums.CacheType; +import com.yanzhu.flowable.common.enums.FormType; +import com.yanzhu.flowable.domain.FlowableModel; +import com.yanzhu.flowable.domain.bo.FlowableMetaInfoBo; +import com.yanzhu.flowable.domain.bo.FlowableModelBo; +import com.yanzhu.flowable.factory.FlowServiceFactory; +import com.yanzhu.flowable.flow.ModelHelper; +import com.yanzhu.flowable.service.IFlowableCategoryService; +import com.yanzhu.flowable.service.IFlowableModelService; +import lombok.extern.slf4j.Slf4j; +import org.flowable.bpmn.model.BpmnModel; +import org.flowable.bpmn.model.StartEvent; +import org.flowable.engine.repository.Deployment; +import org.flowable.engine.repository.Model; +import org.flowable.engine.repository.ModelQuery; +import org.flowable.engine.repository.ProcessDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 流程模型Service业务层处理 + * + * @author ruoyi + * @createtime 2023-11-28 + */ +@Service +@Slf4j +public class FlowableModelServiceImpl extends FlowServiceFactory implements IFlowableModelService +{ + + @Autowired + private RedisService redisService; + + @Autowired + private IFlowableCategoryService flowableCategoryService; + /** + * 查询流程模型 + * + * @param modelId 流程模型主键 + * @return 流程模型 + */ + @Override + public FlowableModel selectFlowableModelByModelId(String modelId) + { + // 获取流程模型 + Model model = repositoryService.getModel(modelId); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + // 获取流程图 + String bpmnXml ; + try { + bpmnXml = queryBpmnXmlById(modelId); + } catch (UnsupportedEncodingException e) { + //e.printStackTrace(); + log.error("模型转换为字符串失败!模型id:"+modelId,e); + throw new RuntimeException("模型转换为字符串失败!"); + } + FlowableModel modelVo = new FlowableModel(); + modelVo.setModelId(model.getId()); + modelVo.setModelName(model.getName()); + modelVo.setModelKey(model.getKey()); + modelVo.setCategory(model.getCategory()); + modelVo.setCreateTime(model.getCreateTime()); + modelVo.setVersion(model.getVersion()); + modelVo.setBpmnXml(bpmnXml); + FlowableMetaInfoBo metaInfo = JSON.parseObject(model.getMetaInfo(), FlowableMetaInfoBo.class); + if (metaInfo != null) { + modelVo.setDescription(metaInfo.getDescription()); + modelVo.setFormType(metaInfo.getFormType()); + modelVo.setFormId(metaInfo.getFormId()); + if (FormType.PROCESS.getType().equals(metaInfo.getFormType())) { + //TODO + //WfFormVo wfFormVo = formService.queryById(metaInfo.getFormId()); + //modelVo.setContent(wfFormVo.getContent()); + } + } + return modelVo; + } + + /** + * 查询流程模型列表 + * + * @param flowableModel 流程模型 + * @return 流程模型 + */ + @Override + public List selectFlowableModelList(FlowableModelBo flowableModel) + { + PageDomain pageDomain = TableSupport.getPageDomain(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + + ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByCreateTime().desc(); + + // 构建查询条件 + if (StringUtils.isNotBlank(flowableModel.getModelKey())) { + modelQuery.modelKey(flowableModel.getModelKey()); + } + if (StringUtils.isNotBlank(flowableModel.getModelName())) { + modelQuery.modelNameLike("%" + flowableModel.getModelName() + "%"); + } + if (StringUtils.isNotBlank(flowableModel.getCategory())) { + modelQuery.modelCategory(flowableModel.getCategory()); + } + + // 执行查询 + long pageTotal = modelQuery.count(); + if (pageTotal <= 0) { + return new ArrayList<>(); + } + //有bug 先注掉 + //modelQuery = modelQuery.latestVersion(); + int offset = pageSize * (pageNum - 1); + List modelList = modelQuery.listPage(offset, pageSize); + List flowableModelList = new ArrayList<>(modelList.size()); + //获取流程分类缓存 + Map flowCategoryMap = redisService.getCacheObject(CacheType.FLOWCATEGORY.getCode()); + if(flowCategoryMap==null){ + flowCategoryMap = flowableCategoryService.updateRedis(null); + } + Map finalFlowCategoryMap = flowCategoryMap; + modelList.forEach(model -> { + FlowableModel modelVo = new FlowableModel(); + modelVo.setModelId(model.getId()); + modelVo.setModelName(model.getName()); + modelVo.setModelKey(model.getKey()); + //翻译分类 + modelVo.setCategory(finalFlowCategoryMap.get(model.getCategory())); + modelVo.setCreateTime(model.getCreateTime()); + modelVo.setVersion(model.getVersion()); + FlowableMetaInfoBo metaInfo = JSON.parseObject(model.getMetaInfo(), FlowableMetaInfoBo.class); + if (metaInfo != null) { + modelVo.setDescription(metaInfo.getDescription()); + modelVo.setFormType(metaInfo.getFormType()); + modelVo.setFormId(metaInfo.getFormId()); + } + flowableModelList.add(modelVo); + }); + return flowableModelList; + } + + /** + * 新增流程模型 + * + * @param flowableModel 流程模型 + * @return + */ + @Override + public int insertFlowableModel(FlowableModel flowableModel) + { + flowableModel.setCreateTime(DateUtils.getNowDate()); + Model model = repositoryService.newModel(); + model.setName(flowableModel.getModelName()); + model.setKey(flowableModel.getModelKey()); + model.setCategory(flowableModel.getCategory()); + String metaInfo = buildMetaInfo(new FlowableMetaInfoBo(), flowableModel.getDescription()); + model.setMetaInfo(metaInfo); + // 保存流程模型 + repositoryService.saveModel(model); + return 1; + } + + /** + * 修改流程模型 + * + * @param flowableModel 流程模型 + * @return + */ + @Override + public int updateFlowableModel(FlowableModel flowableModel) + { + // 根据模型Key查询模型信息 + Model model = repositoryService.getModel(flowableModel.getModelId()); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + model.setCategory(flowableModel.getCategory()); + FlowableMetaInfoBo metaInfoDto = JSON.parseObject(model.getMetaInfo(), FlowableMetaInfoBo.class); + String metaInfo = buildMetaInfo(metaInfoDto, flowableModel.getDescription()); + model.setMetaInfo(metaInfo); + // 保存流程模型 + repositoryService.saveModel(model); + return 1; + } + + /** + * 批量删除流程模型 + * + * @param modelIds 需要删除的流程模型主键 + * @return + */ + @Override + public int deleteFlowableModelByModelIds(String[] modelIds) + { + for(String id:modelIds){ + Model model = repositoryService.getModel(id); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + repositoryService.deleteModel(id); + } + return modelIds.length; + } + + /** + * 删除流程模型信息 + * + * @param modelId 流程模型主键 + */ + @Override + public void deleteFlowableModelByModelId(String modelId) + { + Model model = repositoryService.getModel(modelId); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + repositoryService.deleteModel(modelId); + } + + /** + * 部署流程 + * + * @param modelId 模型id + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deployModel(String modelId) throws UnsupportedEncodingException { + // 获取流程模型 + Model model = repositoryService.getModel(modelId); + if (model== null) { + throw new RuntimeException("流程模型不存在!"); + } + // 获取流程图 + String bpmnXml = queryBpmnXmlById(modelId); + //BpmnModel bpmnModel = ModelHelper.getBpmnModel(bpmnXml); + String processName = model.getName() + ProcessConstants.SUFFIX; + Deployment deployment = repositoryService.createDeployment() + .key(model.getKey()) + .name(model.getName()) + .category(model.getCategory()) + .addString(model.getKey() + ".bpmn20.xml", bpmnXml) + .deploy(); + // 调整分类 + ProcessDefinition precessDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult(); + repositoryService.setProcessDefinitionCategory(precessDefinition.getId(),model.getCategory()); + // TODO:保存部署表单 + + } + + /** + * 构建模型扩展信息 + * @return 返回模型扩展信息 + */ + private String buildMetaInfo(FlowableMetaInfoBo metaInfo, String description) { + // 只有非空,才进行设置,避免更新时的覆盖 + if (StringUtils.isNotEmpty(description)) { + metaInfo.setDescription(description); + } + if (StringUtils.isNotEmpty(metaInfo.getCreateUser())) { + metaInfo.setCreateUser(SecurityUtils.getUsername()); + } + return JSON.toJSONString(metaInfo); + } + + /** + * 将模型数据转字符串返回 + * @param modelId 模型id + * @return 返回模型字符串格式 + */ + public String queryBpmnXmlById(String modelId) throws UnsupportedEncodingException { + byte[] bpmnBytes = repositoryService.getModelEditorSource(modelId); + if(bpmnBytes!=null) { + return new String(bpmnBytes, StandardCharsets.UTF_8); + }else{ + return new String(""); + } + } + + /** + * 查询模型历史版本 + * + * @param modelBo + * @return + */ + @Override + public List historyList(FlowableModelBo modelBo) { + ModelQuery modelQuery = repositoryService.createModelQuery() + .modelKey(modelBo.getModelKey()) + .orderByModelVersion() + .desc(); + // 执行查询(不显示最新版,-1) + long pageTotal = modelQuery.count() - 1; + if (pageTotal <= 0) { + return new ArrayList<>(); + } + PageDomain pageDomain = TableSupport.getPageDomain(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + // offset+1,去掉最新版 + int offset = 1 + pageSize * (pageNum - 1); + List modelList = modelQuery.listPage(offset, pageSize); + List modelVoList = new ArrayList<>(modelList.size()); + modelList.forEach(model -> { + FlowableModel modelVo = new FlowableModel(); + modelVo.setModelId(model.getId()); + modelVo.setModelName(model.getName()); + modelVo.setModelKey(model.getKey()); + modelVo.setCategory(model.getCategory()); + modelVo.setCreateTime(model.getCreateTime()); + modelVo.setVersion(model.getVersion()); + FlowableMetaInfoBo metaInfo = JSON.parseObject(model.getMetaInfo(), FlowableMetaInfoBo.class); + if (metaInfo != null) { + modelVo.setDescription(metaInfo.getDescription()); + modelVo.setFormType(metaInfo.getFormType()); + modelVo.setFormId(metaInfo.getFormId()); + } + modelVoList.add(modelVo); + }); + return modelVoList; + } + @Override + @Transactional(rollbackFor = Exception.class) + public void saveModel(FlowableModelBo modelBo) { + // 查询模型信息 + Model model = repositoryService.getModel(modelBo.getModelId()); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + log.info("==========bpmnxml========="); + log.info(modelBo.getBpmnXml()); + BpmnModel bpmnModel = ModelHelper.getBpmnModel(modelBo.getBpmnXml()); + if (bpmnModel==null) { + throw new RuntimeException("获取模型设计失败!"); + } + //String processName = bpmnModel.getMainProcess().getName(); + // 获取开始节点 + StartEvent startEvent = ModelHelper.getStartEvent(bpmnModel); + if (startEvent==null) { + throw new RuntimeException("开始节点不存在,请检查流程设计是否有误!"); + } + // 获取开始节点配置的表单Key +// if (StringUtils.isBlank(startEvent.getFormKey())) { +// throw new RuntimeException("请配置流程表单"); +// } + Model newModel; + if (Boolean.TRUE.equals(modelBo.getNewVersion())) { + newModel = repositoryService.newModel(); + newModel.setName(model.getName()); + newModel.setKey(model.getKey()); + newModel.setCategory(model.getCategory()); + newModel.setMetaInfo(model.getMetaInfo()); + //获取最大版本号 + ModelQuery modelQuery = repositoryService.createModelQuery() + .modelName(model.getName()) + .modelCategory(model.getCategory()) + .orderByModelVersion() + .desc(); + int offset = 1 * (1 - 1); + List modelList = modelQuery.listPage(offset, 1); + newModel.setVersion(modelList.get(0).getVersion() + 1); + } else { + newModel = model; + // 设置流程名称 + newModel.setName(model.getName()); + } + // 保存流程模型 + repositoryService.saveModel(newModel); + // 保存 BPMN XML + repositoryService.addModelEditorSource(newModel.getId(), ModelHelper.getBpmnXml(bpmnModel)); + } + + /** + * 设置为最新版本 + * + * @param modelId + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void latestModel(String modelId) throws UnsupportedEncodingException { + // 获取流程模型 + Model model = repositoryService.getModel(modelId); + if (model==null) { + throw new RuntimeException("流程模型不存在!"); + } + String bpmnXml = queryBpmnXmlById(modelId); + Integer latestVersion = repositoryService.createModelQuery() + .modelKey(model.getKey()) + .latestVersion() + .singleResult() + .getVersion(); + if (model.getVersion().equals(latestVersion)) { + throw new RuntimeException("当前版本已是最新版!"); + } + Model newModel = repositoryService.newModel(); + newModel.setName(model.getName()); + newModel.setKey(model.getKey()); + newModel.setCategory(model.getCategory()); + newModel.setMetaInfo(model.getMetaInfo()); + newModel.setVersion(latestVersion + 1); + // 保存流程模型 + repositoryService.saveModel(newModel); + // 保存 BPMN XML + repositoryService.addModelEditorSource(newModel.getId(), bpmnXml.getBytes(StandardCharsets.UTF_8)); + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysDeployFormServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysDeployFormServiceImpl.java deleted file mode 100644 index 146e9082..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysDeployFormServiceImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.yanzhu.flowable.domain.SysDeployForm; -import com.yanzhu.flowable.domain.SysForm; -import com.yanzhu.flowable.mapper.SysDeployFormMapper; -import com.yanzhu.flowable.service.ISysDeployFormService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -/** - * 流程实例关联表单Service业务层处理 - * - * @author Tony - * @date 2021-04-03 - */ -@Service -public class SysDeployFormServiceImpl implements ISysDeployFormService -{ - @Autowired - private SysDeployFormMapper sysDeployFormMapper; - - /** - * 查询流程实例关联表单 - * - * @param id 流程实例关联表单ID - * @return 流程实例关联表单 - */ - @Override - public SysDeployForm selectSysDeployFormById(Long id) - { - return sysDeployFormMapper.selectSysDeployFormById(id); - } - - /** - * 查询流程实例关联表单列表 - * - * @param sysDeployForm 流程实例关联表单 - * @return 流程实例关联表单 - */ - @Override - public List selectSysDeployFormList(SysDeployForm sysDeployForm) - { - return sysDeployFormMapper.selectSysDeployFormList(sysDeployForm); - } - - /** - * 新增流程实例关联表单 - * - * @param sysDeployForm 流程实例关联表单 - * @return 结果 - */ - @Override - public int insertSysDeployForm(SysDeployForm sysDeployForm) - { - SysForm sysForm = sysDeployFormMapper.selectSysDeployFormByDeployId(sysDeployForm.getDeployId()); - if (Objects.isNull(sysForm)) { - return sysDeployFormMapper.insertSysDeployForm(sysDeployForm); - }else { - return 1; - } - } - - /** - * 修改流程实例关联表单 - * - * @param sysDeployForm 流程实例关联表单 - * @return 结果 - */ - @Override - public int updateSysDeployForm(SysDeployForm sysDeployForm) - { - return sysDeployFormMapper.updateSysDeployForm(sysDeployForm); - } - - /** - * 批量删除流程实例关联表单 - * - * @param ids 需要删除的流程实例关联表单ID - * @return 结果 - */ - @Override - public int deleteSysDeployFormByIds(Long[] ids) - { - return sysDeployFormMapper.deleteSysDeployFormByIds(ids); - } - - /** - * 删除流程实例关联表单信息 - * - * @param id 流程实例关联表单ID - * @return 结果 - */ - @Override - public int deleteSysDeployFormById(Long id) - { - return sysDeployFormMapper.deleteSysDeployFormById(id); - } - - /** - * 查询流程挂着的表单 - * - * @param deployId - * @return - */ - @Override - public SysForm selectSysDeployFormByDeployId(String deployId) { - return sysDeployFormMapper.selectSysDeployFormByDeployId(deployId); - } -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysExpressionServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysExpressionServiceImpl.java deleted file mode 100644 index a8516ba2..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysExpressionServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.yanzhu.common.core.utils.DateUtils; -import com.yanzhu.flowable.domain.SysExpression; -import com.yanzhu.flowable.mapper.SysExpressionMapper; -import com.yanzhu.flowable.service.ISysExpressionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 流程达式Service业务层处理 - * - * @author yanZhu - * @date 2022-12-12 - */ -@Service -public class SysExpressionServiceImpl implements ISysExpressionService -{ - @Autowired - private SysExpressionMapper sysExpressionMapper; - - /** - * 查询流程达式 - * - * @param id 流程达式主键 - * @return 流程达式 - */ - @Override - public SysExpression selectSysExpressionById(Long id) - { - return sysExpressionMapper.selectSysExpressionById(id); - } - - /** - * 查询流程达式列表 - * - * @param sysExpression 流程达式 - * @return 流程达式 - */ - @Override - public List selectSysExpressionList(SysExpression sysExpression) - { - return sysExpressionMapper.selectSysExpressionList(sysExpression); - } - - /** - * 新增流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - @Override - public int insertSysExpression(SysExpression sysExpression) - { - sysExpression.setCreateTime(DateUtils.getNowDate()); - return sysExpressionMapper.insertSysExpression(sysExpression); - } - - /** - * 修改流程达式 - * - * @param sysExpression 流程达式 - * @return 结果 - */ - @Override - public int updateSysExpression(SysExpression sysExpression) - { - sysExpression.setUpdateTime(DateUtils.getNowDate()); - return sysExpressionMapper.updateSysExpression(sysExpression); - } - - /** - * 批量删除流程达式 - * - * @param ids 需要删除的流程达式主键 - * @return 结果 - */ - @Override - public int deleteSysExpressionByIds(Long[] ids) - { - return sysExpressionMapper.deleteSysExpressionByIds(ids); - } - - /** - * 删除流程达式信息 - * - * @param id 流程达式主键 - * @return 结果 - */ - @Override - public int deleteSysExpressionById(Long id) - { - return sysExpressionMapper.deleteSysExpressionById(id); - } -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysFormServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysFormServiceImpl.java deleted file mode 100644 index 78ca706f..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysFormServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.yanzhu.common.core.utils.DateUtils; -import com.yanzhu.flowable.domain.SysForm; -import com.yanzhu.flowable.mapper.SysFormMapper; -import com.yanzhu.flowable.service.ISysFormService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 流程表单Service业务层处理 - * - * @author Tony - * @date 2021-04-03 - */ -@Service -public class SysFormServiceImpl implements ISysFormService -{ - @Autowired - private SysFormMapper sysFormMapper; - - /** - * 查询流程表单 - * - * @param formId 流程表单ID - * @return 流程表单 - */ - @Override - public SysForm selectSysFormById(Long formId) - { - return sysFormMapper.selectSysFormById(formId); - } - - /** - * 查询流程表单列表 - * - * @param sysForm 流程表单 - * @return 流程表单 - */ - @Override - public List selectSysFormList(SysForm sysForm) - { - return sysFormMapper.selectSysFormList(sysForm); - } - - /** - * 新增流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - @Override - public int insertSysForm(SysForm sysForm) - { - sysForm.setCreateTime(DateUtils.getNowDate()); - return sysFormMapper.insertSysForm(sysForm); - } - - /** - * 修改流程表单 - * - * @param sysForm 流程表单 - * @return 结果 - */ - @Override - public int updateSysForm(SysForm sysForm) - { - sysForm.setUpdateTime(DateUtils.getNowDate()); - return sysFormMapper.updateSysForm(sysForm); - } - - /** - * 批量删除流程表单 - * - * @param formIds 需要删除的流程表单ID - * @return 结果 - */ - @Override - public int deleteSysFormByIds(Long[] formIds) - { - return sysFormMapper.deleteSysFormByIds(formIds); - } - - /** - * 删除流程表单信息 - * - * @param formId 流程表单ID - * @return 结果 - */ - @Override - public int deleteSysFormById(Long formId) - { - return sysFormMapper.deleteSysFormById(formId); - } -} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysTaskFormServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysTaskFormServiceImpl.java deleted file mode 100644 index c32e8979..00000000 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/SysTaskFormServiceImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.yanzhu.flowable.service.impl; - -import com.yanzhu.flowable.domain.SysTaskForm; -import com.yanzhu.flowable.mapper.SysTaskFormMapper; -import com.yanzhu.flowable.service.ISysTaskFormService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 流程任务关联单Service业务层处理 - * - * @author Tony - * @date 2021-04-03 - */ -@Service -public class SysTaskFormServiceImpl implements ISysTaskFormService -{ - @Autowired - private SysTaskFormMapper sysTaskFormMapper; - - /** - * 查询流程任务关联单 - * - * @param id 流程任务关联单ID - * @return 流程任务关联单 - */ - @Override - public SysTaskForm selectSysTaskFormById(Long id) - { - return sysTaskFormMapper.selectSysTaskFormById(id); - } - - /** - * 查询流程任务关联单列表 - * - * @param sysTaskForm 流程任务关联单 - * @return 流程任务关联单 - */ - @Override - public List selectSysTaskFormList(SysTaskForm sysTaskForm) - { - return sysTaskFormMapper.selectSysTaskFormList(sysTaskForm); - } - - /** - * 新增流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - @Override - public int insertSysTaskForm(SysTaskForm sysTaskForm) - { - return sysTaskFormMapper.insertSysTaskForm(sysTaskForm); - } - - /** - * 修改流程任务关联单 - * - * @param sysTaskForm 流程任务关联单 - * @return 结果 - */ - @Override - public int updateSysTaskForm(SysTaskForm sysTaskForm) - { - return sysTaskFormMapper.updateSysTaskForm(sysTaskForm); - } - - /** - * 批量删除流程任务关联单 - * - * @param ids 需要删除的流程任务关联单ID - * @return 结果 - */ - @Override - public int deleteSysTaskFormByIds(Long[] ids) - { - return sysTaskFormMapper.deleteSysTaskFormByIds(ids); - } - - /** - * 删除流程任务关联单信息 - * - * @param id 流程任务关联单ID - * @return 结果 - */ - @Override - public int deleteSysTaskFormById(Long id) - { - return sysTaskFormMapper.deleteSysTaskFormById(id); - } -} diff --git a/yanzhu-ui-vue3/src/App.vue b/yanzhu-ui-vue3/src/App.vue index d824dea3..f911e96f 100644 --- a/yanzhu-ui-vue3/src/App.vue +++ b/yanzhu-ui-vue3/src/App.vue @@ -18,4 +18,9 @@ onMounted(() => { width: 192px; } } +.bjs-container{ + a{ + display: none !important; + } +} diff --git a/yanzhu-ui-vue3/src/api/flowable/category.js b/yanzhu-ui-vue3/src/api/flowable/category.js new file mode 100644 index 00000000..9cf0f506 --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/category.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询流程分类列表 +export function listCategory(query) { + return request({ + url: '/flowable/category/list', + method: 'get', + params: query + }) +} + +// 查询流程分类详细 +export function getCategory(id) { + return request({ + url: '/flowable/category/' + id, + method: 'get' + }) +} + +// 新增流程分类 +export function addCategory(data) { + return request({ + url: '/flowable/category', + method: 'post', + data: data + }) +} + +// 修改流程分类 +export function updateCategory(data) { + return request({ + url: '/flowable/category', + method: 'put', + data: data + }) +} + +// 删除流程分类 +export function delCategory(id) { + return request({ + url: '/flowable/category/' + id, + method: 'delete' + }) +} diff --git a/yanzhu-ui-vue3/src/api/flowable/def.js b/yanzhu-ui-vue3/src/api/flowable/def.js new file mode 100644 index 00000000..f7896b0d --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/def.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询流程字段定义列表 +export function listDef(query) { + return request({ + url: '/flowable/def/list', + method: 'get', + params: query + }) +} + +// 查询流程字段定义详细 +export function getDef(id) { + return request({ + url: '/flowable/def/' + id, + method: 'get' + }) +} + +// 新增流程字段定义 +export function addDef(data) { + return request({ + url: '/flowable/def', + method: 'post', + data: data + }) +} + +// 修改流程字段定义 +export function updateDef(data) { + return request({ + url: '/flowable/def', + method: 'put', + data: data + }) +} + +// 删除流程字段定义 +export function delDef(id) { + return request({ + url: '/flowable/def/' + id, + method: 'delete' + }) +} +// 查询流程字段定义列表(不翻页) +export function listAll(query) { + return request({ + url: '/flowable/def/listAll', + method: 'get', + params: query + }) +} diff --git a/yanzhu-ui-vue3/src/api/flowable/deploy/index.ts b/yanzhu-ui-vue3/src/api/flowable/deploy/index.ts deleted file mode 100644 index 8c015bed..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/deploy/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import request from '@/utils/request'; -import { AxiosPromise } from 'axios'; -import { DeployVO, ProcessQuery } from '@/api/flowable/deploy/types'; - -// 查询流程部署列表 -export function listDeploy(query: ProcessQuery): AxiosPromise { - return request({ - url: '/flowable/deploy/list', - method: 'get', - params: query - }); -} - -export function listPublish(query: ProcessQuery): AxiosPromise { - return request({ - url: '/flowable/deploy/publishList', - method: 'get', - params: query - }); -} - -// 获取流程模型流程图 -export function getBpmnXml(definitionId?: string) { - return request({ - url: '/flowable/deploy/bpmnXml/' + definitionId, - method: 'get' - }); -} - -// 修改流程状态 -export function changeState(params?: any) { - return request({ - url: '/flowable/deploy/changeState', - method: 'put', - params: params - }); -} - -// 删除流程部署 -export function delDeploy(deployIds?: string | string[]) { - return request({ - url: '/flowable/deploy/' + deployIds, - method: 'delete' - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/deploy/types.ts b/yanzhu-ui-vue3/src/api/flowable/deploy/types.ts deleted file mode 100644 index cda78447..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/deploy/types.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface DeployVO { - definitionId: string; - processName: string; - processKey: string; - category: string; - version: number; - formId: string | number; - formName: string; - deploymentId: string; - suspended: boolean; - deploymentTime: string; -} - -export interface ProcessQuery extends PageQuery { - processKey?: string; - processName?: string; - category?: string; - state?: string; -} diff --git a/yanzhu-ui-vue3/src/api/flowable/form/index.ts b/yanzhu-ui-vue3/src/api/flowable/form/index.ts deleted file mode 100644 index a406b6ff..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/form/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -import request from '@/utils/request'; -import { FormForm, FormQuery, FormVO } from './types'; -import { AxiosPromise } from 'axios'; - -// 查询流程表单列表 -export function listForm(query?: FormQuery): AxiosPromise { - return request({ - url: '/flowable/form/list', - method: 'get', - params: query - }); -} - -// 查询流程表单详细 -export function getForm(formId: string | number): AxiosPromise { - return request({ - url: '/flowable/form/' + formId, - method: 'get' - }); -} - -// 新增流程表单 -export function addForm(data: FormForm) { - return request({ - url: '/flowable/form', - method: 'post', - data: data - }); -} - -// 修改流程表单 -export function updateForm(data: FormForm) { - return request({ - url: '/flowable/form', - method: 'put', - data: data - }); -} - -// 删除流程表单 -export function delForm(formId?: string | number | (string | number)[]) { - return request({ - url: '/flowable/form/' + formId, - method: 'delete' - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/form/types.ts b/yanzhu-ui-vue3/src/api/flowable/form/types.ts deleted file mode 100644 index 53e8e270..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/form/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface FormVO extends BaseEntity { - formId: number | string; - formName: string; - content: string; - remark: string; -} - -export interface FormForm { - formId: number | string | undefined; - formName: string; - content?: string; - remark: string; -} - -export interface FormQuery extends PageQuery { - formName?: string; -} diff --git a/yanzhu-ui-vue3/src/api/flowable/identity/index.ts b/yanzhu-ui-vue3/src/api/flowable/identity/index.ts deleted file mode 100644 index 0ab10a96..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/identity/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import request from '@/utils/request'; -import { AxiosPromise } from 'axios'; -import { UserVO, DeptVO } from '@/api/flowable/identity/types'; - -// 查询流程模型信息 -export function selectUser(query?: any): AxiosPromise { - return request({ - url: '/flowable/identity/selectUser', - method: 'get', - params: query - }); -} - -export function deptTreeSelect(): AxiosPromise { - return request({ - url: '/flowable/identity/deptTree', - method: 'get' - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/identity/types.ts b/yanzhu-ui-vue3/src/api/flowable/identity/types.ts deleted file mode 100644 index 1a47d13f..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/identity/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -export interface UserVO { - userId: string | number; - username: string; - nickname: string; - deptId: number; -} - -export interface DeptVO { - deptId: string | number; - deptName: string; -} diff --git a/yanzhu-ui-vue3/src/api/flowable/listener/index.ts b/yanzhu-ui-vue3/src/api/flowable/listener/index.ts deleted file mode 100644 index 4cceecc5..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/listener/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import request from '@/utils/request'; -import {ListenerFieldForm, ListenerForm, ListenerQuery, ListenerVO} from './types'; -import {AxiosPromise} from 'axios'; - -// 分页查询流程监听器 -export function queryListenerPage(query?: ListenerQuery): AxiosPromise { - return request({ - url: '/flowable/listener/queryPage', - method: 'get', - params: query - }); -} - -// 列表查询流程监听器 -export function queryListenerList(query?: ListenerQuery): AxiosPromise { - return request({ - url: '/flowable/listener/queryList', - method: 'get', - params: query - }); -} - -// 详细查询流程监听器 -export function getListener(formId: string | number): AxiosPromise { - return request({ - url: '/flowable/listener/query/' + formId, - method: 'get' - }); -} - -// 新增流程监听器 -export function addListener(data: ListenerForm) { - return request({ - url: '/flowable/listener/insert', - method: 'post', - data: data - }); -} - -// 修改流程监听器 -export function updateListener(data: ListenerForm) { - return request({ - url: '/flowable/listener/update', - method: 'post', - data: data - }); -} - -// 删除流程监听器 -export function delListener(listenerId?: string | number | (string | number)[]) { - return request({ - url: '/flowable/listener/delete/' + listenerId, - method: 'post' - }); -} - -// 新增流程监听器字段 -export function insertListenerFieldAPI(data: ListenerFieldForm) { - return request({ - url: '/flowable/listener/insertField', - method: 'post', - data: data - }); -} - -// 修改流程监听器字段 -export function updateListenerFieldAPI(data: ListenerFieldForm) { - return request({ - url: '/flowable/listener/updateField', - method: 'post', - data: data - }); -} - -// 删除流程监听器字段 -export function deleteListenerFieldAPI(fieldIds?: string | number | (string | number)[]) { - return request({ - url: '/flowable/listener/deleteField/' + fieldIds, - method: 'post' - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/listener/types.ts b/yanzhu-ui-vue3/src/api/flowable/listener/types.ts deleted file mode 100644 index b8a1aaae..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/listener/types.ts +++ /dev/null @@ -1,40 +0,0 @@ -export interface ListenerVO { - id: number | string; - listenerType: string; - name: string; - eventType: string; - valueType: string; - value: string; - fields: ListenerFieldVO[]; -} - -export interface ListenerForm { - id: number | string | undefined; - listenerType: string; - name: string; - eventType: string; - valueType: string; - value: string; -} - -export interface ListenerQuery extends PageQuery { - listenerType?: string; - eventType?: string; - name?: string; -} - -export interface ListenerFieldVO { - id: number | string; - listenerId: number | string; - fieldName: string; - fieldType: string; - fieldValue: string; -} - -export interface ListenerFieldForm { - id: number | string | undefined; - listenerId: number | string | undefined; - fieldName: string | undefined; - fieldType: string | undefined; - fieldValue: string | undefined; -} diff --git a/yanzhu-ui-vue3/src/api/flowable/model.js b/yanzhu-ui-vue3/src/api/flowable/model.js new file mode 100644 index 00000000..1c06cc15 --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/model.js @@ -0,0 +1,83 @@ +import request from '@/utils/request' + +// 查询流程模型列表 +export function listModel(query) { + return request({ + url: '/flowable/model/list', + method: 'get', + params: query + }) +} + +// 查询流程模型详细 +export function getModel(modelId) { + return request({ + url: '/flowable/model/' + modelId, + method: 'get' + }) +} + +// 新增流程模型 +export function addModel(data) { + return request({ + url: '/flowable/model', + method: 'post', + data: data + }) +} + +// 修改流程模型 +export function updateModel(data) { + return request({ + url: '/flowable/model', + method: 'put', + data: data + }) +} + +// 删除流程模型 +export function delModel(modelId) { + return request({ + url: '/flowable/model/' + modelId, + method: 'delete' + }) +} +// 部署流程模型 +export function depolyModel(params) { + return request({ + url: '/flowable/model/deploy' , + method: 'post', + params: params + }) +} +// 获取流程模型xml +export function getModelXml(modelId) { + return request({ + url: '/flowable/model/getBpmnXml/' + modelId, + method: 'get' + }) +} +// 保存(更新或插入新版本)流程模型 +export function saveModel(data) { + return request({ + url: '/flowable/model/save', + method: 'post', + data: data + }) +} +// 查询流程模型历史列表 +export function historyList(query) { + return request({ + url: '/flowable/model/historyList', + method: 'get', + params: query + }) +} +// 设置最新版 +export function latestModel(params) { + return request({ + url: '/flowable/model/latest', + method: 'post', + params: params + }) +} diff --git a/yanzhu-ui-vue3/src/api/flowable/model/index.ts b/yanzhu-ui-vue3/src/api/flowable/model/index.ts deleted file mode 100644 index cb24c413..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/model/index.ts +++ /dev/null @@ -1,86 +0,0 @@ -import request from '@/utils/request'; -import { AxiosPromise } from 'axios'; -import { ModelQuery, ModelVO } from './types'; - -// 查询流程模型信息 -export function listModel(query?: ModelQuery): AxiosPromise { - return request({ - url: '/flowable/model/list', - method: 'get', - params: query - }); -} - -// 查询流程模型信息 -export function historyModel(query?: ModelQuery): AxiosPromise { - return request({ - url: '/flowable/model/historyList', - method: 'get', - params: query - }); -} - -export function getModel(modelId?: string) { - return request({ - url: '/flowable/model/' + modelId, - method: 'get' - }); -} - -// 新增模型信息 -export function addModel(data?: any) { - return request({ - url: '/flowable/model', - method: 'post', - data: data - }); -} - -// 修改模型信息 -export function updateModel(data?: any) { - return request({ - url: '/flowable/model', - method: 'put', - data: data - }); -} - -// 保存流程模型 -export function saveModel(data?: any) { - return request({ - url: '/flowable/model/save', - method: 'post', - data: data - }); -} - -export function latestModel(params?: any) { - return request({ - url: '/flowable/model/latest', - method: 'post', - params: params - }); -} - -export function delModel(modelIds?: string | string[]) { - return request({ - url: '/flowable/model/' + modelIds, - method: 'delete' - }); -} - -export function deployModel(params?: any) { - return request({ - url: '/flowable/model/deploy', - method: 'post', - params: params - }); -} - -// 获取流程模型流程图 -export function getBpmnXml(modelId?: string) { - return request({ - url: '/flowable/model/bpmnXml/' + modelId, - method: 'get' - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/model/types.ts b/yanzhu-ui-vue3/src/api/flowable/model/types.ts deleted file mode 100644 index 14af9c01..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/model/types.ts +++ /dev/null @@ -1,38 +0,0 @@ -export interface ModelVO extends BaseEntity { - modelId: string; - modelKey: string; - modelName: string; - category: string; - version: number; - formType: number; - formId: number | string; - description: string; - createTime: string; - bpmnXml: string; - content: string; -} - -export interface ModelForm { - modelId: string | undefined; - modelKey: string; - modelName: string; - category: string; - description: string; - formType: number | undefined; - formId: number | string | undefined; - bpmnXml: string; - newVersion: boolean; -} - -export interface ModelQuery extends PageQuery { - modelKey?: string; - modelName?: string; -} - -export interface DesignerForm { - modelId: string; - form: { - processName: string; - processKey: string; - }; -} diff --git a/yanzhu-ui-vue3/src/api/flowable/page.js b/yanzhu-ui-vue3/src/api/flowable/page.js new file mode 100644 index 00000000..7338c6fa --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/page.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询建模页面绑定列表 +export function listPage(query) { + return request({ + url: '/flowable/page/list', + method: 'get', + params: query + }) +} + +// 查询建模页面绑定详细 +export function getPage(id) { + return request({ + url: '/flowable/page/' + id, + method: 'get' + }) +} + +//建模页面绑定 +export function bindPage(data) { + return request({ + url: '/flowable/page/bind', + method: 'put', + data: data + }) +} + + +// 删除建模页面绑定 +export function delPage(id) { + return request({ + url: '/flowable/page/' + id, + method: 'delete' + }) +} +// 查询绑定表单(单页面) +export function findPage(params) { + return request({ + url: `/flowable/page/findPage`, + method: 'post', + data:params + }) +} + +// 查询绑定表单(模块,流程标识下一组页面) +export function findModulePages(params) { + return request({ + url: `/flowable/page/findModulePage`, + method: 'post', + data:params + }) +} diff --git a/yanzhu-ui-vue3/src/api/flowable/ref.js b/yanzhu-ui-vue3/src/api/flowable/ref.js new file mode 100644 index 00000000..5a05a396 --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/ref.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询流程字段引用关系列表 +export function listRef(query) { + return request({ + url: '/flowable/ref/list', + method: 'get', + params: query + }) +} + +// 查询流程字段引用关系详细 +export function getRef(id) { + return request({ + url: '/flowable/ref/' + id, + method: 'get' + }) +} + +// 新增流程字段引用关系 +export function addRef(data) { + return request({ + url: '/flowable/ref', + method: 'post', + data: data + }) +} + +// 修改流程字段引用关系 +export function updateRef(data) { + return request({ + url: '/flowable/ref', + method: 'put', + data: data + }) +} + +// 删除流程字段引用关系 +export function delRef(id) { + return request({ + url: '/flowable/ref/' + id, + method: 'delete' + }) +} +//组合查询流程字段引用关系列表 +export function listCombination(query) { + return request({ + url: '/flowable/ref/listCombination', + method: 'get', + params: query + }) +} diff --git a/yanzhu-ui-vue3/src/api/flowable/work/process.ts b/yanzhu-ui-vue3/src/api/flowable/work/process.ts deleted file mode 100644 index 117d718a..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/work/process.ts +++ /dev/null @@ -1,108 +0,0 @@ -import request from '@/utils/request'; -import { AxiosPromise } from 'axios'; -import { ProcessQuery, ProcessVO } from '@/api/flowable/work/types'; - -// 查询流程列表 -export function listProcess(query?: ProcessQuery): AxiosPromise { - return request({ - url: '/flowable/process/list', - method: 'get', - params: query - }); -} - -// 查询流程列表 -export function getProcessForm(query?: any) { - return request({ - url: '/flowable/process/getProcessForm', - method: 'get', - params: query - }); -} - -// 部署流程实例 -export function startProcess(processDefId?: string, data?: string) { - return request({ - url: '/flowable/process/start/' + processDefId, - method: 'post', - data: data - }); -} - -// 删除流程实例 -export function delProcess(ids?: string) { - return request({ - url: '/flowable/process/instance/' + ids, - method: 'delete' - }); -} - -// 获取流程图 -export function getBpmnXml(processDefId?: string) { - return request({ - url: '/flowable/process/bpmnXml/' + processDefId, - method: 'get' - }); -} - -export function detailProcess(query?: any) { - return request({ - url: '/flowable/process/detail', - method: 'get', - params: query - }); -} - -// 我的发起的流程 -export function listOwnProcess(query?: any) { - return request({ - url: '/flowable/process/ownList', - method: 'get', - params: query - }); -} - -// 我待办的流程 -export function listTodoProcess(query?: any) { - return request({ - url: '/flowable/process/todoList', - method: 'get', - params: query - }); -} - -// 我待签的流程 -export function listClaimProcess(query?: any) { - return request({ - url: '/flowable/process/claimList', - method: 'get', - params: query - }); -} - -// 我已办的流程 -export function listFinishedProcess(query?: any) { - return request({ - url: '/flowable/process/finishedList', - method: 'get', - params: query - }); -} - -// 查询流程抄送列表 -export function listCopyProcess(query?: any) { - return request({ - url: '/flowable/process/copyList', - method: 'get', - params: query - }); -} - -// 取消申请 -export function stopProcess(data?: any) { - return request({ - url: '/flowable/task/stopProcess', - method: 'post', - data: data - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/work/task.ts b/yanzhu-ui-vue3/src/api/flowable/work/task.ts deleted file mode 100644 index 58c126ec..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/work/task.ts +++ /dev/null @@ -1,73 +0,0 @@ -import request from '@/utils/request'; - -// 完成任务 -export function complete(data?: any) { - return request({ - url: '/flowable/task/complete', - method: 'post', - data: data - }); -} - -// 委派任务 -export function delegate(data?: any) { - return request({ - url: '/flowable/task/delegate', - method: 'post', - data: data - }); -} - -// 转办任务 -export function transfer(data?: any) { - return request({ - url: '/flowable/task/transfer', - method: 'post', - data: data - }); -} - -// 退回任务 -export function returnTask(data?: any) { - return request({ - url: '/flowable/task/return', - method: 'post', - data: data - }); -} - -// 拒绝任务 -export function rejectTask(data?: any) { - return request({ - url: '/flowable/task/reject', - method: 'post', - data: data - }); -} - -// 签收任务 -export function claimTask(data?: any) { - return request({ - url: '/flowable/task/claim', - method: 'post', - data: data - }); -} - -// 可退回任务列表 -export function returnList(data?: any) { - return request({ - url: '/flowable/task/returnList', - method: 'post', - data: data - }); -} - -// 撤回任务 -export function revokeProcess(data?: any) { - return request({ - url: '/flowable/task/revokeProcess', - method: 'post', - data: data - }); -} diff --git a/yanzhu-ui-vue3/src/api/flowable/work/types.ts b/yanzhu-ui-vue3/src/api/flowable/work/types.ts deleted file mode 100644 index a073856c..00000000 --- a/yanzhu-ui-vue3/src/api/flowable/work/types.ts +++ /dev/null @@ -1,32 +0,0 @@ -export interface ProcessVO extends BaseEntity { - category: string; - definitionId: string; - deploymentId: string; - deploymentTime: string; - formId: string | number; - formName: string; - processKey: string; - processName: string; - taskId: string; - suspended: boolean; - version: number; - procInsId?: string; -} - -export interface ProcessQuery extends PageQuery { - processKey?: string; - processName?: string; - category?: string; - state?: string; -} - -export interface TaskForm { - comment: string; - procInsId: string; - taskId: string; - userId: string; - copyUserIds: string; - nextUserIds: string; - vars: string; - targetKey: string; -} diff --git a/yanzhu-ui-vue3/src/components/bpmn/PropertyPanel.vue b/yanzhu-ui-vue3/src/components/bpmn/PropertyPanel.vue new file mode 100644 index 00000000..7614c62c --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/PropertyPanel.vue @@ -0,0 +1,304 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/context-pad/CustomContextPadProvider.ts b/yanzhu-ui-vue3/src/components/bpmn/context-pad/CustomContextPadProvider.ts new file mode 100644 index 00000000..dc407c63 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/context-pad/CustomContextPadProvider.ts @@ -0,0 +1,512 @@ +import ContextPadProvider, { + Connect, + ContextPad, + ContextPadConfig, + Create, + ElementFactory, + Modeling, + PopupMenu, + Rules, + Injector, + Translate, + EventBus, + ContextPadEntries, + Element, +} from "bpmn-js/lib/features/context-pad/ContextPadProvider"; +import Canvas from "diagram-js/lib/core/Canvas"; +import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil"; +import { isEventSubProcess, isExpanded } from "bpmn-js/lib/util/DiUtil"; +import { getChildLanes } from "bpmn-js/lib/features/modeling/util/LaneUtil"; +import { is } from "bpmn-js/lib/util/ModelUtil"; +import { + assign, + forEach, + isArray +} from 'min-dash'; +import { ContextPadTarget } from "diagram-js/lib/features/context-pad/ContextPad"; +import AutoPlace from "bpmn-js/lib/features/auto-place/BpmnAutoPlace"; +import { Shape } from "bpmn-js/lib/model/Types"; + +export default class CustomContextPadProvider extends ContextPadProvider { + + static $inject: string[] = [ + 'config.contextPad', + 'injector', + 'eventBus', + 'contextPad', + 'modeling', + 'elementFactory', + 'connect', + 'create', + 'popupMenu', + 'canvas', + 'rules', + 'translate' + ] + + protected _contextPad: ContextPad; + protected _modeling: Modeling; + protected _elementFactory: ElementFactory; + protected _connect: Connect; + protected _create; + protected _popupMenu; + protected _canvas; + protected _rules; + protected _translate; + protected _autoPlace; + + constructor(config: ContextPadConfig, injector: Injector, eventBus: EventBus, contextPad: ContextPad, modeling: Modeling, elementFactory: ElementFactory, connect: Connect, create: Create, popupMenu: PopupMenu, canvas: Canvas, rules: Rules, translate: Translate) { + super(config, injector, eventBus, contextPad, modeling, elementFactory, connect, create, popupMenu, canvas, rules, translate) + this._contextPad = contextPad + this._modeling = modeling + this._elementFactory = elementFactory + this._connect = connect + this._create = create + this._popupMenu = popupMenu + this._canvas = canvas + this._rules = rules + this._translate = translate + if (config?.autoPlace !== false) { + this._autoPlace = injector.get('autoPlace', false); + } + } + + public getContextPadEntries(element: Element): ContextPadEntries { + + const contextPad = this._contextPad + const modeling = this._modeling + const elementFactory = this._elementFactory + const connect = this._connect + const create = this._create + const popupMenu = this._popupMenu + const canvas = this._canvas + const rules = this._rules + const translate = this._translate + const autoPlace = this._autoPlace + + + const actions = {}; + + if (element.type === 'label') { + return actions; + } + + const businessObject = element.businessObject; + + function startConnect(event: MouseEvent | TouchEvent, start: Element) { + connect.start(event, element); + } + + function removeElement(e: any) { + modeling.removeElements([ element ]); + } + + function getReplaceMenuPosition(element: ContextPadTarget) { + + const Y_OFFSET = 5; + + const diagramContainer = canvas.getContainer() + const pad = contextPad.getPad(element).html as HTMLElement; + + + const diagramRect = diagramContainer.getBoundingClientRect() + const padRect = pad.getBoundingClientRect(); + + const top = padRect.top - diagramRect.top; + const left = padRect.left - diagramRect.left; + + const pos = { + x: left, + y: top + padRect.height + Y_OFFSET + }; + + return pos; + } + + + /** + * Create an append action + * + * @param {string} type + * @param {string} className + * @param {string} [title] + * @param {Object} [options] + * + * @return {Object} descriptor + */ + function appendAction(type: string, className: string, title?: string, options?: object) { + + if (typeof title !== 'string') { + options = title; + title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') }); + } + + function appendStart(event: any, element: any) { + + const shape = elementFactory.createShape(assign({ type: type }, options)); + create.start(event, shape, { + source: element + }); + } + + + const append = autoPlace ? function(event: MouseEvent | TouchEvent, element: Element) { + const shape = elementFactory.createShape(assign({ type: type }, options)); + + // @ts-ignore + autoPlace.append(element, shape); + } : appendStart; + + + return { + group: 'model', + className: className, + title: title, + action: { + dragstart: appendStart, + click: append + } + }; + } + + /** + * Create an append action + * + * @param {string} group + * @param {string} type + * @param {string} className + * @param {string} [title] + * @param {Object} [options] + * + * @return {Object} descriptor + */ + function appendGroupAction(group: string, type: string, className: string, title?: string, options?: object) { + + if (typeof title !== 'string') { + options = title; + title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') }); + } + + function appendStart(event: TouchEvent | MouseEvent, element: Element) { + + const shape = elementFactory.createShape(assign({ type: type }, options)); + create.start(event, shape, { + source: element + }); + } + + + const append = autoPlace ? function(event: TouchEvent | MouseEvent, element: Element) { + const shape = elementFactory.createShape(assign({ type: type }, options)); + + // @ts-ignore + autoPlace.append(element, shape); + } : appendStart; + + + return { + group, + className: className, + title: title, + action: { + dragstart: appendStart, + click: append + } + }; + } + + + function splitLaneHandler(count: number) { + + return function(event: TouchEvent | MouseEvent, element: Shape) { + + // actual split + modeling.splitLane(element, count); + + // refresh context pad after split to + // get rid of split icons + contextPad.open(element, true); + }; + } + + + if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) { + + const childLanes = getChildLanes(element as Shape); + + assign(actions, { + 'lane-insert-above': { + group: 'lane-insert-above', + className: 'bpmn-icon-lane-insert-above', + title: translate('Add Lane above'), + action: { + click: function(event: TouchEvent | MouseEvent, element: Shape) { + modeling.addLane(element, 'top'); + } + } + } + }); + + if (childLanes.length < 2) { + + if (element.height >= 120) { + assign(actions, { + 'lane-divide-two': { + group: 'lane-divide', + className: 'bpmn-icon-lane-divide-two', + title: translate('Divide into two Lanes'), + action: { + click: splitLaneHandler(2) + } + } + }); + } + + if (element.height >= 180) { + assign(actions, { + 'lane-divide-three': { + group: 'lane-divide', + className: 'bpmn-icon-lane-divide-three', + title: translate('Divide into three Lanes'), + action: { + click: splitLaneHandler(3) + } + } + }); + } + } + + assign(actions, { + 'lane-insert-below': { + group: 'lane-insert-below', + className: 'bpmn-icon-lane-insert-below', + title: translate('Add Lane below'), + action: { + click: function(event: TouchEvent | MouseEvent, element: Shape) { + modeling.addLane(element, 'bottom'); + } + } + } + }); + + } + + if (is(businessObject, 'bpmn:FlowNode')) { + + if (is(businessObject, 'bpmn:EventBasedGateway')) { + + assign(actions, { + 'append.receive-task': appendAction( + 'bpmn:ReceiveTask', + 'bpmn-icon-receive-task', + translate('Append ReceiveTask') + ), + 'append.message-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-message', + translate('Append MessageIntermediateCatchEvent'), + { eventDefinitionType: 'bpmn:MessageEventDefinition' } + ), + 'append.timer-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-timer', + translate('Append TimerIntermediateCatchEvent'), + { eventDefinitionType: 'bpmn:TimerEventDefinition' } + ), + 'append.condition-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-condition', + translate('Append ConditionIntermediateCatchEvent'), + { eventDefinitionType: 'bpmn:ConditionalEventDefinition' } + ), + 'append.signal-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-signal', + translate('Append SignalIntermediateCatchEvent'), + { eventDefinitionType: 'bpmn:SignalEventDefinition' } + ) + }); + } else + + if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) { + + assign(actions, { + 'append.compensation-activity': + appendAction( + 'bpmn:Task', + 'bpmn-icon-task', + translate('Append compensation activity'), + { + isForCompensation: true + } + ) + }); + } else + + if (!is(businessObject, 'bpmn:EndEvent') && + !businessObject.isForCompensation && + !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') && + !isEventSubProcess(businessObject)) { + + assign(actions, { + 'append.end-event': appendAction( + 'bpmn:EndEvent', + 'bpmn-icon-end-event-none', + translate('Append EndEvent') + ), + 'append.gateway': appendAction( + 'bpmn:ExclusiveGateway', + 'bpmn-icon-gateway-xor', + translate('Append Gateway') + ), + 'append.append-task': appendAction( + 'bpmn:UserTask', + 'bpmn-icon-user-task', + translate('Append UserTask') + ), + // 'append.intermediate-event': appendAction( + // 'bpmn:IntermediateThrowEvent', + // 'bpmn-icon-intermediate-event-none', + // translate('Append Intermediate/Boundary Event') + // ) + }); + } + } + + if (!popupMenu.isEmpty(element, 'bpmn-replace')) { + + // Replace menu entry + assign(actions, { + 'replace': { + group: 'edit', + className: 'bpmn-icon-screw-wrench', + title: translate('Change type'), + action: { + click: function(event: MouseEvent, element: Shape) { + + const position = assign(getReplaceMenuPosition(element), { + cursor: { x: event.x, y: event.y } + }); + + popupMenu.open(element, 'bpmn-replace', position); + } + } + } + }); + } + + if ( + isAny(businessObject, [ + 'bpmn:FlowNode', + 'bpmn:InteractionNode', + 'bpmn:DataObjectReference', + 'bpmn:DataStoreReference', + ]) + ) { + assign(actions, { + 'append.text-annotation': appendGroupAction( + 'connect', + 'bpmn:TextAnnotation', + 'bpmn-icon-text-annotation' + ), + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate( + 'Connect using ' + + (businessObject.isForCompensation + ? '' + : 'Sequence/MessageFlow or ') + + 'Association' + ), + action: { + click: startConnect, + dragstart: startConnect, + }, + }, + }); + } + + if (is(businessObject, 'bpmn:TextAnnotation')) { + assign(actions, { + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate('Connect using Association'), + action: { + click: startConnect, + dragstart: startConnect, + }, + }, + }); + } + + if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) { + assign(actions, { + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate('Connect using DataInputAssociation'), + action: { + click: startConnect, + dragstart: startConnect + } + } + }); + } + + if (is(businessObject, 'bpmn:Group')) { + assign(actions, { + 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation') + }); + } + + // delete element entry, only show if allowed by rules + let deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] }); + + if (isArray(deleteAllowed)) { + + // was the element returned as a deletion candidate? + deleteAllowed = deleteAllowed[0] === element; + } + + if (deleteAllowed) { + assign(actions, { + 'delete': { + group: 'edit', + className: 'bpmn-icon-trash', + title: translate('Remove'), + action: { + click: removeElement + } + } + }); + } + + return actions; + } + +} + + +/** + * @param {ModdleElement} businessObject + * @param {string} type + * @param {string} eventDefinitionType + * + * @return {boolean} + */ +function isEventType(businessObject: any, type: string, eventDefinitionType: string) { + + const isType = businessObject.$instanceOf(type); + let isDefinition = false; + + const definitions = businessObject.eventDefinitions || []; + forEach(definitions, function(def: any) { + if (def.$type === eventDefinitionType) { + isDefinition = true; + } + }); + + return isType && isDefinition; +} diff --git a/yanzhu-ui-vue3/src/components/bpmn/extension/FlowableExtension.ts b/yanzhu-ui-vue3/src/components/bpmn/extension/FlowableExtension.ts new file mode 100644 index 00000000..1b24b8d6 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/extension/FlowableExtension.ts @@ -0,0 +1,10 @@ + +function FlowableModdleExtension(eventBus) { + +} + +FlowableModdleExtension.$inject= ['eventBus'] + +FlowableModdleExtension.canCloneProperty = function (newElement, propDescriptor) { + +} \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/ApproverConfig.vue b/yanzhu-ui-vue3/src/components/bpmn/form/ApproverConfig.vue new file mode 100644 index 00000000..8dfde715 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/ApproverConfig.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/BasicSetting.vue b/yanzhu-ui-vue3/src/components/bpmn/form/BasicSetting.vue new file mode 100644 index 00000000..f35c8a2c --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/BasicSetting.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListener.vue b/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListener.vue new file mode 100644 index 00000000..d3c7fdfa --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListener.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListenerForm.vue b/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListenerForm.vue new file mode 100644 index 00000000..ed654fc9 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/ExecutionListenerForm.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/ListenerFieldInject.vue b/yanzhu-ui-vue3/src/components/bpmn/form/ListenerFieldInject.vue new file mode 100644 index 00000000..87bf6bd3 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/ListenerFieldInject.vue @@ -0,0 +1,277 @@ + + + \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/PageConfig.vue b/yanzhu-ui-vue3/src/components/bpmn/form/PageConfig.vue new file mode 100644 index 00000000..2ad535ea --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/PageConfig.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/SeqFlowConfig.vue b/yanzhu-ui-vue3/src/components/bpmn/form/SeqFlowConfig.vue new file mode 100644 index 00000000..4cb91cec --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/SeqFlowConfig.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/TaskListener.vue b/yanzhu-ui-vue3/src/components/bpmn/form/TaskListener.vue new file mode 100644 index 00000000..799197a0 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/TaskListener.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/TaskListenerForm.vue b/yanzhu-ui-vue3/src/components/bpmn/form/TaskListenerForm.vue new file mode 100644 index 00000000..a6d568a6 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/TaskListenerForm.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/components/bpmn/form/util.ts b/yanzhu-ui-vue3/src/components/bpmn/form/util.ts new file mode 100644 index 00000000..05b93694 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/form/util.ts @@ -0,0 +1,35 @@ +import BpmnModeler from "bpmn-js/lib/Modeler"; +import { ShallowRef, unref } from "vue"; +import Modeling from "bpmn-js/lib/features/modeling/Modeling"; +import ElementRegistry from 'diagram-js/lib/core/ElementRegistry' + +export class BpmnUtil { + private bpmnModeler: ShallowRef; + + constructor(bpmnModeler: ShallowRef) { + this.bpmnModeler = bpmnModeler; + } + + public isMultiInstanceUserTask(element: any): boolean { + const bo = unref(element)?.businessObject + return !!bo?.loopCharacteristics + } + + public updateProperty(element: any, properties: Record) { + const modeling = unref(this.bpmnModeler)?.get("modeling") + modeling?.updateProperties(unref(element), properties) + } + + public updateModelingProperty(element: any, attrInstance: any, properties: Record) { + const modeling = this.bpmnModeler.value?.get("modeling") + modeling?.updateModdleProperties(unref(element), attrInstance, properties) + } + + public getProcessKey(): string { + const registry = unref(this.bpmnModeler)?.get("elementRegistry") + const root = registry?.find(it => it.type === 'bpmn:Process') + return root?.id || '' + } + +} + diff --git a/yanzhu-ui-vue3/src/components/bpmn/moddle/CustomModdle.ts b/yanzhu-ui-vue3/src/components/bpmn/moddle/CustomModdle.ts new file mode 100644 index 00000000..4fb305d8 --- /dev/null +++ b/yanzhu-ui-vue3/src/components/bpmn/moddle/CustomModdle.ts @@ -0,0 +1,6 @@ +import CustomContextPadProvider from "../context-pad/CustomContextPadProvider"; + +export default { + __init__: ['customContextPad'], + customContextPad: ['type', CustomContextPadProvider] +} \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/flowable/category/index.vue b/yanzhu-ui-vue3/src/views/flowable/category/index.vue new file mode 100644 index 00000000..f1848e11 --- /dev/null +++ b/yanzhu-ui-vue3/src/views/flowable/category/index.vue @@ -0,0 +1,251 @@ + + + diff --git a/yanzhu-ui-vue3/src/views/flowable/def/index.vue b/yanzhu-ui-vue3/src/views/flowable/def/index.vue new file mode 100644 index 00000000..ed1f630a --- /dev/null +++ b/yanzhu-ui-vue3/src/views/flowable/def/index.vue @@ -0,0 +1,305 @@ + + + diff --git a/yanzhu-ui-vue3/src/views/flowable/deploy/index.vue b/yanzhu-ui-vue3/src/views/flowable/deploy/index.vue index 1bbac831..c044828e 100644 --- a/yanzhu-ui-vue3/src/views/flowable/deploy/index.vue +++ b/yanzhu-ui-vue3/src/views/flowable/deploy/index.vue @@ -1,94 +1,151 @@ diff --git a/yanzhu-ui-vue3/src/views/flowable/form/index.vue b/yanzhu-ui-vue3/src/views/flowable/form/index.vue deleted file mode 100644 index 7475f39c..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/form/index.vue +++ /dev/null @@ -1,258 +0,0 @@ - - - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/listener/index.vue b/yanzhu-ui-vue3/src/views/flowable/listener/index.vue deleted file mode 100644 index 36f17015..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/listener/index.vue +++ /dev/null @@ -1,480 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/model/fieldmaintenance.vue b/yanzhu-ui-vue3/src/views/flowable/model/fieldmaintenance.vue new file mode 100644 index 00000000..507c9afb --- /dev/null +++ b/yanzhu-ui-vue3/src/views/flowable/model/fieldmaintenance.vue @@ -0,0 +1,281 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/views/flowable/model/index.vue b/yanzhu-ui-vue3/src/views/flowable/model/index.vue index d37efe27..667d8629 100644 --- a/yanzhu-ui-vue3/src/views/flowable/model/index.vue +++ b/yanzhu-ui-vue3/src/views/flowable/model/index.vue @@ -1,110 +1,173 @@ - - diff --git a/yanzhu-ui-vue3/src/views/flowable/ref/index.vue b/yanzhu-ui-vue3/src/views/flowable/ref/index.vue new file mode 100644 index 00000000..efdf5492 --- /dev/null +++ b/yanzhu-ui-vue3/src/views/flowable/ref/index.vue @@ -0,0 +1,280 @@ + + + diff --git a/yanzhu-ui-vue3/src/views/flowable/work/claim.vue b/yanzhu-ui-vue3/src/views/flowable/work/claim.vue deleted file mode 100644 index a2afbdd8..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/claim.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/copy.vue b/yanzhu-ui-vue3/src/views/flowable/work/copy.vue deleted file mode 100644 index d63f4893..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/copy.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/detail.vue b/yanzhu-ui-vue3/src/views/flowable/work/detail.vue deleted file mode 100644 index 144ab547..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/detail.vue +++ /dev/null @@ -1,544 +0,0 @@ - - - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/finished.vue b/yanzhu-ui-vue3/src/views/flowable/work/finished.vue deleted file mode 100644 index feaf2db1..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/finished.vue +++ /dev/null @@ -1,152 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/index.vue b/yanzhu-ui-vue3/src/views/flowable/work/index.vue deleted file mode 100644 index f1b97212..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/index.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/flowable/work/initiate.vue b/yanzhu-ui-vue3/src/views/flowable/work/initiate.vue deleted file mode 100644 index 4ced174d..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/initiate.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/own.vue b/yanzhu-ui-vue3/src/views/flowable/work/own.vue deleted file mode 100644 index d33f3e30..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/own.vue +++ /dev/null @@ -1,202 +0,0 @@ - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/start.vue b/yanzhu-ui-vue3/src/views/flowable/work/start.vue deleted file mode 100644 index bd004fb1..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/start.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - diff --git a/yanzhu-ui-vue3/src/views/flowable/work/todo.vue b/yanzhu-ui-vue3/src/views/flowable/work/todo.vue deleted file mode 100644 index ba21e3a6..00000000 --- a/yanzhu-ui-vue3/src/views/flowable/work/todo.vue +++ /dev/null @@ -1,146 +0,0 @@ - - -