!491 合并flowable工作流功能
* update 优化 表字段映射于数据库保持一致
* remove 删除无用代码
* remove 删除无用代码
* fix 修复 实体类未实现序列化接口问题
* update 优化 表字段映射于数据库保持一致
* update 优化 统一sql名称
* fix 修复 接口名称编写错误
* merge dev
* update 调整sql 添加抄送查询
* update 调整菜单
* update 调整sql脚本
* update 调整任务查询 添加抄送
* add 抄送任务
* remove 删除错误代码
* remove 删除无用代码
* update 调整作废,撤销等校验
* fix 修复 流程作废异常问题
* update 优化 flowable 配置到主yml文件
* update 调整 数据排序规则
* fix 修复 数据库无法自动执行建表sql问题
* update 优化 工作流id生成器保持全局统一
* add 添加附件任务查询
* add 添加审批附件上传
* update 调整bpmn文件修复驳回失败问题
* update 调整会签类型转换异常
* add 添加获取运行中流程信息,流程扩展信息,补充注解,删除无用代码
* update 调整流程转换,流程启动,上传新bpmn文件
* update 调整方法
* update 调整模型修改
* fix 修复 user与dept xml 编写错误
* remove 移除原生ui接口,增加新ui接口
* update 优化 下拉选接口数据权限
* update 优化 删除观测用日志记录
* reset 还原修复命名
* update 修复命名
* add 新增 用户、部门、角色、岗位 下拉选接口与代码实现优化
* update 调整任务办理异步时流程状态错误问题
* add 工作流用户查询
* remove 删除无用注释 添加非空校验
* update 优化获取审批记录
* update 调整事件办理
* update 调整工作流选人接口
* Merge branch 'dev' into future/flowable
* update 办理调整执行顺序
* update 调整流程办理优化撤销,驳回,草稿等动作
* fix 修复子流程中设置发起人变量错误问题
* Merge branch 'dev' into future/flowable
* update 调整流程执行非空校验,调整任务节点执行
* update 调整注释
* add 添加自定义任务监听策略
* !469 update-完善对模型key校验逻辑
* update-修改常量命名
* update-完善对模型key校验逻辑
* add 添加sql脚本
* Merge branch 'dev' into future/flowable
* Merge branch 'dev' into future/flowable
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* add 添加SQLserve脚本
* add 添加流程监听示例
* update 调整获取审批记录
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* update 调整请假查询 修改流程定义查看xml
* update 调整流程实例删除
* update 调整sql
* add 添加sql脚本
* update 调整sql
* update 调整请假申请,调整菜单sql
* update 调整设计器保存发起人变量,修改菜单sql
* update 依赖调整
* update 调整flw依赖
* update 升级7.0后移除画图mule类型
* update 调整flw依赖
* update 移动模型设计器翻译方法
* update 调整flw依赖
* fix 修复 误删依赖
* Merge remote-tracking branch 'origin/dev' into future/flowable
* remove 移除动态表单
* Merge remote-tracking branch 'origin/dev' into future/flowable
* update 优化代码结构
* update 调整请假申请包结构
* Merge branch 'dev' into future/flowable
* add 添加文件,调整分类查询
* Merge branch 'dev' into future/flowable
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* add bpmn文件 调整流程办理
* Merge branch 'dev' into future/flowable
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* Merge branch '5.X' into future/flowable
* update 调整消息发送
* update 调整名称
* update 调整流程实例查询
* add 添加任务催办,任务改派
* fix 修复 用户注册接口校验用户名不区分租户问题
* update 还原待办任务,添加待办消息发送
* update 优化任务待办,排除非待办任务
* Merge branch '5.X' into future/flowable
* update 修改流程启动后重新覆盖流程变量,删除并行流程驳回,撤销后,垃圾数据
* update 升级flowable7.0,添加业务单据删除流程信息
* Merge branch '5.X' into future/flowable
* add 添加动态表单提交流程
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* add 添加动态表单单据
* update 升级flowable到7.0.0.M2,调整工作流提交校验,调整工作流工具类
* add 新增流程定义与表单关联
* update 调整修改流程分类后更新流程分类编码
* update 调整流程定义图片预览
* update 调整人员查询
* update 优化作废,撤销等备注
* Merge branch '5.X' into future/flowable
* Merge branch 'future/flowable' of https://gitee.com/dromara/RuoYi-Vue-…
* fix 解决设计器选择设置流程发起人设置变量有问题
* add 添加引擎调度监听
* merge 合并5.x分支代码
* remove 移除flow-ui
* update 调整日志打印
* add 添加按照业务id删除流程记录
* add 添加请假申请示例,添加流程定义文件部署,添加sql菜单
* update 移除流程表单 formConfig 属性,表单配置信息都放一起便于使用。
* update 调整菜单
* add 添加mysql工作流菜单
* update 调整获取加签人,审判记录
* update 调整流程作废
* add 添加任务完成状态
* add 添加加签,减签人员接口
* update 调整任务驳回后设置审批人
* add 添加驳回申请人
* add 添加查询当前租户所有待办,已办任务
* add 添加会签任务加签减签,添加任务作废理由
* update 调整流程实例,流程定义检索
* update 调整撤销流程申请,当前登录人单据
* add 添加办理人名称翻译
* add 添加流程流程实例,流程定义分类查询
* add 添加模型分类查询
* add 添加流程分类
* add 添加流程表单操作相关接口
* fix 修复修改流程历史流程实例错误问题
* update 调整已办任务排序,添加注释
* update 调整用户,用户组查询
* add 添加获取当前任务参与者,优化任务待办,已办
* add 添加当前登录人单据列表,添加单据状态
* update 补充任务撤销事务
* add 添加撤销流程申请
* update 优化流程实例删除
* fix 修复流程实例查询挂起状态错误
* update 优化流程办理 流程挂起抛出异常
* add 添加业务状态枚举。添加流程启动,审批,终止等状态
* update 优化流程启动
* add 添加流程实例作废,运行中流程实例删除,已完成流程实例删除
* add 添加节点信息
* 调整流程预览
* add 添加审批记录
* 还原代码
* fix 修复模型导出错误
* add 增加委托办理,调整流程启动
* add 添加转办任务
* add 添加任务拾取,任务归还,任务终止,任务委托
* fix 修复任务,流程实例分页模糊查询失效
* add 添加流程实例运行中,已结束分页查询
* add 添加通过流程实例id获取历史流程图,添加flowable配置,调整流程办理
* add 添加流程办理,流程待办,已办分页查询
* 删除无用导入
* 调整流程查询租户id
* add 添加流程启动
* 添加模型人员用户,组查询
* add 添加模型部署模型校验
* 修改模型部署导出校验
* fix 修复模型画图保存时key不回显问题
* add 添加流程定义转换为模型
* 优化模型编辑校验,流程定义删除,流程定义激活挂起等
* add 添加流程定义删除,流程定义挂起激活,流程定义版本迁移
* 调整ObjectNode.put警告
* 删除无用依赖,优化模型修改,导出,部署非空校验
* 删除无用导入
* 添加流程定义分页,查看图片,查看xml
* 添加模型部署,导出模型
* 修改画图账户登录信息
* 添加模型编辑key重复校验,添加租户查询,删除忽略token注解
* 添加模型新增校验
* 添加工作流模型新增,修改,查询,删除
* 【ADD】集成原生Flowable-ui
* 添加workflow模块,添加flowable依赖,yml配置信息
| | |
| | | <maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison> |
| | | <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version> |
| | | <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version> |
| | | |
| | | <!--工使µé
ç½®--> |
| | | <flowable.version>7.0.0</flowable.version> |
| | | </properties> |
| | | |
| | | <profiles> |
| | |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-bom</artifactId> |
| | | <version>${hutool.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-bom</artifactId> |
| | | <version>${flowable.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | |
| | | <version>${revision}</version> |
| | | </dependency> |
| | | |
| | | <!-- 工使µæ¨¡å --> |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-workflow</artifactId> |
| | | <version>${revision}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | |
| | | <artifactId>ruoyi-demo</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 工使µæ¨¡å --> |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-workflow</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>de.codecentric</groupId> |
| | | <artifactId>spring-boot-admin-starter-client</artifactId> |
| | |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # jdbc ææåæ°é
ç½®åè https://lionli.blog.csdn.net/article/details/122018562 |
| | | # rewriteBatchedStatements=true æ¹å¤çä¼å 大å¹
æåæ¹éæå
¥æ´æ°å 餿§è½(å¯¹æ°æ®åºææ§è½æè ä½¿ç¨æ¹éæä½åºèèæ§è½é®é¢) |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: root |
| | | # ä»åºæ°æ®æº |
| | |
| | | lazy: true |
| | | type: ${spring.datasource.type} |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: |
| | | password: |
| | | # oracle: |
| | |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # jdbc ææåæ°é
ç½®åè https://lionli.blog.csdn.net/article/details/122018562 |
| | | # rewriteBatchedStatements=true æ¹å¤çä¼å 大å¹
æåæ¹éæå
¥æ´æ°å 餿§è½(å¯¹æ°æ®åºææ§è½æè ä½¿ç¨æ¹éæä½åºèèæ§è½é®é¢) |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: root |
| | | # ä»åºæ°æ®æº |
| | |
| | | lazy: true |
| | | type: ${spring.datasource.type} |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: |
| | | password: |
| | | # oracle: |
| | |
| | | path: /resource/websocket |
| | | # è®¾ç½®è®¿é®æºå°å |
| | | allowedOrigins: '*' |
| | | |
| | | --- #flowableé
ç½® |
| | | flowable: |
| | | async-executor-activate: false #å
³é宿¶ä»»å¡JOB |
| | | # å°databaseSchemaUpdate设置为trueãå½Flowableåç°åºä¸æ°æ®åºè¡¨ç»æä¸ä¸è´æ¶ï¼ä¼èªå¨å°æ°æ®åºè¡¨ç»æåçº§è³æ°çæ¬ã |
| | | database-schema-update: true |
| | | activity-font-name: å®ä½ |
| | | label-font-name: å®ä½ |
| | | annotation-font-name: å®ä½ |
| | | # å
³éå个模åçæè¡¨ï¼ç®ååªä½¿ç¨å·¥ä½æµåºç¡è¡¨ |
| | | idm: |
| | | enabled: false |
| | | cmmn: |
| | | enabled: false |
| | | dmn: |
| | | enabled: false |
| | | app: |
| | | enabled: false |
| | |
| | | <module>ruoyi-generator</module> |
| | | <module>ruoyi-job</module> |
| | | <module>ruoyi-system</module> |
| | | <module>ruoyi-workflow</module> |
| | | </modules> |
| | | |
| | | <artifactId>ruoyi-modules</artifactId> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-modules</artifactId> |
| | | <version>${revision}</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-workflow</artifactId> |
| | | |
| | | <description> |
| | | 工使µæ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!--å¼å
¥flowableä¾èµ--> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-boot-autoconfigure</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-security</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-configurator</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- ç»å¶flowableæµç¨å¾ --> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-image-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- flowable json è½¬æ¢ --> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-json-converter</artifactId> |
| | | <version>6.8.0</version> |
| | | </dependency> |
| | | |
| | | <!-- svg转pngå¾çå·¥å
·--> |
| | | <dependency> |
| | | <groupId>org.apache.xmlgraphics</groupId> |
| | | <artifactId>batik-all</artifactId> |
| | | <version>1.10</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>xalan</groupId> |
| | | <artifactId>xalan</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!--ç³»ç»æ¨¡å--> |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-websocket</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-mail</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-sms</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.annotation; |
| | | |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * æµç¨ä»»å¡ç嬿³¨è§£ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | @Target({ElementType.TYPE}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | @Inherited |
| | | public @interface FlowListenerAnnotation { |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | */ |
| | | String processDefinitionKey(); |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | String taskDefId() default ""; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å页忰 |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class PageEntity { |
| | | |
| | | /** |
| | | * å½å页ç |
| | | */ |
| | | private Integer pageNum = 0; |
| | | |
| | | /** |
| | | * 页容é |
| | | */ |
| | | private Integer pageSize = 10; |
| | | |
| | | public Integer getPageNum() { |
| | | return (pageNum - 1) * pageSize; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.constant; |
| | | |
| | | |
| | | /** |
| | | * 工使µå¸¸é |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface FlowConstant { |
| | | |
| | | String MESSAGE_CURRENT_TASK_IS_NULL = "å½åä»»å¡ä¸åå¨æä½ ä¸æ¯ä»»å¡åç人ï¼"; |
| | | |
| | | String MESSAGE_SUSPENDED = "å½åä»»å¡å·²æèµ·ä¸å¯å®¡æ¹ï¼"; |
| | | |
| | | /** |
| | | * è¿çº¿ |
| | | */ |
| | | String SEQUENCE_FLOW = "sequenceFlow"; |
| | | |
| | | /** |
| | | * å¹¶è¡ç½å
³ |
| | | */ |
| | | String PARALLEL_GATEWAY = "parallelGateway"; |
| | | |
| | | /** |
| | | * æå®ç½å
³ |
| | | */ |
| | | String EXCLUSIVE_GATEWAY = "exclusiveGateway"; |
| | | |
| | | /** |
| | | * å
å«ç½å
³ |
| | | */ |
| | | String INCLUSIVE_GATEWAY = "inclusiveGateway"; |
| | | |
| | | /** |
| | | * ç»æèç¹ |
| | | */ |
| | | String END_EVENT = "endEvent"; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å§æ´¾æ è¯ |
| | | */ |
| | | String PENDING = "PENDING"; |
| | | |
| | | /** |
| | | * åé人æ è¯ |
| | | */ |
| | | String CANDIDATE = "candidate"; |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡æ»æ° |
| | | */ |
| | | String NUMBER_OF_INSTANCES = "nrOfInstances"; |
| | | |
| | | /** |
| | | * æ£å¨æ§è¡çä¼ç¾æ»æ° |
| | | */ |
| | | String NUMBER_OF_ACTIVE_INSTANCES = "nrOfActiveInstances"; |
| | | |
| | | /** |
| | | * 已宿çä¼ç¾ä»»å¡æ»æ° |
| | | */ |
| | | String NUMBER_OF_COMPLETED_INSTANCES = "nrOfCompletedInstances"; |
| | | |
| | | /** |
| | | * 循ç¯çç´¢å¼å¼ï¼å¯ä»¥ä½¿ç¨elementIndexVariable屿§ä¿®æ¹loopCounterçåéå |
| | | */ |
| | | String LOOP_COUNTER = "loopCounter"; |
| | | |
| | | String ZIP = "ZIP"; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾å¯¹è±¡ |
| | | */ |
| | | String PROCESS_INSTANCE_VO = "processInstanceVo"; |
| | | |
| | | /** |
| | | * æµç¨å起人 |
| | | */ |
| | | String INITIATOR = "initiator"; |
| | | |
| | | /** |
| | | * å¼å¯è·³è¿è¡¨è¾¾å¼åé |
| | | */ |
| | | String FLOWABLE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED"; |
| | | |
| | | /** |
| | | * æ¨¡åæ è¯keyå½åè§èæ£åè¡¨è¾¾å¼ |
| | | */ |
| | | String MODEL_KEY_PATTERN = "^[a-zA-Z][a-zA-Z0-9_]{0,254}$"; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.enums; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * ä¸å¡ç¶ææä¸¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum BusinessStatusEnum { |
| | | /** |
| | | * å·²æ¤é |
| | | */ |
| | | CANCEL("cancel", "å·²æ¤é"), |
| | | /** |
| | | * è稿 |
| | | */ |
| | | DRAFT("draft", "è稿"), |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | */ |
| | | WAITING("waiting", "å¾
å®¡æ ¸"), |
| | | /** |
| | | * 已宿 |
| | | */ |
| | | FINISH("finish", "已宿"), |
| | | /** |
| | | * å·²ä½åº |
| | | */ |
| | | INVALID("invalid", "å·²ä½åº"), |
| | | /** |
| | | * å·²éå |
| | | */ |
| | | BACK("back", "å·²éå"), |
| | | /** |
| | | * å·²ç»æ¢ |
| | | */ |
| | | TERMINATION("termination", "å·²ç»æ¢"); |
| | | |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | private final String status; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private final String desc; |
| | | |
| | | /** |
| | | * è·åä¸å¡ç¶æ |
| | | * |
| | | * @param status ç¶æ |
| | | */ |
| | | public static String findByStatus(String status) { |
| | | if (StringUtils.isBlank(status)) { |
| | | return StrUtil.EMPTY; |
| | | } |
| | | return Arrays.stream(BusinessStatusEnum.values()) |
| | | .filter(statusEnum -> statusEnum.getStatus().equals(status)) |
| | | .findFirst() |
| | | .map(BusinessStatusEnum::getDesc) |
| | | .orElse(StrUtil.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * å¯å¨æµç¨æ ¡éª |
| | | * |
| | | * @param status ç¶æ |
| | | */ |
| | | public static void checkStartStatus(String status) { |
| | | if (WAITING.getStatus().equals(status)) { |
| | | throw new ServiceException("è¯¥åæ®å·²æäº¤è¿ç³è¯·,æ£å¨å®¡æ¹ä¸ï¼"); |
| | | } else if (FINISH.getStatus().equals(status)) { |
| | | throw new ServiceException("è¯¥åæ®å·²å®æç³è¯·ï¼"); |
| | | } else if (INVALID.getStatus().equals(status)) { |
| | | throw new ServiceException("è¯¥åæ®å·²ä½åºï¼"); |
| | | } else if (TERMINATION.getStatus().equals(status)) { |
| | | throw new ServiceException("è¯¥åæ®å·²ç»æ¢ï¼"); |
| | | } else if (StringUtils.isBlank(status)) { |
| | | throw new ServiceException("æµç¨ç¶æä¸ºç©ºï¼"); |
| | | } |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»åæä¸¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MessageTypeEnum { |
| | | /** |
| | | * ç«å
ä¿¡ |
| | | */ |
| | | SYSTEM_MESSAGE("1", "ç«å
ä¿¡"), |
| | | /** |
| | | * é®ç®± |
| | | */ |
| | | EMAIL_MESSAGE("2", "é®ç®±"), |
| | | /** |
| | | * çä¿¡ |
| | | */ |
| | | SMS_MESSAGE("3", "çä¿¡"); |
| | | |
| | | private final String code; |
| | | |
| | | private final String desc; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.enums; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * ä»»å¡ç¶ææä¸¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TaskStatusEnum { |
| | | /** |
| | | * æ¤é |
| | | */ |
| | | CANCEL("cancel", "æ¤é"), |
| | | /** |
| | | * éè¿ |
| | | */ |
| | | PASS("pass", "éè¿"), |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | */ |
| | | WAITING("waiting", "å¾
å®¡æ ¸"), |
| | | /** |
| | | * ä½åº |
| | | */ |
| | | INVALID("invalid", "ä½åº"), |
| | | /** |
| | | * éå |
| | | */ |
| | | BACK("back", "éå"), |
| | | /** |
| | | * ç»æ¢ |
| | | */ |
| | | TERMINATION("termination", "ç»æ¢"), |
| | | /** |
| | | * 转å |
| | | */ |
| | | TRANSFER("transfer", "转å"), |
| | | /** |
| | | * å§æ |
| | | */ |
| | | PENDING("pending", "å§æ"), |
| | | /** |
| | | * æé |
| | | */ |
| | | COPY("copy", "æé"), |
| | | /** |
| | | * å ç¾ |
| | | */ |
| | | SIGN("sign", "å ç¾"), |
| | | /** |
| | | * åç¾ |
| | | */ |
| | | SIGN_OFF("sign_off", "åç¾"); |
| | | |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | private final String status; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private final String desc; |
| | | |
| | | /** |
| | | * ä»»å¡ä¸å¡ç¶æ |
| | | * |
| | | * @param status ç¶æ |
| | | */ |
| | | public static String findByStatus(String status) { |
| | | if (StringUtils.isBlank(status)) { |
| | | return StrUtil.EMPTY; |
| | | } |
| | | |
| | | return Arrays.stream(TaskStatusEnum.values()) |
| | | .filter(statusEnum -> statusEnum.getStatus().equals(status)) |
| | | .findFirst() |
| | | .map(TaskStatusEnum::getDesc) |
| | | .orElse(StrUtil.EMPTY); |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.ModelBo; |
| | | import org.dromara.workflow.domain.vo.ModelVo; |
| | | import org.dromara.workflow.service.IActModelService; |
| | | import org.flowable.engine.RepositoryService; |
| | | import org.flowable.engine.repository.Model; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 模åç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/model") |
| | | public class ActModelController extends BaseController { |
| | | |
| | | private final RepositoryService repositoryService; |
| | | |
| | | private final IActModelService actModelService; |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param modelBo 模ååæ° |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo<Model> page(ModelBo modelBo) { |
| | | return actModelService.page(modelBo); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨¡å |
| | | * |
| | | * @param modelBo 模å请æ±å¯¹è±¡ |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/save") |
| | | public R<Void> saveNewModel(@Validated(AddGroup.class) @RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.saveNewModel(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param id 模åid |
| | | */ |
| | | @GetMapping("/getInfo/{id}") |
| | | public R<ModelVo> getInfo(@NotBlank(message = "模åidä¸è½ä¸ºç©º") @PathVariable String id) { |
| | | return R.ok(actModelService.getInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡åä¿¡æ¯ |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping(value = "/update") |
| | | public R<Void> update(@RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.update(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾XMl模å |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping(value = "/editModelXml") |
| | | public R<Void> editModel(@Validated(EditGroup.class) @RequestBody ModelBo modelBo) { |
| | | return toAjax(actModelService.editModelXml(modelBo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨æ¨¡å |
| | | * |
| | | * @param ids 模åid |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @DeleteMapping("/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Void> delete(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") @PathVariable String[] ids) { |
| | | Arrays.stream(ids).parallel().forEachOrdered(repositoryService::deleteModel); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 模åé¨ç½² |
| | | * |
| | | * @param id 模åid |
| | | */ |
| | | @Log(title = "模å管ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/modelDeploy/{id}") |
| | | public R<Void> deploy(@NotBlank(message = "模åidä¸è½ä¸ºç©º") @PathVariable("id") String id) { |
| | | return toAjax(actModelService.modelDeploy(id)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ¨¡åzipå缩å
|
| | | * |
| | | * @param modelId 模åid |
| | | * @param response ç¸åº |
| | | */ |
| | | @GetMapping("/export/zip/{modelId}") |
| | | public void exportZip(@NotEmpty(message = "模åidä¸è½ä¸ºç©º") @PathVariable String modelId, |
| | | HttpServletResponse response) { |
| | | actModelService.exportZip(modelId, response); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.ProcessDefinitionBo; |
| | | import org.dromara.workflow.domain.vo.ProcessDefinitionVo; |
| | | import org.dromara.workflow.service.IActProcessDefinitionService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/processDefinition") |
| | | public class ActProcessDefinitionController extends BaseController { |
| | | |
| | | private final IActProcessDefinitionService actProcessDefinitionService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param processDefinitionBo åæ° |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ProcessDefinitionVo> page(ProcessDefinitionBo processDefinitionBo) { |
| | | return actProcessDefinitionService.page(processDefinitionBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å岿µç¨å®ä¹å表 |
| | | * |
| | | * @param key æµç¨å®ä¹key |
| | | */ |
| | | @GetMapping("/getProcessDefinitionListByKey/{key}") |
| | | public R<List<ProcessDefinitionVo>> getProcessDefinitionListByKey(@NotEmpty(message = "æµç¨å®ä¹keyä¸è½ä¸ºç©º") @PathVariable String key) { |
| | | return R.ok("æä½æå", actProcessDefinitionService.getProcessDefinitionListByKey(key)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹å¾ç |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping("/processDefinitionImage/{processDefinitionId}") |
| | | public R<String> processDefinitionImage(@PathVariable String processDefinitionId) { |
| | | return R.ok("æä½æå", actProcessDefinitionService.processDefinitionImage(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹xmlæä»¶ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping("/processDefinitionXml/{processDefinitionId}") |
| | | public R<Map<String, Object>> getXml(@NotBlank(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String xmlStr = actProcessDefinitionService.processDefinitionXml(processDefinitionId); |
| | | map.put("xml", Arrays.asList(xmlStr.split("\n"))); |
| | | map.put("xmlStr", xmlStr); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param deploymentId é¨ç½²id |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @DeleteMapping("/{deploymentId}/{processDefinitionId}") |
| | | public R<Void> deleteDeployment(@NotBlank(message = "æµç¨é¨ç½²idä¸è½ä¸ºç©º") @PathVariable String deploymentId, |
| | | @NotBlank(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.deleteDeployment(deploymentId, processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»æè
æèµ·æµç¨å®ä¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/updateProcessDefState/{processDefinitionId}") |
| | | public R<Void> updateProcDefState(@NotBlank(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.updateProcessDefState(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * è¿ç§»æµç¨å®ä¹ |
| | | * |
| | | * @param currentProcessDefinitionId å½åæµç¨å®ä¹id |
| | | * @param fromProcessDefinitionId éè¦è¿ç§»å°çæµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/migrationProcessDefinition/{currentProcessDefinitionId}/{fromProcessDefinitionId}") |
| | | public R<Void> migrationProcessDefinition(@NotBlank(message = "å½åæµç¨å®ä¹id") @PathVariable String currentProcessDefinitionId, |
| | | @NotBlank(message = "éè¦è¿ç§»å°çæµç¨å®ä¹id") @PathVariable String fromProcessDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.migrationProcessDefinition(currentProcessDefinitionId, fromProcessDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è½¬æ¢ä¸ºæ¨¡å |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/convertToModel/{processDefinitionId}") |
| | | public R<Void> convertToModel(@NotEmpty(message = "æµç¨å®ä¹idä¸è½ä¸ºç©º") @PathVariable String processDefinitionId) { |
| | | return toAjax(actProcessDefinitionService.convertToModel(processDefinitionId)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿zipæxmlé¨ç½²æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param categoryCode åç±» |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/deployByFile") |
| | | public R<Void> deployByFile(@RequestParam("file") MultipartFile file, @RequestParam("categoryCode") String categoryCode) { |
| | | return toAjax(actProcessDefinitionService.deployByFile(file, categoryCode)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.ProcessInstanceBo; |
| | | import org.dromara.workflow.domain.bo.ProcessInvalidBo; |
| | | import org.dromara.workflow.domain.bo.TaskUrgingBo; |
| | | import org.dromara.workflow.domain.vo.ProcessInstanceVo; |
| | | import org.dromara.workflow.service.IActProcessInstanceService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/processInstance") |
| | | public class ActProcessInstanceController extends BaseController { |
| | | |
| | | private final IActProcessInstanceService actProcessInstanceService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @GetMapping("/getProcessInstanceRunningByPage") |
| | | public TableDataInfo<ProcessInstanceVo> getProcessInstanceRunningByPage(ProcessInstanceBo processInstanceBo) { |
| | | return actProcessInstanceService.getProcessInstanceRunningByPage(processInstanceBo); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·²ç»æçæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @GetMapping("/getProcessInstanceFinishByPage") |
| | | public TableDataInfo<ProcessInstanceVo> getProcessInstanceFinishByPage(ProcessInstanceBo processInstanceBo) { |
| | | return actProcessInstanceService.getProcessInstanceFinishByPage(processInstanceBo); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/getHistoryProcessImage/{processInstanceId}") |
| | | public R<String> getHistoryProcessImage(@NotBlank(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String processInstanceId) { |
| | | return R.ok("æä½æå", actProcessInstanceService.getHistoryProcessImage(processInstanceId)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾è¿è¡ä¸ï¼åå²çèç¹ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/getHistoryProcessList/{processInstanceId}") |
| | | public R<Map<String, Object>> getHistoryProcessList(@NotBlank(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String processInstanceId) { |
| | | return R.ok("æä½æå", actProcessInstanceService.getHistoryProcessList(processInstanceId)); |
| | | } |
| | | |
| | | /** |
| | | * è·å审æ¹è®°å½ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/getHistoryRecord/{processInstanceId}") |
| | | public R<Map<String, Object>> getHistoryRecord(@NotBlank(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String processInstanceId) { |
| | | return R.ok(actProcessInstanceService.getHistoryRecord(processInstanceId)); |
| | | } |
| | | |
| | | /** |
| | | * ä½åºæµç¨å®ä¾ï¼ä¸ä¼å é¤åå²è®°å½(å é¤è¿è¡ä¸çå®ä¾) |
| | | * |
| | | * @param processInvalidBo åæ° |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @PostMapping("/deleteRuntimeProcessInst") |
| | | public R<Void> deleteRuntimeProcessInst(@Validated(AddGroup.class) @RequestBody ProcessInvalidBo processInvalidBo) { |
| | | return toAjax(actProcessInstanceService.deleteRuntimeProcessInst(processInvalidBo)); |
| | | } |
| | | |
| | | /** |
| | | * è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @DeleteMapping("/deleteRuntimeProcessAndHisInst/{processInstanceIds}") |
| | | public R<Void> deleteRuntimeProcessAndHisInst(@NotNull(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String[] processInstanceIds) { |
| | | return toAjax(actProcessInstanceService.deleteRuntimeProcessAndHisInst(Arrays.asList(processInstanceIds))); |
| | | } |
| | | |
| | | /** |
| | | * 已宿çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @DeleteMapping("/deleteFinishProcessAndHisInst/{processInstanceIds}") |
| | | public R<Void> deleteFinishProcessAndHisInst(@NotNull(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String[] processInstanceIds) { |
| | | return toAjax(actProcessInstanceService.deleteFinishProcessAndHisInst(Arrays.asList(processInstanceIds))); |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæµç¨ç³è¯· |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/cancelProcessApply/{processInstanceId}") |
| | | public R<Void> cancelProcessApply(@NotBlank(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º") @PathVariable String processInstanceId) { |
| | | return toAjax(actProcessInstanceService.cancelProcessApply(processInstanceId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å½åç»å½äººåæ® |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @GetMapping("/getCurrentSubmitByPage") |
| | | public TableDataInfo<ProcessInstanceVo> getCurrentSubmitByPage(ProcessInstanceBo processInstanceBo) { |
| | | return actProcessInstanceService.getCurrentSubmitByPage(processInstanceBo); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡å¬å(ç»å½åä»»å¡åç人åéç«å
ä¿¡ï¼é®ä»¶ï¼çä¿¡ç) |
| | | * |
| | | * @param taskUrgingBo ä»»å¡å¬å |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/taskUrging") |
| | | public R<Void> taskUrging(@RequestBody TaskUrgingBo taskUrgingBo) { |
| | | return toAjax(actProcessInstanceService.taskUrging(taskUrgingBo)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.service.IActTaskService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.engine.TaskService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä»»å¡ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/task") |
| | | public class ActTaskController extends BaseController { |
| | | |
| | | private final IActTaskService actTaskService; |
| | | |
| | | private final TaskService taskService; |
| | | |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/startWorkFlow") |
| | | public R<Map<String, Object>> startWorkFlow(@RequestBody StartProcessBo startProcessBo) { |
| | | Map<String, Object> map = actTaskService.startWorkFlow(startProcessBo); |
| | | return R.ok("æäº¤æå", map); |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/completeTask") |
| | | public R<Void> completeTask(@Validated(AddGroup.class) @RequestBody CompleteTaskBo completeTaskBo) { |
| | | return toAjax(actTaskService.completeTask(completeTaskBo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getTaskWaitByPage") |
| | | public TableDataInfo<TaskVo> getTaskWaitByPage(TaskBo taskBo) { |
| | | return actTaskService.getTaskWaitByPage(taskBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getAllTaskWaitByPage") |
| | | public TableDataInfo<TaskVo> getAllTaskWaitByPage(TaskBo taskBo) { |
| | | return actTaskService.getAllTaskWaitByPage(taskBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getTaskFinishByPage") |
| | | public TableDataInfo<TaskVo> getTaskFinishByPage(TaskBo taskBo) { |
| | | return actTaskService.getTaskFinishByPage(taskBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getTaskCopyByPage") |
| | | public TableDataInfo<TaskVo> getTaskCopyByPage(TaskBo taskBo) { |
| | | return actTaskService.getTaskCopyByPage(taskBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getAllTaskFinishByPage") |
| | | public TableDataInfo<TaskVo> getAllTaskFinishByPage(TaskBo taskBo) { |
| | | return actTaskService.getAllTaskFinishByPage(taskBo); |
| | | } |
| | | |
| | | /** |
| | | * ç¾æ¶ï¼æ¾åï¼ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/claim/{taskId}") |
| | | public R<Void> claimTask(@NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º") @PathVariable String taskId) { |
| | | try { |
| | | taskService.claim(taskId, Convert.toStr(LoginHelper.getUserId())); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("ç¾æ¶ä»»å¡å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å½è¿ï¼æ¾åçï¼ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/returnTask/{taskId}") |
| | | public R<Void> returnTask(@NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º") @PathVariable String taskId) { |
| | | try { |
| | | taskService.setAssignee(taskId, null); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("å½è¿ä»»å¡å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å§æ´¾ä»»å¡ |
| | | * |
| | | * @param delegateBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/delegateTask") |
| | | public R<Void> delegateTask(@Validated({AddGroup.class}) @RequestBody DelegateBo delegateBo) { |
| | | return toAjax(actTaskService.delegateTask(delegateBo)); |
| | | } |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param terminationBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @PostMapping("/terminationTask") |
| | | public R<Void> terminationTask(@RequestBody TerminationBo terminationBo) { |
| | | return toAjax(actTaskService.terminationTask(terminationBo)); |
| | | } |
| | | |
| | | /** |
| | | * 转åä»»å¡ |
| | | * |
| | | * @param transmitBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/transferTask") |
| | | public R<Void> transferTask(@Validated({AddGroup.class}) @RequestBody TransmitBo transmitBo) { |
| | | return toAjax(actTaskService.transferTask(transmitBo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡å ç¾ |
| | | * |
| | | * @param addMultiBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/addMultiInstanceExecution") |
| | | public R<Void> addMultiInstanceExecution(@Validated({AddGroup.class}) @RequestBody AddMultiBo addMultiBo) { |
| | | return toAjax(actTaskService.addMultiInstanceExecution(addMultiBo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡åç¾ |
| | | * |
| | | * @param deleteMultiBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/deleteMultiInstanceExecution") |
| | | public R<Void> deleteMultiInstanceExecution(@Validated({AddGroup.class}) @RequestBody DeleteMultiBo deleteMultiBo) { |
| | | return toAjax(actTaskService.deleteMultiInstanceExecution(deleteMultiBo)); |
| | | } |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param backProcessBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/backProcess") |
| | | public R<String> backProcess(@RequestBody BackProcessBo backProcessBo) { |
| | | return R.ok(actTaskService.backProcess(backProcessBo)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨ç¶æ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getBusinessStatus/{taskId}") |
| | | public R<String> getBusinessStatus(@PathVariable String taskId) { |
| | | return R.ok("æä½æå", WorkflowUtils.getBusinessStatusByTaskId(taskId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIds ä»»å¡id |
| | | * @param userId åç人id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/updateAssignee/{taskIds}/{userId}") |
| | | public R<Void> updateAssignee(@PathVariable String[] taskIds, @PathVariable String userId) { |
| | | return toAjax(actTaskService.updateAssignee(taskIds, userId)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | import org.dromara.workflow.service.ITestLeaveService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 请å |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/demo/leave") |
| | | public class TestLeaveController extends BaseController { |
| | | |
| | | private final ITestLeaveService testLeaveService; |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | @SaCheckPermission("demo:leave:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<TestLeaveVo> list(TestLeaveBo bo, PageQuery pageQuery) { |
| | | return testLeaveService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè¯·åå表 |
| | | */ |
| | | @SaCheckPermission("demo:leave:export") |
| | | @Log(title = "请å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(TestLeaveBo bo, HttpServletResponse response) { |
| | | List<TestLeaveVo> list = testLeaveService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "请å", TestLeaveVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·å请å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("demo:leave:query") |
| | | @GetMapping("/{id}") |
| | | public R<TestLeaveVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(testLeaveService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è¯·å |
| | | */ |
| | | @SaCheckPermission("demo:leave:add") |
| | | @Log(title = "请å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<TestLeave> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) { |
| | | return R.ok(testLeaveService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹è¯·å |
| | | */ |
| | | @SaCheckPermission("demo:leave:edit") |
| | | @Log(title = "请å", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<TestLeave> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) { |
| | | return R.ok(testLeaveService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è¯·å |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("demo:leave:remove") |
| | | @Log(title = "请å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(testLeaveService.deleteWithValidByIds(List.of(ids))); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.bo.WfCategoryBo; |
| | | import org.dromara.workflow.domain.vo.WfCategoryVo; |
| | | import org.dromara.workflow.service.IWfCategoryService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±» |
| | | * |
| | | * @author may |
| | | * @date 2023-06-28 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/category") |
| | | public class WfCategoryController extends BaseController { |
| | | |
| | | private final IWfCategoryService wfCategoryService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | */ |
| | | @SaCheckPermission("workflow:category:list") |
| | | @GetMapping("/list") |
| | | public R<List<WfCategoryVo>> list(WfCategoryBo bo) { |
| | | List<WfCategoryVo> list = wfCategoryService.queryList(bo); |
| | | return R.ok(list); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæµç¨åç±»å表 |
| | | */ |
| | | @SaCheckPermission("workflow:category:export") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(WfCategoryBo bo, HttpServletResponse response) { |
| | | List<WfCategoryVo> list = wfCategoryService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "æµç¨åç±»", WfCategoryVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å类详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("workflow:category:query") |
| | | @GetMapping("/{id}") |
| | | public R<WfCategoryVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(wfCategoryService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | */ |
| | | @SaCheckPermission("workflow:category:add") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody WfCategoryBo bo) { |
| | | return toAjax(wfCategoryService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | */ |
| | | @SaCheckPermission("workflow:category:edit") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody WfCategoryBo bo) { |
| | | return toAjax(wfCategoryService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨åç±» |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("workflow:category:remove") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(wfCategoryService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.system.domain.bo.SysUserBo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.workflow.domain.bo.SysUserMultiBo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.service.IWorkflowUserService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 工使µç¨æ·éäººç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/user") |
| | | public class WorkflowUserController extends BaseController { |
| | | |
| | | private final IWorkflowUserService workflowUserService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥ä½æµéæ©å ç¾äººå |
| | | * |
| | | * @param sysUserMultiBo åæ° |
| | | */ |
| | | @GetMapping("/getWorkflowAddMultiListByPage") |
| | | public TableDataInfo<SysUserVo> getWorkflowAddMultiInstanceByPage(SysUserMultiBo sysUserMultiBo) { |
| | | return workflowUserService.getWorkflowAddMultiInstanceByPage(sysUserMultiBo); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥ä½æµéæ©åç¾äººå |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getWorkflowDeleteMultiInstanceList/{taskId}") |
| | | public R<List<TaskVo>> getWorkflowDeleteMultiInstanceList(@PathVariable String taskId) { |
| | | return R.ok(workflowUserService.getWorkflowDeleteMultiInstanceList(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ç¨æ·idæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param userIds ç¨æ·id |
| | | */ |
| | | @GetMapping("/getUserListByIds/{userIds}") |
| | | public R<List<SysUserVo>> getUserListByIds(@PathVariable List<Long> userIds) { |
| | | return R.ok(workflowUserService.getUserListByIds(userIds)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ· |
| | | * |
| | | * @param sysUserBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/getUserListByPage") |
| | | public TableDataInfo<SysUserVo> getUserListByPage(SysUserBo sysUserBo, PageQuery pageQuery) { |
| | | return workflowUserService.getUserListByPage(sysUserBo, pageQuery); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾å¯¹è±¡ act_hi_procinst |
| | | * |
| | | * @author may |
| | | * @date 2023-07-22 |
| | | */ |
| | | @Data |
| | | @TableName("act_hi_procinst") |
| | | public class ActHiProcinst implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "ID_") |
| | | private String id; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "REV_") |
| | | private Long rev; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "PROC_INST_ID_") |
| | | private String procInstId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "BUSINESS_KEY_") |
| | | private String businessKey; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "PROC_DEF_ID_") |
| | | private String procDefId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "START_TIME_") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "END_TIME_") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "DURATION_") |
| | | private Long duration; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "START_USER_ID_") |
| | | private String startUserId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "START_ACT_ID_") |
| | | private String startActId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "END_ACT_ID_") |
| | | private String endActId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "SUPER_PROCESS_INSTANCE_ID_") |
| | | private String superProcessInstanceId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "DELETE_REASON_") |
| | | private String deleteReason; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "TENANT_ID_") |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "NAME_") |
| | | private String name; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "CALLBACK_ID_") |
| | | private String callbackId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "CALLBACK_TYPE_") |
| | | private String callbackType; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "REFERENCE_ID_") |
| | | private String referenceId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "REFERENCE_TYPE_") |
| | | private String referenceType; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "PROPAGATED_STAGE_INST_ID_") |
| | | private String propagatedStageInstId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "BUSINESS_STATUS_") |
| | | private String businessStatus; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * æµç¨åå²ä»»å¡å¯¹è±¡ act_hi_taskinst |
| | | * |
| | | * @author gssong |
| | | * @date 2024-03-02 |
| | | */ |
| | | @Data |
| | | @TableName("act_hi_taskinst") |
| | | public class ActHiTaskinst implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "ID_") |
| | | private String id; |
| | | |
| | | /** |
| | | * çæ¬ |
| | | */ |
| | | @TableField(value = "REV_") |
| | | private Long rev; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹id |
| | | */ |
| | | @TableField(value = "PROC_DEF_ID_") |
| | | private String procDefId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "TASK_DEF_ID_") |
| | | private String taskDefId; |
| | | |
| | | /** |
| | | * ä»»å¡èç¹id |
| | | */ |
| | | @TableField(value = "TASK_DEF_KEY_") |
| | | private String taskDefKey; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | @TableField(value = "PROC_INST_ID_") |
| | | private String procInstId; |
| | | |
| | | /** |
| | | * æµç¨æ§è¡id |
| | | */ |
| | | @TableField(value = "EXECUTION_ID") |
| | | private String executionId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "SCOPE_ID_") |
| | | private String scopeId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "SUB_SCOPE_ID_") |
| | | private String subScopeId; |
| | | |
| | | /** |
| | | * å
ç¨å½ååæ®µæ è¯æéç±»å |
| | | */ |
| | | @TableField(value = "SCOPE_TYPE_") |
| | | private String scopeType; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "SCOPE_DEFINITION_ID_") |
| | | private String scopeDefinitionId; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "PROPAGATED_STAGE_INST_ID_") |
| | | private String propagatedStageInstId; |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | @TableField(value = "NAME_") |
| | | private String name; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | @TableField(value = "PARENT_TASK_ID_") |
| | | private String parentTaskId; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | @TableField(value = "DESCRIPTION_") |
| | | private String description; |
| | | |
| | | /** |
| | | * åç人 |
| | | */ |
| | | @TableField(value = "OWNER_") |
| | | private String owner; |
| | | |
| | | /** |
| | | * åç人 |
| | | */ |
| | | @TableField(value = "ASSIGNEE_") |
| | | private String assignee; |
| | | |
| | | /** |
| | | * å¼å§äºä»¶ |
| | | */ |
| | | @TableField(value = "START_TIME_") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * è®¤é¢æ¶é´ |
| | | */ |
| | | @TableField(value = "CLAIM_TIME_") |
| | | private Date claimTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @TableField(value = "END_TIME_") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * æç»æ¶é´ |
| | | */ |
| | | @TableField(value = "DURATION_") |
| | | private Long duration; |
| | | |
| | | /** |
| | | * å é¤åå |
| | | */ |
| | | @TableField(value = "DELETE_REASON_") |
| | | private String deleteReason; |
| | | |
| | | /** |
| | | * ä¼å
级 |
| | | */ |
| | | @TableField(value = "PRIORITY_") |
| | | private Long priority; |
| | | |
| | | /** |
| | | * å°ææ¶é´ |
| | | */ |
| | | @TableField(value = "DUE_DATE_") |
| | | private Date dueDate; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "FORM_KEY_") |
| | | private String formKey; |
| | | |
| | | /** |
| | | * åç±» |
| | | */ |
| | | @TableField(value = "CATEGORY_") |
| | | private String category; |
| | | |
| | | /** |
| | | * æåä¿®æ¹æ¶é´ |
| | | */ |
| | | @TableField(value = "LAST_UPDATED_TIME_") |
| | | private Date lastUpdatedTime; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | | */ |
| | | @TableField(value = "TENANT_ID_") |
| | | private String tenantId; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | |
| | | import java.io.Serial; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 请å对象 test_leave |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("test_leave") |
| | | public class TestLeave extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 请åç±»å |
| | | */ |
| | | private String leaveType; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * 请åå¤©æ° |
| | | */ |
| | | private Integer leaveDays; |
| | | |
| | | /** |
| | | * 请ååå |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * æµç¨å类对象 wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("wf_category") |
| | | public class WfCategory extends TenantEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * åç±»åç§° |
| | | */ |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * åç±»ç¼ç |
| | | */ |
| | | private String categoryCode; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | private Long sortNum; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å ç¾åæ°è¯·æ± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class AddMultiBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @NotBlank(message = "ä»»å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * å ç¾äººåid |
| | | */ |
| | | @NotEmpty(message = "å ç¾äººåä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<Long> assignees; |
| | | |
| | | /** |
| | | * å ç¾äººååç§° |
| | | */ |
| | | @NotEmpty(message = "å ç¾äººåä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<String> assigneeNames; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 驳ååæ°è¯·æ± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class BackProcessBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @NotBlank(message = "ä»»å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | | */ |
| | | private List<String> messageType; |
| | | |
| | | /** |
| | | * 驳åçèç¹id(ç®åæªä½¿ç¨ï¼ç´æ¥é©³åå°ç³è¯·äºº) |
| | | */ |
| | | private String targetActivityId; |
| | | |
| | | /** |
| | | * åçæè§ |
| | | */ |
| | | private String message; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.workflow.domain.vo.WfCopy; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * åçä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class CompleteTaskBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * éä»¶id |
| | | */ |
| | | private String fileId; |
| | | |
| | | /** |
| | | * æé人å |
| | | */ |
| | | private List<WfCopy> wfCopyList; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | | */ |
| | | private List<String> messageType; |
| | | |
| | | /** |
| | | * åçæè§ |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * æµç¨åé |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
| | | } |
| | | variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue())); |
| | | return variables; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å§æ´¾ä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class DelegateBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * å§æ´¾äººid |
| | | */ |
| | | @NotBlank(message = "å§æ´¾äººidä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String userId; |
| | | |
| | | /** |
| | | * å§æ´¾äººåç§° |
| | | */ |
| | | @NotBlank(message = "å§æ´¾äººåç§°ä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String nickName; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String taskId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åç¾åæ°è¯·æ± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class DeleteMultiBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @NotBlank(message = "ä»»å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * åç¾äººå |
| | | */ |
| | | @NotEmpty(message = "åç¾äººåä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<String> taskIds; |
| | | |
| | | /** |
| | | * æ§è¡id |
| | | */ |
| | | @NotEmpty(message = "æ§è¡idä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<String> executionIds; |
| | | |
| | | /** |
| | | * 人åid |
| | | */ |
| | | @NotEmpty(message = "åç¾äººåidä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<Long> assigneeIds; |
| | | |
| | | /** |
| | | * 人ååç§° |
| | | */ |
| | | @NotEmpty(message = "åç¾äººåä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private List<String> assigneeNames; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.Pattern; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.workflow.common.PageEntity; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 模å请æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class ModelBo extends PageEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 模åid |
| | | */ |
| | | @NotBlank(message = "模åIDä¸è½ä¸ºç©º", groups = {EditGroup.class}) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模ååç§° |
| | | */ |
| | | @NotBlank(message = "模ååç§°ä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String name; |
| | | |
| | | /** |
| | | * æ¨¡åæ è¯key |
| | | */ |
| | | @NotBlank(message = "æ¨¡åæ è¯keyä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | @Pattern(regexp = FlowConstant.MODEL_KEY_PATTERN, message = "æ¨¡åæ è¯keyåªè½å符æè
ä¸å线å¼å¤´", groups = {AddGroup.class}) |
| | | private String key; |
| | | |
| | | /** |
| | | * 模ååç±» |
| | | */ |
| | | @NotBlank(message = "模ååç±»ä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String categoryCode; |
| | | |
| | | /** |
| | | * 模åXML |
| | | */ |
| | | @NotBlank(message = "模åXMLä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String xml; |
| | | |
| | | /** |
| | | * 模åSVGå¾ç |
| | | */ |
| | | @NotBlank(message = "模åSVGä¸è½ä¸ºç©º", groups = {EditGroup.class}) |
| | | private String svg; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String description; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.workflow.common.PageEntity; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class ProcessDefinitionBo extends PageEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§°key |
| | | */ |
| | | private String key; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 模ååç±» |
| | | */ |
| | | private String categoryCode; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.workflow.common.PageEntity; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class ProcessInstanceBo extends PageEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æµç¨key |
| | | */ |
| | | private String key; |
| | | |
| | | /** |
| | | * ä»»å¡å起人 |
| | | */ |
| | | private String startUserId; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessKey; |
| | | |
| | | /** |
| | | * 模ååç±» |
| | | */ |
| | | private String categoryCode; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ä½åºè¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ProcessInvalidBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | @NotBlank(message = "æµç¨å®ä¾idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String processInstanceId; |
| | | |
| | | /** |
| | | * ä½åºåå |
| | | */ |
| | | private String deleteReason; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * å¯å¨æµç¨å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class StartProcessBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸å¡å¯ä¸å¼id |
| | | */ |
| | | private String businessKey; |
| | | |
| | | /** |
| | | * æµç¨æ§è¡key |
| | | */ |
| | | private String processKey; |
| | | |
| | | /** |
| | | * æµç¨åéï¼åç«¯ä¼æäº¤ä¸ä¸ªå
ç´ {'entity': {ä¸å¡è¯¦æ
æ°æ®å¯¹è±¡}} |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
| | | } |
| | | variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue())); |
| | | return variables; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.workflow.common.PageEntity; |
| | | |
| | | |
| | | /** |
| | | * ç¨æ·å ç¾æ¥è¯¢ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | |
| | | public class SysUserMultiBo extends PageEntity { |
| | | /** |
| | | * 人ååç§° |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * 人ååç§° |
| | | */ |
| | | private String nickName; |
| | | |
| | | /** |
| | | * é¨é¨id |
| | | */ |
| | | private String deptId; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private String taskId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.workflow.common.PageEntity; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class TaskBo extends PageEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String processDefinitionName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | */ |
| | | private String processDefinitionKey; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä»»å¡å¬å |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class TaskUrgingBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private String processInstanceId; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | | */ |
| | | private List<String> messageType; |
| | | |
| | | /** |
| | | * å¬åå
容ï¼ä¸ºç©ºé»è®¤ç³»ç»å
置信æ¯ï¼ |
| | | */ |
| | | private String message; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class TerminationBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡id为空", groups = AddGroup.class) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * 转å人id |
| | | */ |
| | | @NotBlank(message = "转å人ä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String userId; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String comment; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 请åä¸å¡å¯¹è±¡ test_leave |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = TestLeave.class, reverseConvertGenerate = false) |
| | | public class TestLeaveBo extends BaseEntity { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @NotNull(message = "主é®ä¸è½ä¸ºç©º", groups = {EditGroup.class}) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 请åç±»å |
| | | */ |
| | | @NotBlank(message = "请åç±»åä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private String leaveType; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @NotNull(message = "å¼å§æ¶é´ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @NotNull(message = "ç»ææ¶é´ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * 请åå¤©æ° |
| | | */ |
| | | @NotNull(message = "请å天æ°ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private Integer leaveDays; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | private Integer startLeaveDays; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Integer endLeaveDays; |
| | | |
| | | /** |
| | | * 请ååå |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ç»è½¬åå¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class TransmitBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡id为空", groups = AddGroup.class) |
| | | private String taskId; |
| | | |
| | | /** |
| | | * 转å人id |
| | | */ |
| | | @NotBlank(message = "转å人ä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String userId; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String comment; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | |
| | | /** |
| | | * æµç¨åç±»ä¸å¡å¯¹è±¡ wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = WfCategory.class, reverseConvertGenerate = false) |
| | | public class WfCategoryBo extends BaseEntity { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @NotNull(message = "主é®ä¸è½ä¸ºç©º", groups = {EditGroup.class}) |
| | | private Long id; |
| | | |
| | | /** |
| | | * åç±»åç§° |
| | | */ |
| | | @NotBlank(message = "åç±»åç§°ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * åç±»ç¼ç |
| | | */ |
| | | @NotBlank(message = "åç±»ç¼ç ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private String categoryCode; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | @NotNull(message = "ç¶çº§idä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | private Long sortNum; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.flowable.engine.task.Attachment; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®¡æ¹è®°å½è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ActHistoryInfoVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private String id; |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String taskDefinitionKey; |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private String processInstanceId; |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | private Date startTime; |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | /** |
| | | * è¿è¡æ¶é¿ |
| | | */ |
| | | private String runDuration; |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | private String status; |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | private String statusName; |
| | | /** |
| | | * åç人id |
| | | */ |
| | | private Long assignee; |
| | | |
| | | /** |
| | | * åç人åç§° |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "assignee") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * åç人id |
| | | */ |
| | | private String owner; |
| | | |
| | | /** |
| | | * 审æ¹ä¿¡æ¯id |
| | | */ |
| | | private String commentId; |
| | | |
| | | /** |
| | | * 审æ¹ä¿¡æ¯ |
| | | */ |
| | | private String comment; |
| | | |
| | | /** |
| | | * 审æ¹éä»¶ |
| | | */ |
| | | private List<Attachment> attachmentList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * èç¹å¾å½¢ä¿¡æ¯ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class GraphicInfoVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * xåæ |
| | | */ |
| | | private double x; |
| | | |
| | | /** |
| | | * yåæ |
| | | */ |
| | | private double y; |
| | | |
| | | /** |
| | | * èç¹é«åº¦ |
| | | */ |
| | | private double height; |
| | | |
| | | /** |
| | | * èç¹å®½åº¦ |
| | | */ |
| | | private double width; |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String nodeId; |
| | | |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author Joram Barrez |
| | | */ |
| | | @Data |
| | | public class GroupRepresentation { |
| | | |
| | | protected String id; |
| | | protected String name; |
| | | protected String type; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 模åè§å¾å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ModelVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 模åid |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 模ååç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æ¨¡åæ è¯key |
| | | */ |
| | | private String key; |
| | | |
| | | /** |
| | | * 模ååç±» |
| | | */ |
| | | private String categoryCode; |
| | | |
| | | /** |
| | | * 模åXML |
| | | */ |
| | | private String xml; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String description; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å¤å®ä¾ä¿¡æ¯ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class MultiInstanceVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¼ç¾ç±»åï¼ä¸²è¡ï¼å¹¶è¡ï¼ |
| | | */ |
| | | private Object type; |
| | | |
| | | /** |
| | | * ä¼ç¾äººåKEY |
| | | */ |
| | | private String assignee; |
| | | |
| | | /** |
| | | * ä¼ç¾äººåéåKEY |
| | | */ |
| | | private String assigneeList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åä¸è
|
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ParticipantVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ç»idï¼è§è²idï¼ |
| | | */ |
| | | private List<Long> groupIds; |
| | | |
| | | /** |
| | | * åé人idï¼ç¨æ·idï¼ å½ç»idä¸ä¸ºç©ºæ¶ï¼å°ç»å
äººåæ¥åºæ¾å
¥candidate |
| | | */ |
| | | private List<Long> candidate; |
| | | |
| | | /** |
| | | * åé人åç§°ï¼ç¨æ·åç§°ï¼ å½ç»idä¸ä¸ºç©ºæ¶ï¼å°ç»å
äººåæ¥åºæ¾å
¥candidateName |
| | | */ |
| | | private List<String> candidateName; |
| | | |
| | | /** |
| | | * æ¯å¦è®¤é¢æ è¯ |
| | | * å½ä¸ºç©ºæ¶é»è®¤å½åä»»å¡ä¸éè¦è®¤é¢ |
| | | * å½ä¸ºtrueæ¶å½åä»»å¡è¯´æä¸ºå鿍¡å¼å¹¶ä¸æäººå·²ç»è®¤é¢äºä»»å¡å¯ä»¥å½è¿ï¼ |
| | | * å½ä¸ºfalseæ¶å½åä»»å¡è¯´æä¸ºå鿍¡å¼è¯¥ä»»å¡æªè®¤é¢ï¼ |
| | | */ |
| | | private Boolean claim; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ProcessDefinitionVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹id |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹æ è¯key |
| | | */ |
| | | private String key; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹çæ¬ |
| | | */ |
| | | private int version; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹æèµ·ææ¿æ´» 1æ¿æ´» 2æèµ· |
| | | */ |
| | | private int suspensionState; |
| | | |
| | | /** |
| | | * æµç¨xmlåç§° |
| | | */ |
| | | private String resourceName; |
| | | |
| | | /** |
| | | * æµç¨å¾çåç§° |
| | | */ |
| | | private String diagramResourceName; |
| | | |
| | | /** |
| | | * æµç¨é¨ç½²id |
| | | */ |
| | | private String deploymentId; |
| | | |
| | | /** |
| | | * æµç¨é¨ç½²æ¶é´ |
| | | */ |
| | | private Date deploymentTime; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class ProcessInstanceVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹id |
| | | */ |
| | | private String processDefinitionId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String processDefinitionName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | */ |
| | | private String processDefinitionKey; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹çæ¬ |
| | | */ |
| | | private String processDefinitionVersion; |
| | | |
| | | /** |
| | | * é¨ç½²id |
| | | */ |
| | | private String deploymentId; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessKey; |
| | | |
| | | /** |
| | | * æ¯å¦æèµ· |
| | | */ |
| | | private Boolean isSuspended; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * å¯å¨æ¶é´ |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * å¯å¨äººid |
| | | */ |
| | | private String startUserId; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String businessStatus; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String businessStatusName; |
| | | |
| | | /** |
| | | * å¾
åä»»å¡éå |
| | | */ |
| | | private List<TaskVo> taskVoList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * ä»»å¡è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class TaskVo { |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private String description; |
| | | |
| | | /** |
| | | * ä¼å
级 |
| | | */ |
| | | private Integer priority; |
| | | |
| | | /** |
| | | * è´è´£æ¤ä»»å¡ç人åçç¨æ·id |
| | | */ |
| | | private String owner; |
| | | |
| | | /** |
| | | * åç人id |
| | | */ |
| | | private Long assignee; |
| | | |
| | | /** |
| | | * åç人 |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "assignee") |
| | | private String assigneeName; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private String processInstanceId; |
| | | |
| | | /** |
| | | * æ§è¡id |
| | | */ |
| | | private String executionId; |
| | | |
| | | /** |
| | | * æ ç¨ |
| | | */ |
| | | private String taskDefinitionId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹id |
| | | */ |
| | | private String processDefinitionId; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String taskDefinitionKey; |
| | | |
| | | /** |
| | | * 任塿ªæ¢æ¥æ |
| | | */ |
| | | private Date dueDate; |
| | | |
| | | /** |
| | | * æµç¨ç±»å« |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * ç¶çº§ä»»å¡id |
| | | */ |
| | | private String parentTaskId; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * è®¤é¢æ¶é´ |
| | | */ |
| | | private Date claimTime; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String businessStatus; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String businessStatusName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String processDefinitionName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | */ |
| | | private String processDefinitionKey; |
| | | |
| | | /** |
| | | * åä¸è
|
| | | */ |
| | | private ParticipantVo participantVo; |
| | | |
| | | /** |
| | | * æ¯å¦ä¼ç¾ |
| | | */ |
| | | private Boolean multiInstance; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * 请åè§å¾å¯¹è±¡ test_leave |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = TestLeave.class) |
| | | public class TestLeaveVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @ExcelProperty(value = "主é®") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 请åç±»å |
| | | */ |
| | | @ExcelProperty(value = "请åç±»å") |
| | | private String leaveType; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "å¼å§æ¶é´") |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "ç»ææ¶é´") |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * 请åå¤©æ° |
| | | */ |
| | | @ExcelProperty(value = "请å天æ°") |
| | | private Integer leaveDays; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "请ååå ") |
| | | private String remark; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾å¯¹è±¡ |
| | | */ |
| | | private ProcessInstanceVo processInstanceVo; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | /** |
| | | * æµç¨åç±»è§å¾å¯¹è±¡ wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = WfCategory.class) |
| | | public class WfCategoryVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @ExcelProperty(value = "主é®") |
| | | private Long id; |
| | | |
| | | /** |
| | | * åç±»åç§° |
| | | */ |
| | | @ExcelProperty(value = "åç±»åç§°") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * åç±»ç¼ç |
| | | */ |
| | | @ExcelProperty(value = "åç±»ç¼ç ") |
| | | private String categoryCode; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | @ExcelProperty(value = "ç¶çº§id") |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | @ExcelProperty(value = "æåº") |
| | | private Long sortNum; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æé |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class WfCopy { |
| | | |
| | | /** |
| | | * ç¨æ·id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * ç¨æ·åç§° |
| | | */ |
| | | private String userName; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable; |
| | | |
| | | import org.flowable.bpmn.model.AssociationDirection; |
| | | import org.flowable.image.impl.DefaultProcessDiagramCanvas; |
| | | |
| | | import java.awt.*; |
| | | import java.awt.geom.Line2D; |
| | | import java.awt.geom.RoundRectangle2D; |
| | | |
| | | public class CustomDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas { |
| | | //设置é«äº®çº¿çé¢è² è¿éæè®¾ç½®æç»¿è² |
| | | protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN; |
| | | |
| | | public CustomDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) { |
| | | super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); |
| | | } |
| | | |
| | | /** |
| | | * ç»çº¿é¢è²è®¾ç½® |
| | | */ |
| | | public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, |
| | | AssociationDirection associationDirection, boolean highLighted, double scaleFactor) { |
| | | |
| | | Paint originalPaint = g.getPaint(); |
| | | Stroke originalStroke = g.getStroke(); |
| | | |
| | | g.setPaint(CONNECTION_COLOR); |
| | | if (connectionType.equals("association")) { |
| | | g.setStroke(ASSOCIATION_STROKE); |
| | | } else if (highLighted) { |
| | | //设置线çé¢è² |
| | | g.setPaint(HIGHLIGHT_SEQUENCEFLOW_COLOR); |
| | | g.setStroke(HIGHLIGHT_FLOW_STROKE); |
| | | } |
| | | |
| | | for (int i = 1; i < xPoints.length; i++) { |
| | | Integer sourceX = xPoints[i - 1]; |
| | | Integer sourceY = yPoints[i - 1]; |
| | | Integer targetX = xPoints[i]; |
| | | Integer targetY = yPoints[i]; |
| | | Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY); |
| | | g.draw(line); |
| | | } |
| | | |
| | | if (isDefault) { |
| | | Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); |
| | | drawDefaultSequenceFlowIndicator(line, scaleFactor); |
| | | } |
| | | |
| | | if (conditional) { |
| | | Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); |
| | | drawConditionalSequenceFlowIndicator(line, scaleFactor); |
| | | } |
| | | |
| | | if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) { |
| | | Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]); |
| | | drawArrowHead(line, scaleFactor); |
| | | } |
| | | if (associationDirection == AssociationDirection.BOTH) { |
| | | Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]); |
| | | drawArrowHead(line, scaleFactor); |
| | | } |
| | | g.setPaint(originalPaint); |
| | | g.setStroke(originalStroke); |
| | | } |
| | | |
| | | /** |
| | | * é«äº®èç¹è®¾ç½® |
| | | */ |
| | | public void drawHighLight(int x, int y, int width, int height) { |
| | | Paint originalPaint = g.getPaint(); |
| | | Stroke originalStroke = g.getStroke(); |
| | | //设置é«äº®èç¹çé¢è² |
| | | g.setPaint(HIGHLIGHT_COLOR); |
| | | g.setStroke(THICK_TASK_BORDER_STROKE); |
| | | |
| | | RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); |
| | | g.draw(rect); |
| | | |
| | | g.setPaint(originalPaint); |
| | | g.setStroke(originalStroke); |
| | | } |
| | | |
| | | /** |
| | | * @description: é«äº®èç¹çº¢è² |
| | | * @param: x |
| | | * @param: y |
| | | * @param: width |
| | | * @param: height |
| | | * @return: void |
| | | * @author: gssong |
| | | * @date: 2022/4/12 |
| | | */ |
| | | public void drawHighLightRed(int x, int y, int width, int height) { |
| | | Paint originalPaint = g.getPaint(); |
| | | Stroke originalStroke = g.getStroke(); |
| | | //设置é«äº®èç¹çé¢è² |
| | | g.setPaint(Color.green); |
| | | g.setStroke(THICK_TASK_BORDER_STROKE); |
| | | |
| | | RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); |
| | | g.draw(rect); |
| | | |
| | | g.setPaint(originalPaint); |
| | | g.setStroke(originalStroke); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | |
| | | package org.dromara.workflow.flowable; |
| | | |
| | | import org.flowable.bpmn.model.Event; |
| | | import org.flowable.bpmn.model.Process; |
| | | import org.flowable.bpmn.model.*; |
| | | import org.flowable.image.ProcessDiagramGenerator; |
| | | |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.InputStream; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Class to generate an image based the diagram interchange information in a BPMN 2.0 process. |
| | | * |
| | | * @author Joram Barrez |
| | | * @author Tijs Rademakers |
| | | * @author Zheng Ji |
| | | */ |
| | | public class CustomDefaultProcessDiagramGenerator implements ProcessDiagramGenerator { |
| | | |
| | | protected Map<Class<? extends BaseElement>, ActivityDrawInstruction> activityDrawInstructions = new HashMap<>(); |
| | | protected Map<Class<? extends BaseElement>, ArtifactDrawInstruction> artifactDrawInstructions = new HashMap<>(); |
| | | |
| | | public CustomDefaultProcessDiagramGenerator() { |
| | | this(1.0); |
| | | } |
| | | |
| | | // The instructions on how to draw a certain construct is |
| | | // created statically and stored in a map for performance. |
| | | public CustomDefaultProcessDiagramGenerator(final double scaleFactor) { |
| | | // start event |
| | | activityDrawInstructions.put(StartEvent.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | StartEvent startEvent = (StartEvent) flowNode; |
| | | if (startEvent.getEventDefinitions() != null && !startEvent.getEventDefinitions().isEmpty()) { |
| | | EventDefinition eventDefinition = startEvent.getEventDefinitions().get(0); |
| | | if (eventDefinition instanceof TimerEventDefinition) { |
| | | processDiagramCanvas.drawTimerStartEvent(graphicInfo, scaleFactor); |
| | | } else if (eventDefinition instanceof ErrorEventDefinition) { |
| | | processDiagramCanvas.drawErrorStartEvent(graphicInfo, scaleFactor); |
| | | } else if (eventDefinition instanceof EscalationEventDefinition) { |
| | | processDiagramCanvas.drawEscalationStartEvent(graphicInfo, scaleFactor); |
| | | } else if (eventDefinition instanceof ConditionalEventDefinition) { |
| | | processDiagramCanvas.drawConditionalStartEvent(graphicInfo, scaleFactor); |
| | | } else if (eventDefinition instanceof SignalEventDefinition) { |
| | | processDiagramCanvas.drawSignalStartEvent(graphicInfo, scaleFactor); |
| | | } else if (eventDefinition instanceof MessageEventDefinition) { |
| | | processDiagramCanvas.drawMessageStartEvent(graphicInfo, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawNoneStartEvent(graphicInfo); |
| | | } |
| | | } else { |
| | | List<ExtensionElement> eventTypeElements = startEvent.getExtensionElements().get("eventType"); |
| | | if (eventTypeElements != null && eventTypeElements.size() > 0) { |
| | | processDiagramCanvas.drawEventRegistryStartEvent(graphicInfo, scaleFactor); |
| | | |
| | | } else { |
| | | processDiagramCanvas.drawNoneStartEvent(graphicInfo); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // signal catch |
| | | activityDrawInstructions.put(IntermediateCatchEvent.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) flowNode; |
| | | if (intermediateCatchEvent.getEventDefinitions() != null && !intermediateCatchEvent.getEventDefinitions().isEmpty()) { |
| | | |
| | | if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition) { |
| | | processDiagramCanvas.drawCatchingSignalEvent(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } else if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition) { |
| | | processDiagramCanvas.drawCatchingTimerEvent(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } else if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof MessageEventDefinition) { |
| | | processDiagramCanvas.drawCatchingMessageEvent(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } else if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof ConditionalEventDefinition) { |
| | | processDiagramCanvas.drawCatchingConditionalEvent(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // signal throw |
| | | activityDrawInstructions.put(ThrowEvent.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | ThrowEvent throwEvent = (ThrowEvent) flowNode; |
| | | if (throwEvent.getEventDefinitions() != null && !throwEvent.getEventDefinitions().isEmpty()) { |
| | | if (throwEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition) { |
| | | processDiagramCanvas.drawThrowingSignalEvent(graphicInfo, scaleFactor); |
| | | } else if (throwEvent.getEventDefinitions().get(0) instanceof EscalationEventDefinition) { |
| | | processDiagramCanvas.drawThrowingEscalationEvent(graphicInfo, scaleFactor); |
| | | } else if (throwEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) { |
| | | processDiagramCanvas.drawThrowingCompensateEvent(graphicInfo, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawThrowingNoneEvent(graphicInfo, scaleFactor); |
| | | } |
| | | } else { |
| | | processDiagramCanvas.drawThrowingNoneEvent(graphicInfo, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // end event |
| | | activityDrawInstructions.put(EndEvent.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | EndEvent endEvent = (EndEvent) flowNode; |
| | | if (endEvent.getEventDefinitions() != null && !endEvent.getEventDefinitions().isEmpty()) { |
| | | if (endEvent.getEventDefinitions().get(0) instanceof ErrorEventDefinition) { |
| | | processDiagramCanvas.drawErrorEndEvent(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } else if (endEvent.getEventDefinitions().get(0) instanceof EscalationEventDefinition) { |
| | | processDiagramCanvas.drawEscalationEndEvent(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawNoneEndEvent(graphicInfo, scaleFactor); |
| | | } |
| | | } else { |
| | | processDiagramCanvas.drawNoneEndEvent(graphicInfo, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // task |
| | | activityDrawInstructions.put(Task.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // user task |
| | | activityDrawInstructions.put(UserTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawUserTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // script task |
| | | activityDrawInstructions.put(ScriptTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawScriptTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // service task |
| | | activityDrawInstructions.put(ServiceTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | ServiceTask serviceTask = (ServiceTask) flowNode; |
| | | if ("camel".equalsIgnoreCase(serviceTask.getType())) { |
| | | processDiagramCanvas.drawCamelTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | }else if (ServiceTask.HTTP_TASK.equalsIgnoreCase(serviceTask.getType())) { |
| | | processDiagramCanvas.drawHttpTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | } else if (ServiceTask.DMN_TASK.equalsIgnoreCase(serviceTask.getType())) { |
| | | processDiagramCanvas.drawDMNTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | } else if (ServiceTask.SHELL_TASK.equalsIgnoreCase(serviceTask.getType())) { |
| | | processDiagramCanvas.drawShellTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawServiceTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // http service task |
| | | activityDrawInstructions.put(HttpServiceTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawHttpTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // receive task |
| | | activityDrawInstructions.put(ReceiveTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawReceiveTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // send task |
| | | activityDrawInstructions.put(SendTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawSendTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // manual task |
| | | activityDrawInstructions.put(ManualTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawManualTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // send event service task |
| | | activityDrawInstructions.put(SendEventServiceTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawSendEventServiceTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // external worker service task |
| | | activityDrawInstructions.put(ExternalWorkerServiceTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | ServiceTask serviceTask = (ServiceTask) flowNode; |
| | | processDiagramCanvas.drawServiceTask(serviceTask.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // case service task |
| | | activityDrawInstructions.put(CaseServiceTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawCaseServiceTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // businessRuleTask task |
| | | activityDrawInstructions.put(BusinessRuleTask.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawBusinessRuleTask(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // exclusive gateway |
| | | activityDrawInstructions.put(ExclusiveGateway.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawExclusiveGateway(graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // inclusive gateway |
| | | activityDrawInstructions.put(InclusiveGateway.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawInclusiveGateway(graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // parallel gateway |
| | | activityDrawInstructions.put(ParallelGateway.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawParallelGateway(graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // event based gateway |
| | | activityDrawInstructions.put(EventGateway.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawEventBasedGateway(graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // Boundary timer |
| | | activityDrawInstructions.put(BoundaryEvent.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | BoundaryEvent boundaryEvent = (BoundaryEvent) flowNode; |
| | | if (boundaryEvent.getEventDefinitions() != null && !boundaryEvent.getEventDefinitions().isEmpty()) { |
| | | EventDefinition eventDefinition = boundaryEvent.getEventDefinitions().get(0); |
| | | if (eventDefinition instanceof TimerEventDefinition) { |
| | | processDiagramCanvas.drawCatchingTimerEvent(flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof ConditionalEventDefinition) { |
| | | processDiagramCanvas.drawCatchingConditionalEvent(graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof ErrorEventDefinition) { |
| | | processDiagramCanvas.drawCatchingErrorEvent(graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof EscalationEventDefinition) { |
| | | processDiagramCanvas.drawCatchingEscalationEvent(graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof SignalEventDefinition) { |
| | | processDiagramCanvas.drawCatchingSignalEvent(flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof MessageEventDefinition) { |
| | | processDiagramCanvas.drawCatchingMessageEvent(flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | |
| | | } else if (eventDefinition instanceof CompensateEventDefinition) { |
| | | processDiagramCanvas.drawCatchingCompensateEvent(graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | } |
| | | |
| | | } else { |
| | | List<ExtensionElement> eventTypeElements = boundaryEvent.getExtensionElements().get("eventType"); |
| | | if (eventTypeElements != null && eventTypeElements.size() > 0) { |
| | | processDiagramCanvas.drawCatchingEventRegistryEvent(flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity(), scaleFactor); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // subprocess |
| | | activityDrawInstructions.put(SubProcess.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | processDiagramCanvas.drawCollapsedSubProcess(flowNode.getName(), graphicInfo, false, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawExpandedSubProcess(flowNode.getName(), graphicInfo, false, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // transaction |
| | | activityDrawInstructions.put(Transaction.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | processDiagramCanvas.drawCollapsedSubProcess(flowNode.getName(), graphicInfo, false, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawExpandedTransaction(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // Event subprocess |
| | | activityDrawInstructions.put(EventSubProcess.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | processDiagramCanvas.drawCollapsedSubProcess(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawExpandedSubProcess(flowNode.getName(), graphicInfo, true, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // Adhoc subprocess |
| | | activityDrawInstructions.put(AdhocSubProcess.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | processDiagramCanvas.drawCollapsedSubProcess(flowNode.getName(), graphicInfo, false, scaleFactor); |
| | | } else { |
| | | processDiagramCanvas.drawExpandedSubProcess(flowNode.getName(), graphicInfo, false, scaleFactor); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // call activity |
| | | activityDrawInstructions.put(CallActivity.class, new ActivityDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | processDiagramCanvas.drawCollapsedCallActivity(flowNode.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // text annotation |
| | | artifactDrawInstructions.put(TextAnnotation.class, new ArtifactDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(artifact.getId()); |
| | | TextAnnotation textAnnotation = (TextAnnotation) artifact; |
| | | processDiagramCanvas.drawTextAnnotation(textAnnotation.getText(), graphicInfo, scaleFactor); |
| | | } |
| | | }); |
| | | |
| | | // association |
| | | artifactDrawInstructions.put(Association.class, new ArtifactDrawInstruction() { |
| | | |
| | | @Override |
| | | public void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) { |
| | | Association association = (Association) artifact; |
| | | String sourceRef = association.getSourceRef(); |
| | | String targetRef = association.getTargetRef(); |
| | | |
| | | // source and target can be instance of FlowElement or Artifact |
| | | BaseElement sourceElement = bpmnModel.getFlowElement(sourceRef); |
| | | BaseElement targetElement = bpmnModel.getFlowElement(targetRef); |
| | | if (sourceElement == null) { |
| | | sourceElement = bpmnModel.getArtifact(sourceRef); |
| | | } |
| | | if (targetElement == null) { |
| | | targetElement = bpmnModel.getArtifact(targetRef); |
| | | } |
| | | List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(artifact.getId()); |
| | | graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList); |
| | | int[] xPoints = new int[graphicInfoList.size()]; |
| | | int[] yPoints = new int[graphicInfoList.size()]; |
| | | for (int i = 1; i < graphicInfoList.size(); i++) { |
| | | GraphicInfo graphicInfo = graphicInfoList.get(i); |
| | | GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1); |
| | | |
| | | if (i == 1) { |
| | | xPoints[0] = (int) previousGraphicInfo.getX(); |
| | | yPoints[0] = (int) previousGraphicInfo.getY(); |
| | | } |
| | | xPoints[i] = (int) graphicInfo.getX(); |
| | | yPoints[i] = (int) graphicInfo.getY(); |
| | | } |
| | | |
| | | AssociationDirection associationDirection = association.getAssociationDirection(); |
| | | processDiagramCanvas.drawAssociation(xPoints, yPoints, associationDirection, false, scaleFactor); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, |
| | | String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | return generateProcessDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows, |
| | | activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor, drawSequenceFlowNameWithNoLabelDI).generateImage(imageType); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows, null, null, null, null, 1.0, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, |
| | | List<String> highLightedActivities, List<String> highLightedFlows, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows, null, null, null, null, scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, imageType, highLightedActivities, Collections.emptyList(), drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, imageType, highLightedActivities, Collections.emptyList(), scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, String activityFontName, |
| | | String labelFontName, String annotationFontName, ClassLoader customClassLoader, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | return generateDiagram(bpmnModel, imageType, Collections.emptyList(), Collections.emptyList(), |
| | | activityFontName, labelFontName, annotationFontName, customClassLoader, 1.0, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, String activityFontName, |
| | | String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | return generateDiagram(bpmnModel, imageType, Collections.emptyList(), Collections.emptyList(), |
| | | activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generatePngDiagram(BpmnModel bpmnModel, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generatePngDiagram(bpmnModel, 1.0, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generatePngDiagram(BpmnModel bpmnModel, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, "png", Collections.emptyList(), Collections.emptyList(), scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateJpgDiagram(BpmnModel bpmnModel) { |
| | | return generateJpgDiagram(bpmnModel, 1.0, false); |
| | | } |
| | | |
| | | @Override |
| | | public InputStream generateJpgDiagram(BpmnModel bpmnModel, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | return generateDiagram(bpmnModel, "jpg", Collections.emptyList(), Collections.emptyList(), drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | public BufferedImage generateImage(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, |
| | | String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | return generateProcessDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows, |
| | | activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor, drawSequenceFlowNameWithNoLabelDI).generateBufferedImage(imageType); |
| | | } |
| | | |
| | | public BufferedImage generateImage(BpmnModel bpmnModel, String imageType, |
| | | List<String> highLightedActivities, List<String> highLightedFlows, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | return generateImage(bpmnModel, imageType, highLightedActivities, highLightedFlows, null, null, null, null, scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | |
| | | @Override |
| | | public BufferedImage generatePngImage(BpmnModel bpmnModel, double scaleFactor) { |
| | | return generateImage(bpmnModel, "png", Collections.emptyList(), Collections.emptyList(), scaleFactor, false); |
| | | } |
| | | |
| | | protected CustomDefaultProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType, |
| | | List<String> highLightedActivities, List<String> highLightedFlows, |
| | | String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | prepareBpmnModel(bpmnModel); |
| | | |
| | | CustomDefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); |
| | | |
| | | // Draw pool shape, if process is participant in collaboration |
| | | for (Pool pool : bpmnModel.getPools()) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId()); |
| | | processDiagramCanvas.drawPoolOrLane(pool.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | |
| | | // Draw lanes |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | for (Lane lane : process.getLanes()) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(lane.getId()); |
| | | processDiagramCanvas.drawPoolOrLane(lane.getName(), graphicInfo, scaleFactor); |
| | | } |
| | | } |
| | | |
| | | // Draw activities and their sequence-flows |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) { |
| | | if (!isPartOfCollapsedSubProcess(flowNode, bpmnModel)) { |
| | | drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Draw artifacts |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | |
| | | for (Artifact artifact : process.getArtifacts()) { |
| | | drawArtifact(processDiagramCanvas, bpmnModel, artifact); |
| | | } |
| | | |
| | | List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true); |
| | | if (subProcesses != null) { |
| | | for (SubProcess subProcess : subProcesses) { |
| | | |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(subProcess.getId()); |
| | | if (graphicInfo != null && graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | continue; |
| | | } |
| | | |
| | | if (!isPartOfCollapsedSubProcess(subProcess, bpmnModel)) { |
| | | for (Artifact subProcessArtifact : subProcess.getArtifacts()) { |
| | | drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return processDiagramCanvas; |
| | | } |
| | | |
| | | protected void prepareBpmnModel(BpmnModel bpmnModel) { |
| | | |
| | | // Need to make sure all elements have positive x and y. |
| | | // Check all graphicInfo and update the elements accordingly |
| | | |
| | | List<GraphicInfo> allGraphicInfos = new ArrayList<>(); |
| | | if (bpmnModel.getLocationMap() != null) { |
| | | allGraphicInfos.addAll(bpmnModel.getLocationMap().values()); |
| | | } |
| | | if (bpmnModel.getLabelLocationMap() != null) { |
| | | allGraphicInfos.addAll(bpmnModel.getLabelLocationMap().values()); |
| | | } |
| | | if (bpmnModel.getFlowLocationMap() != null) { |
| | | for (List<GraphicInfo> flowGraphicInfos : bpmnModel.getFlowLocationMap().values()) { |
| | | allGraphicInfos.addAll(flowGraphicInfos); |
| | | } |
| | | } |
| | | |
| | | if (allGraphicInfos.size() > 0) { |
| | | |
| | | boolean needsTranslationX = false; |
| | | boolean needsTranslationY = false; |
| | | |
| | | double lowestX = 0.0; |
| | | double lowestY = 0.0; |
| | | |
| | | // Collect lowest x and y |
| | | for (GraphicInfo graphicInfo : allGraphicInfos) { |
| | | |
| | | double x = graphicInfo.getX(); |
| | | double y = graphicInfo.getY(); |
| | | |
| | | if (x < lowestX) { |
| | | needsTranslationX = true; |
| | | lowestX = x; |
| | | } |
| | | if (y < lowestY) { |
| | | needsTranslationY = true; |
| | | lowestY = y; |
| | | } |
| | | |
| | | } |
| | | |
| | | // Update all graphicInfo objects |
| | | if (needsTranslationX || needsTranslationY) { |
| | | |
| | | double translationX = Math.abs(lowestX); |
| | | double translationY = Math.abs(lowestY); |
| | | |
| | | for (GraphicInfo graphicInfo : allGraphicInfos) { |
| | | if (needsTranslationX) { |
| | | graphicInfo.setX(graphicInfo.getX() + translationX); |
| | | } |
| | | if (needsTranslationY) { |
| | | graphicInfo.setY(graphicInfo.getY() + translationY); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | protected void drawActivity(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, |
| | | FlowNode flowNode, List<String> highLightedActivities, List<String> highLightedFlows, double scaleFactor, Boolean drawSequenceFlowNameWithNoLabelDI) { |
| | | |
| | | ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(flowNode.getClass()); |
| | | if (drawInstruction != null) { |
| | | |
| | | drawInstruction.draw(processDiagramCanvas, bpmnModel, flowNode); |
| | | |
| | | // Gather info on the multi instance marker |
| | | boolean multiInstanceSequential = false; |
| | | boolean multiInstanceParallel = false; |
| | | boolean collapsed = false; |
| | | if (flowNode instanceof Activity) { |
| | | Activity activity = (Activity) flowNode; |
| | | MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics(); |
| | | if (multiInstanceLoopCharacteristics != null) { |
| | | multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential(); |
| | | multiInstanceParallel = !multiInstanceSequential; |
| | | } |
| | | } |
| | | |
| | | // Gather info on the collapsed marker |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | if (flowNode instanceof SubProcess) { |
| | | collapsed = graphicInfo.getExpanded() != null && !graphicInfo.getExpanded(); |
| | | } else if (flowNode instanceof CallActivity) { |
| | | collapsed = true; |
| | | } |
| | | |
| | | if (scaleFactor == 1.0) { |
| | | // Actually draw the markers |
| | | processDiagramCanvas.drawActivityMarkers((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(), |
| | | multiInstanceSequential, multiInstanceParallel, collapsed); |
| | | } |
| | | |
| | | // Draw highlighted activities |
| | | if (highLightedActivities.contains(flowNode.getId())) { |
| | | drawHighLightRed(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); |
| | | } else if (highLightedActivities.contains(Color.RED.toString() + flowNode.getId())) { |
| | | drawHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); |
| | | } |
| | | |
| | | } else if (flowNode instanceof Task) { |
| | | activityDrawInstructions.get(Task.class).draw(processDiagramCanvas, bpmnModel, flowNode); |
| | | |
| | | if (highLightedActivities.contains(flowNode.getId())) { |
| | | drawHighLightRed(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); |
| | | } else if (highLightedActivities.contains(Color.RED.toString() + flowNode.getId())) { |
| | | drawHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); |
| | | } |
| | | } |
| | | |
| | | // Outgoing transitions of activity |
| | | for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { |
| | | boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId())); |
| | | String defaultFlow = null; |
| | | if (flowNode instanceof Activity) { |
| | | defaultFlow = ((Activity) flowNode).getDefaultFlow(); |
| | | } else if (flowNode instanceof Gateway) { |
| | | defaultFlow = ((Gateway) flowNode).getDefaultFlow(); |
| | | } |
| | | |
| | | boolean isDefault = false; |
| | | if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) { |
| | | isDefault = true; |
| | | } |
| | | boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null && sequenceFlow.getConditionExpression().trim().length() > 0 && !(flowNode instanceof Gateway); |
| | | |
| | | String sourceRef = sequenceFlow.getSourceRef(); |
| | | String targetRef = sequenceFlow.getTargetRef(); |
| | | FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef); |
| | | FlowElement targetElement = bpmnModel.getFlowElement(targetRef); |
| | | List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); |
| | | if (graphicInfoList != null && graphicInfoList.size() > 0) { |
| | | graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList); |
| | | int[] xPoints = new int[graphicInfoList.size()]; |
| | | int[] yPoints = new int[graphicInfoList.size()]; |
| | | |
| | | for (int i = 1; i < graphicInfoList.size(); i++) { |
| | | GraphicInfo graphicInfo = graphicInfoList.get(i); |
| | | GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1); |
| | | |
| | | if (i == 1) { |
| | | xPoints[0] = (int) previousGraphicInfo.getX(); |
| | | yPoints[0] = (int) previousGraphicInfo.getY(); |
| | | } |
| | | xPoints[i] = (int) graphicInfo.getX(); |
| | | yPoints[i] = (int) graphicInfo.getY(); |
| | | |
| | | } |
| | | |
| | | processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted, scaleFactor); |
| | | |
| | | // Draw sequenceflow label |
| | | GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId()); |
| | | if (labelGraphicInfo != null) { |
| | | processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false); |
| | | } else { |
| | | if (drawSequenceFlowNameWithNoLabelDI) { |
| | | GraphicInfo lineCenter = getLineCenter(graphicInfoList); |
| | | processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Nested elements |
| | | if (flowNode instanceof FlowElementsContainer) { |
| | | for (FlowElement nestedFlowElement : ((FlowElementsContainer) flowNode).getFlowElements()) { |
| | | if (nestedFlowElement instanceof FlowNode && !isPartOfCollapsedSubProcess(nestedFlowElement, bpmnModel)) { |
| | | drawActivity(processDiagramCanvas, bpmnModel, (FlowNode) nestedFlowElement, |
| | | highLightedActivities, highLightedFlows, scaleFactor, drawSequenceFlowNameWithNoLabelDI); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * This method makes coordinates of connection flow better. |
| | | * |
| | | * @param processDiagramCanvas |
| | | * @param bpmnModel |
| | | * @param sourceElement |
| | | * @param targetElement |
| | | * @param graphicInfoList |
| | | * @return |
| | | */ |
| | | protected static List<GraphicInfo> connectionPerfectionizer(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, BaseElement sourceElement, BaseElement targetElement, List<GraphicInfo> graphicInfoList) { |
| | | GraphicInfo sourceGraphicInfo = bpmnModel.getGraphicInfo(sourceElement.getId()); |
| | | GraphicInfo targetGraphicInfo = bpmnModel.getGraphicInfo(targetElement.getId()); |
| | | |
| | | CustomDefaultProcessDiagramCanvas.SHAPE_TYPE sourceShapeType = getShapeType(sourceElement); |
| | | CustomDefaultProcessDiagramCanvas.SHAPE_TYPE targetShapeType = getShapeType(targetElement); |
| | | |
| | | return processDiagramCanvas.connectionPerfectionizer(sourceShapeType, targetShapeType, sourceGraphicInfo, targetGraphicInfo, graphicInfoList); |
| | | } |
| | | |
| | | /** |
| | | * This method returns shape type of base element.<br> |
| | | * Each element can be presented as rectangle, rhombus, or ellipse. |
| | | * |
| | | * @param baseElement |
| | | * @return CustomDefaultProcessDiagramCanvas.SHAPE_TYPE |
| | | */ |
| | | protected static CustomDefaultProcessDiagramCanvas.SHAPE_TYPE getShapeType(BaseElement baseElement) { |
| | | if (baseElement instanceof Task || baseElement instanceof Activity || baseElement instanceof TextAnnotation) { |
| | | return CustomDefaultProcessDiagramCanvas.SHAPE_TYPE.Rectangle; |
| | | } else if (baseElement instanceof Gateway) { |
| | | return CustomDefaultProcessDiagramCanvas.SHAPE_TYPE.Rhombus; |
| | | } else if (baseElement instanceof Event) { |
| | | return CustomDefaultProcessDiagramCanvas.SHAPE_TYPE.Ellipse; |
| | | } else { |
| | | // unknown source element, just do not correct coordinates |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | protected static GraphicInfo getLineCenter(List<GraphicInfo> graphicInfoList) { |
| | | GraphicInfo gi = new GraphicInfo(); |
| | | |
| | | int[] xPoints = new int[graphicInfoList.size()]; |
| | | int[] yPoints = new int[graphicInfoList.size()]; |
| | | |
| | | double length = 0; |
| | | double[] lengths = new double[graphicInfoList.size()]; |
| | | lengths[0] = 0; |
| | | double m; |
| | | for (int i = 1; i < graphicInfoList.size(); i++) { |
| | | GraphicInfo graphicInfo = graphicInfoList.get(i); |
| | | GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1); |
| | | |
| | | if (i == 1) { |
| | | xPoints[0] = (int) previousGraphicInfo.getX(); |
| | | yPoints[0] = (int) previousGraphicInfo.getY(); |
| | | } |
| | | xPoints[i] = (int) graphicInfo.getX(); |
| | | yPoints[i] = (int) graphicInfo.getY(); |
| | | |
| | | length += Math.sqrt( |
| | | Math.pow((int) graphicInfo.getX() - (int) previousGraphicInfo.getX(), 2) + |
| | | Math.pow((int) graphicInfo.getY() - (int) previousGraphicInfo.getY(), 2)); |
| | | lengths[i] = length; |
| | | } |
| | | m = length / 2; |
| | | int p1 = 0; |
| | | int p2 = 1; |
| | | for (int i = 1; i < lengths.length; i++) { |
| | | double len = lengths[i]; |
| | | p1 = i - 1; |
| | | p2 = i; |
| | | if (len > m) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | GraphicInfo graphicInfo1 = graphicInfoList.get(p1); |
| | | GraphicInfo graphicInfo2 = graphicInfoList.get(p2); |
| | | |
| | | double AB = (int) graphicInfo2.getX() - (int) graphicInfo1.getX(); |
| | | double OA = (int) graphicInfo2.getY() - (int) graphicInfo1.getY(); |
| | | double OB = lengths[p2] - lengths[p1]; |
| | | double ob = m - lengths[p1]; |
| | | double ab = AB * ob / OB; |
| | | double oa = OA * ob / OB; |
| | | |
| | | double mx = graphicInfo1.getX() + ab; |
| | | double my = graphicInfo1.getY() + oa; |
| | | |
| | | gi.setX(mx); |
| | | gi.setY(my); |
| | | return gi; |
| | | } |
| | | |
| | | protected void drawArtifact(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) { |
| | | |
| | | ArtifactDrawInstruction drawInstruction = artifactDrawInstructions.get(artifact.getClass()); |
| | | if (drawInstruction != null) { |
| | | drawInstruction.draw(processDiagramCanvas, bpmnModel, artifact); |
| | | } |
| | | } |
| | | |
| | | private static void drawHighLight(CustomDefaultProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { |
| | | processDiagramCanvas.drawHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); |
| | | |
| | | } |
| | | |
| | | private static void drawHighLightRed(CustomDefaultProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { |
| | | processDiagramCanvas.drawHighLightRed((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); |
| | | |
| | | } |
| | | |
| | | protected static CustomDefaultProcessDiagramCanvas initProcessDiagramCanvas(BpmnModel bpmnModel, String imageType, |
| | | String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) { |
| | | |
| | | // We need to calculate maximum values to know how big the image will be in its entirety |
| | | double minX = Double.MAX_VALUE; |
| | | double maxX = 0; |
| | | double minY = Double.MAX_VALUE; |
| | | double maxY = 0; |
| | | |
| | | for (Pool pool : bpmnModel.getPools()) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId()); |
| | | minX = graphicInfo.getX(); |
| | | maxX = graphicInfo.getX() + graphicInfo.getWidth(); |
| | | minY = graphicInfo.getY(); |
| | | maxY = graphicInfo.getY() + graphicInfo.getHeight(); |
| | | } |
| | | |
| | | List<FlowNode> flowNodes = gatherAllFlowNodes(bpmnModel); |
| | | for (FlowNode flowNode : flowNodes) { |
| | | |
| | | GraphicInfo flowNodeGraphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); |
| | | |
| | | // width |
| | | if (flowNodeGraphicInfo.getX() + flowNodeGraphicInfo.getWidth() > maxX) { |
| | | maxX = flowNodeGraphicInfo.getX() + flowNodeGraphicInfo.getWidth(); |
| | | } |
| | | if (flowNodeGraphicInfo.getX() < minX) { |
| | | minX = flowNodeGraphicInfo.getX(); |
| | | } |
| | | // height |
| | | if (flowNodeGraphicInfo.getY() + flowNodeGraphicInfo.getHeight() > maxY) { |
| | | maxY = flowNodeGraphicInfo.getY() + flowNodeGraphicInfo.getHeight(); |
| | | } |
| | | if (flowNodeGraphicInfo.getY() < minY) { |
| | | minY = flowNodeGraphicInfo.getY(); |
| | | } |
| | | |
| | | for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { |
| | | List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); |
| | | if (graphicInfoList != null) { |
| | | for (GraphicInfo graphicInfo : graphicInfoList) { |
| | | // width |
| | | if (graphicInfo.getX() > maxX) { |
| | | maxX = graphicInfo.getX(); |
| | | } |
| | | if (graphicInfo.getX() < minX) { |
| | | minX = graphicInfo.getX(); |
| | | } |
| | | // height |
| | | if (graphicInfo.getY() > maxY) { |
| | | maxY = graphicInfo.getY(); |
| | | } |
| | | if (graphicInfo.getY() < minY) { |
| | | minY = graphicInfo.getY(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Artifact> artifacts = gatherAllArtifacts(bpmnModel); |
| | | for (Artifact artifact : artifacts) { |
| | | |
| | | GraphicInfo artifactGraphicInfo = bpmnModel.getGraphicInfo(artifact.getId()); |
| | | |
| | | if (artifactGraphicInfo != null) { |
| | | // width |
| | | if (artifactGraphicInfo.getX() + artifactGraphicInfo.getWidth() > maxX) { |
| | | maxX = artifactGraphicInfo.getX() + artifactGraphicInfo.getWidth(); |
| | | } |
| | | if (artifactGraphicInfo.getX() < minX) { |
| | | minX = artifactGraphicInfo.getX(); |
| | | } |
| | | // height |
| | | if (artifactGraphicInfo.getY() + artifactGraphicInfo.getHeight() > maxY) { |
| | | maxY = artifactGraphicInfo.getY() + artifactGraphicInfo.getHeight(); |
| | | } |
| | | if (artifactGraphicInfo.getY() < minY) { |
| | | minY = artifactGraphicInfo.getY(); |
| | | } |
| | | } |
| | | |
| | | List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(artifact.getId()); |
| | | if (graphicInfoList != null) { |
| | | for (GraphicInfo graphicInfo : graphicInfoList) { |
| | | // width |
| | | if (graphicInfo.getX() > maxX) { |
| | | maxX = graphicInfo.getX(); |
| | | } |
| | | if (graphicInfo.getX() < minX) { |
| | | minX = graphicInfo.getX(); |
| | | } |
| | | // height |
| | | if (graphicInfo.getY() > maxY) { |
| | | maxY = graphicInfo.getY(); |
| | | } |
| | | if (graphicInfo.getY() < minY) { |
| | | minY = graphicInfo.getY(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | int nrOfLanes = 0; |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | for (Lane l : process.getLanes()) { |
| | | |
| | | nrOfLanes++; |
| | | |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(l.getId()); |
| | | // // width |
| | | if (graphicInfo.getX() + graphicInfo.getWidth() > maxX) { |
| | | maxX = graphicInfo.getX() + graphicInfo.getWidth(); |
| | | } |
| | | if (graphicInfo.getX() < minX) { |
| | | minX = graphicInfo.getX(); |
| | | } |
| | | // height |
| | | if (graphicInfo.getY() + graphicInfo.getHeight() > maxY) { |
| | | maxY = graphicInfo.getY() + graphicInfo.getHeight(); |
| | | } |
| | | if (graphicInfo.getY() < minY) { |
| | | minY = graphicInfo.getY(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Special case, see https://activiti.atlassian.net/browse/ACT-1431 |
| | | if (flowNodes.isEmpty() && bpmnModel.getPools().isEmpty() && nrOfLanes == 0) { |
| | | // Nothing to show |
| | | minX = 0; |
| | | minY = 0; |
| | | } |
| | | |
| | | return new CustomDefaultProcessDiagramCanvas((int) maxX + 10, (int) maxY + 10, (int) minX, (int) minY, |
| | | imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); |
| | | } |
| | | |
| | | protected static List<Artifact> gatherAllArtifacts(BpmnModel bpmnModel) { |
| | | List<Artifact> artifacts = new ArrayList<>(); |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | artifacts.addAll(process.getArtifacts()); |
| | | } |
| | | return artifacts; |
| | | } |
| | | |
| | | protected static List<FlowNode> gatherAllFlowNodes(BpmnModel bpmnModel) { |
| | | List<FlowNode> flowNodes = new ArrayList<>(); |
| | | for (Process process : bpmnModel.getProcesses()) { |
| | | flowNodes.addAll(gatherAllFlowNodes(process)); |
| | | } |
| | | return flowNodes; |
| | | } |
| | | |
| | | protected static List<FlowNode> gatherAllFlowNodes(FlowElementsContainer flowElementsContainer) { |
| | | List<FlowNode> flowNodes = new ArrayList<>(); |
| | | for (FlowElement flowElement : flowElementsContainer.getFlowElements()) { |
| | | if (flowElement instanceof FlowNode) { |
| | | flowNodes.add((FlowNode) flowElement); |
| | | } |
| | | if (flowElement instanceof FlowElementsContainer) { |
| | | flowNodes.addAll(gatherAllFlowNodes((FlowElementsContainer) flowElement)); |
| | | } |
| | | } |
| | | return flowNodes; |
| | | } |
| | | |
| | | protected boolean isPartOfCollapsedSubProcess(FlowElement flowElement, BpmnModel model) { |
| | | SubProcess subProcess = flowElement.getSubProcess(); |
| | | if (subProcess != null) { |
| | | GraphicInfo graphicInfo = model.getGraphicInfo(subProcess.getId()); |
| | | if (graphicInfo != null && graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) { |
| | | return true; |
| | | } |
| | | |
| | | return isPartOfCollapsedSubProcess(subProcess, model); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public Map<Class<? extends BaseElement>, ActivityDrawInstruction> getActivityDrawInstructions() { |
| | | return activityDrawInstructions; |
| | | } |
| | | |
| | | public void setActivityDrawInstructions( |
| | | Map<Class<? extends BaseElement>, ActivityDrawInstruction> activityDrawInstructions) { |
| | | this.activityDrawInstructions = activityDrawInstructions; |
| | | } |
| | | |
| | | public Map<Class<? extends BaseElement>, ArtifactDrawInstruction> getArtifactDrawInstructions() { |
| | | return artifactDrawInstructions; |
| | | } |
| | | |
| | | public void setArtifactDrawInstructions( |
| | | Map<Class<? extends BaseElement>, ArtifactDrawInstruction> artifactDrawInstructions) { |
| | | this.artifactDrawInstructions = artifactDrawInstructions; |
| | | } |
| | | |
| | | protected interface ActivityDrawInstruction { |
| | | void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode); |
| | | } |
| | | |
| | | protected interface ArtifactDrawInstruction { |
| | | void draw(CustomDefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.NUMBER_OF_INSTANCES; |
| | | |
| | | /** |
| | | * 串è¡å ç¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | public class AddSequenceMultiInstanceCmd implements Command<Void> { |
| | | |
| | | /** |
| | | * æ§è¡id |
| | | */ |
| | | private final String executionId; |
| | | |
| | | /** |
| | | * ä¼ç¾äººåéåKEY |
| | | */ |
| | | private final String assigneeList; |
| | | |
| | | /** |
| | | * å ç¾äººå |
| | | */ |
| | | private final List<Long> assignees; |
| | | |
| | | public AddSequenceMultiInstanceCmd(String executionId, String assigneeList, List<Long> assignees) { |
| | | this.executionId = executionId; |
| | | this.assigneeList = assigneeList; |
| | | this.assignees = assignees; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute(CommandContext commandContext) { |
| | | ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); |
| | | ExecutionEntity entity = executionEntityManager.findById(executionId); |
| | | // å¤å®ä¾ä»»å¡æ»æ°å assignees.size() |
| | | if (entity.getVariable(NUMBER_OF_INSTANCES) instanceof Integer nrOfInstances) { |
| | | entity.setVariable(NUMBER_OF_INSTANCES, nrOfInstances + assignees.size()); |
| | | } |
| | | // 设置æµç¨åé |
| | | if (entity.getVariable(assigneeList) instanceof List<?> userIds) { |
| | | CollUtil.addAll(userIds, assignees); |
| | | Map<String, Object> variables = new HashMap<>(16); |
| | | variables.put(assigneeList, userIds); |
| | | entity.setVariables(variables); |
| | | } |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.system.domain.vo.SysOssVo; |
| | | import org.dromara.system.service.ISysOssService; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.AttachmentEntity; |
| | | import org.flowable.engine.impl.persistence.entity.AttachmentEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 串è¡å ç¾ |
| | | * |
| | | * @author éä»¶ä¸ä¼ |
| | | */ |
| | | public class AttachmentCmd implements Command<Boolean> { |
| | | |
| | | private final String fileId; |
| | | |
| | | private final String taskId; |
| | | |
| | | private final String processInstanceId; |
| | | |
| | | public AttachmentCmd(String fileId, String taskId, String processInstanceId) { |
| | | this.fileId = fileId; |
| | | this.taskId = taskId; |
| | | this.processInstanceId = processInstanceId; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean execute(CommandContext commandContext) { |
| | | try { |
| | | if (StringUtils.isNotBlank(fileId)) { |
| | | List<Long> fileIds = StreamUtils.toList(Arrays.asList(fileId.split(StrUtil.COMMA)), Long::valueOf); |
| | | List<SysOssVo> sysOssVos = SpringUtils.getBean(ISysOssService.class).listByIds(fileIds); |
| | | if (CollUtil.isNotEmpty(sysOssVos)) { |
| | | for (SysOssVo sysOssVo : sysOssVos) { |
| | | AttachmentEntityManager attachmentEntityManager = CommandContextUtil.getAttachmentEntityManager(); |
| | | AttachmentEntity attachmentEntity = attachmentEntityManager.create(); |
| | | attachmentEntity.setRevision(1); |
| | | attachmentEntity.setUserId(LoginHelper.getUserId().toString()); |
| | | attachmentEntity.setName(sysOssVo.getOriginalName()); |
| | | attachmentEntity.setDescription(sysOssVo.getOriginalName()); |
| | | attachmentEntity.setType(sysOssVo.getFileSuffix()); |
| | | attachmentEntity.setTaskId(taskId); |
| | | attachmentEntity.setProcessInstanceId(processInstanceId); |
| | | attachmentEntity.setContentId(sysOssVo.getOssId().toString()); |
| | | attachmentEntity.setTime(new Date()); |
| | | attachmentEntityManager.insert(attachmentEntity); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return true; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å 餿§è¡æ°æ® |
| | | * |
| | | * @author may |
| | | */ |
| | | public class DeleteExecutionCmd implements Command<Void>, Serializable { |
| | | |
| | | /** |
| | | * æ§è¡id |
| | | */ |
| | | private final String executionId; |
| | | |
| | | public DeleteExecutionCmd(String executionId) { |
| | | this.executionId = executionId; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute(CommandContext commandContext) { |
| | | ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); |
| | | ExecutionEntity entity = executionEntityManager.findById(executionId); |
| | | if (entity != null) { |
| | | executionEntityManager.deleteExecutionAndRelatedData(entity, "", false, false); |
| | | } |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.LOOP_COUNTER; |
| | | import static org.dromara.workflow.common.constant.FlowConstant.NUMBER_OF_INSTANCES; |
| | | |
| | | |
| | | /** |
| | | * 串è¡åç¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @AllArgsConstructor |
| | | public class DeleteSequenceMultiInstanceCmd implements Command<Void> { |
| | | |
| | | /** |
| | | * å½åèç¹å®¡æ¹äººåid |
| | | */ |
| | | private final String currentUserId; |
| | | |
| | | /** |
| | | * æ§è¡id |
| | | */ |
| | | private final String executionId; |
| | | |
| | | /** |
| | | * ä¼ç¾äººåéåKEY |
| | | */ |
| | | private final String assigneeList; |
| | | |
| | | /** |
| | | * åç¾äººå |
| | | */ |
| | | private final List<Long> assignees; |
| | | |
| | | |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | public Void execute(CommandContext commandContext) { |
| | | ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); |
| | | ExecutionEntity entity = executionEntityManager.findById(executionId); |
| | | // 设置æµç¨åé |
| | | List<Long> userIds = new ArrayList<>(); |
| | | List<Object> variable = (List<Object>) entity.getVariable(assigneeList); |
| | | for (Object o : variable) { |
| | | userIds.add(Long.valueOf(o.toString())); |
| | | } |
| | | List<Long> userIdList = new ArrayList<>(); |
| | | userIds.forEach(e -> { |
| | | Long userId = assignees.stream().filter(id -> ObjectUtil.equals(id, e)).findFirst().orElse(null); |
| | | if (userId == null) { |
| | | userIdList.add(e); |
| | | } |
| | | }); |
| | | // å½å任塿§è¡ä½ç½® |
| | | int loopCounterIndex = -1; |
| | | for (int i = 0; i < userIdList.size(); i++) { |
| | | Long userId = userIdList.get(i); |
| | | if (currentUserId.equals(userId.toString())) { |
| | | loopCounterIndex = i; |
| | | } |
| | | } |
| | | Map<String, Object> variables = new HashMap<>(16); |
| | | variables.put(NUMBER_OF_INSTANCES, userIdList.size()); |
| | | variables.put(assigneeList, userIdList); |
| | | variables.put(LOOP_COUNTER, loopCounterIndex); |
| | | entity.setVariables(variables); |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è·åå¹¶è¡ç½å
³æ§è¡åä¿ççæ§è¡å®ä¾æ°æ® |
| | | * |
| | | * @author may |
| | | */ |
| | | public class ExecutionChildByExecutionIdCmd implements Command<List<ExecutionEntity>>, Serializable { |
| | | |
| | | /** |
| | | * å½å任塿§è¡å®ä¾id |
| | | */ |
| | | private final String executionId; |
| | | |
| | | public ExecutionChildByExecutionIdCmd(String executionId) { |
| | | this.executionId = executionId; |
| | | } |
| | | |
| | | @Override |
| | | public List<ExecutionEntity> execute(CommandContext commandContext) { |
| | | ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); |
| | | // è·åå½åæ§è¡æ°æ® |
| | | ExecutionEntity executionEntity = executionEntityManager.findById(executionId); |
| | | // éè¿å½åæ§è¡æ°æ®çç¶æ§è¡ï¼æ¥è¯¢ææåæ§è¡æ°æ® |
| | | List<ExecutionEntity> allChildrenExecution = |
| | | executionEntityManager.collectChildren(executionEntity.getParent()); |
| | | return StreamUtils.filter(allChildrenExecution, e -> !e.isActive()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntity; |
| | | import org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntityManager; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨ç¶æ |
| | | * |
| | | * @author may |
| | | */ |
| | | public class UpdateBusinessStatusCmd implements Command<Boolean> { |
| | | |
| | | private final String processInstanceId; |
| | | private final String status; |
| | | |
| | | public UpdateBusinessStatusCmd(String processInstanceId, String status) { |
| | | this.processInstanceId = processInstanceId; |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean execute(CommandContext commandContext) { |
| | | try { |
| | | HistoricProcessInstanceEntityManager manager = CommandContextUtil.getHistoricProcessInstanceEntityManager(); |
| | | HistoricProcessInstanceEntity processInstance = manager.findById(processInstanceId); |
| | | processInstance.setBusinessStatus(status); |
| | | manager.update(processInstance); |
| | | return true; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.cmd; |
| | | |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.flowable.common.engine.impl.interceptor.Command; |
| | | import org.flowable.common.engine.impl.interceptor.CommandContext; |
| | | import org.flowable.engine.impl.util.CommandContextUtil; |
| | | import org.flowable.task.service.HistoricTaskService; |
| | | import org.flowable.task.service.impl.persistence.entity.HistoricTaskInstanceEntity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åå² |
| | | * |
| | | * @author may |
| | | */ |
| | | public class UpdateHiTaskInstCmd implements Command<Boolean> { |
| | | |
| | | private final List<String> taskIds; |
| | | |
| | | private final String processDefinitionId; |
| | | |
| | | private final String processInstanceId; |
| | | |
| | | public UpdateHiTaskInstCmd(List<String> taskIds, String processDefinitionId, String processInstanceId) { |
| | | this.taskIds = taskIds; |
| | | this.processDefinitionId = processDefinitionId; |
| | | this.processInstanceId = processInstanceId; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean execute(CommandContext commandContext) { |
| | | try { |
| | | HistoricTaskService historicTaskService = CommandContextUtil.getHistoricTaskService(); |
| | | for (String taskId : taskIds) { |
| | | HistoricTaskInstanceEntity historicTask = historicTaskService.getHistoricTask(taskId); |
| | | if (historicTask != null) { |
| | | historicTask.setProcessDefinitionId(processDefinitionId); |
| | | historicTask.setProcessInstanceId(processInstanceId); |
| | | historicTask.setCreateTime(new Date()); |
| | | CommandContextUtil.getHistoricTaskService().updateHistoricTask(historicTask, true); |
| | | } |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import org.flowable.common.engine.impl.cfg.IdGenerator; |
| | | import org.flowable.spring.SpringProcessEngineConfiguration; |
| | | import org.flowable.spring.boot.EngineConfigurationConfigurer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Collections; |
| | | |
| | | |
| | | /** |
| | | * flowableé
ç½® |
| | | * |
| | | * @author may |
| | | */ |
| | | @Configuration |
| | | public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> { |
| | | |
| | | @Autowired |
| | | private GlobalFlowableListener globalFlowableListener; |
| | | @Autowired |
| | | private IdentifierGenerator identifierGenerator; |
| | | |
| | | @Override |
| | | public void configure(SpringProcessEngineConfiguration processEngineConfiguration) { |
| | | processEngineConfiguration.setIdGenerator(() -> identifierGenerator.nextId(null).toString()); |
| | | processEngineConfiguration.setEventListeners(Collections.singletonList(globalFlowableListener)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.config; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.flowable.bpmn.model.BoundaryEvent; |
| | | import org.flowable.bpmn.model.BpmnModel; |
| | | import org.flowable.bpmn.model.FlowElement; |
| | | import org.flowable.common.engine.api.delegate.event.*; |
| | | import org.flowable.common.engine.impl.cfg.TransactionState; |
| | | import org.flowable.engine.RepositoryService; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.runtime.Execution; |
| | | import org.flowable.engine.task.Comment; |
| | | import org.flowable.task.api.Task; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 弿è°åº¦çå¬ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Component |
| | | public class GlobalFlowableListener implements FlowableEventListener { |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private TaskService taskService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private RuntimeService runtimeService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private RepositoryService repositoryService; |
| | | |
| | | @Override |
| | | public void onEvent(FlowableEvent flowableEvent) { |
| | | if (flowableEvent instanceof FlowableEngineEvent flowableEngineEvent) { |
| | | FlowableEngineEventType engineEventType = (FlowableEngineEventType) flowableEvent.getType(); |
| | | switch (engineEventType) { |
| | | case JOB_EXECUTION_SUCCESS -> jobExecutionSuccess((FlowableEngineEntityEvent) flowableEngineEvent); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFailOnException() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFireOnTransactionLifecycleEvent() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String getOnTransaction() { |
| | | return TransactionState.COMMITTED.name(); |
| | | } |
| | | |
| | | /** |
| | | * å¤çè¾¹ç宿¶äºä»¶èªå¨å®¡æ¹è®°å½ |
| | | * |
| | | * @param event äºä»¶ |
| | | */ |
| | | protected void jobExecutionSuccess(FlowableEngineEntityEvent event) { |
| | | Execution execution = runtimeService.createExecutionQuery().executionId(event.getExecutionId()).singleResult(); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(event.getProcessDefinitionId()); |
| | | FlowElement flowElement = bpmnModel.getFlowElement(execution.getActivityId()); |
| | | if (flowElement instanceof BoundaryEvent) { |
| | | String attachedToRefId = ((BoundaryEvent) flowElement).getAttachedToRefId(); |
| | | List<Execution> list = runtimeService.createExecutionQuery().activityId(attachedToRefId).list(); |
| | | for (Execution ex : list) { |
| | | Task task = taskService.createTaskQuery().executionId(ex.getId()).singleResult(); |
| | | if (task != null) { |
| | | List<Comment> taskComments = taskService.getTaskComments(task.getId()); |
| | | if (CollUtil.isEmpty(taskComments)) { |
| | | taskService.addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), "è¶
æ¶èªå¨å®¡æ¹ï¼"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.strategy; |
| | | |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.workflow.annotation.FlowListenerAnnotation; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.config.BeanPostProcessor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨ä»»å¡çå¬çç¥ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | @Component |
| | | public class FlowEventStrategy implements BeanPostProcessor { |
| | | |
| | | private final Map<String, FlowTaskEventHandler> flowTaskEventHandlers = new HashMap<>(); |
| | | private final Map<String, FlowProcessEventHandler> flowProcessEventHandlers = new HashMap<>(); |
| | | |
| | | @Override |
| | | public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { |
| | | if (bean instanceof FlowTaskEventHandler) { |
| | | FlowListenerAnnotation annotation = bean.getClass().getAnnotation(FlowListenerAnnotation.class); |
| | | if (null != annotation) { |
| | | if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isNotBlank(annotation.taskDefId())) { |
| | | String id = annotation.processDefinitionKey() + "_" + annotation.taskDefId(); |
| | | if (!flowTaskEventHandlers.containsKey(id)) { |
| | | flowTaskEventHandlers.put(id, (FlowTaskEventHandler) bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (bean instanceof FlowProcessEventHandler) { |
| | | FlowListenerAnnotation annotation = bean.getClass().getAnnotation(FlowListenerAnnotation.class); |
| | | if (null != annotation) { |
| | | if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isBlank(annotation.taskDefId())) { |
| | | if (!flowProcessEventHandlers.containsKey(annotation.processDefinitionKey())) { |
| | | flowProcessEventHandlers.put(annotation.processDefinitionKey(), (FlowProcessEventHandler) bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName); |
| | | } |
| | | |
| | | /** |
| | | * è·å坿§è¡bean |
| | | * |
| | | * @param key key |
| | | */ |
| | | public FlowTaskEventHandler getTaskHandler(String key) { |
| | | if (!flowTaskEventHandlers.containsKey(key)) { |
| | | return null; |
| | | } |
| | | return flowTaskEventHandlers.get(key); |
| | | } |
| | | |
| | | /** |
| | | * è·å坿§è¡bean |
| | | * |
| | | * @param key key |
| | | */ |
| | | public FlowProcessEventHandler getProcessHandler(String key) { |
| | | if (!flowProcessEventHandlers.containsKey(key)) { |
| | | return null; |
| | | } |
| | | return flowProcessEventHandlers.get(key); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.strategy; |
| | | |
| | | |
| | | /** |
| | | * æµç¨çå¬ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | public interface FlowProcessEventHandler { |
| | | |
| | | /** |
| | | * æ§è¡åçä»»å¡çå¬ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @param status ç¶æ |
| | | * @param submit å½ä¸ºtrueæ¶ä¸ºç³è¯·äººèç¹åç |
| | | */ |
| | | void handleProcess(String businessKey, String status, boolean submit); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.flowable.strategy; |
| | | |
| | | import org.flowable.task.api.Task; |
| | | |
| | | /** |
| | | * æµç¨ä»»å¡çå¬ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | public interface FlowTaskEventHandler { |
| | | |
| | | /** |
| | | * æ§è¡åçä»»å¡çå¬ |
| | | * |
| | | * @param task ä»»å¡ |
| | | * @param businessKey ä¸å¡id |
| | | */ |
| | | void handleTask(Task task, String businessKey); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.listener; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.workflow.annotation.FlowListenerAnnotation; |
| | | import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * èªå®ä¹ç嬿µè¯ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @FlowListenerAnnotation(processDefinitionKey = "leave1") |
| | | public class TestCustomProcessHandler implements FlowProcessEventHandler { |
| | | |
| | | |
| | | @Override |
| | | public void handleProcess(String businessKey, String status, boolean submit) { |
| | | log.info("ä¸å¡ID:" + businessKey + ",ç¶æ:" + status); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.listener; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.workflow.annotation.FlowListenerAnnotation; |
| | | import org.dromara.workflow.flowable.strategy.FlowTaskEventHandler; |
| | | import org.flowable.task.api.Task; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * èªå®ä¹ç嬿µè¯ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-27 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @FlowListenerAnnotation(processDefinitionKey = "leave1", taskDefId = "Activity_14633hx") |
| | | public class TestCustomTaskHandler implements FlowTaskEventHandler { |
| | | |
| | | @Override |
| | | public void handleTask(Task task, String businessKey) { |
| | | log.info("ä»»å¡åç§°:" + task.getName() + ",ä¸å¡ID:" + businessKey); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.listener; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.delegate.DelegateExecution; |
| | | import org.flowable.engine.delegate.ExecutionListener; |
| | | import org.flowable.task.api.Task; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ç嬿µè¯ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-12 |
| | | */ |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Component("testLeaveExecutionListener") |
| | | public class TestLeaveExecutionListener implements ExecutionListener { |
| | | |
| | | private final TaskService taskService; |
| | | |
| | | @Override |
| | | public void notify(DelegateExecution execution) { |
| | | Task task = taskService.createTaskQuery().executionId(execution.getId()).singleResult(); |
| | | log.info("æ§è¡çå¬ã" + task.getName() + "ã"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.listener; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.task.service.delegate.DelegateTask; |
| | | import org.flowable.task.service.delegate.TaskListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * æµç¨ä»»å¡ç嬿µè¯ |
| | | * |
| | | * @author may |
| | | * @date 2023-12-12 |
| | | */ |
| | | @Slf4j |
| | | @Component("testLeaveTaskListener") |
| | | public class TestLeaveTaskListener implements TaskListener { |
| | | @Override |
| | | public void notify(DelegateTask delegateTask) { |
| | | log.info("æ§è¡çå¬ã" + delegateTask.getName() + "ã"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾Mapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-07-22 |
| | | */ |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | public interface ActHiProcinstMapper extends BaseMapperPlus<ActHiProcinst, ActHiProcinst> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import org.dromara.workflow.domain.ActHiTaskinst; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | /** |
| | | * æµç¨åå²ä»»å¡Mapperæ¥å£ |
| | | * |
| | | * @author gssong |
| | | * @date 2024-03-02 |
| | | */ |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | public interface ActHiTaskinstMapper extends BaseMapperPlus<ActHiTaskinst, ActHiTaskinst> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | |
| | | |
| | | /** |
| | | * ä»»å¡ä¿¡æ¯Mapperæ¥å£ |
| | | * |
| | | * @author gssong |
| | | * @date 2024-03-02 |
| | | */ |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | public interface ActTaskMapper extends BaseMapperPlus<TaskVo, TaskVo> { |
| | | /** |
| | | * è·åå¾
åä¿¡æ¯ |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<TaskVo> getTaskWaitByPage(@Param("page") Page<TaskVo> page, @Param(Constants.WRAPPER) Wrapper<TaskVo> queryWrapper); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<TaskVo> getTaskCopyByPage(@Param("page") Page<TaskVo> page, @Param(Constants.WRAPPER) QueryWrapper<TaskVo> queryWrapper); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | |
| | | /** |
| | | * 请åMapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | public interface TestLeaveMapper extends BaseMapperPlus<TestLeave, TestLeaveVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | import org.dromara.workflow.domain.vo.WfCategoryVo; |
| | | |
| | | /** |
| | | * æµç¨åç±»Mapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | public interface WfCategoryMapper extends BaseMapperPlus<WfCategory, WfCategoryVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾Serviceæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-07-22 |
| | | */ |
| | | public interface IActHiProcinstService { |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<ActHiProcinst> selectByBusinessKeyIn(List<String> businessKeys); |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | ActHiProcinst selectByBusinessKey(String businessKey); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | |
| | | /** |
| | | * æµç¨åå²ä»»å¡Serviceæ¥å£ |
| | | * |
| | | * @author gssong |
| | | * @date 2024-03-02 |
| | | */ |
| | | public interface IActHiTaskinstService { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.bo.ModelBo; |
| | | import org.dromara.workflow.domain.vo.ModelVo; |
| | | import org.flowable.engine.repository.Model; |
| | | |
| | | |
| | | /** |
| | | * 模åç®¡ç æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IActModelService { |
| | | /** |
| | | * å页æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param modelBo 模ååæ° |
| | | * @return è¿åå页å表 |
| | | */ |
| | | TableDataInfo<Model> page(ModelBo modelBo); |
| | | |
| | | /** |
| | | * æ°å¢æ¨¡å |
| | | * |
| | | * @param modelBo 模å请æ±å¯¹è±¡ |
| | | * @return ç»æ |
| | | */ |
| | | boolean saveNewModel(ModelBo modelBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param modelId 模åid |
| | | * @return æ¨¡åæ°æ® |
| | | */ |
| | | ModelVo getInfo(String modelId); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡åä¿¡æ¯ |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | * @return ç»æ |
| | | */ |
| | | boolean update(ModelBo modelBo); |
| | | |
| | | /** |
| | | * ç¼è¾æ¨¡åXML |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | * @return ç»æ |
| | | */ |
| | | boolean editModelXml(ModelBo modelBo); |
| | | |
| | | /** |
| | | * 模åé¨ç½² |
| | | * |
| | | * @param id 模åid |
| | | * @return ç»æ |
| | | */ |
| | | boolean modelDeploy(String id); |
| | | |
| | | /** |
| | | * å¯¼åºæ¨¡åzipå缩å
|
| | | * |
| | | * @param modelId 模åid |
| | | * @param response ç¸åº |
| | | */ |
| | | void exportZip(String modelId, HttpServletResponse response); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.bo.ProcessDefinitionBo; |
| | | import org.dromara.workflow.domain.vo.ProcessDefinitionVo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IActProcessDefinitionService { |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param processDefinitionBo åæ° |
| | | * @return è¿åå页å表 |
| | | */ |
| | | TableDataInfo<ProcessDefinitionVo> page(ProcessDefinitionBo processDefinitionBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å岿µç¨å®ä¹å表 |
| | | * |
| | | * @param key æµç¨å®ä¹key |
| | | * @return ç»æ |
| | | */ |
| | | List<ProcessDefinitionVo> getProcessDefinitionListByKey(String key); |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹å¾ç |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | String processDefinitionImage(String processDefinitionId); |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹xmlæä»¶ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | String processDefinitionXml(String processDefinitionId); |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param deploymentId é¨ç½²id |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteDeployment(String deploymentId, String processDefinitionId); |
| | | |
| | | /** |
| | | * æ¿æ´»æè
æèµ·æµç¨å®ä¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean updateProcessDefState(String processDefinitionId); |
| | | |
| | | /** |
| | | * è¿ç§»æµç¨å®ä¹ |
| | | * |
| | | * @param currentProcessDefinitionId å½åæµç¨å®ä¹id |
| | | * @param fromProcessDefinitionId éè¦è¿ç§»å°çæµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean migrationProcessDefinition(String currentProcessDefinitionId, String fromProcessDefinitionId); |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è½¬æ¢ä¸ºæ¨¡å |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean convertToModel(String processDefinitionId); |
| | | |
| | | /** |
| | | * éè¿zipæxmlé¨ç½²æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param categoryCode åç±» |
| | | * @return ç»æ |
| | | */ |
| | | boolean deployByFile(MultipartFile file, String categoryCode); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.bo.ProcessInstanceBo; |
| | | import org.dromara.workflow.domain.bo.ProcessInvalidBo; |
| | | import org.dromara.workflow.domain.bo.TaskUrgingBo; |
| | | import org.dromara.workflow.domain.vo.ProcessInstanceVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IActProcessInstanceService { |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | String getHistoryProcessImage(String processInstanceId); |
| | | |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾è¿è¡ä¸ï¼åå²çèç¹ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | Map<String, Object> getHistoryProcessList(String processInstanceId); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<ProcessInstanceVo> getProcessInstanceRunningByPage(ProcessInstanceBo processInstanceBo); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·²ç»æçæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<ProcessInstanceVo> getProcessInstanceFinishByPage(ProcessInstanceBo processInstanceBo); |
| | | |
| | | /** |
| | | * è·å审æ¹è®°å½ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | Map<String, Object> getHistoryRecord(String processInstanceId); |
| | | |
| | | /** |
| | | * ä½åºæµç¨å®ä¾ï¼ä¸ä¼å é¤åå²è®°å½(å é¤è¿è¡ä¸çå®ä¾) |
| | | * |
| | | * @param processInvalidBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteRuntimeProcessInst(ProcessInvalidBo processInvalidBo); |
| | | |
| | | /** |
| | | * è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteRuntimeProcessAndHisInst(List<String> processInstanceIds); |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå é¤ è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteRuntimeProcessAndHisInstByBusinessKeys(List<String> businessKeys); |
| | | |
| | | /** |
| | | * 已宿çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteFinishProcessAndHisInst(List<String> processInstanceIds); |
| | | |
| | | /** |
| | | * æ¤éæµç¨ç³è¯· |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | boolean cancelProcessApply(String processInstanceId); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å½åç»å½äººåæ® |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<ProcessInstanceVo> getCurrentSubmitByPage(ProcessInstanceBo processInstanceBo); |
| | | |
| | | /** |
| | | * ä»»å¡å¬å(ç»å½åä»»å¡åç人åéç«å
ä¿¡ï¼é®ä»¶ï¼çä¿¡ç) |
| | | * |
| | | * @param taskUrgingBo ä»»å¡å¬å |
| | | * @return ç»æ |
| | | */ |
| | | boolean taskUrging(TaskUrgingBo taskUrgingBo); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä»»å¡ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IActTaskService { |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | * @return ç»æ |
| | | */ |
| | | Map<String, Object> startWorkFlow(StartProcessBo startProcessBo); |
| | | |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean completeTask(CompleteTaskBo completeTaskBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<TaskVo> getTaskWaitByPage(TaskBo taskBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<TaskVo> getAllTaskWaitByPage(TaskBo taskBo); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<TaskVo> getTaskFinishByPage(TaskBo taskBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param taskBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<TaskVo> getTaskCopyByPage(TaskBo taskBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<TaskVo> getAllTaskFinishByPage(TaskBo taskBo); |
| | | |
| | | /** |
| | | * å§æ´¾ä»»å¡ |
| | | * |
| | | * @param delegateBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean delegateTask(DelegateBo delegateBo); |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param terminationBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean terminationTask(TerminationBo terminationBo); |
| | | |
| | | /** |
| | | * 转åä»»å¡ |
| | | * |
| | | * @param transmitBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean transferTask(TransmitBo transmitBo); |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡å ç¾ |
| | | * |
| | | * @param addMultiBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean addMultiInstanceExecution(AddMultiBo addMultiBo); |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡åç¾ |
| | | * |
| | | * @param deleteMultiBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteMultiInstanceExecution(DeleteMultiBo deleteMultiBo); |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param backProcessBo åæ° |
| | | * @return æµç¨å®ä¾id |
| | | */ |
| | | String backProcess(BackProcessBo backProcessBo); |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIds ä»»å¡id |
| | | * @param userId åç人id |
| | | * @return ç»æ |
| | | */ |
| | | boolean updateAssignee(String[] taskIds, String userId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 请åServiceæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | public interface ITestLeaveService { |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·å |
| | | */ |
| | | TestLeaveVo queryById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | TableDataInfo<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | List<TestLeaveVo> queryList(TestLeaveBo bo); |
| | | |
| | | /** |
| | | * æ°å¢è¯·å |
| | | */ |
| | | TestLeave insertByBo(TestLeaveBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹è¯·å |
| | | */ |
| | | TestLeave updateByBo(TestLeaveBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤è¯·åä¿¡æ¯ |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | import org.dromara.workflow.domain.bo.WfCategoryBo; |
| | | import org.dromara.workflow.domain.vo.WfCategoryVo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±»Serviceæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-06-28 |
| | | */ |
| | | public interface IWfCategoryService { |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±» |
| | | */ |
| | | WfCategoryVo queryById(Long id); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | */ |
| | | List<WfCategoryVo> queryList(WfCategoryBo bo); |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | */ |
| | | Boolean insertByBo(WfCategoryBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | */ |
| | | Boolean updateByBo(WfCategoryBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå 餿µç¨åç±»ä¿¡æ¯ |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | /** |
| | | * æç
§ç±»å«ç¼ç æ¥è¯¢ |
| | | * |
| | | * @param categoryCode åç±»æ¯å |
| | | * @return ç»æ |
| | | */ |
| | | WfCategory queryByCategoryCode(String categoryCode); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.system.domain.SysUserRole; |
| | | import org.dromara.system.domain.bo.SysUserBo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.workflow.domain.bo.SysUserMultiBo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 工使µç¨æ·éäººç®¡ç æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IWorkflowUserService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥ä½æµéæ©å ç¾äººå |
| | | * |
| | | * @param sysUserMultiBo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<SysUserVo> getWorkflowAddMultiInstanceByPage(SysUserMultiBo sysUserMultiBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥ä½æµéæ©åç¾äººå |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<TaskVo> getWorkflowDeleteMultiInstanceList(String taskId); |
| | | |
| | | /** |
| | | * æç
§ç¨æ·idæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param userIds ç¨æ·id |
| | | * @return ç»æ |
| | | */ |
| | | List<SysUserVo> getUserListByIds(List<Long> userIds); |
| | | |
| | | /** |
| | | * æç
§è§è²idæ¥è¯¢å
³èç¨æ·id |
| | | * |
| | | * @param roleIds è§è²id |
| | | * @return ç»æ |
| | | */ |
| | | List<SysUserRole> getUserRoleListByRoleIds(List<Long> roleIds); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ· |
| | | * |
| | | * @param sysUserBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<SysUserVo> getUserListByPage(SysUserBo sysUserBo, PageQuery pageQuery); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | import org.dromara.workflow.mapper.ActHiProcinstMapper; |
| | | import org.dromara.workflow.service.IActHiProcinstService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å®ä¾Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author may |
| | | * @date 2023-07-22 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActHiProcinstServiceImpl implements IActHiProcinstService { |
| | | |
| | | private final ActHiProcinstMapper baseMapper; |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | */ |
| | | @Override |
| | | public List<ActHiProcinst> selectByBusinessKeyIn(List<String> businessKeys) { |
| | | return baseMapper.selectList(new LambdaQueryWrapper<ActHiProcinst>() |
| | | .in(ActHiProcinst::getBusinessKey, businessKeys) |
| | | .eq(TenantHelper.isEnable(), ActHiProcinst::getTenantId, TenantHelper.getTenantId())); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | */ |
| | | @Override |
| | | public ActHiProcinst selectByBusinessKey(String businessKey) { |
| | | return baseMapper.selectOne(new LambdaQueryWrapper<ActHiProcinst>() |
| | | .eq(ActHiProcinst::getBusinessKey, businessKey) |
| | | .eq(TenantHelper.isEnable(), ActHiProcinst::getTenantId, TenantHelper.getTenantId())); |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.workflow.service.IActHiTaskinstService; |
| | | |
| | | |
| | | /** |
| | | * æµç¨åå²ä»»å¡Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author gssong |
| | | * @date 2024-03-02 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActHiTaskinstServiceImpl implements IActHiTaskinstService { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Validator; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.core.util.ZipUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.batik.transcoder.TranscoderInput; |
| | | import org.apache.batik.transcoder.TranscoderOutput; |
| | | import org.apache.batik.transcoder.image.PNGTranscoder; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.domain.bo.ModelBo; |
| | | import org.dromara.workflow.domain.vo.ModelVo; |
| | | import org.dromara.workflow.service.IActModelService; |
| | | import org.dromara.workflow.utils.ModelUtils; |
| | | import org.flowable.bpmn.model.BpmnModel; |
| | | import org.flowable.engine.RepositoryService; |
| | | 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.flowable.validation.ValidationError; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * 模åç®¡ç æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActModelServiceImpl implements IActModelService { |
| | | |
| | | private final RepositoryService repositoryService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param modelBo 模ååæ° |
| | | * @return è¿åå页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<Model> page(ModelBo modelBo) { |
| | | ModelQuery query = repositoryService.createModelQuery(); |
| | | query.modelTenantId(TenantHelper.getTenantId()); |
| | | if (StringUtils.isNotEmpty(modelBo.getName())) { |
| | | query.modelNameLike("%" + modelBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotEmpty(modelBo.getKey())) { |
| | | query.modelKey(modelBo.getKey()); |
| | | } |
| | | if (StringUtils.isNotEmpty(modelBo.getCategoryCode())) { |
| | | query.modelCategory(modelBo.getCategoryCode()); |
| | | } |
| | | query.orderByLastUpdateTime().desc(); |
| | | // å建æ¶é´éåºæå |
| | | query.orderByCreateTime().desc(); |
| | | // å页æ¥è¯¢ |
| | | List<Model> modelList = query.listPage(modelBo.getPageNum(), modelBo.getPageSize()); |
| | | // æ»è®°å½æ° |
| | | long total = query.count(); |
| | | return new TableDataInfo<>(modelList, total); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨¡å |
| | | * |
| | | * @param modelBo 模å请æ±å¯¹è±¡ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveNewModel(ModelBo modelBo) { |
| | | try { |
| | | int version = 0; |
| | | String key = modelBo.getKey(); |
| | | String name = modelBo.getName(); |
| | | String description = modelBo.getDescription(); |
| | | String categoryCode = modelBo.getCategoryCode(); |
| | | String xml = modelBo.getXml(); |
| | | Model checkModel = repositoryService.createModelQuery().modelKey(key).modelTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (ObjectUtil.isNotNull(checkModel)) { |
| | | throw new ServiceException("模åkeyå·²åå¨ï¼"); |
| | | } |
| | | //åå§ç©ºç模å |
| | | Model model = repositoryService.newModel(); |
| | | model.setKey(key); |
| | | model.setName(name); |
| | | model.setVersion(version); |
| | | model.setCategory(categoryCode); |
| | | model.setMetaInfo(description); |
| | | model.setTenantId(TenantHelper.getTenantId()); |
| | | //ä¿ååå§åçæ¨¡ååºæ¬ä¿¡æ¯æ°æ® |
| | | repositoryService.saveModel(model); |
| | | repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(xml)); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¨¡å |
| | | * |
| | | * @param id 模åid |
| | | * @return æ¨¡åæ°æ® |
| | | */ |
| | | @Override |
| | | public ModelVo getInfo(String id) { |
| | | ModelVo modelVo = new ModelVo(); |
| | | Model model = repositoryService.getModel(id); |
| | | if (model != null) { |
| | | try { |
| | | byte[] modelEditorSource = repositoryService.getModelEditorSource(model.getId()); |
| | | modelVo.setXml(StrUtil.utf8Str(modelEditorSource)); |
| | | modelVo.setId(model.getId()); |
| | | modelVo.setKey(model.getKey()); |
| | | modelVo.setName(model.getName()); |
| | | modelVo.setCategoryCode(model.getCategory()); |
| | | modelVo.setDescription(model.getMetaInfo()); |
| | | return modelVo; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | return modelVo; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡åä¿¡æ¯ |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public boolean update(ModelBo modelBo) { |
| | | try { |
| | | Model model = repositoryService.getModel(modelBo.getId()); |
| | | List<Model> list = repositoryService.createModelQuery().modelTenantId(TenantHelper.getTenantId()).modelKey(modelBo.getKey()).list(); |
| | | list.stream().filter(e -> !e.getId().equals(model.getId())).findFirst().ifPresent(e -> { |
| | | throw new ServiceException("模åKEYå·²åå¨ï¼"); |
| | | }); |
| | | model.setCategory(modelBo.getCategoryCode()); |
| | | model.setMetaInfo(modelBo.getDescription()); |
| | | repositoryService.saveModel(model); |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾æ¨¡åXML |
| | | * |
| | | * @param modelBo æ¨¡åæ°æ® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean editModelXml(ModelBo modelBo) { |
| | | try { |
| | | String xml = modelBo.getXml(); |
| | | String svg = modelBo.getSvg(); |
| | | String modelId = modelBo.getId(); |
| | | String key = modelBo.getKey(); |
| | | String name = modelBo.getName(); |
| | | BpmnModel bpmnModel = ModelUtils.xmlToBpmnModel(xml); |
| | | ModelUtils.checkBpmnModel(bpmnModel); |
| | | Model model = repositoryService.getModel(modelId); |
| | | List<Model> list = repositoryService.createModelQuery().modelTenantId(TenantHelper.getTenantId()).modelKey(key).list(); |
| | | list.stream().filter(e -> !e.getId().equals(model.getId())).findFirst().ifPresent(e -> { |
| | | throw new ServiceException("模åKEYå·²åå¨ï¼"); |
| | | }); |
| | | // æ ¡éªkeyå½åè§è |
| | | if (!Validator.isMatchRegex(FlowConstant.MODEL_KEY_PATTERN, key)) { |
| | | throw new ServiceException("æ¨¡åæ è¯KEYåªè½å符æè
ä¸å线å¼å¤´ï¼"); |
| | | } |
| | | model.setKey(key); |
| | | model.setName(name); |
| | | model.setVersion(model.getVersion() + 1); |
| | | repositoryService.saveModel(model); |
| | | repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(xml)); |
| | | // 转æ¢å¾ç |
| | | InputStream svgStream = new ByteArrayInputStream(StrUtil.utf8Bytes(svg)); |
| | | TranscoderInput input = new TranscoderInput(svgStream); |
| | | |
| | | PNGTranscoder transcoder = new PNGTranscoder(); |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | TranscoderOutput output = new TranscoderOutput(outStream); |
| | | |
| | | transcoder.transcode(input, output); |
| | | final byte[] result = outStream.toByteArray(); |
| | | repositoryService.addModelEditorSourceExtra(model.getId(), result); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 模åé¨ç½² |
| | | * |
| | | * @param id 模åid |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean modelDeploy(String id) { |
| | | try { |
| | | // æ¥è¯¢æµç¨å®ä¹æ¨¡åxml |
| | | byte[] xmlBytes = repositoryService.getModelEditorSource(id); |
| | | if (ArrayUtil.isEmpty(xmlBytes)) { |
| | | throw new ServiceException("æ¨¡åæ°æ®ä¸ºç©ºï¼è¯·å
设计æµç¨å®ä¹æ¨¡åï¼åè¿è¡é¨ç½²ï¼"); |
| | | } |
| | | if (JSONUtil.isTypeJSON(IOUtils.toString(xmlBytes, StandardCharsets.UTF_8.toString()))) { |
| | | byte[] bytes = ModelUtils.bpmnJsonToXmlBytes(xmlBytes); |
| | | if (ArrayUtil.isEmpty(bytes)) { |
| | | throw new ServiceException("模åä¸è½ä¸ºç©ºï¼è¯·è³å°è®¾è®¡ä¸æ¡ä¸»çº¿æµç¨ï¼"); |
| | | } |
| | | } |
| | | BpmnModel bpmnModel = ModelUtils.xmlToBpmnModel(xmlBytes); |
| | | // æ ¡éªæ¨¡å |
| | | ModelUtils.checkBpmnModel(bpmnModel); |
| | | List<ValidationError> validationErrors = repositoryService.validateProcess(bpmnModel); |
| | | if (CollUtil.isNotEmpty(validationErrors)) { |
| | | String errorMsg = validationErrors.stream().map(ValidationError::getProblem).distinct().collect(Collectors.joining(",")); |
| | | throw new ServiceException(errorMsg); |
| | | } |
| | | // æ¥è¯¢æ¨¡åçåºæ¬ä¿¡æ¯ |
| | | Model model = repositoryService.getModel(id); |
| | | // xmlèµæºçåç§° ï¼å¯¹åºact_ge_bytearray表ä¸çname_åæ®µ |
| | | String processName = model.getName() + ".bpmn20.xml"; |
| | | // è°ç¨é¨ç½²ç¸å
³çapiæ¹æ³è¿è¡é¨ç½²æµç¨å®ä¹ |
| | | Deployment deployment = repositoryService.createDeployment() |
| | | // é¨ç½²åç§° |
| | | .name(model.getName()) |
| | | // é¨ç½²æ è¯key |
| | | .key(model.getKey()) |
| | | // é¨ç½²æµç¨åç±» |
| | | .category(model.getCategory()) |
| | | // bpmn20.xmlèµæº |
| | | .addBytes(processName, xmlBytes) |
| | | // ç§æ·id |
| | | .tenantId(TenantHelper.getTenantId()) |
| | | .deploy(); |
| | | |
| | | // æ´æ° é¨ç½²id å°æµç¨å®ä¹æ¨¡åæ°æ®è¡¨ä¸ |
| | | model.setDeploymentId(deployment.getId()); |
| | | repositoryService.saveModel(model); |
| | | // æ´æ°åç±» |
| | | ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult(); |
| | | repositoryService.setProcessDefinitionCategory(definition.getId(), model.getCategory()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ¨¡åzipå缩å
|
| | | * |
| | | * @param modelId 模åid |
| | | * @param response ç¸åº |
| | | */ |
| | | @Override |
| | | public void exportZip(String modelId, HttpServletResponse response) { |
| | | ZipOutputStream zos = null; |
| | | try { |
| | | zos = ZipUtil.getZipOutputStream(response.getOutputStream(), StandardCharsets.UTF_8); |
| | | // å缩å
æä»¶å |
| | | String zipName = "模åä¸åå¨"; |
| | | // æ¥è¯¢æ¨¡ååºæ¬ä¿¡æ¯ |
| | | Model model = repositoryService.getModel(modelId); |
| | | byte[] xmlBytes = repositoryService.getModelEditorSource(modelId); |
| | | if (ObjectUtil.isNotNull(model)) { |
| | | if (JSONUtil.isTypeJSON(IOUtils.toString(xmlBytes, StandardCharsets.UTF_8.toString())) && ArrayUtil.isEmpty(ModelUtils.bpmnJsonToXmlBytes(xmlBytes))) { |
| | | zipName = "模åä¸è½ä¸ºç©ºï¼è¯·è³å°è®¾è®¡ä¸æ¡ä¸»çº¿æµç¨ï¼"; |
| | | zos.putNextEntry(new ZipEntry(zipName + ".txt")); |
| | | zos.write(zipName.getBytes(StandardCharsets.UTF_8)); |
| | | } else if (ArrayUtil.isEmpty(xmlBytes)) { |
| | | zipName = "æ¨¡åæ°æ®ä¸ºç©ºï¼è¯·å
设计æµç¨å®ä¹æ¨¡åï¼åè¿è¡é¨ç½²ï¼"; |
| | | zos.putNextEntry(new ZipEntry(zipName + ".txt")); |
| | | zos.write(zipName.getBytes(StandardCharsets.UTF_8)); |
| | | } else { |
| | | String fileName = model.getName() + "-" + model.getKey(); |
| | | // å缩å
æä»¶å |
| | | zipName = fileName + ".zip"; |
| | | // å°xmlæ·»å å°å缩å
ä¸(æå®xmlæä»¶åï¼è¯·åæµç¨.bpmn20.xml |
| | | zos.putNextEntry(new ZipEntry(fileName + ".bpmn20.xml")); |
| | | zos.write(xmlBytes); |
| | | } |
| | | } |
| | | response.setHeader("Content-Disposition", |
| | | "attachment; filename=" + URLEncoder.encode(zipName, StandardCharsets.UTF_8) + ".zip"); |
| | | // å·åºååºæµ |
| | | response.flushBuffer(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (zos != null) { |
| | | try { |
| | | zos.closeEntry(); |
| | | zos.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | import org.dromara.workflow.domain.bo.ProcessDefinitionBo; |
| | | import org.dromara.workflow.domain.vo.ProcessDefinitionVo; |
| | | import org.dromara.workflow.service.IActProcessDefinitionService; |
| | | import org.dromara.workflow.service.IWfCategoryService; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.ProcessMigrationService; |
| | | import org.flowable.engine.RepositoryService; |
| | | import org.flowable.engine.impl.bpmn.deployer.ResourceNameUtil; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.Model; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.repository.ProcessDefinitionQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipInputStream; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionService { |
| | | |
| | | private final RepositoryService repositoryService; |
| | | |
| | | private final HistoryService historyService; |
| | | |
| | | private final ProcessMigrationService processMigrationService; |
| | | |
| | | private final IWfCategoryService wfCategoryService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param processDefinitionBo åæ° |
| | | * @return è¿åå页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<ProcessDefinitionVo> page(ProcessDefinitionBo processDefinitionBo) { |
| | | ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery(); |
| | | query.processDefinitionTenantId(TenantHelper.getTenantId()); |
| | | if (StringUtils.isNotEmpty(processDefinitionBo.getKey())) { |
| | | query.processDefinitionKey(processDefinitionBo.getKey()); |
| | | } |
| | | if (StringUtils.isNotEmpty(processDefinitionBo.getCategoryCode())) { |
| | | query.processDefinitionCategory(processDefinitionBo.getCategoryCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(processDefinitionBo.getName())) { |
| | | query.processDefinitionNameLike("%" + processDefinitionBo.getName() + "%"); |
| | | } |
| | | query.orderByDeploymentId().desc(); |
| | | // å页æ¥è¯¢ |
| | | List<ProcessDefinitionVo> processDefinitionVoList = new ArrayList<>(); |
| | | List<ProcessDefinition> definitionList = query.latestVersion().listPage(processDefinitionBo.getPageNum(), processDefinitionBo.getPageSize()); |
| | | List<Deployment> deploymentList = null; |
| | | if (CollUtil.isNotEmpty(definitionList)) { |
| | | List<String> deploymentIds = StreamUtils.toList(definitionList, ProcessDefinition::getDeploymentId); |
| | | deploymentList = repositoryService.createDeploymentQuery().deploymentIds(deploymentIds).list(); |
| | | } |
| | | for (ProcessDefinition processDefinition : definitionList) { |
| | | ProcessDefinitionVo processDefinitionVo = BeanUtil.toBean(processDefinition, ProcessDefinitionVo.class); |
| | | if (CollUtil.isNotEmpty(deploymentList)) { |
| | | // é¨ç½²æ¶é´ |
| | | deploymentList.stream().filter(e -> e.getId().equals(processDefinition.getDeploymentId())).findFirst().ifPresent(e -> { |
| | | processDefinitionVo.setDeploymentTime(e.getDeploymentTime()); |
| | | }); |
| | | } |
| | | processDefinitionVoList.add(processDefinitionVo); |
| | | } |
| | | // æ»è®°å½æ° |
| | | long total = query.count(); |
| | | |
| | | return new TableDataInfo<>(processDefinitionVoList, total); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å岿µç¨å®ä¹å表 |
| | | * |
| | | * @param key æµç¨å®ä¹key |
| | | */ |
| | | @Override |
| | | public List<ProcessDefinitionVo> getProcessDefinitionListByKey(String key) { |
| | | List<ProcessDefinitionVo> processDefinitionVoList = new ArrayList<>(); |
| | | ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery(); |
| | | List<ProcessDefinition> definitionList = query.processDefinitionTenantId(TenantHelper.getTenantId()).processDefinitionKey(key).list(); |
| | | List<Deployment> deploymentList = null; |
| | | if (CollUtil.isNotEmpty(definitionList)) { |
| | | List<String> deploymentIds = definitionList.stream().map(ProcessDefinition::getDeploymentId).collect(Collectors.toList()); |
| | | deploymentList = repositoryService.createDeploymentQuery() |
| | | .deploymentIds(deploymentIds).list(); |
| | | } |
| | | for (ProcessDefinition processDefinition : definitionList) { |
| | | ProcessDefinitionVo processDefinitionVo = BeanUtil.toBean(processDefinition, ProcessDefinitionVo.class); |
| | | if (CollUtil.isNotEmpty(deploymentList)) { |
| | | // é¨ç½²æ¶é´ |
| | | deploymentList.stream().filter(e -> e.getId().equals(processDefinition.getDeploymentId())).findFirst().ifPresent(e -> { |
| | | processDefinitionVo.setDeploymentTime(e.getDeploymentTime()); |
| | | }); |
| | | } |
| | | processDefinitionVoList.add(processDefinitionVo); |
| | | } |
| | | return CollectionUtil.reverse(processDefinitionVoList); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹å¾ç |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @SneakyThrows |
| | | @Override |
| | | public String processDefinitionImage(String processDefinitionId) { |
| | | InputStream inputStream = repositoryService.getProcessDiagram(processDefinitionId); |
| | | return Base64.encode(IOUtils.toByteArray(inputStream)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çæµç¨å®ä¹xmlæä»¶ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | public String processDefinitionXml(String processDefinitionId) { |
| | | StringBuilder xml = new StringBuilder(); |
| | | ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId); |
| | | InputStream inputStream; |
| | | try { |
| | | inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName()); |
| | | xml.append(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return xml.toString(); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param deploymentId é¨ç½²id |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | public boolean deleteDeployment(String deploymentId, String processDefinitionId) { |
| | | try { |
| | | List<HistoricTaskInstance> taskInstanceList = historyService.createHistoricTaskInstanceQuery() |
| | | .processDefinitionId(processDefinitionId).list(); |
| | | if (CollectionUtil.isNotEmpty(taskInstanceList)) { |
| | | throw new ServiceException("å½åæµç¨å®ä¹å·²è¢«ä½¿ç¨ä¸å¯å é¤ï¼"); |
| | | } |
| | | //å 餿µç¨å®ä¹ |
| | | repositoryService.deleteDeployment(deploymentId); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»æè
æèµ·æµç¨å®ä¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | public boolean updateProcessDefState(String processDefinitionId) { |
| | | try { |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionId(processDefinitionId).processDefinitionTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | //å°å½å为æèµ·ç¶ææ´æ°ä¸ºæ¿æ´»ç¶æ |
| | | //åæ°è¯´æï¼åæ°1ï¼æµç¨å®ä¹id,åæ°2ï¼æ¯å¦æ¿æ´»ï¼trueæ¯å¦çº§èå¯¹åºæµç¨å®ä¾ï¼æ¿æ´»äºåå¯¹åºæµç¨å®ä¾é½å¯ä»¥å®¡æ¹ï¼ï¼ |
| | | //åæ°3ï¼ä»ä¹æ¶åæ¿æ´»ï¼å¦æä¸ºnullåç«å³æ¿æ´»ï¼å¦æä¸ºå
·ä½æ¶é´åå°è¾¾æ¤æ¶é´åæ¿æ´» |
| | | if (processDefinition.isSuspended()) { |
| | | repositoryService.activateProcessDefinitionById(processDefinitionId, true, null); |
| | | } else { |
| | | repositoryService.suspendProcessDefinitionById(processDefinitionId, true, null); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("æä½å¤±è´¥:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿ç§»æµç¨å®ä¹ |
| | | * |
| | | * @param currentProcessDefinitionId å½åæµç¨å®ä¹id |
| | | * @param fromProcessDefinitionId éè¦è¿ç§»å°çæµç¨å®ä¹id |
| | | */ |
| | | |
| | | @Override |
| | | public boolean migrationProcessDefinition(String currentProcessDefinitionId, String fromProcessDefinitionId) { |
| | | try { |
| | | // è¿ç§»éªè¯ |
| | | boolean migrationValid = processMigrationService.createProcessInstanceMigrationBuilder() |
| | | .migrateToProcessDefinition(currentProcessDefinitionId) |
| | | .validateMigrationOfProcessInstances(fromProcessDefinitionId) |
| | | .isMigrationValid(); |
| | | if (!migrationValid) { |
| | | throw new ServiceException("æµç¨å®ä¹å·®å¼è¿å¤§æ æ³è¿ç§»ï¼è¯·ä¿®æ¹æµç¨å¾"); |
| | | } |
| | | // å·²ç»æçæµç¨å®ä¾ä¸ä¼è¿ç§» |
| | | processMigrationService.createProcessInstanceMigrationBuilder() |
| | | .migrateToProcessDefinition(currentProcessDefinitionId) |
| | | .migrateProcessInstances(fromProcessDefinitionId); |
| | | return true; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è½¬æ¢ä¸ºæ¨¡å |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | public boolean convertToModel(String processDefinitionId) { |
| | | ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionId(processDefinitionId).singleResult(); |
| | | InputStream inputStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), pd.getResourceName()); |
| | | Model model = repositoryService.createModelQuery().modelKey(pd.getKey()).modelTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | try { |
| | | if (ObjectUtil.isNotNull(model)) { |
| | | repositoryService.addModelEditorSource(model.getId(), IoUtil.readBytes(inputStream)); |
| | | } else { |
| | | Model modelData = repositoryService.newModel(); |
| | | modelData.setKey(pd.getKey()); |
| | | modelData.setName(pd.getName()); |
| | | modelData.setTenantId(pd.getTenantId()); |
| | | repositoryService.saveModel(modelData); |
| | | repositoryService.addModelEditorSource(modelData.getId(), IoUtil.readBytes(inputStream)); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éè¿zipæxmlé¨ç½²æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param categoryCode åç±» |
| | | */ |
| | | @Override |
| | | public boolean deployByFile(MultipartFile file, String categoryCode) { |
| | | try { |
| | | WfCategory wfCategory = wfCategoryService.queryByCategoryCode(categoryCode); |
| | | if (wfCategory == null) { |
| | | throw new ServiceException("æµç¨åç±»ä¸åå¨"); |
| | | } |
| | | // æä»¶å = æµç¨åç§°-æµç¨key |
| | | String filename = file.getOriginalFilename(); |
| | | assert filename != null; |
| | | String[] splitFilename = filename.substring(0, filename.lastIndexOf(".")).split("-"); |
| | | if (splitFilename.length < 2) { |
| | | throw new ServiceException("æµç¨åç±»ä¸è½ä¸ºç©º(æä»¶å = æµç¨åç§°-æµç¨key)"); |
| | | } |
| | | //æµç¨åç§° |
| | | String processName = splitFilename[0]; |
| | | //æµç¨key |
| | | String processKey = splitFilename[1]; |
| | | // æä»¶åç¼å |
| | | String suffix = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); |
| | | InputStream inputStream = file.getInputStream(); |
| | | Deployment deployment; |
| | | if (FlowConstant.ZIP.equals(suffix)) { |
| | | deployment = repositoryService.createDeployment() |
| | | .tenantId(TenantHelper.getTenantId()) |
| | | .addZipInputStream(new ZipInputStream(inputStream)).name(processName).key(processKey).category(categoryCode).deploy(); |
| | | } else { |
| | | String[] list = ResourceNameUtil.BPMN_RESOURCE_SUFFIXES; |
| | | boolean flag = false; |
| | | for (String str : list) { |
| | | if (filename.contains(str)) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | deployment = repositoryService.createDeployment() |
| | | .tenantId(TenantHelper.getTenantId()) |
| | | .addInputStream(filename, inputStream).name(processName).key(processKey).category(categoryCode).deploy(); |
| | | } else { |
| | | throw new ServiceException("æä»¶ç±»åä¸ä¼ é误ï¼"); |
| | | } |
| | | } |
| | | // æ´æ°åç±» |
| | | ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult(); |
| | | repositoryService.setProcessDefinitionCategory(definition.getId(), categoryCode); |
| | | |
| | | return true; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("é¨ç½²å¤±è´¥" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.common.enums.BusinessStatusEnum; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | import org.dromara.workflow.domain.bo.ProcessInstanceBo; |
| | | import org.dromara.workflow.domain.bo.ProcessInvalidBo; |
| | | import org.dromara.workflow.domain.bo.TaskUrgingBo; |
| | | import org.dromara.workflow.domain.vo.ActHistoryInfoVo; |
| | | import org.dromara.workflow.domain.vo.GraphicInfoVo; |
| | | import org.dromara.workflow.domain.vo.ProcessInstanceVo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.flowable.CustomDefaultProcessDiagramGenerator; |
| | | import org.dromara.workflow.flowable.strategy.FlowEventStrategy; |
| | | import org.dromara.workflow.flowable.cmd.DeleteExecutionCmd; |
| | | import org.dromara.workflow.flowable.cmd.ExecutionChildByExecutionIdCmd; |
| | | import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler; |
| | | import org.dromara.workflow.service.IActHiProcinstService; |
| | | import org.dromara.workflow.service.IActProcessInstanceService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.bpmn.model.*; |
| | | import org.flowable.engine.*; |
| | | import org.flowable.engine.history.HistoricActivityInstance; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.engine.history.HistoricProcessInstanceQuery; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.engine.runtime.ProcessInstanceQuery; |
| | | import org.flowable.engine.task.Attachment; |
| | | import org.flowable.engine.task.Comment; |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.awt.*; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActProcessInstanceServiceImpl implements IActProcessInstanceService { |
| | | |
| | | private final RepositoryService repositoryService; |
| | | private final RuntimeService runtimeService; |
| | | private final HistoryService historyService; |
| | | private final TaskService taskService; |
| | | private final IActHiProcinstService actHiProcinstService; |
| | | private final ManagementService managementService; |
| | | private final FlowEventStrategy flowEventStrategy; |
| | | |
| | | @Value("${flowable.activity-font-name}") |
| | | private String activityFontName; |
| | | |
| | | @Value("${flowable.label-font-name}") |
| | | private String labelFontName; |
| | | |
| | | @Value("${flowable.annotation-font-name}") |
| | | private String annotationFontName; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<ProcessInstanceVo> getProcessInstanceRunningByPage(ProcessInstanceBo processInstanceBo) { |
| | | List<ProcessInstanceVo> list = new ArrayList<>(); |
| | | ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); |
| | | query.processInstanceTenantId(TenantHelper.getTenantId()); |
| | | if (StringUtils.isNotBlank(processInstanceBo.getName())) { |
| | | query.processInstanceNameLikeIgnoreCase("%" + processInstanceBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getKey())) { |
| | | query.processDefinitionKey(processInstanceBo.getKey()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getStartUserId())) { |
| | | query.startedBy(processInstanceBo.getStartUserId()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getBusinessKey())) { |
| | | query.processInstanceBusinessKey(processInstanceBo.getBusinessKey()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getCategoryCode())) { |
| | | query.processDefinitionCategory(processInstanceBo.getCategoryCode()); |
| | | } |
| | | query.orderByStartTime().desc(); |
| | | List<ProcessInstance> processInstances = query.listPage(processInstanceBo.getPageNum(), processInstanceBo.getPageSize()); |
| | | for (ProcessInstance processInstance : processInstances) { |
| | | ProcessInstanceVo processInstanceVo = BeanUtil.toBean(processInstance, ProcessInstanceVo.class); |
| | | processInstanceVo.setIsSuspended(processInstance.isSuspended()); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstance.getBusinessStatus())); |
| | | list.add(processInstanceVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·²ç»æçæµç¨å®ä¾ |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<ProcessInstanceVo> getProcessInstanceFinishByPage(ProcessInstanceBo processInstanceBo) { |
| | | List<ProcessInstanceVo> list = new ArrayList<>(); |
| | | HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().finished() |
| | | .orderByProcessInstanceEndTime().desc(); |
| | | query.processInstanceTenantId(TenantHelper.getTenantId()); |
| | | if (StringUtils.isNotEmpty(processInstanceBo.getName())) { |
| | | query.processInstanceNameLikeIgnoreCase("%" + processInstanceBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getKey())) { |
| | | query.processDefinitionKey(processInstanceBo.getKey()); |
| | | } |
| | | if (StringUtils.isNotEmpty(processInstanceBo.getStartUserId())) { |
| | | query.startedBy(processInstanceBo.getStartUserId()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getBusinessKey())) { |
| | | query.processInstanceBusinessKey(processInstanceBo.getBusinessKey()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getCategoryCode())) { |
| | | query.processDefinitionCategory(processInstanceBo.getCategoryCode()); |
| | | } |
| | | List<HistoricProcessInstance> historicProcessInstances = query.listPage(processInstanceBo.getPageNum(), processInstanceBo.getPageSize()); |
| | | for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) { |
| | | ProcessInstanceVo processInstanceVo = BeanUtil.toBean(historicProcessInstance, ProcessInstanceVo.class); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(historicProcessInstance.getBusinessStatus())); |
| | | list.add(processInstanceVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @SneakyThrows |
| | | @Override |
| | | public String getHistoryProcessImage(String processInstanceId) { |
| | | String processDefinitionId; |
| | | // è·åå½åçæµç¨å®ä¾ |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
| | | // 妿æµç¨å·²ç»ç»æï¼åå¾å°ç»æèç¹ |
| | | if (Objects.isNull(processInstance)) { |
| | | HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
| | | processDefinitionId = pi.getProcessDefinitionId(); |
| | | } else { |
| | | // æ ¹æ®æµç¨å®ä¾IDè·å¾å½åå¤äºæ´»å¨ç¶æçActivityIdåé |
| | | ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
| | | processDefinitionId = pi.getProcessDefinitionId(); |
| | | } |
| | | |
| | | // è·å¾æ´»å¨çèç¹ |
| | | List<HistoricActivityInstance> highLightedFlowList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list(); |
| | | |
| | | List<String> highLightedFlows = new ArrayList<>(); |
| | | List<String> highLightedNodes = new ArrayList<>(); |
| | | //é«äº® |
| | | for (HistoricActivityInstance tempActivity : highLightedFlowList) { |
| | | if (FlowConstant.SEQUENCE_FLOW.equals(tempActivity.getActivityType())) { |
| | | //é«äº®çº¿ |
| | | highLightedFlows.add(tempActivity.getActivityId()); |
| | | } else { |
| | | //é«äº®èç¹ |
| | | if (tempActivity.getEndTime() == null) { |
| | | highLightedNodes.add(Color.RED.toString() + tempActivity.getActivityId()); |
| | | } else { |
| | | highLightedNodes.add(tempActivity.getActivityId()); |
| | | } |
| | | } |
| | | } |
| | | List<String> highLightedNodeList = new ArrayList<>(); |
| | | //è¿è¡ä¸çèç¹ |
| | | List<String> redNodeCollect = StreamUtils.filter(highLightedNodes, e -> e.contains(Color.RED.toString())); |
| | | //æé¤ä¸è¿è¡ä¸ç¸åçèç¹ |
| | | for (String nodeId : highLightedNodes) { |
| | | if (!nodeId.contains(Color.RED.toString()) && !redNodeCollect.contains(Color.RED + nodeId)) { |
| | | highLightedNodeList.add(nodeId); |
| | | } |
| | | } |
| | | highLightedNodeList.addAll(redNodeCollect); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); |
| | | CustomDefaultProcessDiagramGenerator diagramGenerator = new CustomDefaultProcessDiagramGenerator(); |
| | | InputStream inputStream = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedNodeList, highLightedFlows, activityFontName, labelFontName, annotationFontName, null, 1.0, true); |
| | | return Base64.encode(IOUtils.toByteArray(inputStream)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æµç¨å®ä¾idè·åå岿µç¨å¾è¿è¡ä¸ï¼åå²çèç¹ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getHistoryProcessList(String processInstanceId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> taskList = new ArrayList<>(); |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
| | | StringBuilder xml = new StringBuilder(); |
| | | ProcessDefinition processDefinition = repositoryService.getProcessDefinition(historicProcessInstance.getProcessDefinitionId()); |
| | | // è·åèç¹ |
| | | List<HistoricActivityInstance> highLightedFlowList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list(); |
| | | for (HistoricActivityInstance tempActivity : highLightedFlowList) { |
| | | Map<String, Object> task = new HashMap<>(); |
| | | if (!FlowConstant.SEQUENCE_FLOW.equals(tempActivity.getActivityType()) && |
| | | !FlowConstant.PARALLEL_GATEWAY.equals(tempActivity.getActivityType()) && |
| | | !FlowConstant.EXCLUSIVE_GATEWAY.equals(tempActivity.getActivityType()) && |
| | | !FlowConstant.INCLUSIVE_GATEWAY.equals(tempActivity.getActivityType()) |
| | | ) { |
| | | task.put("key", tempActivity.getActivityId()); |
| | | task.put("completed", tempActivity.getEndTime() != null); |
| | | task.put("activityType", tempActivity.getActivityType()); |
| | | taskList.add(task); |
| | | } |
| | | } |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
| | | if (processInstance != null) { |
| | | taskList = taskList.stream().filter(e -> !e.get("activityType").equals(FlowConstant.END_EVENT)).collect(Collectors.toList()); |
| | | } |
| | | //æ¥è¯¢åºè¿è¡ä¸èç¹ |
| | | List<Map<String, Object>> runtimeNodeList = taskList.stream().filter(e -> !(Boolean) e.get("completed")).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(runtimeNodeList)) { |
| | | Iterator<Map<String, Object>> iterator = taskList.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> next = iterator.next(); |
| | | runtimeNodeList.stream().filter(t -> t.get("key").equals(next.get("key")) && (Boolean) next.get("completed")).findFirst().ifPresent(t -> iterator.remove()); |
| | | } |
| | | } |
| | | map.put("taskList", taskList); |
| | | List<ActHistoryInfoVo> historyTaskList = getHistoryTaskList(processInstanceId); |
| | | map.put("historyList", historyTaskList); |
| | | InputStream inputStream; |
| | | try { |
| | | inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName()); |
| | | xml.append(IOUtils.toString(inputStream, String.valueOf(StandardCharsets.UTF_8))); |
| | | map.put("xml", xml.toString()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * è·ååå²ä»»å¡èç¹ä¿¡æ¯ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | private List<ActHistoryInfoVo> getHistoryTaskList(String processInstanceId) { |
| | | //æ¥è¯¢ä»»å¡åçè®°å½ |
| | | List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByHistoricTaskInstanceEndTime().desc().list(); |
| | | list = StreamUtils.sorted(list, Comparator.comparing(HistoricTaskInstance::getEndTime, Comparator.nullsFirst(Date::compareTo)).reversed()); |
| | | List<ActHistoryInfoVo> actHistoryInfoVoList = new ArrayList<>(); |
| | | for (HistoricTaskInstance historicTaskInstance : list) { |
| | | ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo(); |
| | | BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo); |
| | | actHistoryInfoVo.setStatus(actHistoryInfoVo.getEndTime() == null ? "å¾
å¤ç" : "å·²å¤ç"); |
| | | if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) { |
| | | actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis())); |
| | | } |
| | | actHistoryInfoVoList.add(actHistoryInfoVo); |
| | | } |
| | | List<ActHistoryInfoVo> historyInfoVoList = new ArrayList<>(); |
| | | Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey); |
| | | for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) { |
| | | ActHistoryInfoVo historyInfoVo = new ActHistoryInfoVo(); |
| | | BeanUtils.copyProperties(entry.getValue().get(0), historyInfoVo); |
| | | actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() == null).findFirst() |
| | | .ifPresent(e -> { |
| | | historyInfoVo.setStatus("å¾
å¤ç"); |
| | | historyInfoVo.setStartTime(e.getStartTime()); |
| | | historyInfoVo.setEndTime(null); |
| | | historyInfoVo.setRunDuration(null); |
| | | }); |
| | | historyInfoVoList.add(historyInfoVo); |
| | | } |
| | | return historyInfoVoList; |
| | | } |
| | | |
| | | /** |
| | | * è·å审æ¹è®°å½ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getHistoryRecord(String processInstanceId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // æ¥è¯¢ä»»å¡åçè®°å½ |
| | | List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).orderByHistoricTaskInstanceEndTime().desc().list(); |
| | | list = StreamUtils.sorted(list, Comparator.comparing(HistoricTaskInstance::getEndTime, Comparator.nullsFirst(Date::compareTo)).reversed()); |
| | | List<ActHistoryInfoVo> actHistoryInfoVoList = new ArrayList<>(); |
| | | List<Comment> processInstanceComments = taskService.getProcessInstanceComments(processInstanceId); |
| | | //éä»¶ |
| | | List<Attachment> attachmentList = taskService.getProcessInstanceAttachments(processInstanceId); |
| | | for (HistoricTaskInstance historicTaskInstance : list) { |
| | | ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo(); |
| | | BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo); |
| | | if (actHistoryInfoVo.getEndTime() == null) { |
| | | actHistoryInfoVo.setStatus(TaskStatusEnum.WAITING.getStatus()); |
| | | actHistoryInfoVo.setStatusName(TaskStatusEnum.WAITING.getDesc()); |
| | | } |
| | | if (CollUtil.isNotEmpty(processInstanceComments)) { |
| | | processInstanceComments.stream().filter(e -> e.getTaskId().equals(historicTaskInstance.getId())).findFirst().ifPresent(e -> { |
| | | actHistoryInfoVo.setComment(e.getFullMessage()); |
| | | actHistoryInfoVo.setStatus(e.getType()); |
| | | actHistoryInfoVo.setStatusName(TaskStatusEnum.findByStatus(e.getType())); |
| | | }); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) { |
| | | actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis())); |
| | | } |
| | | try { |
| | | actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null); |
| | | } catch (NumberFormatException ignored) { |
| | | log.warn("å½åä»»å¡ã{}ã,åç人转æ¢äººåIDã{}ãå¼å¸¸ï¼", historicTaskInstance.getName(), historicTaskInstance.getAssignee()); |
| | | } |
| | | //éä»¶ |
| | | if (CollUtil.isNotEmpty(attachmentList)) { |
| | | List<Attachment> attachments = attachmentList.stream().filter(e -> e.getTaskId().equals(historicTaskInstance.getId())).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(attachments)) { |
| | | actHistoryInfoVo.setAttachmentList(attachments); |
| | | } |
| | | } |
| | | actHistoryInfoVoList.add(actHistoryInfoVo); |
| | | } |
| | | List<ActHistoryInfoVo> collect = new ArrayList<>(); |
| | | // å¾
åç |
| | | List<ActHistoryInfoVo> waitingTask = StreamUtils.filter(actHistoryInfoVoList, e -> e.getEndTime() == null); |
| | | // å·²åç |
| | | List<ActHistoryInfoVo> finishTask = StreamUtils.filter(actHistoryInfoVoList, e -> e.getEndTime() != null); |
| | | collect.addAll(waitingTask); |
| | | collect.addAll(finishTask); |
| | | // 审æ¹è®°å½ |
| | | map.put("historyRecordList", collect); |
| | | List<ActHistoryInfoVo> nodeInfoList = new ArrayList<>(); |
| | | Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey); |
| | | for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) { |
| | | ActHistoryInfoVo actHistoryInfoVo = BeanUtil.toBean(entry.getValue().get(0), ActHistoryInfoVo.class); |
| | | String nickName = entry.getValue().stream().filter(e -> StringUtils.isNotBlank(e.getNickName()) && e.getEndTime() == null).map(ActHistoryInfoVo::getNickName).toList().stream().distinct().collect(Collectors.joining(StringUtils.SEPARATOR)); |
| | | if (StringUtils.isNotBlank(nickName)) { |
| | | actHistoryInfoVo.setNickName(nickName); |
| | | } |
| | | actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() != null).findFirst() |
| | | .ifPresent(e -> { |
| | | actHistoryInfoVo.setStatus("å·²å¤ç"); |
| | | actHistoryInfoVo.setStartTime(e.getStartTime()); |
| | | }); |
| | | actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() == null).findFirst() |
| | | .ifPresent(e -> { |
| | | actHistoryInfoVo.setStatus("å¾
å¤ç"); |
| | | actHistoryInfoVo.setStartTime(e.getStartTime()); |
| | | actHistoryInfoVo.setEndTime(null); |
| | | actHistoryInfoVo.setRunDuration(null); |
| | | }); |
| | | nodeInfoList.add(actHistoryInfoVo); |
| | | } |
| | | // èç¹ä¿¡æ¯ |
| | | map.put("nodeListInfo", nodeInfoList); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(list.get(0).getProcessDefinitionId()); |
| | | List<GraphicInfoVo> graphicInfoVos = new ArrayList<>(); |
| | | Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements(); |
| | | //èç¹å¾å½¢ä¿¡æ¯ |
| | | buildGraphicInfo(flowElements, graphicInfoVos, bpmnModel); |
| | | map.put("graphicInfoVos", graphicInfoVos); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * æå»ºèç¹å¾å½¢ä¿¡æ¯ |
| | | * |
| | | * @param flowElements èç¹ |
| | | */ |
| | | private static void buildGraphicInfo(Collection<FlowElement> flowElements, List<GraphicInfoVo> graphicInfoVos, BpmnModel bpmnModel) { |
| | | for (FlowElement flowElement : flowElements) { |
| | | if (flowElement instanceof SubProcess) { |
| | | Collection<FlowElement> subFlowElements = ((SubProcess) flowElement).getFlowElements(); |
| | | buildGraphicInfo(subFlowElements, graphicInfoVos, bpmnModel); |
| | | } else { |
| | | if (flowElement instanceof UserTask) { |
| | | GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowElement.getId()); |
| | | GraphicInfoVo graphicInfoVo = BeanUtil.toBean(graphicInfo, GraphicInfoVo.class); |
| | | graphicInfoVo.setNodeId(flowElement.getId()); |
| | | graphicInfoVo.setNodeName(flowElement.getName()); |
| | | graphicInfoVos.add(graphicInfoVo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡å®ææ¶é´å¤ç |
| | | * |
| | | * @param time æ¶é´ |
| | | */ |
| | | private String getDuration(long time) { |
| | | |
| | | long day = time / (24 * 60 * 60 * 1000); |
| | | long hour = (time / (60 * 60 * 1000) - day * 24); |
| | | long minute = ((time / (60 * 1000)) - day * 24 * 60 - hour * 60); |
| | | long second = (time / 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 + "ç§"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä½åºæµç¨å®ä¾ï¼ä¸ä¼å é¤åå²è®°å½(å é¤è¿è¡ä¸çå®ä¾) |
| | | * |
| | | * @param processInvalidBo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteRuntimeProcessInst(ProcessInvalidBo processInvalidBo) { |
| | | try { |
| | | List<Task> list = taskService.createTaskQuery().processInstanceId(processInvalidBo.getProcessInstanceId()) |
| | | .taskTenantId(TenantHelper.getTenantId()).list(); |
| | | List<Task> subTasks = StreamUtils.filter(list, e -> StringUtils.isNotBlank(e.getParentTaskId())); |
| | | if (CollUtil.isNotEmpty(subTasks)) { |
| | | subTasks.forEach(e -> taskService.deleteTask(e.getId())); |
| | | } |
| | | String deleteReason = LoginHelper.getLoginUser().getNickname() + "ä½åºäºå½åç³è¯·ï¼"; |
| | | if (StringUtils.isNotBlank(processInvalidBo.getDeleteReason())) { |
| | | deleteReason = LoginHelper.getLoginUser().getNickname() + "ä½åºçç±:" + processInvalidBo.getDeleteReason(); |
| | | } |
| | | for (Task task : StreamUtils.filter(list, e -> StringUtils.isBlank(e.getParentTaskId()))) { |
| | | taskService.addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.INVALID.getStatus(), deleteReason); |
| | | } |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() |
| | | .processInstanceId(processInvalidBo.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.FINISH.getStatus().equals(historicProcessInstance.getBusinessStatus())) { |
| | | throw new ServiceException("è¯¥åæ®å·²å®æç³è¯·ï¼"); |
| | | } |
| | | runtimeService.updateBusinessStatus(processInvalidBo.getProcessInstanceId(), BusinessStatusEnum.INVALID.getStatus()); |
| | | runtimeService.deleteProcessInstance(processInvalidBo.getProcessInstanceId(), deleteReason); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(historicProcessInstance.getBusinessKey(), BusinessStatusEnum.INVALID.getStatus(), false); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteRuntimeProcessAndHisInst(List<String> processInstanceIds) { |
| | | try { |
| | | // 1.å é¤è¿è¡ä¸æµç¨å®ä¾ |
| | | List<Task> list = taskService.createTaskQuery().processInstanceIdIn(processInstanceIds) |
| | | .taskTenantId(TenantHelper.getTenantId()).list(); |
| | | List<Task> subTasks = StreamUtils.filter(list, e -> StringUtils.isNotBlank(e.getParentTaskId())); |
| | | if (CollUtil.isNotEmpty(subTasks)) { |
| | | subTasks.forEach(e -> taskService.deleteTask(e.getId())); |
| | | } |
| | | runtimeService.bulkDeleteProcessInstances(processInstanceIds, LoginHelper.getUserId() + "å é¤äºå½åæµç¨ç³è¯·"); |
| | | // 2.å é¤åå²è®°å½ |
| | | List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery() |
| | | .processInstanceTenantId(TenantHelper.getTenantId()).processInstanceIds(new HashSet<>(processInstanceIds)).list(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstanceList)) { |
| | | historyService.bulkDeleteHistoricProcessInstances(processInstanceIds); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå é¤ è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteRuntimeProcessAndHisInstByBusinessKeys(List<String> businessKeys) { |
| | | try { |
| | | // 1.å é¤è¿è¡ä¸æµç¨å®ä¾ |
| | | List<ActHiProcinst> actHiProcinsts = actHiProcinstService.selectByBusinessKeyIn(businessKeys); |
| | | if (CollUtil.isEmpty(actHiProcinsts)) { |
| | | log.warn("å½åä¸å¡ID:{}æ¥è¯¢å°æµç¨å®ä¾ä¸ºç©ºï¼", businessKeys); |
| | | return false; |
| | | } |
| | | List<String> processInstanceIds = StreamUtils.toList(actHiProcinsts, ActHiProcinst::getId); |
| | | List<Task> list = taskService.createTaskQuery().processInstanceIdIn(processInstanceIds) |
| | | .taskTenantId(TenantHelper.getTenantId()).list(); |
| | | List<Task> subTasks = StreamUtils.filter(list, e -> StringUtils.isNotBlank(e.getParentTaskId())); |
| | | if (CollUtil.isNotEmpty(subTasks)) { |
| | | subTasks.forEach(e -> taskService.deleteTask(e.getId())); |
| | | } |
| | | runtimeService.bulkDeleteProcessInstances(processInstanceIds, LoginHelper.getUserId() + "å é¤äºå½åæµç¨ç³è¯·"); |
| | | // 2.å é¤åå²è®°å½ |
| | | List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery() |
| | | .processInstanceTenantId(TenantHelper.getTenantId()).processInstanceIds(new HashSet<>(processInstanceIds)).list(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstanceList)) { |
| | | historyService.bulkDeleteHistoricProcessInstances(processInstanceIds); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 已宿çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param processInstanceIds æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteFinishProcessAndHisInst(List<String> processInstanceIds) { |
| | | try { |
| | | historyService.bulkDeleteHistoricProcessInstances(processInstanceIds); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæµç¨ç³è¯· |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean cancelProcessApply(String processInstanceId) { |
| | | try { |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() |
| | | .processInstanceId(processInstanceId).processInstanceTenantId(TenantHelper.getTenantId()).startedBy(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | if (ObjectUtil.isNull(processInstance)) { |
| | | throw new ServiceException("æ¨ä¸æ¯æµç¨å起人,æ¤é失败!"); |
| | | } |
| | | if (processInstance.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | if (BusinessStatusEnum.CANCEL.getStatus().equals(processInstance.getBusinessStatus())) { |
| | | throw new ServiceException("è¯¥åæ®å·²æ¤éï¼"); |
| | | } |
| | | List<Task> taskList = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(processInstanceId).list(); |
| | | for (Task task : taskList) { |
| | | taskService.setAssignee(task.getId(), String.valueOf(LoginHelper.getUserId())); |
| | | taskService.addComment(task.getId(), processInstanceId, TaskStatusEnum.CANCEL.getStatus(), LoginHelper.getLoginUser().getNickname() + "ï¼æ¤éç³è¯·"); |
| | | } |
| | | HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().finished().orderByHistoricTaskInstanceEndTime().asc().list().get(0); |
| | | List<String> nodeIds = StreamUtils.toList(taskList, Task::getTaskDefinitionKey); |
| | | runtimeService.createChangeActivityStateBuilder() |
| | | .processInstanceId(processInstanceId) |
| | | .moveActivityIdsToSingleActivityId(nodeIds, historicTaskInstance.getTaskDefinitionKey()).changeState(); |
| | | Task task = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(processInstanceId).list().get(0); |
| | | taskService.setAssignee(task.getId(), historicTaskInstance.getAssignee()); |
| | | //è·åå¹¶è¡ç½å
³æ§è¡åä¿ççæ§è¡å®ä¾æ°æ® |
| | | ExecutionChildByExecutionIdCmd childByExecutionIdCmd = new ExecutionChildByExecutionIdCmd(task.getExecutionId()); |
| | | List<ExecutionEntity> executionEntities = managementService.executeCommand(childByExecutionIdCmd); |
| | | //å 餿µç¨å®ä¾å徿°æ® |
| | | for (ExecutionEntity executionEntity : executionEntities) { |
| | | DeleteExecutionCmd deleteExecutionCmd = new DeleteExecutionCmd(executionEntity.getId()); |
| | | managementService.executeCommand(deleteExecutionCmd); |
| | | } |
| | | runtimeService.updateBusinessStatus(processInstanceId, BusinessStatusEnum.CANCEL.getStatus()); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(processInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), BusinessStatusEnum.CANCEL.getStatus(), false); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("æ¤é失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å½åç»å½äººåæ® |
| | | * |
| | | * @param processInstanceBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<ProcessInstanceVo> getCurrentSubmitByPage(ProcessInstanceBo processInstanceBo) { |
| | | List<ProcessInstanceVo> list = new ArrayList<>(); |
| | | HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); |
| | | query.processInstanceTenantId(TenantHelper.getTenantId()); |
| | | query.startedBy(processInstanceBo.getStartUserId()); |
| | | if (StringUtils.isNotBlank(processInstanceBo.getName())) { |
| | | query.processInstanceNameLikeIgnoreCase("%" + processInstanceBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getKey())) { |
| | | query.processDefinitionKey(processInstanceBo.getKey()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getBusinessKey())) { |
| | | query.processInstanceBusinessKey(processInstanceBo.getBusinessKey()); |
| | | } |
| | | if (StringUtils.isNotBlank(processInstanceBo.getCategoryCode())) { |
| | | query.processDefinitionCategory(processInstanceBo.getCategoryCode()); |
| | | } |
| | | query.orderByProcessInstanceStartTime().desc(); |
| | | List<HistoricProcessInstance> historicProcessInstanceList = query.listPage(processInstanceBo.getPageNum(), processInstanceBo.getPageSize()); |
| | | List<TaskVo> taskVoList = new ArrayList<>(); |
| | | if (CollUtil.isNotEmpty(historicProcessInstanceList)) { |
| | | List<String> processInstanceIds = StreamUtils.toList(historicProcessInstanceList, HistoricProcessInstance::getId); |
| | | List<Task> taskList = taskService.createTaskQuery().processInstanceIdIn(processInstanceIds).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | for (Task task : taskList) { |
| | | taskVoList.add(BeanUtil.toBean(task, TaskVo.class)); |
| | | } |
| | | } |
| | | for (HistoricProcessInstance processInstance : historicProcessInstanceList) { |
| | | ProcessInstanceVo processInstanceVo = BeanUtil.toBean(processInstance, ProcessInstanceVo.class); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstance.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(taskVoList)) { |
| | | List<TaskVo> collect = StreamUtils.filter(taskVoList, e -> e.getProcessInstanceId().equals(processInstance.getId())); |
| | | processInstanceVo.setTaskVoList(CollUtil.isNotEmpty(collect) ? collect : Collections.emptyList()); |
| | | } |
| | | list.add(processInstanceVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡å¬å(ç»å½åä»»å¡åç人åéç«å
ä¿¡ï¼é®ä»¶ï¼çä¿¡ç) |
| | | * |
| | | * @param taskUrgingBo ä»»å¡å¬å |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean taskUrging(TaskUrgingBo taskUrgingBo) { |
| | | try { |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() |
| | | .processInstanceId(taskUrgingBo.getProcessInstanceId()) |
| | | .processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (processInstance == null) { |
| | | throw new ServiceException("ä»»å¡å·²ç»æï¼"); |
| | | } |
| | | String message = taskUrgingBo.getMessage(); |
| | | if (StringUtils.isBlank(message)) { |
| | | message = "æ¨çã" + processInstance.getName() + "ãåæ®è¿æªå®¡æ¹ï¼è¯·æ¨åæ¶å¤çã"; |
| | | } |
| | | List<Task> list = taskService.createTaskQuery().processInstanceId(taskUrgingBo.getProcessInstanceId()).list(); |
| | | WorkflowUtils.sendMessage(list, processInstance.getName(), taskUrgingBo.getMessageType(), message); |
| | | } catch (ServiceException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return true; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.common.enums.BusinessStatusEnum; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.domain.vo.WfCopy; |
| | | import org.dromara.workflow.flowable.strategy.FlowEventStrategy; |
| | | import org.dromara.workflow.flowable.cmd.*; |
| | | import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler; |
| | | import org.dromara.workflow.flowable.strategy.FlowTaskEventHandler; |
| | | import org.dromara.workflow.mapper.ActTaskMapper; |
| | | import org.dromara.workflow.service.IActTaskService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.common.engine.api.FlowableObjectNotFoundException; |
| | | import org.flowable.common.engine.impl.identity.Authentication; |
| | | import org.flowable.engine.*; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | 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.flowable.task.service.impl.persistence.entity.TaskEntity; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.FLOWABLE_SKIP_EXPRESSION_ENABLED; |
| | | import static org.dromara.workflow.common.constant.FlowConstant.INITIATOR; |
| | | |
| | | /** |
| | | * ä»»å¡ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ActTaskServiceImpl implements IActTaskService { |
| | | |
| | | private final RuntimeService runtimeService; |
| | | private final TaskService taskService; |
| | | private final HistoryService historyService; |
| | | private final IdentityService identityService; |
| | | private final ManagementService managementService; |
| | | private final FlowEventStrategy flowEventStrategy; |
| | | private final ActTaskMapper actTaskMapper; |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, Object> startWorkFlow(StartProcessBo startProcessBo) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (StringUtils.isBlank(startProcessBo.getBusinessKey())) { |
| | | throw new ServiceException("å¯å¨å·¥ä½æµæ¶å¿
é¡»å
å«ä¸å¡ID"); |
| | | } |
| | | // 夿å½åä¸å¡æ¯å¦å¯å¨è¿æµç¨ |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(startProcessBo.getBusinessKey()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstance)) { |
| | | BusinessStatusEnum.checkStartStatus(historicProcessInstance.getBusinessStatus()); |
| | | } |
| | | TaskQuery taskQuery = taskService.createTaskQuery(); |
| | | List<Task> taskResult = taskQuery.processInstanceBusinessKey(startProcessBo.getBusinessKey()).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | if (CollUtil.isNotEmpty(taskResult)) { |
| | | if (CollUtil.isNotEmpty(startProcessBo.getVariables())) { |
| | | taskService.setVariables(taskResult.get(0).getId(), startProcessBo.getVariables()); |
| | | } |
| | | map.put("processInstanceId", taskResult.get(0).getProcessInstanceId()); |
| | | map.put("taskId", taskResult.get(0).getId()); |
| | | return map; |
| | | } |
| | | // 设置å¯å¨äºº |
| | | identityService.setAuthenticatedUserId(String.valueOf(LoginHelper.getUserId())); |
| | | Authentication.setAuthenticatedUserId(String.valueOf(LoginHelper.getUserId())); |
| | | // å¯å¨æµç¨å®ä¾ï¼æäº¤ç³è¯·ï¼ |
| | | Map<String, Object> variables = startProcessBo.getVariables(); |
| | | // å¯å¨è·³è¿è¡¨è¾¾å¼ |
| | | variables.put(FLOWABLE_SKIP_EXPRESSION_ENABLED, true); |
| | | // æµç¨å起人 |
| | | variables.put(INITIATOR, (String.valueOf(LoginHelper.getUserId()))); |
| | | ProcessInstance pi; |
| | | try { |
| | | pi = runtimeService.startProcessInstanceByKeyAndTenantId(startProcessBo.getProcessKey(), startProcessBo.getBusinessKey(), variables, TenantHelper.getTenantId()); |
| | | } catch (FlowableObjectNotFoundException e) { |
| | | throw new ServiceException("æ¾ä¸å°å½åã" + startProcessBo.getProcessKey() + "ãæµç¨å®ä¹ï¼"); |
| | | } |
| | | // å°æµç¨å®ä¹åç§° ä½ä¸º æµç¨å®ä¾åç§° |
| | | runtimeService.setProcessInstanceName(pi.getProcessInstanceId(), pi.getProcessDefinitionName()); |
| | | // ç³è¯·äººæ§è¡æµç¨ |
| | | List<Task> taskList = taskService.createTaskQuery().processInstanceId(pi.getId()).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | if (taskList.size() > 1) { |
| | | throw new ServiceException("è¯·æ£æ¥æµç¨ç¬¬ä¸ä¸ªç¯èæ¯å¦ä¸ºç³è¯·äººï¼"); |
| | | } |
| | | |
| | | runtimeService.updateBusinessStatus(pi.getProcessInstanceId(), BusinessStatusEnum.DRAFT.getStatus()); |
| | | taskService.setAssignee(taskList.get(0).getId(), LoginHelper.getUserId().toString()); |
| | | taskService.setVariable(taskList.get(0).getId(), "processInstanceId", pi.getProcessInstanceId()); |
| | | map.put("processInstanceId", pi.getProcessInstanceId()); |
| | | map.put("taskId", taskList.get(0).getId()); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean completeTask(CompleteTaskBo completeTaskBo) { |
| | | try { |
| | | List<RoleDTO> roles = LoginHelper.getLoginUser().getRoles(); |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | TaskQuery taskQuery = taskService.createTaskQuery(); |
| | | taskQuery.taskId(completeTaskBo.getTaskId()).taskTenantId(TenantHelper.getTenantId()).taskCandidateOrAssigned(userId); |
| | | if (CollUtil.isNotEmpty(roles)) { |
| | | List<String> groupIds = StreamUtils.toList(roles, e -> String.valueOf(e.getRoleId())); |
| | | taskQuery.taskCandidateGroupIn(groupIds); |
| | | } |
| | | Task task = taskQuery.singleResult(); |
| | | if (task == null) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); |
| | | //åçå§æä»»å¡ |
| | | if (ObjectUtil.isNotEmpty(task.getDelegationState()) && FlowConstant.PENDING.equals(task.getDelegationState().name())) { |
| | | taskService.resolveTask(completeTaskBo.getTaskId()); |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), completeTaskBo.getMessage()); |
| | | taskService.complete(newTask.getId()); |
| | | return true; |
| | | } |
| | | //éä»¶ä¸ä¼ |
| | | AttachmentCmd attachmentCmd = new AttachmentCmd(completeTaskBo.getFileId(), task.getId(), task.getProcessInstanceId()); |
| | | managementService.executeCommand(attachmentCmd); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(processInstance.getProcessDefinitionKey()); |
| | | String businessStatus = WorkflowUtils.getBusinessStatus(task.getProcessInstanceId()); |
| | | if (BusinessStatusEnum.DRAFT.getStatus().equals(businessStatus) || BusinessStatusEnum.BACK.getStatus().equals(businessStatus) || BusinessStatusEnum.CANCEL.getStatus().equals(businessStatus)) { |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), businessStatus, true); |
| | | } |
| | | } |
| | | runtimeService.updateBusinessStatus(task.getProcessInstanceId(), BusinessStatusEnum.WAITING.getStatus()); |
| | | String key = processInstance.getProcessDefinitionKey() + "_" + task.getTaskDefinitionKey(); |
| | | FlowTaskEventHandler taskHandler = flowEventStrategy.getTaskHandler(key); |
| | | if (taskHandler != null) { |
| | | taskHandler.handleTask(task, processInstance.getBusinessKey()); |
| | | } |
| | | //åçæè§ |
| | | taskService.addComment(completeTaskBo.getTaskId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), StringUtils.isBlank(completeTaskBo.getMessage()) ? "åæ" : completeTaskBo.getMessage()); |
| | | //åçä»»å¡ |
| | | if (CollUtil.isNotEmpty(completeTaskBo.getVariables())) { |
| | | taskService.complete(completeTaskBo.getTaskId(), completeTaskBo.getVariables()); |
| | | } else { |
| | | taskService.complete(completeTaskBo.getTaskId()); |
| | | } |
| | | ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()) |
| | | .processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (pi == null) { |
| | | UpdateBusinessStatusCmd updateBusinessStatusCmd = new UpdateBusinessStatusCmd(task.getProcessInstanceId(), BusinessStatusEnum.FINISH.getStatus()); |
| | | managementService.executeCommand(updateBusinessStatusCmd); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), BusinessStatusEnum.FINISH.getStatus(), false); |
| | | } |
| | | } else { |
| | | List<Task> list = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(task.getProcessInstanceId()).list(); |
| | | if (CollUtil.isNotEmpty(list) && CollUtil.isNotEmpty(completeTaskBo.getWfCopyList())) { |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.COPY.getStatus(), |
| | | LoginHelper.getLoginUser().getNickname() + "ãæéãç»" + String.join(",", StreamUtils.toList(completeTaskBo.getWfCopyList(), WfCopy::getUserName))); |
| | | taskService.complete(newTask.getId()); |
| | | List<Task> taskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); |
| | | WorkflowUtils.createCopyTask(taskList, StreamUtils.toList(completeTaskBo.getWfCopyList(), WfCopy::getUserId)); |
| | | } |
| | | sendMessage(list, processInstance.getName(), completeTaskBo.getMessageType(), null); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åéæ¶æ¯ |
| | | * |
| | | * @param list ä»»å¡ |
| | | * @param name æµç¨åç§° |
| | | * @param messageType æ¶æ¯ç±»å |
| | | * @param message æ¶æ¯å
容ï¼ä¸ºç©ºååéé»è®¤é
ç½®çæ¶æ¯å
容 |
| | | */ |
| | | @Async |
| | | public void sendMessage(List<Task> list, String name, List<String> messageType, String message) { |
| | | WorkflowUtils.sendMessage(list, name, messageType, message); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TaskVo> getTaskWaitByPage(TaskBo taskBo) { |
| | | PageQuery pageQuery = new PageQuery(); |
| | | pageQuery.setPageNum(taskBo.getPageNum()); |
| | | pageQuery.setPageSize(taskBo.getPageSize()); |
| | | QueryWrapper<TaskVo> queryWrapper = new QueryWrapper<>(); |
| | | List<RoleDTO> roles = LoginHelper.getLoginUser().getRoles(); |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | queryWrapper.eq("t.business_status_", BusinessStatusEnum.WAITING.getStatus()); |
| | | queryWrapper.eq("t.tenant_id_", TenantHelper.getTenantId()); |
| | | queryWrapper.and(w1 -> |
| | | w1.eq("t.assignee_", userId) |
| | | .or(w2 -> w2.isNull("t.assignee_") |
| | | .and(w3 -> w3.eq("t.user_id_", userId).or().in("t.group_id_", StreamUtils.toList(roles, RoleDTO::getRoleId)))) |
| | | ); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | queryWrapper.like("t.name_", taskBo.getName()); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { |
| | | queryWrapper.like("t.processDefinitionName", taskBo.getProcessDefinitionName()); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { |
| | | queryWrapper.eq("t.processDefinitionKey", taskBo.getProcessDefinitionKey()); |
| | | } |
| | | Page<TaskVo> page = actTaskMapper.getTaskWaitByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TaskVo> getAllTaskWaitByPage(TaskBo taskBo) { |
| | | TaskQuery query = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | query.taskNameLike("%" + taskBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { |
| | | query.processDefinitionNameLike("%" + taskBo.getProcessDefinitionName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { |
| | | query.processDefinitionKey(taskBo.getProcessDefinitionKey()); |
| | | } |
| | | query.orderByTaskCreateTime().desc(); |
| | | List<Task> taskList = query.listPage(taskBo.getPageNum(), taskBo.getPageSize()); |
| | | List<ProcessInstance> processInstanceList = null; |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | Set<String> processInstanceIds = StreamUtils.toSet(taskList, Task::getProcessInstanceId); |
| | | processInstanceList = runtimeService.createProcessInstanceQuery().processInstanceIds(processInstanceIds).list(); |
| | | } |
| | | List<TaskVo> list = new ArrayList<>(); |
| | | for (Task task : taskList) { |
| | | TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class); |
| | | if (CollUtil.isNotEmpty(processInstanceList)) { |
| | | processInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> { |
| | | taskVo.setBusinessStatus(e.getBusinessStatus()); |
| | | taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus())); |
| | | taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey()); |
| | | taskVo.setProcessDefinitionName(e.getProcessDefinitionName()); |
| | | }); |
| | | } |
| | | taskVo.setAssignee(StringUtils.isNotBlank(task.getAssignee()) ? Long.valueOf(task.getAssignee()) : null); |
| | | taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | list.add(taskVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TaskVo> getTaskFinishByPage(TaskBo taskBo) { |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).taskTenantId(TenantHelper.getTenantId()).finished().orderByHistoricTaskInstanceStartTime().desc(); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | query.taskNameLike("%" + taskBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { |
| | | query.processDefinitionNameLike("%" + taskBo.getProcessDefinitionName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { |
| | | query.processDefinitionKey(taskBo.getProcessDefinitionKey()); |
| | | } |
| | | List<HistoricTaskInstance> taskInstanceList = query.listPage(taskBo.getPageNum(), taskBo.getPageSize()); |
| | | List<HistoricProcessInstance> historicProcessInstanceList = null; |
| | | if (CollUtil.isNotEmpty(taskInstanceList)) { |
| | | Set<String> processInstanceIds = StreamUtils.toSet(taskInstanceList, HistoricTaskInstance::getProcessInstanceId); |
| | | historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds).list(); |
| | | } |
| | | List<TaskVo> list = new ArrayList<>(); |
| | | for (HistoricTaskInstance task : taskInstanceList) { |
| | | TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class); |
| | | if (CollUtil.isNotEmpty(historicProcessInstanceList)) { |
| | | historicProcessInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> { |
| | | taskVo.setBusinessStatus(e.getBusinessStatus()); |
| | | taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus())); |
| | | taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey()); |
| | | taskVo.setProcessDefinitionName(e.getProcessDefinitionName()); |
| | | }); |
| | | } |
| | | taskVo.setAssignee(StringUtils.isNotBlank(task.getAssignee()) ? Long.valueOf(task.getAssignee()) : null); |
| | | list.add(taskVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TaskVo> getTaskCopyByPage(TaskBo taskBo) { |
| | | PageQuery pageQuery = new PageQuery(); |
| | | pageQuery.setPageNum(taskBo.getPageNum()); |
| | | pageQuery.setPageSize(taskBo.getPageSize()); |
| | | QueryWrapper<TaskVo> queryWrapper = new QueryWrapper<>(); |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | queryWrapper.like("t.name_", taskBo.getName()); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { |
| | | queryWrapper.like("t.processDefinitionName", taskBo.getProcessDefinitionName()); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { |
| | | queryWrapper.eq("t.processDefinitionKey", taskBo.getProcessDefinitionKey()); |
| | | } |
| | | queryWrapper.eq("t.assignee_", userId); |
| | | Page<TaskVo> page = actTaskMapper.getTaskCopyByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TaskVo> getAllTaskFinishByPage(TaskBo taskBo) { |
| | | HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().taskTenantId(TenantHelper.getTenantId()).finished().orderByHistoricTaskInstanceStartTime().desc(); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | query.taskNameLike("%" + taskBo.getName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { |
| | | query.processDefinitionNameLike("%" + taskBo.getProcessDefinitionName() + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { |
| | | query.processDefinitionKey(taskBo.getProcessDefinitionKey()); |
| | | } |
| | | List<HistoricTaskInstance> taskInstanceList = query.listPage(taskBo.getPageNum(), taskBo.getPageSize()); |
| | | List<HistoricProcessInstance> historicProcessInstanceList = null; |
| | | if (CollUtil.isNotEmpty(taskInstanceList)) { |
| | | Set<String> processInstanceIds = StreamUtils.toSet(taskInstanceList, HistoricTaskInstance::getProcessInstanceId); |
| | | historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds).list(); |
| | | } |
| | | List<TaskVo> list = new ArrayList<>(); |
| | | for (HistoricTaskInstance task : taskInstanceList) { |
| | | TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class); |
| | | if (CollUtil.isNotEmpty(historicProcessInstanceList)) { |
| | | historicProcessInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> { |
| | | taskVo.setBusinessStatus(e.getBusinessStatus()); |
| | | taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus())); |
| | | taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey()); |
| | | taskVo.setProcessDefinitionName(e.getProcessDefinitionName()); |
| | | }); |
| | | } |
| | | taskVo.setAssignee(Convert.toLong(task.getAssignee())); |
| | | list.add(taskVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | } |
| | | |
| | | /** |
| | | * å§æ´¾ä»»å¡ |
| | | * |
| | | * @param delegateBo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean delegateTask(DelegateBo delegateBo) { |
| | | TaskEntity task = (TaskEntity) taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).taskId(delegateBo.getTaskId()).taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | try { |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.PENDING.getStatus(), "ã" + LoginHelper.getLoginUser().getNickname() + "ãå§æ´¾ç»ã" + delegateBo.getNickName() + "ã"); |
| | | //å§æä»»å¡ |
| | | taskService.delegateTask(delegateBo.getTaskId(), delegateBo.getUserId()); |
| | | //åççæçä»»å¡è®°å½ |
| | | taskService.complete(newTask.getId()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param terminationBo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean terminationTask(TerminationBo terminationBo) { |
| | | Task task = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).taskId(terminationBo.getTaskId()).singleResult(); |
| | | |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(task.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.TERMINATION.getStatus().equals(historicProcessInstance.getBusinessStatus())) { |
| | | throw new ServiceException("è¯¥åæ®å·²ç»æ¢ï¼"); |
| | | } |
| | | try { |
| | | if (StringUtils.isBlank(terminationBo.getComment())) { |
| | | terminationBo.setComment(LoginHelper.getLoginUser().getNickname() + "ç»æ¢äºç³è¯·"); |
| | | } else { |
| | | terminationBo.setComment(LoginHelper.getLoginUser().getNickname() + "ç»æ¢äºç³è¯·ï¼" + terminationBo.getComment()); |
| | | } |
| | | taskService.addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.TERMINATION.getStatus(), terminationBo.getComment()); |
| | | List<Task> list = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(task.getProcessInstanceId()).list(); |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | List<Task> subTasks = StreamUtils.filter(list, e -> StringUtils.isNotBlank(e.getParentTaskId())); |
| | | if (CollectionUtil.isNotEmpty(subTasks)) { |
| | | subTasks.forEach(e -> taskService.deleteTask(e.getId())); |
| | | } |
| | | runtimeService.deleteProcessInstance(task.getProcessInstanceId(), StrUtil.EMPTY); |
| | | } |
| | | runtimeService.updateBusinessStatus(task.getProcessInstanceId(), BusinessStatusEnum.TERMINATION.getStatus()); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(historicProcessInstance.getBusinessKey(), BusinessStatusEnum.TERMINATION.getStatus(), false); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转åä»»å¡ |
| | | * |
| | | * @param transmitBo åæ° |
| | | */ |
| | | @Override |
| | | public boolean transferTask(TransmitBo transmitBo) { |
| | | Task task = taskService.createTaskQuery().taskId(transmitBo.getTaskId()).taskTenantId(TenantHelper.getTenantId()).taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | try { |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.TRANSFER.getStatus(), StringUtils.isNotBlank(transmitBo.getComment()) ? transmitBo.getComment() : LoginHelper.getUsername() + "转åäºä»»å¡"); |
| | | taskService.complete(newTask.getId()); |
| | | taskService.setAssignee(task.getId(), transmitBo.getUserId()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡å ç¾ |
| | | * |
| | | * @param addMultiBo åæ° |
| | | */ |
| | | @Override |
| | | public boolean addMultiInstanceExecution(AddMultiBo addMultiBo) { |
| | | TaskQuery taskQuery = taskService.createTaskQuery(); |
| | | taskQuery.taskId(addMultiBo.getTaskId()); |
| | | taskQuery.taskTenantId(TenantHelper.getTenantId()); |
| | | if (!LoginHelper.isSuperAdmin() && !LoginHelper.isTenantAdmin()) { |
| | | taskQuery.taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())); |
| | | } |
| | | Task task = taskQuery.singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | String taskDefinitionKey = task.getTaskDefinitionKey(); |
| | | String processInstanceId = task.getProcessInstanceId(); |
| | | String processDefinitionId = task.getProcessDefinitionId(); |
| | | |
| | | try { |
| | | MultiInstanceVo multiInstanceVo = WorkflowUtils.isMultiInstance(processDefinitionId, taskDefinitionKey); |
| | | if (multiInstanceVo == null) { |
| | | throw new ServiceException("å½åç¯è䏿¯ä¼ç¾èç¹"); |
| | | } |
| | | if (multiInstanceVo.getType() instanceof ParallelMultiInstanceBehavior) { |
| | | for (Long assignee : addMultiBo.getAssignees()) { |
| | | runtimeService.addMultiInstanceExecution(taskDefinitionKey, processInstanceId, Collections.singletonMap(multiInstanceVo.getAssignee(), assignee)); |
| | | } |
| | | } else if (multiInstanceVo.getType() instanceof SequentialMultiInstanceBehavior) { |
| | | AddSequenceMultiInstanceCmd addSequenceMultiInstanceCmd = new AddSequenceMultiInstanceCmd(task.getExecutionId(), multiInstanceVo.getAssigneeList(), addMultiBo.getAssignees()); |
| | | managementService.executeCommand(addSequenceMultiInstanceCmd); |
| | | } |
| | | List<String> assigneeNames = addMultiBo.getAssigneeNames(); |
| | | String username = LoginHelper.getUsername(); |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), processInstanceId, TaskStatusEnum.SIGN.getStatus(), username + "å ç¾ã" + String.join(StringUtils.SEPARATOR, assigneeNames) + "ã"); |
| | | taskService.complete(newTask.getId()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡åç¾ |
| | | * |
| | | * @param deleteMultiBo åæ° |
| | | */ |
| | | @Override |
| | | public boolean deleteMultiInstanceExecution(DeleteMultiBo deleteMultiBo) { |
| | | TaskQuery taskQuery = taskService.createTaskQuery(); |
| | | taskQuery.taskId(deleteMultiBo.getTaskId()); |
| | | taskQuery.taskTenantId(TenantHelper.getTenantId()); |
| | | if (!LoginHelper.isSuperAdmin() && !LoginHelper.isTenantAdmin()) { |
| | | taskQuery.taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())); |
| | | } |
| | | Task task = taskQuery.singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | String taskDefinitionKey = task.getTaskDefinitionKey(); |
| | | String processInstanceId = task.getProcessInstanceId(); |
| | | String processDefinitionId = task.getProcessDefinitionId(); |
| | | try { |
| | | MultiInstanceVo multiInstanceVo = WorkflowUtils.isMultiInstance(processDefinitionId, taskDefinitionKey); |
| | | if (multiInstanceVo == null) { |
| | | throw new ServiceException("å½åç¯è䏿¯ä¼ç¾èç¹"); |
| | | } |
| | | if (multiInstanceVo.getType() instanceof ParallelMultiInstanceBehavior) { |
| | | for (String executionId : deleteMultiBo.getExecutionIds()) { |
| | | runtimeService.deleteMultiInstanceExecution(executionId, false); |
| | | } |
| | | for (String taskId : deleteMultiBo.getTaskIds()) { |
| | | historyService.deleteHistoricTaskInstance(taskId); |
| | | } |
| | | } else if (multiInstanceVo.getType() instanceof SequentialMultiInstanceBehavior) { |
| | | DeleteSequenceMultiInstanceCmd deleteSequenceMultiInstanceCmd = new DeleteSequenceMultiInstanceCmd(task.getAssignee(), task.getExecutionId(), multiInstanceVo.getAssigneeList(), deleteMultiBo.getAssigneeIds()); |
| | | managementService.executeCommand(deleteSequenceMultiInstanceCmd); |
| | | } |
| | | List<String> assigneeNames = deleteMultiBo.getAssigneeNames(); |
| | | String username = LoginHelper.getUsername(); |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), processInstanceId, TaskStatusEnum.SIGN_OFF.getStatus(), username + "åç¾ã" + String.join(StringUtils.SEPARATOR, assigneeNames) + "ã"); |
| | | taskService.complete(newTask.getId()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param backProcessBo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String backProcess(BackProcessBo backProcessBo) { |
| | | Task task = taskService.createTaskQuery().taskId(backProcessBo.getTaskId()).taskTenantId(TenantHelper.getTenantId()).taskAssignee(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | try { |
| | | String processInstanceId = task.getProcessInstanceId(); |
| | | ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); |
| | | //è·åå¹¶è¡ç½å
³æ§è¡åä¿ççæ§è¡å®ä¾æ°æ® |
| | | ExecutionChildByExecutionIdCmd childByExecutionIdCmd = new ExecutionChildByExecutionIdCmd(task.getExecutionId()); |
| | | List<ExecutionEntity> executionEntities = managementService.executeCommand(childByExecutionIdCmd); |
| | | //æ ¡éªåæ® |
| | | if (BusinessStatusEnum.BACK.getStatus().equals(processInstance.getBusinessStatus())) { |
| | | throw new ServiceException("è¯¥åæ®å·²éåï¼"); |
| | | } |
| | | //夿æ¯å¦æå¤ä¸ªä»»å¡ |
| | | List<Task> taskList = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | //ç³è¯·äººèç¹ |
| | | HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).finished().orderByHistoricTaskInstanceEndTime().asc().list().get(0); |
| | | String backTaskDefinitionKey = historicTaskInstance.getTaskDefinitionKey(); |
| | | taskService.addComment(task.getId(), processInstanceId, TaskStatusEnum.BACK.getStatus(), StringUtils.isNotBlank(backProcessBo.getMessage()) ? backProcessBo.getMessage() : "éå"); |
| | | if (taskList.size() > 1) { |
| | | //å½åå¤ä¸ªä»»å¡é©³åå°å个èç¹ |
| | | runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdsToSingleActivityId(taskList.stream().map(Task::getTaskDefinitionKey).distinct().collect(Collectors.toList()), backTaskDefinitionKey).changeState(); |
| | | } else { |
| | | //å½åå个èç¹é©³åå个èç¹ |
| | | runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdTo(task.getTaskDefinitionKey(), backTaskDefinitionKey).changeState(); |
| | | } |
| | | List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | for (Task t : list) { |
| | | taskService.setAssignee(t.getId(), historicTaskInstance.getAssignee()); |
| | | } |
| | | //åéæ¶æ¯ |
| | | String message = "æ¨çã" + processInstance.getName() + "ã忮已ç»è¢«é©³åï¼è¯·æ¨æ³¨ææ¥æ¶ã"; |
| | | sendMessage(list, processInstance.getName(), backProcessBo.getMessageType(), message); |
| | | //å 餿µç¨å®ä¾å徿°æ® |
| | | for (ExecutionEntity executionEntity : executionEntities) { |
| | | DeleteExecutionCmd deleteExecutionCmd = new DeleteExecutionCmd(executionEntity.getId()); |
| | | managementService.executeCommand(deleteExecutionCmd); |
| | | } |
| | | runtimeService.updateBusinessStatus(processInstanceId, BusinessStatusEnum.BACK.getStatus()); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(processInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), BusinessStatusEnum.BACK.getStatus(), false); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return task.getProcessInstanceId(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIds ä»»å¡id |
| | | * @param userId åç人id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateAssignee(String[] taskIds, String userId) { |
| | | try { |
| | | List<Task> list = taskService.createTaskQuery().taskIds(Arrays.asList(taskIds)).taskTenantId(TenantHelper.getTenantId()).list(); |
| | | for (Task task : list) { |
| | | taskService.setAssignee(task.getId(), userId); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | return true; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | import org.dromara.workflow.mapper.TestLeaveMapper; |
| | | import org.dromara.workflow.service.IActProcessInstanceService; |
| | | import org.dromara.workflow.service.ITestLeaveService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 请åServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class TestLeaveServiceImpl implements ITestLeaveService { |
| | | |
| | | private final TestLeaveMapper baseMapper; |
| | | private final IActProcessInstanceService iActProcessInstanceService; |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·å |
| | | */ |
| | | @Override |
| | | public TestLeaveVo queryById(Long id) { |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo); |
| | | Page<TestLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | TableDataInfo<TestLeaveVo> build = TableDataInfo.build(result); |
| | | List<TestLeaveVo> rows = build.getRows(); |
| | | if (CollUtil.isNotEmpty(rows)) { |
| | | List<String> ids = StreamUtils.toList(rows, e -> String.valueOf(e.getId())); |
| | | WorkflowUtils.setProcessInstanceListVo(rows, ids, "id"); |
| | | } |
| | | return build; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | @Override |
| | | public List<TestLeaveVo> queryList(TestLeaveBo bo) { |
| | | LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<TestLeave> buildQueryWrapper(TestLeaveBo bo) { |
| | | LambdaQueryWrapper<TestLeave> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), TestLeave::getLeaveType, bo.getLeaveType()); |
| | | lqw.ge(bo.getStartLeaveDays() != null,TestLeave::getLeaveDays, bo.getStartLeaveDays()); |
| | | lqw.le(bo.getEndLeaveDays() != null,TestLeave::getLeaveDays, bo.getEndLeaveDays()); |
| | | lqw.orderByDesc(BaseEntity::getCreateTime); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è¯·å |
| | | */ |
| | | @Override |
| | | public TestLeave insertByBo(TestLeaveBo bo) { |
| | | TestLeave add = MapstructUtils.convert(bo, TestLeave.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return add; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹è¯·å |
| | | */ |
| | | @Override |
| | | public TestLeave updateByBo(TestLeaveBo bo) { |
| | | TestLeave update = MapstructUtils.convert(bo, TestLeave.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0 ? update : null; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(TestLeave entity) { |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤è¯·å |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids) { |
| | | List<String> idList = StreamUtils.toList(ids, String::valueOf); |
| | | iActProcessInstanceService.deleteRuntimeProcessAndHisInstByBusinessKeys(idList); |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.workflow.domain.WfCategory; |
| | | import org.dromara.workflow.domain.bo.WfCategoryBo; |
| | | import org.dromara.workflow.domain.vo.WfCategoryVo; |
| | | import org.dromara.workflow.mapper.WfCategoryMapper; |
| | | import org.dromara.workflow.service.IWfCategoryService; |
| | | import org.flowable.engine.RepositoryService; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.Model; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±»Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author may |
| | | * @date 2023-06-28 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class WfCategoryServiceImpl implements IWfCategoryService { |
| | | |
| | | private final WfCategoryMapper baseMapper; |
| | | |
| | | private final RepositoryService repositoryService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±» |
| | | */ |
| | | @Override |
| | | public WfCategoryVo queryById(Long id) { |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | */ |
| | | @Override |
| | | public List<WfCategoryVo> queryList(WfCategoryBo bo) { |
| | | LambdaQueryWrapper<WfCategory> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<WfCategory> buildQueryWrapper(WfCategoryBo bo) { |
| | | LambdaQueryWrapper<WfCategory> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), WfCategory::getCategoryName, bo.getCategoryName()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getCategoryCode()), WfCategory::getCategoryCode, bo.getCategoryCode()); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(WfCategoryBo bo) { |
| | | WfCategory add = MapstructUtils.convert(bo, WfCategory.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateByBo(WfCategoryBo bo) { |
| | | WfCategory update = MapstructUtils.convert(bo, WfCategory.class); |
| | | validEntityBeforeSave(update); |
| | | WfCategoryVo wfCategoryVo = baseMapper.selectVoById(bo.getId()); |
| | | List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery().processDefinitionCategory(wfCategoryVo.getCategoryCode()).list(); |
| | | for (ProcessDefinition processDefinition : processDefinitionList) { |
| | | repositoryService.setProcessDefinitionCategory(processDefinition.getId(), bo.getCategoryCode()); |
| | | } |
| | | List<Deployment> deploymentList = repositoryService.createDeploymentQuery().deploymentCategory(wfCategoryVo.getCategoryCode()).list(); |
| | | for (Deployment deployment : deploymentList) { |
| | | repositoryService.setDeploymentCategory(deployment.getId(), bo.getCategoryCode()); |
| | | } |
| | | List<Model> modelList = repositoryService.createModelQuery().modelCategory(wfCategoryVo.getCategoryCode()).list(); |
| | | for (Model model : modelList) { |
| | | model.setCategory(bo.getCategoryCode()); |
| | | repositoryService.saveModel(model); |
| | | } |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(WfCategory entity) { |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿µç¨åç±» |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | | * æç
§ç±»å«ç¼ç æ¥è¯¢ |
| | | * |
| | | * @param categoryCode åç±»æ¯å |
| | | */ |
| | | @Override |
| | | public WfCategory queryByCategoryCode(String categoryCode) { |
| | | return baseMapper.selectOne(new LambdaQueryWrapper<WfCategory>().eq(WfCategory::getCategoryCode, categoryCode)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.system.domain.SysUser; |
| | | import org.dromara.system.domain.SysUserRole; |
| | | import org.dromara.system.domain.bo.SysUserBo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.system.mapper.SysUserMapper; |
| | | import org.dromara.system.mapper.SysUserRoleMapper; |
| | | import org.dromara.workflow.domain.bo.SysUserMultiBo; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.service.IWorkflowUserService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| | | import org.flowable.task.api.Task; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 工使µç¨æ·é人管ç ä¸å¡å¤çå± |
| | | * |
| | | * @author may |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class WorkflowUserServiceImpl implements IWorkflowUserService { |
| | | |
| | | private final SysUserMapper sysUserMapper; |
| | | private final SysUserRoleMapper sysUserRoleMapper; |
| | | private final TaskService taskService; |
| | | private final RuntimeService runtimeService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥ä½æµéæ©å ç¾äººå |
| | | * |
| | | * @param sysUserMultiBo åæ° |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | public TableDataInfo<SysUserVo> getWorkflowAddMultiInstanceByPage(SysUserMultiBo sysUserMultiBo) { |
| | | Task task = taskService.createTaskQuery().taskId(sysUserMultiBo.getTaskId()).singleResult(); |
| | | if (task == null) { |
| | | throw new ServiceException("ä»»å¡ä¸åå¨"); |
| | | } |
| | | MultiInstanceVo multiInstance = WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()); |
| | | if (multiInstance == null) { |
| | | return TableDataInfo.build(); |
| | | } |
| | | LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery(); |
| | | //æ£ç´¢æ¡ä»¶ |
| | | queryWrapper.eq(StringUtils.isNotEmpty(sysUserMultiBo.getDeptId()), SysUser::getDeptId, sysUserMultiBo.getDeptId()); |
| | | queryWrapper.eq(SysUser::getStatus, UserStatus.OK.getCode()); |
| | | if (multiInstance.getType() instanceof SequentialMultiInstanceBehavior) { |
| | | List<Long> assigneeList = (List<Long>) runtimeService.getVariable(task.getExecutionId(), multiInstance.getAssigneeList()); |
| | | queryWrapper.notIn(CollectionUtil.isNotEmpty(assigneeList), SysUser::getUserId, assigneeList); |
| | | } else { |
| | | List<Task> list = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); |
| | | List<Long> userIds = StreamUtils.toList(list, e -> Long.valueOf(e.getAssignee())); |
| | | queryWrapper.notIn(CollectionUtil.isNotEmpty(userIds), SysUser::getUserId, userIds); |
| | | } |
| | | queryWrapper.like(StringUtils.isNotEmpty(sysUserMultiBo.getUserName()), SysUser::getUserName, sysUserMultiBo.getUserName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(sysUserMultiBo.getNickName()), SysUser::getNickName, sysUserMultiBo.getNickName()); |
| | | Page<SysUser> page = new Page<>(sysUserMultiBo.getPageNum(), sysUserMultiBo.getPageSize()); |
| | | Page<SysUserVo> userPage = sysUserMapper.selectVoPage(page, queryWrapper); |
| | | return TableDataInfo.build(recordPage(userPage)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥ä½æµéæ©åç¾äººå |
| | | * |
| | | * @param taskId ä»»å¡id ä»»å¡id |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | public List<TaskVo> getWorkflowDeleteMultiInstanceList(String taskId) { |
| | | Task task = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).taskId(taskId).singleResult(); |
| | | List<Task> taskList = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(task.getProcessInstanceId()).list(); |
| | | MultiInstanceVo multiInstance = WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()); |
| | | List<TaskVo> taskListVo = new ArrayList<>(); |
| | | if (multiInstance == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<Long> assigneeList = new ArrayList<>(); |
| | | if (multiInstance.getType() instanceof SequentialMultiInstanceBehavior) { |
| | | List<Object> variable = (List<Object>) runtimeService.getVariable(task.getExecutionId(), multiInstance.getAssigneeList()); |
| | | for (Object o : variable) { |
| | | assigneeList.add(Long.valueOf(o.toString())); |
| | | } |
| | | } |
| | | |
| | | if (multiInstance.getType() instanceof SequentialMultiInstanceBehavior) { |
| | | List<Long> userIds = StreamUtils.filter(assigneeList, e -> !String.valueOf(e).equals(task.getAssignee())); |
| | | List<SysUserVo> sysUsers = null; |
| | | if (CollectionUtil.isNotEmpty(userIds)) { |
| | | sysUsers = sysUserMapper.selectVoBatchIds(userIds); |
| | | } |
| | | for (Long userId : userIds) { |
| | | TaskVo taskVo = new TaskVo(); |
| | | taskVo.setId("串è¡ä¼ç¾"); |
| | | taskVo.setExecutionId("串è¡ä¼ç¾"); |
| | | taskVo.setProcessInstanceId(task.getProcessInstanceId()); |
| | | taskVo.setName(task.getName()); |
| | | taskVo.setAssignee(userId); |
| | | if (CollectionUtil.isNotEmpty(sysUsers)) { |
| | | sysUsers.stream().filter(u -> u.getUserId().toString().equals(userId.toString())).findFirst().ifPresent(u -> taskVo.setAssigneeName(u.getNickName())); |
| | | } |
| | | taskListVo.add(taskVo); |
| | | } |
| | | return taskListVo; |
| | | } else if (multiInstance.getType() instanceof ParallelMultiInstanceBehavior) { |
| | | List<Task> tasks = StreamUtils.filter(taskList, e -> StringUtils.isBlank(e.getParentTaskId()) && !e.getExecutionId().equals(task.getExecutionId()) && e.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())); |
| | | if (CollectionUtil.isNotEmpty(tasks)) { |
| | | List<Long> userIds = StreamUtils.toList(tasks, e -> Long.valueOf(e.getAssignee())); |
| | | List<SysUserVo> sysUsers = null; |
| | | if (CollectionUtil.isNotEmpty(userIds)) { |
| | | sysUsers = sysUserMapper.selectVoBatchIds(userIds); |
| | | } |
| | | for (Task t : tasks) { |
| | | TaskVo taskVo = new TaskVo(); |
| | | taskVo.setId(t.getId()); |
| | | taskVo.setExecutionId(t.getExecutionId()); |
| | | taskVo.setProcessInstanceId(t.getProcessInstanceId()); |
| | | taskVo.setName(t.getName()); |
| | | taskVo.setAssignee(Long.valueOf(t.getAssignee())); |
| | | if (CollectionUtil.isNotEmpty(sysUsers)) { |
| | | sysUsers.stream().filter(u -> u.getUserId().toString().equals(t.getAssignee())).findFirst().ifPresent(e -> taskVo.setAssigneeName(e.getNickName())); |
| | | } |
| | | taskListVo.add(taskVo); |
| | | } |
| | | return taskListVo; |
| | | } |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** |
| | | * ç¿»è¯é¨é¨ |
| | | * |
| | | * @param page ç¨æ·åé¡µæ°æ® |
| | | */ |
| | | private Page<SysUserVo> recordPage(Page<SysUserVo> page) { |
| | | List<SysUserVo> records = page.getRecords(); |
| | | if (CollUtil.isEmpty(records)) { |
| | | return page; |
| | | } |
| | | List<Long> collectDeptId = StreamUtils.toList(records, SysUserVo::getDeptId); |
| | | if (CollUtil.isEmpty(collectDeptId)) { |
| | | return page; |
| | | } |
| | | page.setRecords(records); |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * æç
§ç¨æ·idæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param userIds ç¨æ·id |
| | | */ |
| | | @Override |
| | | public List<SysUserVo> getUserListByIds(List<Long> userIds) { |
| | | if (CollUtil.isEmpty(userIds)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery(); |
| | | // æ£ç´¢æ¡ä»¶ |
| | | queryWrapper.eq(SysUser::getStatus, UserStatus.OK.getCode()); |
| | | queryWrapper.in(SysUser::getUserId, userIds); |
| | | return sysUserMapper.selectVoList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * æç
§è§è²idæ¥è¯¢å
³èç¨æ·id |
| | | * |
| | | * @param roleIds è§è²id |
| | | */ |
| | | @Override |
| | | public List<SysUserRole> getUserRoleListByRoleIds(List<Long> roleIds) { |
| | | return sysUserRoleMapper.selectList(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ· |
| | | * |
| | | * @param sysUserBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<SysUserVo> getUserListByPage(SysUserBo sysUserBo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(sysUserBo.getDeptId() != null, SysUser::getDeptId, sysUserBo.getDeptId()); |
| | | queryWrapper.eq(SysUser::getStatus, UserStatus.OK.getCode()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(sysUserBo.getUserName()), SysUser::getUserName, sysUserBo.getUserName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(sysUserBo.getNickName()), SysUser::getNickName, sysUserBo.getNickName()); |
| | | Page<SysUserVo> userPage = sysUserMapper.selectVoPage(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(recordPage(userPage)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.utils; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.flowable.bpmn.converter.BpmnXMLConverter; |
| | | import org.flowable.bpmn.model.*; |
| | | import org.flowable.bpmn.model.Process; |
| | | import org.flowable.editor.language.json.converter.BpmnJsonConverter; |
| | | import org.flowable.engine.impl.util.ProcessDefinitionUtil; |
| | | |
| | | import javax.xml.stream.XMLInputFactory; |
| | | import javax.xml.stream.XMLStreamException; |
| | | import javax.xml.stream.XMLStreamReader; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.rmi.ServerException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 模åå·¥å
· |
| | | * |
| | | * @author may |
| | | */ |
| | | public class ModelUtils { |
| | | public ModelUtils() { |
| | | } |
| | | |
| | | public static BpmnModel xmlToBpmnModel(String xml) throws IOException { |
| | | if (xml == null) { |
| | | throw new ServerException("xmlä¸è½ä¸ºç©º"); |
| | | } |
| | | try { |
| | | InputStream inputStream = new ByteArrayInputStream(StrUtil.utf8Bytes(xml)); |
| | | XMLInputFactory factory = XMLInputFactory.newInstance(); |
| | | XMLStreamReader reader = factory.createXMLStreamReader(inputStream); |
| | | return new BpmnXMLConverter().convertToBpmnModel(reader); |
| | | } catch (XMLStreamException e) { |
| | | throw new ServerException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * bpmnModel转为xml |
| | | * |
| | | * @param jsonBytes json |
| | | */ |
| | | public static byte[] bpmnJsonToXmlBytes(byte[] jsonBytes) throws IOException { |
| | | if (jsonBytes == null) { |
| | | return new byte[0]; |
| | | } |
| | | // 1. jsonåèç 转æ BpmnModel 对象 |
| | | ObjectMapper objectMapper = JsonUtils.getObjectMapper(); |
| | | JsonNode jsonNode = objectMapper.readTree(jsonBytes); |
| | | BpmnModel bpmnModel = new BpmnJsonConverter().convertToBpmnModel(jsonNode); |
| | | |
| | | if (bpmnModel.getProcesses().isEmpty()) { |
| | | return new byte[0]; |
| | | } |
| | | // 2.å°bpmnModel转为xml |
| | | return new BpmnXMLConverter().convertToXML(bpmnModel); |
| | | } |
| | | |
| | | /** |
| | | * xml转为bpmnModel |
| | | * |
| | | * @param xmlBytes xml |
| | | */ |
| | | public static BpmnModel xmlToBpmnModel(byte[] xmlBytes) throws XMLStreamException { |
| | | ByteArrayInputStream byteArrayInputStream = IoUtil.toStream(xmlBytes); |
| | | XMLInputFactory xif = XMLInputFactory.newInstance(); |
| | | XMLStreamReader xtr = xif.createXMLStreamReader(byteArrayInputStream); |
| | | return new BpmnXMLConverter().convertToBpmnModel(xtr); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¨¡å |
| | | * |
| | | * @param bpmnModel bpmn模å |
| | | */ |
| | | public static void checkBpmnModel(BpmnModel bpmnModel) throws ServerException { |
| | | Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements(); |
| | | |
| | | checkBpmnNode(flowElements, false); |
| | | |
| | | List<SubProcess> subProcessList = flowElements.stream().filter(SubProcess.class::isInstance).map(SubProcess.class::cast).collect(Collectors.toList()); |
| | | if (!CollUtil.isEmpty(subProcessList)) { |
| | | for (SubProcess subProcess : subProcessList) { |
| | | Collection<FlowElement> subProcessFlowElements = subProcess.getFlowElements(); |
| | | checkBpmnNode(subProcessFlowElements, true); |
| | | } |
| | | } |
| | | List<MultiInstanceVo> multiInstanceVoList = new ArrayList<>(); |
| | | for (FlowElement flowElement : flowElements) { |
| | | if (flowElement instanceof UserTask && ObjectUtil.isNotEmpty(((UserTask) flowElement).getLoopCharacteristics()) && StringUtils.isNotBlank(((UserTask) flowElement).getLoopCharacteristics().getInputDataItem())) { |
| | | MultiInstanceVo multiInstanceVo = new MultiInstanceVo(); |
| | | multiInstanceVo.setAssigneeList(((UserTask) flowElement).getLoopCharacteristics().getInputDataItem()); |
| | | multiInstanceVoList.add(multiInstanceVo); |
| | | } |
| | | } |
| | | |
| | | if (CollectionUtil.isNotEmpty(multiInstanceVoList) && multiInstanceVoList.size() > 1) { |
| | | Map<String, List<MultiInstanceVo>> assigneeListGroup = StreamUtils.groupByKey(multiInstanceVoList, MultiInstanceVo::getAssigneeList); |
| | | for (Map.Entry<String, List<MultiInstanceVo>> entry : assigneeListGroup.entrySet()) { |
| | | List<MultiInstanceVo> value = entry.getValue(); |
| | | if (CollectionUtil.isNotEmpty(value) && value.size() > 1) { |
| | | String key = entry.getKey(); |
| | | throw new ServerException("ä¼ç¾äººåéåã" + key + "ãéå¤,è¯·éæ°è®¾ç½®éåKEY"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªbpmnèç¹æ¯å¦åæ³ |
| | | * |
| | | * @param flowElements èç¹éå |
| | | * @param subtask æ¯å¦åæµç¨ |
| | | */ |
| | | private static void checkBpmnNode(Collection<FlowElement> flowElements, boolean subtask) throws ServerException { |
| | | |
| | | if (CollUtil.isEmpty(flowElements)) { |
| | | throw new ServerException(subtask ? "åæµç¨å¿
é¡»åå¨èç¹" : "å¿
é¡»åå¨èç¹ï¼"); |
| | | } |
| | | |
| | | List<StartEvent> startEventList = flowElements.stream().filter(StartEvent.class::isInstance).map(StartEvent.class::cast).collect(Collectors.toList()); |
| | | if (CollUtil.isEmpty(startEventList)) { |
| | | throw new ServerException(subtask ? "åæµç¨å¿
é¡»åå¨å¼å§èç¹" : "å¿
é¡»åå¨å¼å§èç¹ï¼"); |
| | | } |
| | | |
| | | if (startEventList.size() > 1) { |
| | | throw new ServerException(subtask ? "åæµç¨åªè½åå¨ä¸ä¸ªå¼å§èç¹" : "åªè½åå¨ä¸ä¸ªå¼å§èç¹ï¼"); |
| | | } |
| | | |
| | | StartEvent startEvent = startEventList.get(0); |
| | | List<SequenceFlow> outgoingFlows = startEvent.getOutgoingFlows(); |
| | | if (CollUtil.isEmpty(outgoingFlows)) { |
| | | throw new ServerException(subtask ? "åæµç¨æµç¨èç¹ä¸ºç©ºï¼è¯·è³å°è®¾è®¡ä¸æ¡ä¸»çº¿æµç¨ï¼" : "æµç¨èç¹ä¸ºç©ºï¼è¯·è³å°è®¾è®¡ä¸æ¡ä¸»çº¿æµç¨ï¼"); |
| | | } |
| | | |
| | | FlowElement targetFlowElement = outgoingFlows.get(0).getTargetFlowElement(); |
| | | if (!(targetFlowElement instanceof UserTask) && !subtask) { |
| | | throw new ServerException("å¼å§èç¹å第ä¸ä¸ªèç¹å¿
é¡»æ¯ç¨æ·ä»»å¡ï¼"); |
| | | } |
| | | |
| | | List<EndEvent> endEventList = flowElements.stream().filter(EndEvent.class::isInstance).map(EndEvent.class::cast).collect(Collectors.toList()); |
| | | if (CollUtil.isEmpty(endEventList)) { |
| | | throw new ServerException(subtask ? "åæµç¨å¿
é¡»åå¨ç»æèç¹ï¼" : "å¿
é¡»åå¨ç»æèç¹ï¼"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å
¨é¨èç¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | public static List<FlowElement> getFlowElements(String processDefinitionId) { |
| | | BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); |
| | | List<FlowElement> list = new ArrayList<>(); |
| | | List<Process> processes = bpmnModel.getProcesses(); |
| | | Collection<FlowElement> flowElements = processes.get(0).getFlowElements(); |
| | | buildFlowElements(flowElements, list); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * éå½è·åææèç¹ |
| | | * |
| | | * @param flowElements èç¹ä¿¡æ¯ |
| | | * @param list éå |
| | | */ |
| | | private static void buildFlowElements(Collection<FlowElement> flowElements, List<FlowElement> list) { |
| | | for (FlowElement flowElement : flowElements) { |
| | | list.add(flowElement); |
| | | if (flowElement instanceof SubProcess) { |
| | | Collection<FlowElement> subFlowElements = ((SubProcess) flowElement).getFlowElements(); |
| | | buildFlowElements(subFlowElements, list); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå
¨é¨æ©å±ä¿¡æ¯ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | */ |
| | | public Map<String, List<ExtensionElement>> getExtensionElements(String processDefinitionId) { |
| | | Map<String, List<ExtensionElement>> map = new HashMap<>(); |
| | | List<FlowElement> flowElements = getFlowElements(processDefinitionId); |
| | | for (FlowElement flowElement : flowElements) { |
| | | if (flowElement instanceof UserTask && CollUtil.isNotEmpty(flowElement.getExtensionElements())) { |
| | | map.putAll(flowElement.getExtensionElements()); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * è·åæä¸ªèç¹çæ©å±ä¿¡æ¯ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @param flowElementId èç¹id |
| | | */ |
| | | public Map<String, List<ExtensionElement>> getExtensionElement(String processDefinitionId, String flowElementId) { |
| | | BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); |
| | | Process process = bpmnModel.getMainProcess(); |
| | | FlowElement flowElement = process.getFlowElement(flowElementId); |
| | | return flowElement.getExtensionElements(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.utils; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | import org.dromara.common.mail.utils.MailUtils; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.common.websocket.dto.WebSocketMessageDto; |
| | | import org.dromara.common.websocket.utils.WebSocketUtils; |
| | | import org.dromara.system.domain.SysUserRole; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.common.enums.BusinessStatusEnum; |
| | | import org.dromara.workflow.common.enums.MessageTypeEnum; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | import org.dromara.workflow.domain.ActHiTaskinst; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.dromara.workflow.domain.vo.ParticipantVo; |
| | | import org.dromara.workflow.domain.vo.ProcessInstanceVo; |
| | | import org.dromara.workflow.flowable.cmd.UpdateHiTaskInstCmd; |
| | | import org.dromara.workflow.mapper.ActHiTaskinstMapper; |
| | | import org.dromara.workflow.service.IActHiProcinstService; |
| | | import org.dromara.workflow.service.IWorkflowUserService; |
| | | import org.dromara.workflow.service.impl.WorkflowUserServiceImpl; |
| | | import org.flowable.bpmn.model.*; |
| | | import org.flowable.common.engine.api.delegate.Expression; |
| | | import org.flowable.engine.ProcessEngine; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| | | import org.flowable.identitylink.api.history.HistoricIdentityLink; |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.flowable.task.service.impl.persistence.entity.TaskEntity; |
| | | |
| | | import java.util.*; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.*; |
| | | |
| | | /** |
| | | * 工使µå·¥å
· |
| | | * |
| | | * @author may |
| | | */ |
| | | public class WorkflowUtils { |
| | | |
| | | public WorkflowUtils() { |
| | | } |
| | | |
| | | private static final ProcessEngine PROCESS_ENGINE = SpringUtils.getBean(ProcessEngine.class); |
| | | private static final IWorkflowUserService I_WORKFLOW_USER_SERVICE = SpringUtils.getBean(WorkflowUserServiceImpl.class); |
| | | private static final IActHiProcinstService I_ACT_HI_PROCINST_SERVICE = SpringUtils.getBean(IActHiProcinstService.class); |
| | | private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class); |
| | | |
| | | /** |
| | | * å建ä¸ä¸ªæ°ä»»å¡ |
| | | * |
| | | * @param currentTask åæ° |
| | | */ |
| | | public static TaskEntity createNewTask(Task currentTask) { |
| | | TaskEntity task = null; |
| | | if (ObjectUtil.isNotEmpty(currentTask)) { |
| | | task = (TaskEntity) PROCESS_ENGINE.getTaskService().newTask(); |
| | | task.setCategory(currentTask.getCategory()); |
| | | task.setDescription(currentTask.getDescription()); |
| | | task.setTenantId(currentTask.getTenantId()); |
| | | task.setAssignee(currentTask.getAssignee()); |
| | | task.setName(currentTask.getName()); |
| | | task.setProcessDefinitionId(currentTask.getProcessDefinitionId()); |
| | | task.setProcessInstanceId(currentTask.getProcessInstanceId()); |
| | | task.setTaskDefinitionKey(currentTask.getTaskDefinitionKey()); |
| | | task.setPriority(currentTask.getPriority()); |
| | | task.setCreateTime(new Date()); |
| | | task.setTenantId(TenantHelper.getTenantId()); |
| | | PROCESS_ENGINE.getTaskService().saveTask(task); |
| | | } |
| | | if (ObjectUtil.isNotNull(task)) { |
| | | UpdateHiTaskInstCmd updateHiTaskInstCmd = new UpdateHiTaskInstCmd(Collections.singletonList(task.getId()), task.getProcessDefinitionId(), task.getProcessInstanceId()); |
| | | PROCESS_ENGINE.getManagementService().executeCommand(updateHiTaskInstCmd); |
| | | } |
| | | return task; |
| | | } |
| | | |
| | | /** |
| | | * æéä»»å¡ |
| | | * |
| | | * @param parentTaskList ç¶çº§ä»»å¡ |
| | | * @param userIds 人åid |
| | | */ |
| | | public static void createCopyTask(List<Task> parentTaskList, List<Long> userIds) { |
| | | List<Task> list = new ArrayList<>(); |
| | | for (Task parentTask : parentTaskList) { |
| | | for (Long userId : userIds) { |
| | | TaskEntity newTask = (TaskEntity) PROCESS_ENGINE.getTaskService().newTask(); |
| | | newTask.setParentTaskId(parentTask.getId()); |
| | | newTask.setAssignee(userId.toString()); |
| | | newTask.setName("ãæéã-" + parentTask.getName()); |
| | | newTask.setProcessDefinitionId(parentTask.getProcessDefinitionId()); |
| | | newTask.setProcessInstanceId(parentTask.getProcessInstanceId()); |
| | | newTask.setTaskDefinitionKey(parentTask.getTaskDefinitionKey()); |
| | | newTask.setTenantId(TenantHelper.getTenantId()); |
| | | list.add(newTask); |
| | | } |
| | | } |
| | | PROCESS_ENGINE.getTaskService().bulkSaveTasks(list); |
| | | if (CollUtil.isNotEmpty(list) && CollUtil.isNotEmpty(parentTaskList)) { |
| | | String processInstanceId = parentTaskList.get(0).getProcessInstanceId(); |
| | | String processDefinitionId = parentTaskList.get(0).getProcessDefinitionId(); |
| | | List<String> taskIds = StreamUtils.toList(list, Task::getId); |
| | | ActHiTaskinst actHiTaskinst = new ActHiTaskinst(); |
| | | actHiTaskinst.setProcDefId(processDefinitionId); |
| | | actHiTaskinst.setProcInstId(processInstanceId); |
| | | actHiTaskinst.setScopeType(TaskStatusEnum.COPY.getStatus()); |
| | | actHiTaskinst.setTenantId(TenantHelper.getTenantId()); |
| | | LambdaUpdateWrapper<ActHiTaskinst> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.in(ActHiTaskinst::getId, taskIds); |
| | | ACT_HI_TASKINST_MAPPER.update(actHiTaskinst, updateWrapper); |
| | | for (Task task : list) { |
| | | PROCESS_ENGINE.getTaskService().addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.COPY.getStatus(), StrUtil.EMPTY); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡åä¸è
|
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | public static ParticipantVo getCurrentTaskParticipant(String taskId) { |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | List<HistoricIdentityLink> linksForTask = PROCESS_ENGINE.getHistoryService().getHistoricIdentityLinksForTask(taskId); |
| | | Task task = PROCESS_ENGINE.getTaskService().createTaskQuery().taskTenantId(TenantHelper.getTenantId()).taskId(taskId).singleResult(); |
| | | if (task != null && CollUtil.isNotEmpty(linksForTask)) { |
| | | List<HistoricIdentityLink> groupList = StreamUtils.filter(linksForTask, e -> StringUtils.isNotBlank(e.getGroupId())); |
| | | if (CollUtil.isNotEmpty(groupList)) { |
| | | List<Long> groupIds = StreamUtils.toList(groupList, e -> Long.valueOf(e.getGroupId())); |
| | | List<SysUserRole> sysUserRoles = I_WORKFLOW_USER_SERVICE.getUserRoleListByRoleIds(groupIds); |
| | | if (CollUtil.isNotEmpty(sysUserRoles)) { |
| | | participantVo.setGroupIds(groupIds); |
| | | List<Long> userIdList = StreamUtils.toList(sysUserRoles, SysUserRole::getUserId); |
| | | List<SysUserVo> sysUsers = I_WORKFLOW_USER_SERVICE.getUserListByIds(userIdList); |
| | | if (CollUtil.isNotEmpty(sysUsers)) { |
| | | List<Long> userIds = StreamUtils.toList(sysUsers, SysUserVo::getUserId); |
| | | List<String> nickNames = StreamUtils.toList(sysUsers, SysUserVo::getNickName); |
| | | participantVo.setCandidate(userIds); |
| | | participantVo.setCandidateName(nickNames); |
| | | participantVo.setClaim(!StringUtils.isBlank(task.getAssignee())); |
| | | } |
| | | } |
| | | } else { |
| | | List<HistoricIdentityLink> candidateList = StreamUtils.filter(linksForTask, e -> FlowConstant.CANDIDATE.equals(e.getType())); |
| | | List<Long> userIdList = new ArrayList<>(); |
| | | for (HistoricIdentityLink historicIdentityLink : linksForTask) { |
| | | try { |
| | | userIdList.add(Long.valueOf(historicIdentityLink.getUserId())); |
| | | } catch (NumberFormatException ignored) { |
| | | |
| | | } |
| | | } |
| | | List<SysUserVo> sysUsers = I_WORKFLOW_USER_SERVICE.getUserListByIds(userIdList); |
| | | if (CollUtil.isNotEmpty(sysUsers)) { |
| | | List<Long> userIds = StreamUtils.toList(sysUsers, SysUserVo::getUserId); |
| | | List<String> nickNames = StreamUtils.toList(sysUsers, SysUserVo::getNickName); |
| | | participantVo.setCandidate(userIds); |
| | | participantVo.setCandidateName(nickNames); |
| | | if (StringUtils.isBlank(task.getAssignee()) && CollUtil.isNotEmpty(candidateList)) { |
| | | participantVo.setClaim(false); |
| | | } |
| | | if (!StringUtils.isBlank(task.getAssignee()) && CollUtil.isNotEmpty(candidateList)) { |
| | | participantVo.setClaim(true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return participantVo; |
| | | } |
| | | |
| | | /** |
| | | * 夿å½åèç¹æ¯å¦ä¸ºä¼ç¾èç¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @param taskDefinitionKey æµç¨å®ä¹id |
| | | */ |
| | | public static MultiInstanceVo isMultiInstance(String processDefinitionId, String taskDefinitionKey) { |
| | | BpmnModel bpmnModel = PROCESS_ENGINE.getRepositoryService().getBpmnModel(processDefinitionId); |
| | | FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(taskDefinitionKey); |
| | | MultiInstanceVo multiInstanceVo = new MultiInstanceVo(); |
| | | //夿æ¯å¦ä¸ºå¹¶è¡ä¼ç¾èç¹ |
| | | if (flowNode.getBehavior() instanceof ParallelMultiInstanceBehavior behavior && behavior.getCollectionExpression() != null) { |
| | | Expression collectionExpression = behavior.getCollectionExpression(); |
| | | String assigneeList = collectionExpression.getExpressionText(); |
| | | String assignee = behavior.getCollectionElementVariable(); |
| | | multiInstanceVo.setType(behavior); |
| | | multiInstanceVo.setAssignee(assignee); |
| | | multiInstanceVo.setAssigneeList(assigneeList); |
| | | return multiInstanceVo; |
| | | //夿æ¯å¦ä¸ºä¸²è¡ä¼ç¾èç¹ |
| | | } else if (flowNode.getBehavior() instanceof SequentialMultiInstanceBehavior behavior && behavior.getCollectionExpression() != null) { |
| | | Expression collectionExpression = behavior.getCollectionExpression(); |
| | | String assigneeList = collectionExpression.getExpressionText(); |
| | | String assignee = behavior.getCollectionElementVariable(); |
| | | multiInstanceVo.setType(behavior); |
| | | multiInstanceVo.setAssignee(assignee); |
| | | multiInstanceVo.setAssigneeList(assigneeList); |
| | | return multiInstanceVo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | public static String getBusinessStatusByTaskId(String taskId) { |
| | | HistoricTaskInstance historicTaskInstance = PROCESS_ENGINE.getHistoryService().createHistoricTaskInstanceQuery().taskId(taskId).taskTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | HistoricProcessInstance historicProcessInstance = PROCESS_ENGINE.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(historicTaskInstance.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | return historicProcessInstance.getBusinessStatus(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | public static String getBusinessStatus(String processInstanceId) { |
| | | HistoricProcessInstance historicProcessInstance = PROCESS_ENGINE.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); |
| | | return historicProcessInstance.getBusinessStatus(); |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨å®ä¾å¯¹è±¡ |
| | | * |
| | | * @param obj ä¸å¡å¯¹è±¡ |
| | | * @param businessKey ä¸å¡id |
| | | */ |
| | | public static void setProcessInstanceVo(Object obj, String businessKey) { |
| | | if (StringUtils.isBlank(businessKey)) { |
| | | return; |
| | | } |
| | | ActHiProcinst actHiProcinst = I_ACT_HI_PROCINST_SERVICE.selectByBusinessKey(businessKey); |
| | | if (actHiProcinst == null) { |
| | | ProcessInstanceVo processInstanceVo = new ProcessInstanceVo(); |
| | | processInstanceVo.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); |
| | | ReflectUtils.invokeSetter(obj, PROCESS_INSTANCE_VO, processInstanceVo); |
| | | return; |
| | | } |
| | | ProcessInstanceVo processInstanceVo = BeanUtil.toBean(actHiProcinst, ProcessInstanceVo.class); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstanceVo.getBusinessStatus())); |
| | | ReflectUtils.invokeSetter(obj, PROCESS_INSTANCE_VO, processInstanceVo); |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨å®ä¾å¯¹è±¡ |
| | | * |
| | | * @param obj ä¸å¡å¯¹è±¡ |
| | | * @param idList ä¸å¡id |
| | | * @param fieldName 主é®å±æ§åç§° |
| | | */ |
| | | public static void setProcessInstanceListVo(Object obj, List<String> idList, String fieldName) { |
| | | if (CollUtil.isEmpty(idList)) { |
| | | return; |
| | | } |
| | | List<ActHiProcinst> actHiProcinstList = I_ACT_HI_PROCINST_SERVICE.selectByBusinessKeyIn(idList); |
| | | if (obj instanceof Collection<?> collection) { |
| | | for (Object o : collection) { |
| | | String fieldValue = ReflectUtils.invokeGetter(o, fieldName).toString(); |
| | | if (CollUtil.isEmpty(actHiProcinstList)) { |
| | | ProcessInstanceVo processInstanceVo = new ProcessInstanceVo(); |
| | | processInstanceVo.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstanceVo.getBusinessStatus())); |
| | | ReflectUtils.invokeSetter(o, PROCESS_INSTANCE_VO, processInstanceVo); |
| | | } else { |
| | | ActHiProcinst actHiProcinst = actHiProcinstList.stream().filter(e -> e.getBusinessKey().equals(fieldValue)).findFirst().orElse(null); |
| | | if (ObjectUtil.isNotEmpty(actHiProcinst)) { |
| | | ProcessInstanceVo processInstanceVo = BeanUtil.toBean(actHiProcinst, ProcessInstanceVo.class); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstanceVo.getBusinessStatus())); |
| | | ReflectUtils.invokeSetter(o, PROCESS_INSTANCE_VO, processInstanceVo); |
| | | } else { |
| | | ProcessInstanceVo processInstanceVo = new ProcessInstanceVo(); |
| | | processInstanceVo.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); |
| | | processInstanceVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(processInstanceVo.getBusinessStatus())); |
| | | ReflectUtils.invokeSetter(o, PROCESS_INSTANCE_VO, processInstanceVo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åéæ¶æ¯ |
| | | * |
| | | * @param list ä»»å¡ |
| | | * @param name æµç¨åç§° |
| | | * @param messageType æ¶æ¯ç±»å |
| | | * @param message æ¶æ¯å
容ï¼ä¸ºç©ºååéé»è®¤é
ç½®çæ¶æ¯å
容 |
| | | */ |
| | | public static void sendMessage(List<Task> list, String name, List<String> messageType, String message) { |
| | | Set<Long> userIds = new HashSet<>(); |
| | | if (StringUtils.isBlank(message)) { |
| | | message = "ææ°çã" + name + "ãåæ®å·²ç»æäº¤è³æ¨çå¾
åï¼è¯·æ¨åæ¶å¤çã"; |
| | | } |
| | | for (Task t : list) { |
| | | ParticipantVo taskParticipant = WorkflowUtils.getCurrentTaskParticipant(t.getId()); |
| | | if (CollUtil.isNotEmpty(taskParticipant.getGroupIds())) { |
| | | List<SysUserRole> sysUserRoles = I_WORKFLOW_USER_SERVICE.getUserRoleListByRoleIds(taskParticipant.getGroupIds()); |
| | | if (CollUtil.isNotEmpty(sysUserRoles)) { |
| | | userIds.addAll(StreamUtils.toList(sysUserRoles, SysUserRole::getUserId)); |
| | | } |
| | | } |
| | | List<Long> candidate = taskParticipant.getCandidate(); |
| | | if (CollUtil.isNotEmpty(candidate)) { |
| | | userIds.addAll(candidate); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(userIds)) { |
| | | List<SysUserVo> sysUserVoList = I_WORKFLOW_USER_SERVICE.getUserListByIds(new ArrayList<>(userIds)); |
| | | for (String code : messageType) { |
| | | if (code.equals(MessageTypeEnum.SYSTEM_MESSAGE.getCode())) { |
| | | WebSocketMessageDto dto = new WebSocketMessageDto(); |
| | | dto.setSessionKeys(new ArrayList<>(userIds)); |
| | | dto.setMessage(message); |
| | | WebSocketUtils.publishMessage(dto); |
| | | } |
| | | if (code.equals(MessageTypeEnum.EMAIL_MESSAGE.getCode())) { |
| | | MailUtils.sendText(StreamUtils.join(sysUserVoList, SysUserVo::getEmail), "åæ®å®¡æ¹æé", message); |
| | | } |
| | | if (code.equals(MessageTypeEnum.SMS_MESSAGE.getCode())) { |
| | | //todo çä¿¡åé |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | javaå
ä½¿ç¨ `.` åå² resource ç®å½ä½¿ç¨ `/` åå² |
| | | <br> |
| | | æ¤æä»¶ç®ç 鲿¢æä»¶å¤¹ç²è¿æ¾ä¸å° `xml` æä»¶ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.ActHiProcinstMapper"> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.ActHiTaskinstMapper"> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.ActTaskMapper"> |
| | | <resultMap type="org.dromara.workflow.domain.vo.TaskVo" id="TaskWaitingVoResult"> |
| | | <result property="id" column="ID_"/> |
| | | <result property="name" column="NAME_"/> |
| | | <result property="description" column="DESCRIPTION_"/> |
| | | <result property="priority" column="PRIORITY_"/> |
| | | <result property="owner" column="OWNER_"/> |
| | | <result property="assignee" column="ASSIGNEE_"/> |
| | | <result property="processInstanceId" column="PROC_INST_ID_"/> |
| | | <result property="executionId" column="EXECUTION_ID_"/> |
| | | <result property="taskDefinitionId" column="TASK_DEF_ID_"/> |
| | | <result property="processDefinitionId" column="PROC_DEF_ID_"/> |
| | | <result property="createTime" column="CREATE_TIME_"/> |
| | | <result property="endTime" column="END_TIME_"/> |
| | | <result property="taskDefinitionKey" column="TASK_DEF_KEY_"/> |
| | | <result property="dueDate" column="DUE_DATE_"/> |
| | | <result property="processDefinitionKey" column="key_"/> |
| | | <result property="category" column="CATEGORY_"/> |
| | | <result property="parentTaskId" column="PARENT_TASK_ID_"/> |
| | | <result property="tenantId" column="TENANT_ID_"/> |
| | | <result property="claimTime" column="CLAIM_TIME"/> |
| | | <result property="businessStatus" column="BUSINESS_STATUS_"/> |
| | | <result property="processDefinitionName" column="processDefinitionName"/> |
| | | <result property="processDefinitionKey" column="processDefinitionName"/> |
| | | |
| | | </resultMap> |
| | | <select id="getTaskWaitByPage" resultMap="TaskWaitingVoResult"> |
| | | select * |
| | | from (SELECT RES.*, |
| | | AHP.BUSINESS_STATUS_, |
| | | ARP.NAME_ as processDefinitionName, |
| | | ARP.KEY_ as processDefinitionKey, |
| | | LINK.USER_ID_, |
| | | LINK.GROUP_ID_ |
| | | FROM ACT_RU_TASK RES |
| | | INNER JOIN ACT_HI_PROCINST AHP ON RES.PROC_INST_ID_ = AHP.PROC_INST_ID_ |
| | | INNER JOIN ACT_RE_PROCDEF ARP ON ARP.ID_ = RES.PROC_DEF_ID_ |
| | | LEFT JOIN ACT_RU_IDENTITYLINK LINK ON LINK.TASK_ID_ = RES.ID_ AND LINK.TYPE_ = 'candidate' |
| | | WHERE RES.PARENT_TASK_ID_ is null |
| | | ORDER BY RES.CREATE_TIME_ DESC) t ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="getTaskCopyByPage" resultMap="TaskWaitingVoResult"> |
| | | select * |
| | | from (SELECT AHT.*, |
| | | AHP.BUSINESS_STATUS_, |
| | | ARP.NAME_ as processDefinitionName, |
| | | ARP.KEY_ as processDefinitionKey |
| | | FROM ACT_HI_TASKINST AHT |
| | | INNER JOIN ACT_HI_PROCINST AHP ON AHT.PROC_INST_ID_ = AHP.PROC_INST_ID_ |
| | | INNER JOIN ACT_RE_PROCDEF ARP ON ARP.ID_ = AHT.PROC_DEF_ID_ |
| | | WHERE AHT.PARENT_TASK_ID_ is not null |
| | | and AHT.scope_type_ = 'copy' |
| | | ORDER BY AHT.START_TIME_ DESC) t ${ew.getCustomSqlSegment} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.TestLeaveMapper"> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.WfCategoryMapper"> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | insert into sys_menu values('11616', '工使µ' , '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11617', '模å管ç', '11616', '2', 'model', 'workflow/model/index', '', '1', '1', 'C', '0', '0', 'workflow:model:list', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | |
| | | |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | insert into sys_menu values ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1, sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1, sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove','#', 103, 1, sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export','#', 103, 1, sysdate(), null, null, ''); |
| | | -- 请ååä¿¡æ¯ |
| | | DROP TABLE if EXISTS test_leave; |
| | | create table test_leave |
| | | ( |
| | | id bigint not null comment '主é®', |
| | | leave_type varchar(255) not null comment '请åç±»å', |
| | | start_date datetime not null comment 'å¼å§æ¶é´', |
| | | end_date datetime not null comment 'ç»ææ¶é´', |
| | | leave_days int(10) not null comment '请å天æ°', |
| | | remark varchar(255) null comment '请ååå ', |
| | | create_dept bigint null comment 'å建é¨é¨', |
| | | create_by bigint null comment 'å建è
', |
| | | create_time datetime null comment 'å建æ¶é´', |
| | | update_by bigint null comment 'æ´æ°è
', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | tenant_id varchar(20) default '000000' null comment 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (id) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT = '请åç³è¯·è¡¨'; |
| | | |
| | | -- æµç¨å类信æ¯è¡¨ |
| | | DROP TABLE if EXISTS wf_category; |
| | | create table wf_category |
| | | ( |
| | | id bigint not null comment '主é®' |
| | | primary key, |
| | | category_name varchar(255) null comment 'åç±»åç§°', |
| | | category_code varchar(255) null comment 'åç±»ç¼ç ', |
| | | parent_id bigint null comment 'ç¶çº§id', |
| | | sort_num int(19) null comment 'æåº', |
| | | tenant_id varchar(20) default '000000' null comment 'ç§æ·ç¼å·', |
| | | create_dept bigint null comment 'å建é¨é¨', |
| | | create_by bigint null comment 'å建è
', |
| | | create_time datetime null comment 'å建æ¶é´', |
| | | update_by bigint null comment 'æ´æ°è
', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | constraint uni_category_code |
| | | unique (category_code) |
| | | ) engine=innodb comment= 'æµç¨åç±»'; |
| | | |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11638, '请åç³è¯·', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11639, '请åç³è¯·æ¥è¯¢', 11638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11640, '请åç³è¯·æ°å¢', 11638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11641, '请åç³è¯·ä¿®æ¹', 11638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11642, '请åç³è¯·å é¤', 11638, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:remove', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11643, '请åç³è¯·å¯¼åº', 11638, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:export', '#', 103, 1, sysdate(), NULL, NULL, ''); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | insert into sys_menu values('11616', '工使µ' , '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11617', '模å管ç', '11616', '2', 'model', 'workflow/model/index', '', '1', '1', 'C', '0', '0', 'workflow:model:list', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | insert into sys_menu values('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate, NULL, NULL, ''); |
| | | |
| | | |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | insert into sys_menu values ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1, sysdate, null, null, ''); |
| | | insert into sys_menu values ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1, sysdate, null, null, ''); |
| | | insert into sys_menu values ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, sysdate, null, null, ''); |
| | | insert into sys_menu values ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove','#', 103, 1, sysdate, null, null, ''); |
| | | insert into sys_menu values ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export','#', 103, 1, sysdate, null, null, ''); |
| | | |
| | | -- 请ååä¿¡æ¯ |
| | | create table TEST_LEAVE |
| | | ( |
| | | ID NUMBER(20) not null |
| | | constraint PK_TEST_LEAVE |
| | | primary key, |
| | | LEAVE_TYPE VARCHAR2(255), |
| | | START_DATE DATE, |
| | | END_DATE DATE, |
| | | LEAVE_DAYS NUMBER(10), |
| | | REMARK VARCHAR2(255), |
| | | CREATE_DEPT NUMBER(20), |
| | | CREATE_BY NUMBER(20), |
| | | CREATE_TIME DATE, |
| | | UPDATE_BY NUMBER(20), |
| | | UPDATE_TIME DATE, |
| | | TENANT_ID VARCHAR2(255) default '000000' |
| | | ); |
| | | |
| | | comment on table TEST_LEAVE is '请åç³è¯·è¡¨' |
| | | comment on column TEST_LEAVE.ID is '主é®' |
| | | comment on column TEST_LEAVE.LEAVE_TYPE is '请åç±»å' |
| | | comment on column TEST_LEAVE.START_DATE is 'å¼å§æ¶é´' |
| | | comment on column TEST_LEAVE.END_DATE is 'ç»ææ¶é´' |
| | | comment on column TEST_LEAVE.LEAVE_DAYS is '请å天æ°' |
| | | comment on column TEST_LEAVE.REMARK is '请ååå ' |
| | | comment on column TEST_LEAVE.CREATE_DEPT is 'å建é¨é¨' |
| | | comment on column TEST_LEAVE.CREATE_BY is 'å建è
' |
| | | comment on column TEST_LEAVE.CREATE_TIME is 'å建æ¶é´' |
| | | comment on column TEST_LEAVE.UPDATE_BY is 'æ´æ°è
' |
| | | comment on column TEST_LEAVE.UPDATE_TIME is 'æ´æ°æ¶é´' |
| | | comment on column TEST_LEAVE.TENANT_ID is 'ç§æ·ç¼å·' |
| | | |
| | | -- æµç¨å类信æ¯è¡¨ |
| | | create table WF_CATEGORY |
| | | ( |
| | | ID NUMBER(20) not null |
| | | constraint PK_WF_CATEGORY |
| | | primary key, |
| | | CATEGORY_NAME VARCHAR2(255), |
| | | CATEGORY_CODE VARCHAR2(255) |
| | | constraint UNI_CATEGORY_CODE |
| | | unique, |
| | | PARENT_ID NUMBER(20), |
| | | SORT_NUM NUMBER(10), |
| | | TENANT_ID NUMBER(20), |
| | | CREATE_DEPT NUMBER(20), |
| | | CREATE_BY NUMBER(20), |
| | | CREATE_TIME DATE, |
| | | UPDATE_BY NUMBER(20), |
| | | UPDATE_TIME DATE |
| | | ); |
| | | |
| | | comment on table WF_CATEGORY is 'æµç¨åç±»' |
| | | comment on column WF_CATEGORY.ID is '主é®' |
| | | comment on column WF_CATEGORY.CATEGORY_NAME is 'åç±»åç§°' |
| | | comment on column WF_CATEGORY.CATEGORY_CODE is 'åç±»ç¼ç ' |
| | | comment on column WF_CATEGORY.PARENT_ID is 'ç¶çº§id' |
| | | comment on column WF_CATEGORY.SORT_NUM is 'æåº' |
| | | comment on column WF_CATEGORY.TENANT_ID is 'ç§æ·ç¼å·' |
| | | comment on column WF_CATEGORY.CREATE_DEPT is 'å建é¨é¨' |
| | | comment on column WF_CATEGORY.CREATE_BY is 'å建è
' |
| | | comment on column WF_CATEGORY.CREATE_TIME is 'å建æ¶é´' |
| | | comment on column WF_CATEGORY.UPDATE_BY is 'æ´æ°è
' |
| | | comment on column WF_CATEGORY.UPDATE_TIME is 'æ´æ°æ¶é´' |
| | | |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11638, '请åç³è¯·', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, sysdate, NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11639, '请åç³è¯·æ¥è¯¢', 11638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, sysdate, NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11640, '请åç³è¯·æ°å¢', 11638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, sysdate, NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11641, '请åç³è¯·ä¿®æ¹', 11638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, sysdate, NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11642, '请åç³è¯·å é¤', 11638, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:remove', '#', 103, 1, sysdate, NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11643, '请åç³è¯·å¯¼åº', 11638, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:export', '#', 103, 1, sysdate, NULL, NULL, ''); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | insert into sys_menu values('11616', '工使µ' , '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11617', '模å管ç', '11616', '2', 'model', 'workflow/model/index', '', '1', '1', 'C', '0', '0', 'workflow:model:list', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | insert into sys_menu values('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | |
| | | |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | insert into sys_menu values ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1, now(), null, null, ''); |
| | | insert into sys_menu values ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1, now(), null, null, ''); |
| | | insert into sys_menu values ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, now(), null, null, ''); |
| | | insert into sys_menu values ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove','#', 103, 1, now(), null, null, ''); |
| | | insert into sys_menu values ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export','#', 103, 1, now(), null, null, ''); |
| | | -- 请ååä¿¡æ¯ |
| | | DROP TABLE if EXISTS test_leave; |
| | | create table test_leave |
| | | ( |
| | | id bigint not null |
| | | constraint test_leave_pk |
| | | primary key, |
| | | leave_type varchar(255), |
| | | start_date timestamp, |
| | | end_date timestamp, |
| | | leave_days bigint, |
| | | remark varchar(255), |
| | | create_dept bigint, |
| | | create_by bigint, |
| | | create_time timestamp, |
| | | update_by bigint, |
| | | update_time timestamp, |
| | | tenant_id varchar(20) |
| | | ); |
| | | |
| | | comment on table test_leave is '请åç³è¯·è¡¨'; |
| | | |
| | | comment on column test_leave.id is '主é®'; |
| | | |
| | | comment on column test_leave.leave_type is '请åç±»å'; |
| | | |
| | | comment on column test_leave.start_date is 'å¼å§æ¶é´'; |
| | | |
| | | comment on column test_leave.end_date is 'ç»ææ¶é´'; |
| | | |
| | | comment on column test_leave.remark is '请ååå '; |
| | | |
| | | comment on column test_leave.create_dept is 'å建é¨é¨'; |
| | | |
| | | comment on column test_leave.create_by is 'å建è
'; |
| | | |
| | | comment on column test_leave.create_time is 'å建æ¶é´'; |
| | | |
| | | comment on column test_leave.update_by is 'æ´æ°è
'; |
| | | |
| | | comment on column test_leave.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | comment on column test_leave.tenant_id is 'ç§æ·ç¼ç '; |
| | | |
| | | alter table test_leave |
| | | owner to postgres; |
| | | |
| | | -- æµç¨å类信æ¯è¡¨ |
| | | DROP TABLE if EXISTS wf_category; |
| | | create table wf_category |
| | | ( |
| | | id bigint not null |
| | | constraint wf_category_pk |
| | | primary key, |
| | | category_name varchar(255), |
| | | category_code varchar(255), |
| | | parent_id bigint, |
| | | sort_num bigint, |
| | | tenant_id bigint, |
| | | create_dept bigint, |
| | | create_by bigint, |
| | | create_time timestamp, |
| | | update_by bigint, |
| | | update_time timestamp |
| | | ); |
| | | |
| | | comment on table wf_category is 'æµç¨åç±»'; |
| | | |
| | | comment on column wf_category.id is '主é®'; |
| | | |
| | | comment on column wf_category.category_name is 'åç±»åç§°'; |
| | | |
| | | comment on column wf_category.category_code is 'åç±»ç¼ç '; |
| | | |
| | | comment on column wf_category.parent_id is 'ç¶çº§id'; |
| | | |
| | | comment on column wf_category.sort_num is 'æåº'; |
| | | |
| | | comment on column wf_category.tenant_id is 'ç§æ·id'; |
| | | |
| | | comment on column wf_category.create_dept is 'å建é¨é¨'; |
| | | |
| | | comment on column wf_category.create_by is 'å建è
'; |
| | | |
| | | comment on column wf_category.create_time is 'å建æ¶é´'; |
| | | |
| | | comment on column wf_category.update_by is 'ä¿®æ¹è
'; |
| | | |
| | | comment on column wf_category.update_time is 'ä¿®æ¹æ¶é´'; |
| | | |
| | | alter table wf_category |
| | | owner to postgres; |
| | | |
| | | create unique index uni_category_code |
| | | on wf_category (category_code); |
| | | |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11638, '请åç³è¯·', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, now(), NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11639, '请åç³è¯·æ¥è¯¢', 11638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11640, '请åç³è¯·æ°å¢', 11638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11641, '请åç³è¯·ä¿®æ¹', 11638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11642, '请åç³è¯·å é¤', 11638, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:remove', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11643, '请åç³è¯·å¯¼åº', 11638, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:export', '#', 103, 1, now(), NULL, NULL, ''); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | insert into sys_menu values('11616', '工使µ' , '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11617', '模å管ç', '11616', '2', 'model', 'workflow/model/index', '', '1', '1', 'C', '0', '0', 'workflow:model:list', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | insert into sys_menu values('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, getdate(), NULL, NULL, ''); |
| | | |
| | | |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | insert into sys_menu values ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1, getdate(), null, null, ''); |
| | | insert into sys_menu values ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1, getdate(), null, null, ''); |
| | | insert into sys_menu values ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, getdate(), null, null, ''); |
| | | insert into sys_menu values ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove','#', 103, 1, getdate(), null, null, ''); |
| | | insert into sys_menu values ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export','#', 103, 1, getdate(), null, null, ''); |
| | | -- 请ååä¿¡æ¯ |
| | | DROP TABLE if EXISTS test_leave; |
| | | create table test_leave |
| | | ( |
| | | id bigint not null |
| | | primary key, |
| | | leave_type nvarchar(255) not null, |
| | | start_date datetime2 not null, |
| | | end_date datetime2 not null, |
| | | leave_days int not null, |
| | | remark nvarchar(255), |
| | | create_dept bigint, |
| | | create_by bigint, |
| | | create_time datetime2, |
| | | update_by bigint, |
| | | update_time datetime2, |
| | | tenant_id nvarchar(20) default '000000' |
| | | ) |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'请åç³è¯·è¡¨', 'SCHEMA', 'dbo', 'TABLE', 'test_leave' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'主é®', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'id' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'请åç±»å', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'leave_type' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å¼å§æ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'start_date' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'ç»ææ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'end_date' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'请å天æ°', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'leave_days' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'请ååå ', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'remark' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建é¨é¨', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'create_dept' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建è
', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'create_by' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建æ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'create_time' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æ´æ°è
', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'update_by' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æ´æ°æ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', |
| | | 'update_time' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'ç§æ·ç¼å·', 'SCHEMA', 'dbo', 'TABLE', 'test_leave', 'COLUMN', 'tenant_id' |
| | | go |
| | | |
| | | -- æµç¨å类信æ¯è¡¨ |
| | | DROP TABLE if EXISTS wf_category; |
| | | create table wf_category |
| | | ( |
| | | id bigint not null |
| | | primary key, |
| | | category_name nvarchar(255), |
| | | category_code nvarchar(255) |
| | | constraint uni_category_code |
| | | unique, |
| | | parent_id bigint, |
| | | sort_num int, |
| | | tenant_id nvarchar(20) default '000000', |
| | | create_dept bigint, |
| | | create_by bigint, |
| | | create_time datetime2, |
| | | update_by bigint, |
| | | update_time datetime2 |
| | | ) |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æµç¨åç±»', 'SCHEMA', 'dbo', 'TABLE', 'wf_category' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'主é®', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', 'id' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'åç±»åç§°', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'category_name' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'åç±»ç¼ç ', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'category_code' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'ç¶çº§id', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', 'parent_id' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æåº', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', 'sort_num' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'ç§æ·ç¼å·', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'tenant_id' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建é¨é¨', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'create_dept' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建è
', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', 'create_by' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'å建æ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'create_time' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æ´æ°è
', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', 'update_by' |
| | | go |
| | | |
| | | exec sp_addextendedproperty 'MS_Description', N'æ´æ°æ¶é´', 'SCHEMA', 'dbo', 'TABLE', 'wf_category', 'COLUMN', |
| | | 'update_time' |
| | | go |
| | | |
| | | |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11638, '请åç³è¯·', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, getdate(), NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11639, '请åç³è¯·æ¥è¯¢', 11638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, getdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11640, '请åç³è¯·æ°å¢', 11638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, getdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11641, '请åç³è¯·ä¿®æ¹', 11638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, getdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11642, '请åç³è¯·å é¤', 11638, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:remove', '#', 103, 1, getdate(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11643, '请åç³è¯·å¯¼åº', 11638, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:export', '#', 103, 1, getdate(), NULL, NULL, ''); |