├── doc
├── 流程描述,总结
│ └── Entity4Process.md
├── core.jpg
├── Controller.jpg
├── Entity5Process
│ ├── 1.jpg
│ ├── 2.png
│ ├── 3.png
│ └── 4.png
└── Entity4Proceess
│ └── image
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── 6.jpg
│ ├── 7.jpg
│ ├── 8.jpg
│ ├── 9.jpg
│ └── transform_entity_info.jpg
├── image
├── 撤回前.jpg
├── 撤回后.jpg
├── 撤回操作.jpg
├── 节点状态.png
└── 连线配置.png
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── src
├── main
│ ├── resources
│ │ ├── static
│ │ │ ├── plugins
│ │ │ │ ├── img
│ │ │ │ │ ├── loading.gif
│ │ │ │ │ └── loading-sm.gif
│ │ │ │ ├── datetimepicker
│ │ │ │ │ └── bootstrap-datetimepicker.zh-CN.js
│ │ │ │ ├── table
│ │ │ │ │ ├── bootstrap-table-zh-CN.js
│ │ │ │ │ └── bootstrap-table-filter.js
│ │ │ │ └── fileinput
│ │ │ │ │ └── bootstrap-fileinput.zh-CN.js
│ │ │ ├── fonts
│ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ └── doc
│ │ │ │ └── bootstrap.note
│ │ ├── configs
│ │ │ ├── workflow-url.properties
│ │ │ └── myBatis-config.xml
│ │ ├── application.yml
│ │ ├── mappers
│ │ │ └── workflow
│ │ │ │ ├── TransformEntityInfo.xml
│ │ │ │ └── UserProcessInstance.xml
│ │ └── templates
│ │ │ ├── workflow
│ │ │ ├── UserGroup.html
│ │ │ ├── ProcessAuditStatus.html
│ │ │ ├── ProcessDefinition.html
│ │ │ ├── ProcessTaskConfig.html
│ │ │ ├── history-task.html
│ │ │ └── current-task.html
│ │ │ ├── sys
│ │ │ └── UserEntity.html
│ │ │ ├── login.html
│ │ │ └── test
│ │ │ ├── Entity2Process.html
│ │ │ ├── Entity3Process.html
│ │ │ └── Entity1Process.html
│ └── java
│ │ └── com
│ │ └── oldguy
│ │ └── example
│ │ ├── modules
│ │ ├── common
│ │ │ ├── exceptions
│ │ │ │ ├── NoLoginException.java
│ │ │ │ └── FormValidException.java
│ │ │ ├── dto
│ │ │ │ ├── Form.java
│ │ │ │ ├── AbstractForm.java
│ │ │ │ ├── BootstrapTablePage.java
│ │ │ │ ├── AbstractQueryForm.java
│ │ │ │ └── AbstractPageQueryForm.java
│ │ │ ├── dao
│ │ │ │ ├── jpas
│ │ │ │ │ ├── WorkEntityMapper.java
│ │ │ │ │ ├── BaseMapper.java
│ │ │ │ │ └── BaseEntityMapper.java
│ │ │ │ └── entities
│ │ │ │ │ ├── BaseEntity.java
│ │ │ │ │ ├── WorkFlowEntity.java
│ │ │ │ │ └── SqlTableObject.java
│ │ │ ├── utils
│ │ │ │ ├── Log4jUtils.java
│ │ │ │ ├── JsonUtils.java
│ │ │ │ ├── SpringContextUtils.java
│ │ │ │ └── HttpJsonUtils.java
│ │ │ ├── services
│ │ │ │ ├── TableFactory.java
│ │ │ │ ├── BaseService.java
│ │ │ │ └── impls
│ │ │ │ │ └── MySQLTableFactory.java
│ │ │ ├── handles
│ │ │ │ ├── LoginExceptionHandle.java
│ │ │ │ └── CommonExceptionHandle.java
│ │ │ └── configs
│ │ │ │ └── DbRegisterConfiguration.java
│ │ ├── sys
│ │ │ ├── annonation
│ │ │ │ └── NoLoginPerm.java
│ │ │ ├── dao
│ │ │ │ ├── entities
│ │ │ │ │ ├── UserAndGroup.java
│ │ │ │ │ ├── UserEntity.java
│ │ │ │ │ └── UserGroup.java
│ │ │ │ └── jpas
│ │ │ │ │ ├── UserGroupMapper.java
│ │ │ │ │ └── UserEntityMapper.java
│ │ │ ├── controllers
│ │ │ │ └── UserEntityController.java
│ │ │ ├── aop
│ │ │ │ └── LoginAspect.java
│ │ │ └── services
│ │ │ │ └── UserEntityService.java
│ │ ├── test
│ │ │ ├── dao
│ │ │ │ ├── entities
│ │ │ │ │ ├── Entity3Process.java
│ │ │ │ │ ├── Entity4Process.java
│ │ │ │ │ ├── Entity5Process.java
│ │ │ │ │ ├── Entity6Process.java
│ │ │ │ │ ├── Entity7Process.java
│ │ │ │ │ ├── Entity1Process.java
│ │ │ │ │ └── Entity2Process.java
│ │ │ │ └── jpas
│ │ │ │ │ ├── Entity1ProcessMapper.java
│ │ │ │ │ ├── Entity7ProcessMapper.java
│ │ │ │ │ ├── Entity2ProcessMapper.java
│ │ │ │ │ ├── Entity3ProcessMapper.java
│ │ │ │ │ ├── Entity4ProcessMapper.java
│ │ │ │ │ ├── Entity5ProcessMapper.java
│ │ │ │ │ └── Entity6ProcessMapper.java
│ │ │ ├── controllers
│ │ │ │ ├── Entity5ProcessController.java
│ │ │ │ ├── Entity1ProcessController.java
│ │ │ │ ├── Entity2ProcessController.java
│ │ │ │ └── Entity3ProcessController.java
│ │ │ └── service
│ │ │ │ ├── Entity1ProcessService.java
│ │ │ │ ├── Entity2ProcessService.java
│ │ │ │ ├── Entity3ProcessService.java
│ │ │ │ ├── Entity6ProcessService.java
│ │ │ │ └── Entity7ProcessService.java
│ │ ├── workflow
│ │ │ ├── service
│ │ │ │ ├── activiti
│ │ │ │ │ └── MultiWorkFLow.java
│ │ │ │ ├── impls
│ │ │ │ │ ├── Entity3ProcessInstanceService.java
│ │ │ │ │ ├── Entity6ProcessInstanceService.java
│ │ │ │ │ ├── Entity7ProcessInstanceService.java
│ │ │ │ │ ├── Entity4ProcessInstanceService.java
│ │ │ │ │ ├── Entity5ProcessInstanceService.java
│ │ │ │ │ ├── Entity2ProcessInstanceService.java
│ │ │ │ │ └── Entity1ProcessInstanceService.java
│ │ │ │ ├── CommonWorkEntityService.java
│ │ │ │ ├── ProcessInstanceService.java
│ │ │ │ ├── AbstractProcessInstanceService.java
│ │ │ │ └── entities
│ │ │ │ │ ├── ProcessTaskConfigService.java
│ │ │ │ │ └── ProcessAuditStatusService.java
│ │ │ ├── dao
│ │ │ │ ├── jpas
│ │ │ │ │ ├── TransformEntityInfoMapper.java
│ │ │ │ │ ├── HistoryTaskMapper.java
│ │ │ │ │ ├── ProcessTaskConfigMapper.java
│ │ │ │ │ ├── UserProcessInstanceMapper.java
│ │ │ │ │ └── ProcessAuditStatusMapper.java
│ │ │ │ └── entities
│ │ │ │ │ ├── TransformEntityInfo.java
│ │ │ │ │ ├── UserProcessInstance.java
│ │ │ │ │ ├── ProcessAuditStatus.java
│ │ │ │ │ ├── ProcessTaskConfig.java
│ │ │ │ │ └── HistoryTask.java
│ │ │ ├── handles
│ │ │ │ ├── Entity1ProcessTaskListener.java
│ │ │ │ ├── Entity2ProcessTaskListener.java
│ │ │ │ ├── AbstractProcessTaskListener.java
│ │ │ │ └── Entity3ProcessTaskListener.java
│ │ │ ├── dto
│ │ │ │ ├── TaskFlow.java
│ │ │ │ ├── HistoryTaskInfo.java
│ │ │ │ ├── UserProcessInstanceQueryForm.java
│ │ │ │ ├── TaskForm.java
│ │ │ │ ├── WorkBtn.java
│ │ │ │ ├── WorkEntityInfo.java
│ │ │ │ ├── TaskComment.java
│ │ │ │ ├── form
│ │ │ │ │ ├── ProcessTaskConfigForm.java
│ │ │ │ │ └── ProcessAuditStatusForm.java
│ │ │ │ └── ProcessDefinitionInfo.java
│ │ │ ├── utils
│ │ │ │ └── HttpUtils.java
│ │ │ ├── controllers
│ │ │ │ ├── UserGroupController.java
│ │ │ │ ├── HistoryTaskController.java
│ │ │ │ ├── ProcessTaskConfigController.java
│ │ │ │ ├── ProcessAuditStatusController.java
│ │ │ │ └── TaskController.java
│ │ │ ├── commands
│ │ │ │ ├── AbstractCountersignCmd.java
│ │ │ │ └── CountersigningVariables.java
│ │ │ └── configs
│ │ │ │ ├── ProcessEngineConfiguration.java
│ │ │ │ └── WorkFlowConfiguration.java
│ │ └── view
│ │ │ └── controllers
│ │ │ ├── SysController.java
│ │ │ ├── TestController.java
│ │ │ ├── LoginController.java
│ │ │ └── WorkFlowController.java
│ │ ├── ActivitiDemoApplication.java
│ │ └── configs
│ │ ├── DemoConfiguration.java
│ │ ├── ActivitiConfiguration.java
│ │ └── PropertiesConfiguration.java
└── test
│ └── java
│ └── com
│ └── oldguy
│ └── example
│ ├── ActivitiDemoApplicationTests.java
│ ├── utils
│ └── UtilsTest.java
│ ├── sys
│ └── dao
│ │ └── UserEntityMapperTest.java
│ └── services
│ ├── Entity5ProcessTest.java
│ ├── AbstractMultiWorkFLowServiceTest.java
│ ├── DefaultInstanceConvertToMultiInstanceTest.java
│ ├── Entity3ProcessTest.java
│ └── Entity7ProcessTest.java
├── readme.md
└── .gitignore
/doc/流程描述,总结/Entity4Process.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/doc/core.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/core.jpg
--------------------------------------------------------------------------------
/image/撤回前.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/image/撤回前.jpg
--------------------------------------------------------------------------------
/image/撤回后.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/image/撤回后.jpg
--------------------------------------------------------------------------------
/image/撤回操作.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/image/撤回操作.jpg
--------------------------------------------------------------------------------
/image/节点状态.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/image/节点状态.png
--------------------------------------------------------------------------------
/image/连线配置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/image/连线配置.png
--------------------------------------------------------------------------------
/doc/Controller.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Controller.jpg
--------------------------------------------------------------------------------
/doc/Entity5Process/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity5Process/1.jpg
--------------------------------------------------------------------------------
/doc/Entity5Process/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity5Process/2.png
--------------------------------------------------------------------------------
/doc/Entity5Process/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity5Process/3.png
--------------------------------------------------------------------------------
/doc/Entity5Process/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity5Process/4.png
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/1.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/2.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/3.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/4.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/5.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/6.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/7.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/8.jpg
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/9.jpg
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/doc/Entity4Proceess/image/transform_entity_info.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/doc/Entity4Proceess/image/transform_entity_info.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/img/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/plugins/img/loading.gif
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/img/loading-sm.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/plugins/img/loading-sm.gif
--------------------------------------------------------------------------------
/src/main/resources/static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/src/main/resources/static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldguys/ActivitiDemo/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/src/main/resources/static/doc/bootstrap.note:
--------------------------------------------------------------------------------
1 | /**
2 | * 全面版
3 | **/
4 | container-fluid
5 |
6 |
7 | autocomplete="off" // 不带出历史数据
8 | readonly // 只读
9 | disabled // 不可使用,包括事件都会被禁止
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/exceptions/NoLoginException.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.exceptions;
2 |
3 | /**
4 | * @author huangrenhao
5 | * @date 2019/1/21
6 | */
7 | public class NoLoginException extends RuntimeException {
8 |
9 | public NoLoginException() {
10 | super("当前用户未登录!");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/annonation/NoLoginPerm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.annonation;
2 |
3 | import java.lang.annotation.*;
4 |
5 |
6 | /**
7 | * 跳过登录校验
8 | * @author King
9 | *
10 | */
11 | @Target(ElementType.METHOD)
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Documented
14 | public @interface NoLoginPerm {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ##Activiti Demo 功能介绍
2 |
3 | **环境**
4 | 1. SpringBoot 1.5.19.RELEASE
5 | 2. Activiti 6.0
6 |
7 | **功能**
8 | 1. 自定义流程审批框架(通用配置)
9 | 2. 基于界面的流程配置(按钮配置,审批路径配置,流程状态配置)
10 | 3. 流程回退到上一节点
11 | 4. 流程挂起、激活
12 | 5. Activiti 获取流程图
13 | 6. 动态改变流程节点类型(普通节点 ——> 会签节点)Entity4Process
14 | 7. 动态调转流程节点,让流程跑到指定的节点(节点A -> 节点N(可以从一个节点任务变成多个节点任务))Entity5Process
15 | 8. 会签加签,减签 Entity6Process
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity3Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity3Process extends WorkFlowEntity {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity4Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity4Process extends WorkFlowEntity {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity5Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity5Process extends WorkFlowEntity {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity6Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity6Process extends WorkFlowEntity {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity7Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity7Process extends WorkFlowEntity {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity1Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class Entity1Process extends WorkFlowEntity {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/entities/Entity2Process.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/22
10 | */
11 | @Entity
12 | public class Entity2Process extends WorkFlowEntity {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/activiti/MultiWorkFLow.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.activiti;
2 |
3 | import java.util.Map;
4 |
5 | /**
6 | * 特定业务完成类
7 | */
8 | public interface MultiWorkFLow {
9 |
10 | /**
11 | *
12 | * @param taskId
13 | * @param data
14 | */
15 | void completeTask(String taskId, Map data);
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/ActivitiDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ActivitiDemoApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ActivitiDemoApplication.class, args);
11 | }
12 |
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dto/Form.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dto;
2 |
3 | /**
4 | * @author huangrenhao
5 | * @date 2018/8/19
6 | */
7 | public interface Form {
8 |
9 | String DATE_TIME_REGEXP = "/^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$/";
10 |
11 | /**
12 | * 专函成为实体
13 | * @return
14 | */
15 | T trainToEntity();
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/exceptions/FormValidException.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.exceptions;
2 |
3 | /**
4 | * @Description: 表单校验异常
5 | * @Author: ren
6 | * @CreateTime: 2018-10-2018/10/26 0026 14:44
7 | */
8 | public class FormValidException extends RuntimeException {
9 |
10 | private static final long serialVersionUID = 1L;
11 |
12 | public FormValidException(String msg) {
13 | super(msg);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/ActivitiDemoApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class ActivitiDemoApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity1ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity1Process;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Repository
12 | public interface Entity1ProcessMapper extends WorkEntityMapper {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity7ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity7Process;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Repository
12 | public interface Entity7ProcessMapper extends WorkEntityMapper {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/view/controllers/SysController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.view.controllers;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | /**
7 | * @author huangrenhao
8 | * @date 2019/1/19
9 | */
10 | @Controller
11 | @RequestMapping("view/sys")
12 | public class SysController {
13 |
14 | @RequestMapping("UserEntity")
15 | public String index() {
16 | return "sys/UserEntity";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dao/jpas/WorkEntityMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dao.jpas;
2 |
3 | import org.apache.ibatis.annotations.Param;
4 |
5 | /**
6 | * @author huangrenhao
7 | * @date 2019/1/24
8 | */
9 | public interface WorkEntityMapper extends BaseEntityMapper {
10 |
11 | /**
12 | * 更新流程状态
13 | * @param id
14 | * @param auditStatus
15 | * @return
16 | */
17 | int updateAuditStatus(@Param("id") Long id, @Param("auditStatus") String auditStatus);
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/utils/Log4jUtils.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.utils;/**
2 | * Created by Administrator on 2018/9/20 0020.
3 | */
4 |
5 | import org.apache.log4j.Logger;
6 |
7 | /**
8 | * @Description:
9 | * @Author: ren
10 | * @CreateTime: 2018-09-2018/9/20 0020 22:05
11 | */
12 | public class Log4jUtils {
13 | public static Logger logger;
14 |
15 | public static Logger getInstance(Class clazz){
16 | logger = Logger.getLogger(clazz);
17 | return logger;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/resources/configs/workflow-url.properties:
--------------------------------------------------------------------------------
1 | #Entity1Process
2 | Entity1Process.step2=/Entity1Process/step2/complete
3 |
4 | #Entity2Process
5 | Entity2Process.step1=/Entity2Process/completeTask
6 | Entity2Process.step2.default-cancel=/Entity2Process/completeTask
7 | Entity2Process.step2.default-submit=/Entity2Process/completeTask
8 | Entity2Process.step3.1=/Entity2Process/completeTask
9 | Entity2Process.step3.2=/Entity2Process/completeTask
10 | Entity2Process.step4=/Entity2Process/completeTask
11 | Entity2Process.step5=/Entity2Process/completeTask
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/dao/entities/UserAndGroup.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.dao.entities;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | /**
10 | * @author huangrenhao
11 | * @date 2019/1/24
12 | */
13 | @Entity
14 | @Data
15 | public class UserAndGroup {
16 |
17 | @GeneratedValue
18 | @Id
19 | private Long id;
20 |
21 | private String userId;
22 |
23 | private String groupSequence;
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/jpas/TransformEntityInfoMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.workflow.dao.entities.TransformEntityInfo;
5 | import org.springframework.stereotype.Repository;
6 |
7 | @Repository
8 | public interface TransformEntityInfoMapper extends BaseEntityMapper {
9 |
10 | TransformEntityInfo findByProcessInstance(String processInstanceId);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity3ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity3Process;
4 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/24
10 | */
11 | @Service
12 | public class Entity3ProcessInstanceService extends AbstractProcessInstanceService {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity6ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity6Process;
4 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/24
10 | */
11 | @Service
12 | public class Entity6ProcessInstanceService extends AbstractProcessInstanceService {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity7ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity7Process;
4 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/24
10 | */
11 | @Service
12 | public class Entity7ProcessInstanceService extends AbstractProcessInstanceService {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity2ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
5 | import com.oldguy.example.modules.test.dao.entities.Entity2Process;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | @Repository
13 | public interface Entity2ProcessMapper extends WorkEntityMapper {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity3ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity2Process;
5 | import com.oldguy.example.modules.test.dao.entities.Entity3Process;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | @Repository
13 | public interface Entity3ProcessMapper extends WorkEntityMapper {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity4ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity3Process;
5 | import com.oldguy.example.modules.test.dao.entities.Entity4Process;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | @Repository
13 | public interface Entity4ProcessMapper extends WorkEntityMapper {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity5ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity4Process;
5 | import com.oldguy.example.modules.test.dao.entities.Entity5Process;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | @Repository
13 | public interface Entity5ProcessMapper extends WorkEntityMapper {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/dao/jpas/Entity6ProcessMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
4 | import com.oldguy.example.modules.test.dao.entities.Entity5Process;
5 | import com.oldguy.example.modules.test.dao.entities.Entity6Process;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | @Repository
13 | public interface Entity6ProcessMapper extends WorkEntityMapper {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/handles/Entity1ProcessTaskListener.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.handles;
2 |
3 | import com.oldguy.example.configs.DemoConfiguration;
4 | import org.activiti.engine.delegate.DelegateTask;
5 |
6 | /**
7 | * @Date: 2019/1/13 0013
8 | * @Author: ren
9 | * @Description:
10 | */
11 | public class Entity1ProcessTaskListener extends AbstractProcessTaskListener {
12 | @Override
13 | public void notify(DelegateTask delegateTask) {
14 | delegateTask.addCandidateUsers(getAssigneeSet(DemoConfiguration.WorkFlowConfig.ENTITY1_PROCESS));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity4ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity3Process;
4 | import com.oldguy.example.modules.test.dao.entities.Entity4Process;
5 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/24
11 | */
12 | @Service
13 | public class Entity4ProcessInstanceService extends AbstractProcessInstanceService {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity5ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity4Process;
4 | import com.oldguy.example.modules.test.dao.entities.Entity5Process;
5 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/24
11 | */
12 | @Service
13 | public class Entity5ProcessInstanceService extends AbstractProcessInstanceService {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/jpas/HistoryTaskMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.workflow.dao.entities.HistoryTask;
5 | import org.springframework.stereotype.Repository;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author huangrenhao
11 | * @date 2019/1/21
12 | */
13 | @Repository
14 | public interface HistoryTaskMapper extends BaseEntityMapper {
15 |
16 | /**
17 | * 通过用户ID
18 | * @param userId
19 | * @return
20 | */
21 | List findByUserId(String userId);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/services/TableFactory.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.services;/**
2 | * Created by Administrator on 2018/10/23 0023.
3 | */
4 |
5 |
6 | import com.oldguy.example.modules.common.dao.entities.SqlTableObject;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | /**
12 | * @Description:
13 | * @Author: ren
14 | * @CreateTime: 2018-10-2018/10/23 0023 13:53
15 | */
16 | public interface TableFactory {
17 |
18 | String showTableSQL();
19 |
20 | String getDialect();
21 |
22 | Map getColumnType();
23 |
24 | Map trainToDBSchema(List sqlTableObjects);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/dao/jpas/UserGroupMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.sys.dao.entities.UserGroup;
5 | import org.springframework.stereotype.Repository;
6 |
7 | import java.util.Set;
8 |
9 | /**
10 | * @Date: 2019/1/13 0013
11 | * @Author: ren
12 | * @Description:
13 | */
14 | @Repository
15 | public interface UserGroupMapper extends BaseEntityMapper {
16 |
17 | /**
18 | * 获取角色组
19 | * @param groupSequence
20 | * @return
21 | */
22 | Set findUserIdByGroupSequence(String groupSequence);
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/utils/UtilsTest.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.utils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 | import org.junit.Test;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * @ClassName: UtilsTest
11 | * @Author: ren
12 | * @Description:
13 | * @CreateTIme: 2019/4/29 0029 下午 11:39
14 | **/
15 | public class UtilsTest {
16 |
17 |
18 | @Test
19 | public void test(){
20 |
21 | List list = new ArrayList<>();
22 | list.add("1");
23 | list.add("2");
24 | list.add("3");
25 |
26 | String str = StringUtils.join(list,",");
27 | System.out.println(str);
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/CommonWorkEntityService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service;
2 |
3 | import com.oldguy.example.modules.common.utils.Log4jUtils;
4 | import com.oldguy.example.modules.workflow.dto.WorkEntityInfo;
5 | import org.springframework.stereotype.Service;
6 |
7 | import javax.annotation.PostConstruct;
8 |
9 | /**
10 | * @author huangrenhao
11 | * @date 2019/1/21
12 | */
13 | @Service
14 | public class CommonWorkEntityService extends AbstractWorkEntityService {
15 |
16 | @PostConstruct
17 | public void initWorkFlowService() {
18 | Log4jUtils.getInstance(getClass()).info("初始化工作流服务----------------------");
19 | init();
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/datetimepicker/bootstrap-datetimepicker.zh-CN.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Simplified Chinese translation for bootstrap-datetimepicker
3 | * Yuan Cheung
4 | */
5 | ;(function($){
6 | $.fn.datetimepicker.dates['zh-CN'] = {
7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
10 | months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
11 | monthsShort: [" 1月", " 2月", " 3月", " 4月 ", " 5月", " 6月", " 7月", " 8月", " 9月 ", " 10月", " 11月 ", " 12月 "],
12 | today: "今天",
13 | suffix: [],
14 | meridiem: ["上午", "下午"]
15 | };
16 | }(jQuery));
17 |
--------------------------------------------------------------------------------
/src/main/resources/configs/myBatis-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/entities/TransformEntityInfo.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 | import lombok.Data;
5 |
6 | import javax.persistence.Column;
7 | import javax.persistence.Entity;
8 |
9 | /**
10 | * @ClassName: TransformEntityInfo
11 | * @Author: ren
12 | * @Description:
13 | * @CreateTIme: 2019/5/23 0023 下午 2:58
14 | **/
15 | @Entity
16 | @Data
17 | public class TransformEntityInfo extends BaseEntity {
18 |
19 | private String processInstanceId;
20 |
21 | private String taskDefineKey;
22 |
23 | /**
24 | * 是否串行:
25 | * 串行:true
26 | * 并行:false
27 | */
28 | private Boolean sequential;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/TaskFlow.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @Date: 2019/1/26 0026
7 | * @Author: ren
8 | * @Description:
9 | */
10 | @Data
11 | public class TaskFlow {
12 |
13 | private String id;
14 |
15 | private String name;
16 |
17 | private String expression;
18 |
19 | private String sourceTask;
20 |
21 | private String targetTask;
22 |
23 | public TaskFlow(String id, String name, String expression, String sourceTask, String targetTask) {
24 | this.id = id;
25 | this.name = name;
26 | this.expression = expression;
27 | this.sourceTask = sourceTask;
28 | this.targetTask = targetTask;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/dao/entities/UserEntity.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2019/1/18
10 | */
11 | @Entity
12 | public class UserEntity extends BaseEntity {
13 |
14 | private String username;
15 |
16 | private String userId;
17 |
18 | public String getUsername() {
19 | return username;
20 | }
21 |
22 | public void setUsername(String username) {
23 | this.username = username;
24 | }
25 |
26 | public String getUserId() {
27 | return userId;
28 | }
29 |
30 | public void setUserId(String userId) {
31 | this.userId = userId;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/entities/UserProcessInstance.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.entities;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 | import java.util.Set;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2018/12/26
11 | */
12 | @Data
13 | public class UserProcessInstance {
14 |
15 | private String processInstanceId;
16 |
17 | private String businessKey;
18 |
19 | private String creatorId;
20 |
21 | private Date startTime;
22 |
23 | private Date endTime;
24 |
25 |
26 | private String processDefinitionKey;
27 |
28 | private String processDefinitionName;
29 |
30 | private String taskName;
31 |
32 | private String assignees;
33 |
34 | /**
35 | * 流程状态
36 | */
37 | private String active;
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/view/controllers/TestController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.view.controllers;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | /**
7 | * @author huangrenhao
8 | * @date 2019/1/19
9 | */
10 | @Controller
11 | @RequestMapping("view/test")
12 | public class TestController {
13 |
14 | @RequestMapping("Entity1Process")
15 | public String Entity1Process() {
16 | return "test/Entity1Process";
17 | }
18 |
19 | @RequestMapping("Entity2Process")
20 | public String Entity2Process() {
21 | return "test/Entity2Process";
22 | }
23 |
24 | @RequestMapping("Entity3Process")
25 | public String Entity3Process() {
26 | return "test/Entity3Process";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/HistoryTaskInfo.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | import com.oldguy.example.modules.workflow.dao.entities.HistoryTask;
4 |
5 | /**
6 | * @author huangrenhao
7 | * @date 2019/1/22
8 | */
9 | public class HistoryTaskInfo extends HistoryTask {
10 |
11 | private String processDefineName;
12 |
13 | private String lastCommit;
14 |
15 | public String getLastCommit() {
16 | return lastCommit;
17 | }
18 |
19 | public void setLastCommit(String lastCommit) {
20 | this.lastCommit = lastCommit;
21 | }
22 |
23 | public String getProcessDefineName() {
24 | return processDefineName;
25 | }
26 |
27 | public void setProcessDefineName(String processDefineName) {
28 | this.processDefineName = processDefineName;
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dto/AbstractForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dto;
2 |
3 |
4 | import com.oldguy.example.modules.common.utils.ReflectUtils;
5 |
6 | import java.lang.reflect.InvocationTargetException;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2018/11/22
11 | */
12 | public abstract class AbstractForm implements Form {
13 |
14 | protected T defaultTrainToEntity(Class clazz) {
15 |
16 | try {
17 | return ReflectUtils.updateEntityFormToEntity(this, clazz);
18 | } catch (IllegalAccessException e) {
19 | e.printStackTrace();
20 | } catch (InstantiationException e) {
21 | e.printStackTrace();
22 | } catch (InvocationTargetException e) {
23 | e.printStackTrace();
24 | }
25 |
26 | return null;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/utils/HttpUtils.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.utils;
2 |
3 | import org.apache.commons.io.IOUtils;
4 |
5 | import java.io.IOException;
6 | import java.io.InputStream;
7 | import java.io.OutputStream;
8 |
9 | /**
10 | * @author huangrenhao
11 | * @date 2019/1/22
12 | */
13 | public class HttpUtils {
14 |
15 | public static void copyImageStream(InputStream inputStream,OutputStream outputStream){
16 | try {
17 | IOUtils.copy(inputStream,outputStream);
18 | } catch (IOException e) {
19 | e.printStackTrace();
20 | }finally {
21 | try {
22 | inputStream.close();
23 | outputStream.close();
24 | } catch (IOException e) {
25 | e.printStackTrace();
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/handles/Entity2ProcessTaskListener.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.handles;
2 |
3 | import com.oldguy.example.configs.DemoConfiguration;
4 | import com.oldguy.example.modules.common.exceptions.FormValidException;
5 | import org.activiti.engine.delegate.DelegateTask;
6 | import org.apache.commons.lang3.StringUtils;
7 |
8 | /**
9 | * @Date: 2019/1/13 0013
10 | * @Author: ren
11 | * @Description:
12 | */
13 | public class Entity2ProcessTaskListener extends AbstractProcessTaskListener {
14 | @Override
15 | public void notify(DelegateTask delegateTask) {
16 |
17 | String formKey = delegateTask.getFormKey();
18 | if(StringUtils.isBlank(formKey)){
19 | throw new FormValidException("formKey 不能为空!");
20 | }
21 | delegateTask.addCandidateUsers(getAssigneeSet(formKey));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/handles/AbstractProcessTaskListener.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.handles;
2 |
3 |
4 | import com.oldguy.example.modules.common.utils.SpringContextUtils;
5 | import com.oldguy.example.modules.sys.dao.jpas.UserGroupMapper;
6 | import org.activiti.engine.delegate.TaskListener;
7 |
8 | import java.util.Set;
9 |
10 | /**
11 | * @author huangrenhao
12 | * @date 2018/12/19
13 | */
14 | public abstract class AbstractProcessTaskListener implements TaskListener {
15 |
16 |
17 | protected Set getAssigneeSet(String userGroupFlag) {
18 | UserGroupMapper userGroupMapper = SpringContextUtils.getBean(UserGroupMapper.class);
19 | Set userIdSet = userGroupMapper.findUserIdByGroupSequence(userGroupFlag);
20 | if (userIdSet.isEmpty()) {
21 | throw new RuntimeException("找不到节点审批人!");
22 | }
23 | return userIdSet;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dao/jpas/BaseMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dao.jpas;/**
2 | * Created by Administrator on 2018/10/29 0029.
3 | */
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.Collection;
8 |
9 | /**
10 | * @Description:
11 | * @Author: ren
12 | * @CreateTime: 2018-10-2018/10/29 0029 10:19
13 | */
14 | public interface BaseMapper {
15 |
16 | /**
17 | * 批量持久化
18 | * @param collection
19 | * @return
20 | */
21 | int saveBatch(@Param("collections") Collection collection);
22 |
23 | /**
24 | * 持久化单个
25 | * @param entity
26 | * @return
27 | */
28 | int save(T entity);
29 |
30 | /**
31 | * 更新单个
32 | * @param entity
33 | * @return
34 | */
35 | int update(T entity);
36 | /**
37 | * 获取实体
38 | * @param id
39 | * @return
40 | */
41 | T findOne(S id);
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/dao/jpas/UserEntityMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.Collection;
9 | import java.util.List;
10 | import java.util.Set;
11 |
12 | /**
13 | * @author huangrenhao
14 | * @date 2019/1/18
15 | */
16 | @Repository
17 | public interface UserEntityMapper extends BaseEntityMapper{
18 |
19 | /**
20 | * 获取用户
21 | * @param userId
22 | * @return
23 | */
24 | UserEntity findByUserId(String userId);
25 |
26 | /**
27 | * 获取用户集合
28 | * @param allUserIdSet
29 | * @return
30 | */
31 | List findByUserIdSet(@Param("collections") Collection allUserIdSet);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/controllers/UserGroupController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.controllers;
2 |
3 | import com.oldguy.example.modules.sys.dao.entities.UserGroup;
4 | import com.oldguy.example.modules.sys.dao.jpas.UserGroupMapper;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author huangrenhao
14 | * @date 2019/1/19
15 | */
16 | @RestController
17 | @RequestMapping("UserGroup")
18 | public class UserGroupController {
19 |
20 | @Autowired
21 | private UserGroupMapper userGroupMapper;
22 |
23 | @GetMapping("all")
24 | public List getList(Integer status) {
25 | return userGroupMapper.findAllByStatus(status);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dto/BootstrapTablePage.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dto;
2 |
3 |
4 | import java.util.List;
5 |
6 | /**
7 | * Bootstrap-table 分页Json
8 | *
9 | * @param
10 | * @author huangrenhao
11 | * @version V1.0
12 | * @ClassName: BootstrapTablePage
13 | * @Description: TODO
14 | * @date 2018年4月28日 下午3:39:22
15 | */
16 | public class BootstrapTablePage {
17 |
18 | private List rows;
19 |
20 | private Long total;
21 |
22 | // public BootstrapTablePage(Page page) {
23 | // total = page.getTotal();
24 | // rows = page.getRecords();
25 | // }
26 |
27 | public List getRows() {
28 | return rows;
29 | }
30 |
31 | public void setRows(List rows) {
32 | this.rows = rows;
33 | }
34 |
35 | public Long getTotal() {
36 | return total;
37 | }
38 |
39 | public void setTotal(Long total) {
40 | this.total = total;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service;
2 |
3 |
4 |
5 | import com.oldguy.example.modules.workflow.dto.WorkBtn;
6 | import org.activiti.bpmn.model.SequenceFlow;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author huangrenhao
12 | * @date 2018/12/5
13 | */
14 | public interface ProcessInstanceService {
15 |
16 | /**
17 | * 获取流程任务节点按钮
18 | * @param taskDefinitionKey
19 | * @param outPutLinks
20 | * @return
21 | */
22 | List getWorkBtnList(String processDefinitionId, String taskDefinitionKey, List outPutLinks);
23 |
24 | /**
25 | * 获取流程实体
26 | *
27 | * @param id
28 | * @return
29 | */
30 | T getTarget(Long id);
31 |
32 | /**
33 | * 更新流程状态
34 | * @param id
35 | * @param auditCode
36 | * @return
37 | */
38 | int updateAuditStatus(Long id, String auditCode);
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity2ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity2Process;
4 | import com.oldguy.example.modules.test.dao.jpas.Entity2ProcessMapper;
5 | import com.oldguy.example.modules.workflow.configs.WorkFlowConfiguration;
6 | import com.oldguy.example.modules.workflow.dto.WorkBtn;
7 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
8 | import com.oldguy.example.modules.workflow.service.ProcessInstanceService;
9 | import org.activiti.bpmn.model.SequenceFlow;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Service;
12 |
13 | import java.util.*;
14 |
15 | /**
16 | * @author huangrenhao
17 | * @date 2019/1/24
18 | */
19 | @Service
20 | public class Entity2ProcessInstanceService extends AbstractProcessInstanceService {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/dao/entities/UserGroup.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 | import lombok.Data;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.Id;
9 |
10 | /**
11 | * @Date: 2019/1/13 0013
12 | * @Author: ren
13 | * @Description:
14 | */
15 | @Entity
16 | public class UserGroup extends BaseEntity {
17 |
18 | private String groupSequence;
19 |
20 | private String groupName;
21 |
22 | public String getGroupSequence() {
23 | return groupSequence;
24 | }
25 |
26 | public void setGroupSequence(String groupSequence) {
27 | this.groupSequence = groupSequence;
28 | }
29 |
30 | public String getGroupName() {
31 | return groupName;
32 | }
33 |
34 | public void setGroupName(String groupName) {
35 | this.groupName = groupName;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/utils/JsonUtils.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.utils;/**
2 | * Created by Administrator on 2018/10/26 0026.
3 | */
4 |
5 | import com.google.gson.Gson;
6 |
7 | import java.util.Map;
8 |
9 | /**
10 | * @Description:
11 | * @Author: ren
12 | * @CreateTime: 2018-10-2018/10/26 0026 15:46
13 | */
14 | public class JsonUtils {
15 |
16 | private JsonUtils() {
17 | }
18 |
19 | private static volatile Gson gson;
20 |
21 | public static Gson getInstance() {
22 |
23 | Gson temp = gson;
24 | if (temp == null) {
25 | synchronized (Gson.class) {
26 | if (gson == null) {
27 | gson = new Gson();
28 | temp = gson;
29 | }
30 | }
31 | }
32 | return temp;
33 | }
34 |
35 | public static Map parseResultMap(String json){
36 | return getInstance().fromJson(json,Map.class);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/UserProcessInstanceQueryForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 |
4 | import com.oldguy.example.modules.common.dto.AbstractPageQueryForm;
5 | import com.oldguy.example.modules.common.dto.AbstractQueryForm;
6 |
7 | /**
8 | * @author huangrenhao
9 | * @date 2018/12/26
10 | */
11 | public class UserProcessInstanceQueryForm extends AbstractPageQueryForm {
12 |
13 | /**
14 | * 用户ID
15 | */
16 | private String userId;
17 |
18 | /**
19 | * 1:当前用户
20 | * 0:包含所有用户
21 | */
22 | private Integer currentUser = 0;
23 |
24 | public Integer getCurrentUser() {
25 | return currentUser;
26 | }
27 |
28 | public void setCurrentUser(Integer currentUser) {
29 | this.currentUser = currentUser;
30 | }
31 |
32 | public String getUserId() {
33 | return userId;
34 | }
35 |
36 | public void setUserId(String userId) {
37 | this.userId = userId;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/handles/LoginExceptionHandle.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.handles;
2 |
3 | import com.oldguy.example.modules.common.exceptions.FormValidException;
4 | import com.oldguy.example.modules.common.exceptions.NoLoginException;
5 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
6 | import org.springframework.http.HttpStatus;
7 | import org.springframework.ui.Model;
8 | import org.springframework.web.bind.annotation.ControllerAdvice;
9 | import org.springframework.web.bind.annotation.ExceptionHandler;
10 | import org.springframework.web.bind.annotation.ResponseStatus;
11 |
12 | /**
13 | * @author huangrenhao
14 | * @date 2019/1/21
15 | */
16 | @ControllerAdvice
17 | public class LoginExceptionHandle {
18 |
19 | @ExceptionHandler(NoLoginException.class)
20 | public String NoLoginException(NoLoginException exception, Model model) {
21 | model.addAttribute("errorMessage", exception.getMessage());
22 | return "/login";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/commands/AbstractCountersignCmd.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.commands;
2 |
3 | import com.oldguy.example.modules.common.utils.SpringContextUtils;
4 | import org.activiti.engine.RepositoryService;
5 | import org.activiti.engine.RuntimeService;
6 | import org.activiti.engine.TaskService;
7 |
8 |
9 | /**
10 | * @ClassName: AbstractCountersignCmd
11 | * @Author: ren
12 | * @Description:
13 | * @CreateTIme: 2019/5/13 0013 下午 11:43
14 | **/
15 | public abstract class AbstractCountersignCmd {
16 |
17 | protected RuntimeService runtimeService;
18 |
19 | protected TaskService taskService;
20 |
21 | protected RepositoryService repositoryService;
22 |
23 | public AbstractCountersignCmd(){
24 |
25 | runtimeService = SpringContextUtils.getBean(RuntimeService.class);
26 | taskService = SpringContextUtils.getBean(TaskService.class);
27 | repositoryService = SpringContextUtils.getBean(RepositoryService.class);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/configs/ProcessEngineConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.configs;
2 |
3 | import com.oldguy.example.modules.common.utils.Log4jUtils;
4 | import org.activiti.spring.SpringProcessEngineConfiguration;
5 | import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2018/8/13
11 | * @Descripton 配置字符集
12 | */
13 | @Component
14 | public class ProcessEngineConfiguration implements ProcessEngineConfigurationConfigurer {
15 |
16 | @Override
17 | public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
18 | processEngineConfiguration.setActivityFontName("宋体");
19 | processEngineConfiguration.setLabelFontName("宋体");
20 | processEngineConfiguration.setAnnotationFontName("宋体");
21 | Log4jUtils.getInstance(getClass()).info("配置字体:" + processEngineConfiguration.getActivityFontName());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/jpas/ProcessTaskConfigMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.workflow.dao.entities.ProcessTaskConfig;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @Date: 2019/1/26 0026
12 | * @Author: ren
13 | * @Description:
14 | */
15 | @Repository
16 | public interface ProcessTaskConfigMapper extends BaseEntityMapper {
17 |
18 |
19 | /**
20 | * 获取流程定义信息
21 | * @param processDefinitionId
22 | * @return
23 | */
24 | List findByProcessDefinitionId(String processDefinitionId);
25 |
26 | /**
27 | * 获取流程类别最新流程定义信息
28 | * @param processDefinitionKey
29 | * @return
30 | */
31 | List findByProcessDefinitionKey(String processDefinitionKey);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/services/BaseService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.services;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 | import com.oldguy.example.modules.test.dao.entities.Entity5Process;
5 | import com.oldguy.example.modules.test.dao.entities.Entity6Process;
6 | import org.activiti.engine.runtime.ProcessInstance;
7 | import org.springframework.transaction.annotation.Transactional;
8 |
9 | import java.util.Date;
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | /**
14 | * @ClassName: BaseService
15 | * @Author: ren
16 | * @Description:
17 | * @CreateTIme: 2019/5/6 0006 下午 12:13
18 | **/
19 | public abstract class BaseService {
20 |
21 |
22 |
23 |
24 | protected void newInstance(WorkFlowEntity entity){
25 |
26 | entity.setAuditStatus("1");
27 | entity.setCreatorId("1");
28 | entity.setCreateTime(new Date());
29 | entity.setStatus(1);
30 | entity.setCreatorName("测试用户1");
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 | mode: LEGACYHTML5
5 | jackson:
6 | time-zone: GMT+8
7 | date-format: yyyy-MM-dd
8 | mvc:
9 | date-format: yyyy-MM-dd
10 | activiti:
11 | process-definition-location-prefix: classpath*:/processes/
12 | datasource:
13 | username: root
14 | password: root
15 | url: jdbc:mysql://127.0.0.1:3306/activiti_demo?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true
16 | driver-class-name: com.mysql.jdbc.Driver
17 | type: com.alibaba.druid.pool.DruidDataSource
18 |
19 |
20 | mybatis:
21 | mapper-locations: classpath:mappers/**/*.xml
22 | type-aliases-package: com.oldguy.example.modules.workflow.dao.entities;com.oldguy.example.modules.sys.dao.entities;com.oldguy.example.modules.test.dao.entities;
23 | config-location: classpath:configs/myBatis-config.xml
24 |
25 | workflow-configuration-location: "configs/workflow-url.properties"
26 | server:
27 | port: 8081
28 |
29 | logging:
30 | level:
31 | root: info
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/commands/CountersigningVariables.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.commands;
2 |
3 | import org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior;
4 |
5 | /**
6 | * Activiti 会签任务中变量标志
7 | *
8 | * {@link MultiInstanceActivityBehavior}
9 | */
10 | public interface CountersigningVariables {
11 |
12 | /**
13 | * 默认审核人
14 | */
15 | String ASSIGNEE_USER = "assignee";
16 |
17 | /**
18 | * 审核人集合
19 | */
20 | String ASSIGNEE_LIST = "assigneeList";
21 |
22 | /**
23 | * 会签任务总数
24 | */
25 | String NUMBER_OF_INSTANCES = "nrOfInstances";
26 |
27 | /**
28 | * 正在执行的会签总数
29 | */
30 | String NUMBER_OF_ACTIVE_INSTANCES = "nrOfActiveInstances";
31 |
32 | /**
33 | * 已完成的会签任务总数
34 | */
35 | String NUMBER_OF_COMPLETED_INSTANCES = "nrOfCompletedInstances";
36 |
37 | /**
38 | * 会签任务表示
39 | * collectionElementIndexVariable
40 | */
41 | String LOOP_COUNTER = "loopCounter";
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/jpas/UserProcessInstanceMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.jpas;
2 |
3 |
4 | import com.baomidou.mybatisplus.plugins.Page;
5 | import com.oldguy.example.modules.workflow.dao.entities.UserProcessInstance;
6 | import com.oldguy.example.modules.workflow.dto.UserProcessInstanceQueryForm;
7 | import org.apache.ibatis.annotations.Param;
8 | import org.springframework.stereotype.Repository;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author huangrenhao
14 | * @date 2018/12/26
15 | */
16 | @Repository
17 | public interface UserProcessInstanceMapper {
18 |
19 | /**
20 | * 获取 流程信息
21 | *
22 | * @param page
23 | * @param form
24 | * @return
25 | */
26 | List findByPage(Page page, @Param("form") UserProcessInstanceQueryForm form);
27 |
28 | /**
29 | * 获取流程实例
30 | * @param processInstanceId
31 | * @return
32 | */
33 | UserProcessInstance findOne(@Param("processInstanceId") String processInstanceId);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dao/entities/BaseEntity.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dao.entities;
2 |
3 |
4 |
5 |
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import java.util.Date;
9 |
10 | /**
11 | * @Description:
12 | * @Author: ren
13 | * @CreateTime: 2018-10-2018/10/15 0015 16:41
14 | */
15 | public abstract class BaseEntity {
16 |
17 | @Id
18 | @GeneratedValue
19 | private Long id;
20 |
21 | private Date createTime;
22 |
23 | private Integer status;
24 |
25 | public Long getId() {
26 | return id;
27 | }
28 |
29 | public void setId(Long id) {
30 | this.id = id;
31 | }
32 |
33 | public Date getCreateTime() {
34 | return createTime;
35 | }
36 |
37 | public void setCreateTime(Date createTime) {
38 | this.createTime = createTime;
39 | }
40 |
41 | public Integer getStatus() {
42 | return status;
43 | }
44 |
45 | public void setStatus(Integer status) {
46 | this.status = status;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/service/impls/Entity1ProcessInstanceService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.service.impls;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity1Process;
4 | import com.oldguy.example.modules.test.dao.jpas.Entity1ProcessMapper;
5 | import com.oldguy.example.modules.workflow.configs.WorkFlowConfiguration;
6 | import com.oldguy.example.modules.workflow.dto.WorkBtn;
7 | import com.oldguy.example.modules.workflow.service.AbstractProcessInstanceService;
8 | import com.oldguy.example.modules.workflow.service.ProcessInstanceService;
9 | import org.activiti.bpmn.model.SequenceFlow;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Service;
12 | import org.springframework.transaction.annotation.Transactional;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * @author huangrenhao
19 | * @date 2019/1/21
20 | */
21 | @Service
22 | public class Entity1ProcessInstanceService extends AbstractProcessInstanceService {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/sys/dao/UserEntityMapperTest.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.sys.dao;
2 |
3 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
4 | import com.oldguy.example.modules.sys.dao.jpas.UserEntityMapper;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.boot.test.context.SpringBootTest;
9 | import org.springframework.test.context.junit4.SpringRunner;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * @author huangrenhao
15 | * @date 2019/1/19
16 | */
17 | @RunWith(SpringRunner.class)
18 | @SpringBootTest
19 | public class UserEntityMapperTest {
20 |
21 | @Autowired
22 | private UserEntityMapper userEntityMapper;
23 |
24 | @Test
25 | public void testSave() {
26 |
27 | UserEntity entity = new UserEntity();
28 | entity.setUserId("测试2");
29 | entity.setUsername("测试2");
30 | entity.setCreateTime(new Date());
31 | entity.setStatus(1);
32 |
33 | userEntityMapper.save(entity);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/TaskForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | import org.hibernate.validator.constraints.NotBlank;
4 |
5 | /**
6 | * @author huangrenhao
7 | * @date 2018/12/7
8 | */
9 | public class TaskForm {
10 |
11 | /**
12 | * 任务ID
13 | */
14 | @NotBlank(message = "taskId 任务ID 不能为空!")
15 | private String taskId;
16 |
17 | /**
18 | * 批注
19 | */
20 | private String comment;
21 |
22 | /**
23 | * 流程标示
24 | */
25 | private String flowFlag;
26 |
27 | public String getTaskId() {
28 | return taskId;
29 | }
30 |
31 | public void setTaskId(String taskId) {
32 | this.taskId = taskId;
33 | }
34 |
35 | public String getComment() {
36 | return comment;
37 | }
38 |
39 | public void setComment(String comment) {
40 | this.comment = comment;
41 | }
42 |
43 | public String getFlowFlag() {
44 | return flowFlag;
45 | }
46 |
47 | public void setFlowFlag(String flowFlag) {
48 | this.flowFlag = flowFlag;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dto/AbstractQueryForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dto;
2 |
3 | /**
4 | * @author huangrenhao
5 | * @date 2018/11/26
6 | */
7 | public abstract class AbstractQueryForm {
8 |
9 | /**
10 | * 模糊搜索字段
11 | */
12 | private String queryText;
13 |
14 | /**
15 | * 排序:
16 | * 1 - > id 倒序
17 | * 0 - > id 正序
18 | */
19 | private Integer sort;
20 |
21 | /**
22 | * 状态:
23 | * 1 - > 正常
24 | * 0 - > 禁用
25 | */
26 | private Integer status;
27 |
28 | public String getQueryText() {
29 | return queryText;
30 | }
31 |
32 | public void setQueryText(String queryText) {
33 | this.queryText = queryText;
34 | }
35 |
36 | public Integer getSort() {
37 | return sort;
38 | }
39 |
40 | public void setSort(Integer sort) {
41 | this.sort = sort;
42 | }
43 |
44 | public Integer getStatus() {
45 | return status;
46 | }
47 |
48 | public void setStatus(Integer status) {
49 | this.status = status;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/handles/CommonExceptionHandle.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.handles;/**
2 | * Created by Administrator on 2018/10/29 0029.
3 | */
4 |
5 |
6 | import com.oldguy.example.modules.common.exceptions.FormValidException;
7 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
8 | import org.springframework.http.HttpStatus;
9 | import org.springframework.web.bind.annotation.ExceptionHandler;
10 | import org.springframework.web.bind.annotation.ResponseStatus;
11 | import org.springframework.web.bind.annotation.RestControllerAdvice;
12 |
13 | /**
14 | * @Description:
15 | * @Author: ren
16 | * @CreateTime: 2018-10-2018/10/29 0029 15:23
17 | */
18 | @RestControllerAdvice
19 | public class CommonExceptionHandle {
20 |
21 | /**
22 | * 表单异常处理
23 | * @param exception
24 | * @return
25 | */
26 | @ExceptionHandler(FormValidException.class)
27 | @ResponseStatus(value = HttpStatus.BAD_REQUEST)
28 | public Object unauthenticatedException(FormValidException exception) {
29 | return HttpJsonUtils.buildValid(exception.getMessage());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/WorkBtn.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | /**
4 | * @author huangrenhao
5 | * @date 2018/12/6
6 | */
7 | public class WorkBtn {
8 |
9 | /**
10 | * 按钮名称
11 | */
12 | private String name;
13 |
14 | /**
15 | * 路径
16 | */
17 | private String url;
18 |
19 | /**
20 | * 提交标示
21 | */
22 | private Object flowFlag;
23 |
24 | public WorkBtn(String name, String url, Object flowFlag) {
25 | this.name = name;
26 | this.url = url;
27 | this.flowFlag = flowFlag;
28 | }
29 |
30 | public String getName() {
31 | return name;
32 | }
33 |
34 | public void setName(String name) {
35 | this.name = name;
36 | }
37 |
38 | public String getUrl() {
39 | return url;
40 | }
41 |
42 | public void setUrl(String url) {
43 | this.url = url;
44 | }
45 |
46 | public Object getFlowFlag() {
47 | return flowFlag;
48 | }
49 |
50 | public void setFlowFlag(Object flowFlag) {
51 | this.flowFlag = flowFlag;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/utils/SpringContextUtils.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.utils;
2 |
3 | import org.springframework.beans.BeansException;
4 | import org.springframework.context.ApplicationContext;
5 | import org.springframework.context.ApplicationContextAware;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2018/8/11
11 | */
12 | @Component
13 | public class SpringContextUtils implements ApplicationContextAware {
14 |
15 | private static ApplicationContext applicationContext;
16 |
17 | public static String[] getBeanNamesForType(Class> clazz ){
18 | return applicationContext.getBeanNamesForType(clazz);
19 | }
20 |
21 | public static T getBean(String beanName,Class clazz) {
22 | return applicationContext.getBean(beanName,clazz);
23 | }
24 |
25 | public static T getBean(Class clazz) {
26 | return applicationContext.getBean(clazz);
27 | }
28 |
29 | @SuppressWarnings("static-access")
30 | @Override
31 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
32 | SpringContextUtils.applicationContext = applicationContext;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/controllers/HistoryTaskController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.controllers;
2 |
3 | import com.oldguy.example.modules.sys.services.UserEntityService;
4 | import com.oldguy.example.modules.workflow.dao.entities.HistoryTask;
5 | import com.oldguy.example.modules.workflow.dao.jpas.HistoryTaskMapper;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * @author huangrenhao
15 | * @date 2019/1/19
16 | */
17 | @RequestMapping("HistoryTask")
18 | @RestController
19 | public class HistoryTaskController {
20 |
21 | @Autowired
22 | private HistoryTaskMapper historyTaskMapper;
23 |
24 |
25 | @GetMapping("all")
26 | public List getList(Integer status) {
27 | return historyTaskMapper.findAllByStatus(status);
28 | }
29 |
30 | @GetMapping("current")
31 | public List current() {
32 | return historyTaskMapper.findByUserId(UserEntityService.getCurrentUserEntity().getUserId());
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/jpas/ProcessAuditStatusMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.jpas.BaseEntityMapper;
4 | import com.oldguy.example.modules.workflow.dao.entities.ProcessAuditStatus;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.Collection;
9 | import java.util.List;
10 |
11 | /**
12 | * @author huangrenhao
13 | * @date 2019/1/23
14 | */
15 | @Repository
16 | public interface ProcessAuditStatusMapper extends BaseEntityMapper {
17 |
18 | /**
19 | * 获取审核状态
20 | * @param processDefinitionId
21 | * @return
22 | */
23 | List findByProcessDefinitionId(String processDefinitionId);
24 |
25 | /**
26 | * 获取审核状态
27 | * @param processDefinitionId
28 | * @param userTask
29 | * @return
30 | */
31 | ProcessAuditStatus findByProcessDefinitionIdAndUserTask(@Param("processDefinitionId") String processDefinitionId,@Param("userTask") String userTask);
32 |
33 | /**
34 | *
35 | * @param processDefinitionKey
36 | * @return
37 | */
38 | List findByProcessDefinitionKey(String processDefinitionKey);
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/handles/Entity3ProcessTaskListener.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.handles;
2 |
3 | import com.oldguy.example.modules.common.utils.SpringContextUtils;
4 | import org.activiti.bpmn.model.BpmnModel;
5 | import org.activiti.bpmn.model.Process;
6 | import org.activiti.bpmn.model.UserTask;
7 | import org.activiti.engine.RepositoryService;
8 | import org.activiti.engine.delegate.DelegateTask;
9 | import org.activiti.engine.delegate.TaskListener;
10 |
11 | /**
12 | * @ClassName: Entity3ProcessTaskListener
13 | * @Author: ren
14 | * @Description:
15 | * @CreateTIme: 2019/4/30 0030 上午 8:54
16 | **/
17 | public class Entity3ProcessTaskListener implements TaskListener {
18 | @Override
19 | public void notify(DelegateTask delegateTask) {
20 |
21 | RepositoryService repositoryService = SpringContextUtils.getBean(RepositoryService.class);
22 |
23 | // BpmnModel bpmnModel = repositoryService.getBpmnModel(delegateTask.getProcessDefinitionId());
24 | // Process process = bpmnModel.getProcesses().get(0);
25 | //
26 | // // 当前任务节点
27 | // UserTask userTask = (UserTask) process.getFlowElement(delegateTask.getTaskDefinitionKey());
28 |
29 | System.out.println("assignee:" + delegateTask.getAssignee());
30 |
31 | System.out.println("------------------------------------");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/controllers/UserEntityController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.controllers;
2 |
3 | import com.oldguy.example.modules.common.exceptions.FormValidException;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.sys.annonation.NoLoginPerm;
6 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
7 | import com.oldguy.example.modules.sys.dao.jpas.UserEntityMapper;
8 | import com.oldguy.example.modules.sys.services.UserEntityService;
9 | import org.apache.commons.lang3.StringUtils;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.web.bind.annotation.GetMapping;
12 | import org.springframework.web.bind.annotation.PostMapping;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RestController;
15 |
16 | import javax.servlet.http.HttpSession;
17 | import java.util.List;
18 |
19 | /**
20 | * @author huangrenhao
21 | * @date 2019/1/19
22 | */
23 | @RestController
24 | @RequestMapping("UserEntity")
25 | public class UserEntityController {
26 |
27 | @Autowired
28 | private UserEntityMapper userEntityMapper;
29 |
30 | @GetMapping("all")
31 | public List getList(Integer status) {
32 | return userEntityMapper.findAllByStatus(status);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/WorkEntityInfo.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 任务实体
7 | * @author huangrenhao
8 | * @date 2018/12/5
9 | */
10 | public class WorkEntityInfo {
11 |
12 | /**
13 | * 任务信息
14 | */
15 | private TaskEntityInfo taskEntityInfo;
16 |
17 | /**
18 | * 任务批注
19 | */
20 | private List taskComments;
21 |
22 | /**
23 | * 任务按钮
24 | */
25 | private List workBtnList;
26 |
27 | /**
28 | * 数据对象
29 | */
30 | private Object target;
31 |
32 | public Object getTarget() {
33 | return target;
34 | }
35 |
36 | public void setTarget(Object target) {
37 | this.target = target;
38 | }
39 |
40 | public TaskEntityInfo getTaskEntityInfo() {
41 | return taskEntityInfo;
42 | }
43 |
44 | public void setTaskEntityInfo(TaskEntityInfo taskEntityInfo) {
45 | this.taskEntityInfo = taskEntityInfo;
46 | }
47 |
48 | public List getTaskComments() {
49 | return taskComments;
50 | }
51 |
52 | public void setTaskComments(List taskComments) {
53 | this.taskComments = taskComments;
54 | }
55 |
56 | public List getWorkBtnList() {
57 | return workBtnList;
58 | }
59 |
60 | public void setWorkBtnList(List workBtnList) {
61 | this.workBtnList = workBtnList;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/table/bootstrap-table-zh-CN.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Bootstrap Table Chinese translation
3 | * Author: Zhixin Wen
4 | */
5 | (function ($) {
6 | 'use strict';
7 |
8 | $.fn.bootstrapTable.locales['zh-CN'] = {
9 | formatLoadingMessage: function () {
10 | return '正在努力地加载数据中,请稍候……';
11 | },
12 | formatRecordsPerPage: function (pageNumber) {
13 | return '每页显示 ' + pageNumber + ' 条记录';
14 | },
15 | formatShowingRows: function (pageFrom, pageTo, totalRows) {
16 | return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
17 | },
18 | formatSearch: function () {
19 | return '搜索';
20 | },
21 | formatNoMatches: function () {
22 | return '没有找到匹配的记录';
23 | },
24 | formatPaginationSwitch: function () {
25 | return '隐藏/显示分页';
26 | },
27 | formatRefresh: function () {
28 | return '刷新';
29 | },
30 | formatToggle: function () {
31 | return '切换';
32 | },
33 | formatColumns: function () {
34 | return '列';
35 | },
36 | formatExport: function () {
37 | return '导出数据';
38 | },
39 | formatClearFilters: function () {
40 | return '清空过滤';
41 | }
42 | };
43 |
44 | $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
45 |
46 | })(jQuery);
47 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/TaskComment.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * @author huangrenhao
7 | * @date 2018/12/5
8 | */
9 | public class TaskComment {
10 |
11 | private String id;
12 |
13 | private String taskId;
14 |
15 | private String processInstanceId;
16 |
17 | private String userId;
18 |
19 | private String message;
20 |
21 | private Date time;
22 |
23 | public String getId() {
24 | return id;
25 | }
26 |
27 | public void setId(String id) {
28 | this.id = id;
29 | }
30 |
31 | public String getTaskId() {
32 | return taskId;
33 | }
34 |
35 | public void setTaskId(String taskId) {
36 | this.taskId = taskId;
37 | }
38 |
39 | public String getProcessInstanceId() {
40 | return processInstanceId;
41 | }
42 |
43 | public void setProcessInstanceId(String processInstanceId) {
44 | this.processInstanceId = processInstanceId;
45 | }
46 |
47 | public String getUserId() {
48 | return userId;
49 | }
50 |
51 | public void setUserId(String userId) {
52 | this.userId = userId;
53 | }
54 |
55 | public String getMessage() {
56 | return message;
57 | }
58 |
59 | public void setMessage(String message) {
60 | this.message = message;
61 | }
62 |
63 | public Date getTime() {
64 | return time;
65 | }
66 |
67 | public void setTime(Date time) {
68 | this.time = time;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/configs/DemoConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.configs;
2 |
3 | import com.oldguy.example.modules.common.configs.DbRegisterConfiguration;
4 | import org.mybatis.spring.annotation.MapperScan;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Value;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.jdbc.core.JdbcTemplate;
9 |
10 | import javax.annotation.PostConstruct;
11 | import javax.sql.DataSource;
12 |
13 | /**
14 | * @Date: 2019/1/13 0013
15 | * @Author: ren
16 | * @Description:
17 | */
18 | @Configuration
19 | @MapperScan(basePackages={
20 | "com.oldguy.example.modules.sys.dao.jpas",
21 | "com.oldguy.example.modules.test.dao.jpas",
22 | "com.oldguy.example.modules.workflow.dao.jpas"
23 | })
24 | public class DemoConfiguration {
25 |
26 |
27 | public static final Integer DEFAULT_PAGE_SIZE = 15;
28 |
29 | public static class WorkFlowConfig {
30 |
31 | public static String ENTITY1_PROCESS = "ENTITY1_PROCESS";
32 |
33 | }
34 |
35 | @Autowired
36 | private DataSource dataSource;
37 |
38 | @Value("${mybatis.type-aliases-package}")
39 | private String typeAliasesPackage;
40 |
41 | @PostConstruct
42 | public void init() {
43 | JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
44 | DbRegisterConfiguration configuration = new DbRegisterConfiguration();
45 | configuration.initDB(typeAliasesPackage, jdbcTemplate);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/controllers/Entity5ProcessController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.controllers;
2 |
3 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
4 | import com.oldguy.example.modules.test.dao.jpas.Entity5ProcessMapper;
5 | import com.oldguy.example.modules.test.service.Entity5ProcessService;
6 | import com.oldguy.example.modules.workflow.service.UserTaskService;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | /**
13 | * @ClassName: Entity4ProcessController
14 | * @Author: ren
15 | * @Description:
16 | * @CreateTIme: 2019/4/29 0029 上午 8:58
17 | **/
18 | @RestController
19 | @RequestMapping("Entity5Process")
20 | public class Entity5ProcessController {
21 |
22 |
23 | @Autowired
24 | private UserTaskService userTaskService;
25 | @Autowired
26 | private Entity5ProcessMapper entity5ProcessMapper;
27 | @Autowired
28 | private Entity5ProcessService entity5ProcessService;
29 |
30 | /**
31 | * 开启流程实例
32 | *
33 | * @return
34 | */
35 | @PostMapping("openProcessInstance")
36 | public Object openProcessInstance() {
37 | String processInstanceId = entity5ProcessService.openProcessInstance();
38 | // 更新审核状态
39 | userTaskService.updateAuditStatus(processInstanceId);
40 | return HttpJsonUtils.OK;
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/aop/LoginAspect.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.aop;/**
2 | * Created by Administrator on 2018/10/24 0024.
3 | */
4 |
5 |
6 |
7 | import com.oldguy.example.modules.common.exceptions.NoLoginException;
8 | import com.oldguy.example.modules.common.utils.Log4jUtils;
9 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
10 | import com.oldguy.example.modules.sys.services.UserEntityService;
11 | import org.aspectj.lang.annotation.Aspect;
12 | import org.aspectj.lang.annotation.Before;
13 | import org.aspectj.lang.annotation.Pointcut;
14 | import org.springframework.stereotype.Component;
15 |
16 |
17 | /**
18 | * @Description:
19 | * @Author: ren
20 | * @CreateTime: 2018-10-2018/10/24 0024 20:59
21 | */
22 | @Aspect
23 | @Component
24 | public class LoginAspect {
25 |
26 | @Pointcut("within(com.oldguy.example.modules.*.controllers.*)")
27 | public void login() {
28 | }
29 |
30 | @Pointcut("@annotation(com.oldguy.example.modules.sys.annonation.NoLoginPerm)")
31 | public void noLoginMethod() {
32 | }
33 |
34 | @Pointcut("within(com.oldguy.example.modules.view.controllers.LoginController)")
35 | public void noLogin() {
36 | }
37 |
38 | @Before("login() && !noLoginMethod() && !noLogin()")
39 | public void before() {
40 | UserEntity entity = UserEntityService.getCurrentUserEntity();
41 | if(entity == null){
42 | throw new NoLoginException();
43 | }
44 | Log4jUtils.getInstance(getClass()).info("用户[" + entity.getUserId() + "]:正在使用");
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/resources/mappers/workflow/TransformEntityInfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | transform_entity_info
9 |
10 |
11 | ${prefix}.process_instance_id,
12 | ${prefix}.task_define_key,
13 | ${prefix}.sequential,
14 | ${prefix}.create_time,
15 | ${prefix}.id,
16 | ${prefix}.`status`
17 |
18 |
19 |
20 |
21 |
32 |
33 |
34 | INSERT
35 |
36 | (
37 | process_instance_id,
38 | task_define_key,
39 | sequential,
40 | create_time,
41 | `status`
42 | )
43 | VALUES (
44 | #{processInstanceId},
45 | #{taskDefineKey},
46 | #{sequential},
47 | #{createTime},
48 | #{status}
49 | )
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/main/resources/templates/workflow/UserGroup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UserGroup
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
53 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dao/jpas/BaseEntityMapper.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dao.jpas;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 | import com.oldguy.example.modules.workflow.dao.entities.ProcessTaskConfig;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.Collection;
8 | import java.util.Date;
9 | import java.util.List;
10 |
11 | /**
12 | * 实体映射基类,用于映射BaseEntity的子类
13 | *
14 | * @param
15 | * @author huangrenhao
16 | * @version V1.0
17 | * @ClassName: BaseEntityMapper
18 | * @Description: TODO
19 | * @date 2017年12月4日 上午10:44:55
20 | */
21 | public interface BaseEntityMapper extends BaseMapper {
22 |
23 | /**
24 | * 初始化新实例
25 | * @param collection
26 | */
27 | static void initNewInstance(Collection collection) {
28 | collection.forEach(obj -> {
29 | obj.setStatus(1);
30 | obj.setCreateTime(new Date());
31 | });
32 | }
33 |
34 |
35 | /**
36 | * 获取 List 列表
37 | * status :
38 | * 1 - 有效
39 | * 0 - 无效
40 | * null -> 所有
41 | *
42 | * @param status
43 | * @return
44 | */
45 | List findAllByStatus(@Param("status") Integer status);
46 |
47 | /**
48 | * 修改 T 状态
49 | *
50 | * @param id
51 | * @param status
52 | * @return
53 | */
54 | int updateStatus(@Param("id") Long id, @Param("status") Integer status);
55 |
56 | /**
57 | * 批量更新实体
58 | * @param collection
59 | * @return
60 | */
61 | int updateBatch(@Param("collection") Collection collection);
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/controllers/ProcessTaskConfigController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.controllers;
2 |
3 | import com.oldguy.example.modules.common.utils.FormValidateUtils;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.workflow.dao.entities.ProcessAuditStatus;
6 | import com.oldguy.example.modules.workflow.dao.entities.ProcessTaskConfig;
7 | import com.oldguy.example.modules.workflow.dao.jpas.ProcessTaskConfigMapper;
8 | import com.oldguy.example.modules.workflow.dto.form.ProcessTaskConfigForm;
9 | import com.oldguy.example.modules.workflow.service.entities.ProcessTaskConfigService;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.web.bind.annotation.*;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * @Date: 2019/1/27 0027
17 | * @Author: ren
18 | * @Description:
19 | */
20 | @RestController
21 | @RequestMapping("ProcessTaskConfig")
22 | public class ProcessTaskConfigController {
23 |
24 |
25 | @Autowired
26 | private ProcessTaskConfigService processTaskConfigService;
27 | @Autowired
28 | private ProcessTaskConfigMapper processTaskConfigMapper;
29 |
30 | @GetMapping("all")
31 | public List getList(Integer status) {
32 | return processTaskConfigMapper.findAllByStatus(status);
33 | }
34 |
35 |
36 | @PostMapping("persist")
37 | public Object persist(@RequestBody ProcessTaskConfigForm form){
38 |
39 | FormValidateUtils.validate(form,true);
40 |
41 | processTaskConfigService.persist(form);
42 |
43 | return HttpJsonUtils.OK;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/configs/ActivitiConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.configs;
2 |
3 | import org.activiti.spring.SpringAsyncExecutor;
4 | import org.activiti.spring.SpringProcessEngineConfiguration;
5 | import org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration;
6 | import org.activiti.spring.boot.ActivitiProperties;
7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
8 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 | import org.springframework.jdbc.datasource.DataSourceTransactionManager;
12 | import org.springframework.transaction.PlatformTransactionManager;
13 |
14 | import javax.sql.DataSource;
15 | import java.io.IOException;
16 |
17 | /**
18 | * @author huangrenhao
19 | * @date 2018/11/27
20 | */
21 | @Configuration
22 | @EnableConfigurationProperties(ActivitiProperties.class)
23 | public class ActivitiConfiguration extends AbstractProcessEngineAutoConfiguration {
24 |
25 | @Bean
26 | public PlatformTransactionManager transactionManager(DataSource dataSource) {
27 | return new DataSourceTransactionManager(dataSource);
28 | }
29 |
30 | @Bean
31 | public SpringProcessEngineConfiguration springProcessEngineConfiguration(
32 | DataSource dataSource,
33 | PlatformTransactionManager transactionManager,
34 | SpringAsyncExecutor springAsyncExecutor) throws IOException {
35 |
36 | return this.baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/entities/ProcessAuditStatus.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 | import lombok.Data;
5 |
6 | import javax.persistence.Entity;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/23
11 | */
12 | @Entity
13 | public class ProcessAuditStatus extends BaseEntity {
14 |
15 | private String processDefinitionKey;
16 |
17 | private String processDefinitionId;
18 |
19 | private String userTask;
20 |
21 | private String auditCode;
22 |
23 | private String auditMessage;
24 |
25 | public String getProcessDefinitionKey() {
26 | return processDefinitionKey;
27 | }
28 |
29 | public void setProcessDefinitionKey(String processDefinitionKey) {
30 | this.processDefinitionKey = processDefinitionKey;
31 | }
32 |
33 | public String getProcessDefinitionId() {
34 | return processDefinitionId;
35 | }
36 |
37 | public void setProcessDefinitionId(String processDefinitionId) {
38 | this.processDefinitionId = processDefinitionId;
39 | }
40 |
41 | public String getUserTask() {
42 | return userTask;
43 | }
44 |
45 | public void setUserTask(String userTask) {
46 | this.userTask = userTask;
47 | }
48 |
49 | public String getAuditCode() {
50 | return auditCode;
51 | }
52 |
53 | public void setAuditCode(String auditCode) {
54 | this.auditCode = auditCode;
55 | }
56 |
57 | public String getAuditMessage() {
58 | return auditMessage;
59 | }
60 |
61 | public void setAuditMessage(String auditMessage) {
62 | this.auditMessage = auditMessage;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/view/controllers/LoginController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.view.controllers;
2 |
3 |
4 | import com.oldguy.example.modules.sys.annonation.NoLoginPerm;
5 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
6 | import com.oldguy.example.modules.sys.dao.jpas.UserEntityMapper;
7 | import com.oldguy.example.modules.sys.services.UserEntityService;
8 | import org.apache.commons.lang3.StringUtils;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Controller;
11 | import org.springframework.ui.Model;
12 | import org.springframework.web.bind.annotation.PostMapping;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 |
15 | import javax.servlet.http.HttpSession;
16 |
17 | /**
18 | * @author huangrenhao
19 | * @date 2019/1/19
20 | */
21 | @Controller
22 | public class LoginController {
23 |
24 | @Autowired
25 | private UserEntityMapper userEntityMapper;
26 |
27 | @RequestMapping({"", "login"})
28 | public String login() {
29 | return "login";
30 | }
31 |
32 | @NoLoginPerm
33 | @PostMapping("sign")
34 | public String sign(HttpSession session, Model model, String userId) {
35 |
36 | if (StringUtils.isBlank(userId)) {
37 | model.addAttribute("errorMessage","用户ID 不能为空!");
38 | return "/login";
39 | }
40 |
41 | UserEntity userEntity = userEntityMapper.findByUserId(userId);
42 |
43 | if (null == userEntity) {
44 | model.addAttribute("errorMessage","不存在该用户!");
45 | return "/login";
46 | }
47 | session.setAttribute(UserEntityService.CURRENT_USER_FLAG, userEntity);
48 | return "redirect:view/sys/UserEntity";
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/configs/PropertiesConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.configs;
2 |
3 | import com.oldguy.example.modules.common.utils.Log4jUtils;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.util.ResourceUtils;
7 |
8 | import java.io.*;
9 | import java.util.HashMap;
10 | import java.util.Map;
11 | import java.util.Properties;
12 |
13 | /**
14 | * @author huangrenhao
15 | * @date 2019/1/25
16 | */
17 | @Configuration
18 | public class PropertiesConfiguration {
19 |
20 | /**
21 | * 路径映射
22 | */
23 | public static final Map WORKFLOW_TASK_URL_MAP = new HashMap<>();
24 |
25 | @Value("${workflow-configuration-location}")
26 | private String WORKFLOW_CONFIGURATION_LOCATION;
27 |
28 | /**
29 | * 初始化环境常量
30 | *
31 | * @throws IOException
32 | */
33 | public void init() throws IOException {
34 | Log4jUtils.getInstance(getClass()).info("初始化环境常量");
35 | setProperties(WORKFLOW_CONFIGURATION_LOCATION, WORKFLOW_TASK_URL_MAP);
36 | }
37 |
38 | private void setProperties(String configPath, Map valueMap) throws IOException {
39 | Properties properties = new Properties();
40 | File file = ResourceUtils.getFile("classpath:" + configPath);
41 | FileInputStream fileInputStream = new FileInputStream(file);
42 | BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
43 | properties.load(new InputStreamReader(bufferedInputStream, "gbk"));
44 | fileInputStream.close();
45 |
46 | for (Object key : properties.keySet()) {
47 | valueMap.put(String.valueOf(key), String.valueOf(properties.get(key)));
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/sys/services/UserEntityService.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.sys.services;
2 |
3 | import com.oldguy.example.modules.sys.dao.entities.UserEntity;
4 | import com.oldguy.example.modules.sys.dao.jpas.UserEntityMapper;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 | import org.springframework.web.context.request.RequestContextHolder;
8 | import org.springframework.web.context.request.ServletRequestAttributes;
9 |
10 | import javax.servlet.http.HttpServletRequest;
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 | import java.util.Set;
15 |
16 | /**
17 | * @author huangrenhao
18 | * @date 2019/1/19
19 | */
20 | @Service
21 | public class UserEntityService {
22 |
23 | public static final String CURRENT_USER_FLAG = "CURRENT_USER";
24 | @Autowired
25 | private UserEntityMapper userEntityMapper;
26 |
27 |
28 | public static UserEntity getCurrentUserEntity() {
29 |
30 | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
31 |
32 | Object obj = request.getSession().getAttribute(CURRENT_USER_FLAG);
33 | if (null != obj) {
34 | return (UserEntity) obj;
35 | }
36 |
37 | return null;
38 | }
39 |
40 | public Map getUsernameMapByUserIds(Set allUserIdSet) {
41 | // 关联ID对应的用户名
42 | List userEntities = userEntityMapper.findByUserIdSet(allUserIdSet);
43 | Map usernameMap = new HashMap<>(userEntities.size());
44 | userEntities.forEach(obj -> {
45 | usernameMap.put(obj.getUserId(), obj.getUsername());
46 | });
47 |
48 | return usernameMap;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dto/AbstractPageQueryForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dto;
2 |
3 | import com.baomidou.mybatisplus.plugins.Page;
4 | import com.oldguy.example.configs.DemoConfiguration;
5 | import org.springframework.format.annotation.DateTimeFormat;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author huangrenhao
11 | * @date 2019/1/9
12 | */
13 | public abstract class AbstractPageQueryForm extends AbstractQueryForm {
14 |
15 | /**
16 | * 当前页
17 | */
18 | private Integer current;
19 |
20 | /**
21 | * 单页记录数
22 | */
23 | private Integer size;
24 |
25 | /**
26 | * 创建时间 > 开始时间
27 | */
28 | @DateTimeFormat
29 | private Date startTime;
30 |
31 | /**
32 | * 创建时间 < 结束时间
33 | */
34 | @DateTimeFormat
35 | private Date endTime;
36 |
37 | public Page trainToPage() {
38 |
39 | current = current == null ? current = 0 : current;
40 | size = size == null ? size = DemoConfiguration.DEFAULT_PAGE_SIZE : size;
41 |
42 | return new Page(current, size);
43 | }
44 |
45 | public Date getStartTime() {
46 | return startTime;
47 | }
48 |
49 | public void setStartTime(Date startTime) {
50 | this.startTime = startTime;
51 | }
52 |
53 | public Date getEndTime() {
54 | return endTime;
55 | }
56 |
57 | public void setEndTime(Date endTime) {
58 | this.endTime = endTime;
59 | }
60 |
61 | public Integer getCurrent() {
62 | return current;
63 | }
64 |
65 | public void setCurrent(Integer current) {
66 | this.current = current;
67 | }
68 |
69 | public Integer getSize() {
70 | return size;
71 | }
72 |
73 | public void setSize(Integer size) {
74 | this.size = size;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/controllers/ProcessAuditStatusController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.controllers;
2 |
3 | import com.oldguy.example.modules.common.utils.FormValidateUtils;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.workflow.dao.entities.ProcessAuditStatus;
6 | import com.oldguy.example.modules.workflow.dao.jpas.ProcessAuditStatusMapper;
7 | import com.oldguy.example.modules.workflow.dto.form.ProcessAuditStatusForm;
8 | import com.oldguy.example.modules.workflow.service.entities.ProcessAuditStatusService;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * @author huangrenhao
16 | * @date 2019/1/23
17 | */
18 | @RestController
19 | @RequestMapping("ProcessAuditStatus")
20 | public class ProcessAuditStatusController {
21 |
22 | @Autowired
23 | private ProcessAuditStatusMapper processAuditStatusMapper;
24 | @Autowired
25 | private ProcessAuditStatusService processAuditStatusService;
26 |
27 | @GetMapping("{ProcessDefinitionId}")
28 | public Object findByProcessDefinitionId(@PathVariable("ProcessDefinitionId") String ProcessDefinitionId){
29 | return processAuditStatusMapper.findByProcessDefinitionId(ProcessDefinitionId);
30 | }
31 |
32 | @PostMapping("persist")
33 | public Object persistProcessAuditStatus(@RequestBody ProcessAuditStatusForm form) {
34 | FormValidateUtils.validate(form, true);
35 | processAuditStatusService.persist(form);
36 | return HttpJsonUtils.OK;
37 | }
38 |
39 | @GetMapping("all")
40 | public List getList(Integer status) {
41 | return processAuditStatusMapper.findAllByStatus(status);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dao/entities/ProcessTaskConfig.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dao.entities;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.BaseEntity;
4 |
5 | import javax.persistence.Entity;
6 |
7 | /**
8 | * @Date: 2019/1/26 0026
9 | * @Author: ren
10 | * @Description:
11 | */
12 | @Entity
13 | public class ProcessTaskConfig extends BaseEntity{
14 |
15 | private String processDefinitionId;
16 |
17 | private String processDefinitionKey;
18 |
19 | private String flowFlag;
20 |
21 | private String flowId;
22 |
23 | private String btn;
24 |
25 | private String url;
26 |
27 | public String getFlowId() {
28 | return flowId;
29 | }
30 |
31 | public void setFlowId(String flowId) {
32 | this.flowId = flowId;
33 | }
34 |
35 | public String getProcessDefinitionId() {
36 | return processDefinitionId;
37 | }
38 |
39 | public void setProcessDefinitionId(String processDefinitionId) {
40 | this.processDefinitionId = processDefinitionId;
41 | }
42 |
43 | public String getProcessDefinitionKey() {
44 | return processDefinitionKey;
45 | }
46 |
47 | public void setProcessDefinitionKey(String processDefinitionKey) {
48 | this.processDefinitionKey = processDefinitionKey;
49 | }
50 |
51 | public String getFlowFlag() {
52 | return flowFlag;
53 | }
54 |
55 | public void setFlowFlag(String flowFlag) {
56 | this.flowFlag = flowFlag;
57 | }
58 |
59 | public String getBtn() {
60 | return btn;
61 | }
62 |
63 | public void setBtn(String btn) {
64 | this.btn = btn;
65 | }
66 |
67 | public String getUrl() {
68 | return url;
69 | }
70 |
71 | public void setUrl(String url) {
72 | this.url = url;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/form/ProcessTaskConfigForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto.form;
2 |
3 | import lombok.Data;
4 | import org.hibernate.validator.constraints.NotBlank;
5 | import org.hibernate.validator.constraints.NotEmpty;
6 |
7 | import java.util.Collections;
8 | import java.util.List;
9 |
10 | /**
11 | * @Date: 2019/1/27 0027
12 | * @Author: ren
13 | * @Description:
14 | */
15 | @Data
16 | public class ProcessTaskConfigForm {
17 |
18 | @NotBlank(message = "processDefinitionId 不能为空!")
19 | private String processDefinitionId;
20 |
21 | @NotBlank(message = "processDefinitionId 不能为空!")
22 | private String processDefinitionKey;
23 |
24 | @NotEmpty(message = "elements 不能为空!")
25 | private List elements = Collections.emptyList();
26 |
27 | public String getProcessDefinitionId() {
28 | return processDefinitionId;
29 | }
30 |
31 | public String getProcessDefinitionKey() {
32 | return processDefinitionKey;
33 | }
34 |
35 | public List getElements() {
36 | return elements;
37 | }
38 |
39 | @Data
40 | public static class TaskConfigItem{
41 |
42 | @NotBlank(message = "flowId 不能为空!")
43 | private String flowId;
44 |
45 | @NotBlank(message = "btn 不能为空!")
46 | private String btn;
47 |
48 | @NotBlank(message = "url 不能为空!")
49 | private String url;
50 |
51 | @NotBlank(message = "flowFlag 不能为空!")
52 | private String flowFlag;
53 |
54 | public String getFlowId() {
55 | return flowId;
56 | }
57 |
58 | public String getBtn() {
59 | return btn;
60 | }
61 |
62 | public String getUrl() {
63 | return url;
64 | }
65 |
66 | public String getFlowFlag() {
67 | return flowFlag;
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/resources/templates/workflow/ProcessAuditStatus.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Process AuditStatus
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
63 |
--------------------------------------------------------------------------------
/src/main/resources/templates/sys/UserEntity.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UserEntity
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
63 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/services/Entity5ProcessTest.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.services;
2 |
3 | import com.oldguy.example.modules.test.service.Entity5ProcessService;
4 | import org.activiti.engine.TaskService;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.boot.test.context.SpringBootTest;
9 | import org.springframework.test.context.junit4.SpringRunner;
10 | import org.springframework.transaction.annotation.Transactional;
11 |
12 | import java.util.ArrayList;
13 | import java.util.HashMap;
14 | import java.util.List;
15 | import java.util.Map;
16 |
17 | /**
18 | * @ClassName: Entity5ProcessTest
19 | * @Author: ren
20 | * @Description:
21 | * @CreateTIme: 2019/5/6 0006 下午 12:18
22 | **/
23 | @RunWith(SpringRunner.class)
24 | @SpringBootTest
25 | public class Entity5ProcessTest {
26 |
27 | @Autowired
28 | private Entity5ProcessService entity5ProcessService;
29 | @Autowired
30 | private TaskService taskService;
31 |
32 | @Test
33 | public void test1() {
34 |
35 | List assigneeList = new ArrayList<>();
36 | assigneeList.add("2");
37 | assigneeList.add("4");
38 | assigneeList.add("6");
39 |
40 | entity5ProcessService.test1("17520", assigneeList);
41 | }
42 |
43 | @Test
44 | public void testOpenInstance() {
45 | entity5ProcessService.openProcessInstance();
46 | }
47 |
48 | @Test
49 | @Transactional(rollbackFor = Exception.class)
50 | public void testDefaultComplete() {
51 | Map data = new HashMap<>(1);
52 | data.put("assignee", "3");
53 | taskService.complete("112506", data);
54 | // throw new RuntimeException("transpondTask。。。。。。。。。。。");
55 | }
56 |
57 | @Test
58 | public void testTranspondTask() {
59 | entity5ProcessService.transpondTask("5017", "transpondTask-b", "transpondTask-c", "transpondTask-d", "transpondTask-e");
60 |
61 | throw new RuntimeException("test....");
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/services/AbstractMultiWorkFLowServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.services;
2 |
3 | import com.oldguy.example.modules.common.dao.entities.WorkFlowEntity;
4 | import com.oldguy.example.modules.common.dao.jpas.BaseMapper;
5 | import com.oldguy.example.modules.common.dao.jpas.WorkEntityMapper;
6 | import org.activiti.engine.RuntimeService;
7 | import org.activiti.engine.runtime.ProcessInstance;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 |
10 | import java.lang.reflect.Method;
11 | import java.util.Date;
12 |
13 | /**
14 | * @ClassName: AbstractMultiWorkFLowServiceTest
15 | * @Author: ren
16 | * @Description:
17 | * @CreateTIme: 2019/5/24 0024 上午 8:55
18 | **/
19 | public abstract class AbstractMultiWorkFLowServiceTest {
20 |
21 | @Autowired
22 | private RuntimeService runtimeService;
23 | @Autowired
24 | private WorkEntityMapper entityMapper;
25 |
26 | protected String openProcessInstance(Class clazz) throws Exception {
27 | WorkFlowEntity entity = newInstance(clazz);
28 |
29 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(clazz.getSimpleName(), clazz.getSimpleName() + "." + entity.getId());
30 | return processInstance.getId();
31 | }
32 |
33 |
34 | protected T newInstance(Class clazz) throws Exception {
35 |
36 | WorkFlowEntity entity = (WorkFlowEntity) clazz.newInstance();
37 |
38 | entity.setCreateTime(new Date());
39 | entity.setAuditStatus("1");
40 | entity.setCreatorId("2");
41 |
42 | Method method = getMethod("save");
43 | method.invoke(entityMapper, entity);
44 |
45 | return clazz.cast(entity);
46 |
47 | }
48 |
49 | private Method getMethod(String methodName) {
50 |
51 | Method[] methods = BaseMapper.class.getDeclaredMethods();
52 | for (Method method : methods) {
53 | if (methodName.equals(method.getName())) {
54 | return method;
55 | }
56 | }
57 |
58 | return null;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/dto/form/ProcessAuditStatusForm.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.dto.form;
2 |
3 | import com.oldguy.example.modules.common.dto.AbstractForm;
4 | import lombok.Data;
5 | import org.hibernate.validator.constraints.NotBlank;
6 | import org.hibernate.validator.constraints.NotEmpty;
7 |
8 | import java.util.Collections;
9 | import java.util.List;
10 |
11 | /**
12 | * @author huangrenhao
13 | * @date 2019/1/23
14 | */
15 | public class ProcessAuditStatusForm {
16 |
17 | @NotBlank(message = "processDefinitionId 不能为空!")
18 | private String processDefinitionId;
19 |
20 | @NotBlank(message = "processDefinitionId 不能为空!")
21 | private String processDefinitionKey;
22 |
23 | @NotEmpty(message = "elements 不能为空!")
24 | private List elements = Collections.emptyList();
25 |
26 | public String getProcessDefinitionKey() {
27 | return processDefinitionKey;
28 | }
29 |
30 | public String getProcessDefinitionId() {
31 | return processDefinitionId;
32 | }
33 |
34 | public List getElements() {
35 | return elements;
36 | }
37 |
38 | public void setProcessDefinitionId(String processDefinitionId) {
39 | this.processDefinitionId = processDefinitionId;
40 | }
41 |
42 | public void setProcessDefinitionKey(String processDefinitionKey) {
43 | this.processDefinitionKey = processDefinitionKey;
44 | }
45 |
46 | public void setElements(List elements) {
47 | this.elements = elements;
48 | }
49 |
50 | @Data
51 | public static class AuditItem {
52 |
53 | @NotBlank(message = "code 不能为空!")
54 | private String code;
55 |
56 | @NotBlank(message = "code 不能为空!")
57 | private String message;
58 |
59 | @NotBlank(message = "code 不能为空!")
60 | private String itemId;
61 |
62 | public String getCode() {
63 | return code;
64 | }
65 |
66 | public String getMessage() {
67 | return message;
68 | }
69 |
70 | public String getItemId() {
71 | return itemId;
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/resources/templates/workflow/ProcessDefinition.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Process Definition
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
66 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/configs/WorkFlowConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.configs;
2 |
3 | import org.springframework.util.StringUtils;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/18
11 | */
12 | public class WorkFlowConfiguration {
13 |
14 | /**
15 | * 工作流 执行用户
16 | */
17 | public static final String DEFAULT_USER_TASK_ASSIGNEE = "assignee";
18 |
19 | public static final String DEFAULT_USER_TASK_ASSIGNEE_LIST = "assigneeList";
20 |
21 | /**
22 | * businessKey 分割符
23 | */
24 | public final static String BUSINESS_KEY_SEPARATOR = "\\.";
25 |
26 | /**
27 | * businessKey 尺寸
28 | */
29 | public static final int BUSINESS_KEY_SIZE = 2;
30 |
31 | /***
32 | * 删除流程
33 | */
34 | public static final String DELETE_PROCESS_INSTANCE_FLAG = "delete";
35 |
36 | /**
37 | * 流程信息
38 | */
39 | public static final String PROCESS_DEFINITION_KEY = "PROCESS_DEFINITION_KEY";
40 |
41 | /**
42 | * 流程实例对应的业务ID
43 | */
44 | public static final String PROCESS_INSTANCE_ID = "PROCESS_INSTANCE_ID";
45 |
46 | /**
47 | * 流程标示
48 | */
49 | public static final String WORKFLOW_FLOW_FLAG = "flowFlag";
50 |
51 | public static final String DEFAULT_SUBMIT = "default-submit";
52 |
53 | /**
54 | * 分割符
55 | */
56 | public static final String CANDIDATE_SEPARATOR = "\\,";
57 |
58 | public static final String PROCESS_END_EVENT_FLAG = "endevent";
59 |
60 | public static Map trainFormBusinessKey(String businessKey) {
61 |
62 | if (StringUtils.isEmpty(businessKey)) {
63 | throw new RuntimeException("businessKey 不能为空!");
64 | }
65 |
66 | String[] params = businessKey.split(BUSINESS_KEY_SEPARATOR);
67 | if (params.length < BUSINESS_KEY_SIZE) {
68 | throw new RuntimeException("businessKey 格式不准确!");
69 | }
70 |
71 | Map map = new HashMap<>(16);
72 | map.put(PROCESS_DEFINITION_KEY, params[0]);
73 | map.put(PROCESS_INSTANCE_ID, params[1]);
74 |
75 | return map;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/view/controllers/WorkFlowController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.view.controllers;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | /**
9 | * @author huangrenhao
10 | * @date 2019/1/19
11 | */
12 | @Controller
13 | @RequestMapping("view/WorkFlow")
14 | public class WorkFlowController {
15 |
16 |
17 | @RequestMapping("ProcessAuditStatus")
18 | public String ProcessAuditStatus() {
19 | return "workflow/ProcessAuditStatus";
20 | }
21 |
22 | @RequestMapping("ProcessTaskConfig")
23 | public String ProcessTaskConfig() {
24 | return "workflow/ProcessTaskConfig";
25 | }
26 |
27 | @RequestMapping("ProcessDefinitionConfig/{processDefinitionId}")
28 | public String ProcessDefinitionConfig() {
29 | return "workflow/process-definition-config";
30 | }
31 |
32 | @RequestMapping("ProcessDefinition")
33 | public String ProcessDefinition() {
34 | return "workflow/ProcessDefinition";
35 | }
36 |
37 | @RequestMapping("historyTask")
38 | public String historyTask() {
39 | return "workflow/history-task";
40 | }
41 |
42 | @RequestMapping("current")
43 | public String current() {
44 | return "workflow/current-task";
45 | }
46 |
47 | @RequestMapping("process")
48 | public String process() {
49 | return "workflow/process";
50 | }
51 |
52 | @RequestMapping("UserGroup")
53 | public String UserGroup() {
54 | return "workflow/UserGroup";
55 | }
56 |
57 | @RequestMapping("{processDefinitionKey}/{step}/{taskId}")
58 | public String taskInfo(@PathVariable("processDefinitionKey") String processDefinitionKey,
59 | @PathVariable("step") String step) {
60 | return "workflow/task/Entity2Process-task";
61 | // return "workflow/task/" + processDefinitionKey + "-" + step;
62 | }
63 |
64 | @RequestMapping("Entity2Process/{taskId}")
65 | public String Entity2Process() {
66 |
67 | return "workflow/task/Entity2Process-task";
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/test/java/com/oldguy/example/services/DefaultInstanceConvertToMultiInstanceTest.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.services;
2 |
3 | import com.oldguy.example.modules.test.dao.entities.Entity4Process;
4 | import com.oldguy.example.modules.test.dao.jpas.Entity4ProcessMapper;
5 | import com.oldguy.example.modules.workflow.service.activiti.DefaultInstanceConvertToMultiInstance;
6 | import org.activiti.engine.RuntimeService;
7 | import org.activiti.engine.runtime.ProcessInstance;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.boot.test.context.SpringBootTest;
12 | import org.springframework.test.context.junit4.SpringRunner;
13 |
14 | import java.util.*;
15 |
16 | /**
17 | * @ClassName: DefaultInstanceConvertToMultiInstanceTest
18 | * @Author: ren
19 | * @Description:
20 | * @CreateTIme: 2019/5/24 0024 上午 8:47
21 | **/
22 | @RunWith(SpringRunner.class)
23 | @SpringBootTest
24 | public class DefaultInstanceConvertToMultiInstanceTest extends AbstractMultiWorkFLowServiceTest {
25 |
26 | @Autowired
27 | private DefaultInstanceConvertToMultiInstance service;
28 |
29 |
30 | /**
31 | * 测试开启新流程,到节点1 不进入节点2 ,以便于测试
32 | */
33 | @Test
34 | public void testOpenProcessInstance() throws Exception {
35 |
36 | System.out.println(openProcessInstance(Entity4Process.class));
37 | }
38 |
39 | /**
40 | * 测试完成 节点1 任务到节点2 ,进行 普通任务向 会签任务进行转换
41 | */
42 | @Test
43 | public void testCovertToMultiInstance() {
44 |
45 | List assigneeList = new ArrayList<>();
46 | assigneeList.add("1");
47 | assigneeList.add("2");
48 | assigneeList.add("3");
49 | Map map = new HashMap<>();
50 | map.put("assigneeList", assigneeList);
51 |
52 | service.covertToMultiInstance("7505", true, map);
53 | }
54 |
55 | /**
56 | * 完成任务 会签任务
57 | */
58 | @Test
59 | public void testCompleteTask() {
60 |
61 | service.completeTask("15002", null);
62 | // service.completeTask("2520", null);
63 | // service.completeTask("2522", null);
64 | // throw new RuntimeException("test....");
65 | }
66 |
67 |
68 |
69 |
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/table/bootstrap-table-filter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author zhixin wen
3 | * extensions: https://github.com/lukaskral/bootstrap-table-filter
4 | */
5 |
6 | !function($) {
7 |
8 | 'use strict';
9 |
10 | $.extend($.fn.bootstrapTable.defaults, {
11 | showFilter: false
12 | });
13 |
14 | var BootstrapTable = $.fn.bootstrapTable.Constructor,
15 | _init = BootstrapTable.prototype.init,
16 | _initSearch = BootstrapTable.prototype.initSearch;
17 |
18 | BootstrapTable.prototype.init = function () {
19 | _init.apply(this, Array.prototype.slice.apply(arguments));
20 |
21 | var that = this;
22 | this.$el.on('load-success.bs.table', function () {
23 | if (that.options.showFilter) {
24 | $(that.options.toolbar).bootstrapTableFilter({
25 | connectTo: that.$el
26 | });
27 | }
28 | });
29 | };
30 |
31 | BootstrapTable.prototype.initSearch = function () {
32 | _initSearch.apply(this, Array.prototype.slice.apply(arguments));
33 |
34 | if (this.options.sidePagination !== 'server') {
35 | if (typeof this.searchCallback === 'function') {
36 | this.data = $.grep(this.options.data, this.searchCallback);
37 | }
38 | }
39 | };
40 |
41 | BootstrapTable.prototype.getData = function () {
42 | return (this.searchText || this.searchCallback) ? this.data : this.options.data;
43 | };
44 |
45 | BootstrapTable.prototype.getColumns = function () {
46 | return this.columns;
47 | };
48 |
49 | BootstrapTable.prototype.registerSearchCallback = function (callback) {
50 | this.searchCallback = callback;
51 | };
52 |
53 | BootstrapTable.prototype.updateSearch = function () {
54 | this.options.pageNumber = 1;
55 | this.initSearch();
56 | this.updatePagination();
57 | };
58 |
59 | BootstrapTable.prototype.getServerUrl = function () {
60 | return (this.options.sidePagination === 'server') ? this.options.url : false;
61 | };
62 |
63 | $.fn.bootstrapTable.methods.push('getColumns',
64 | 'registerSearchCallback', 'updateSearch',
65 | 'getServerUrl');
66 |
67 | }(jQuery);
--------------------------------------------------------------------------------
/src/main/resources/static/plugins/fileinput/bootstrap-fileinput.zh-CN.js:
--------------------------------------------------------------------------------
1 | !function(e){"use strict";e.fn.fileinputLocales.zh={fileSingle:"文件",filePlural:"个文件",browseLabel:"选择 …",removeLabel:"移除",removeTitle:"清除选中文件",cancelLabel:"取消",cancelTitle:"取消进行中的上传",uploadLabel:"上传",uploadTitle:"上传选中文件",msgNo:"没有",msgNoFilesSelected:"",msgCancelled:"取消",msgZoomModalHeading:"详细预览",msgFileRequired:"必须选择一个文件上传.",msgSizeTooSmall:'文件 "{name}" ({size} KB) 必须大于限定大小 {minSize} KB.',msgSizeTooLarge:'文件 "{name}" ({size} KB) 超过了允许大小 {maxSize} KB.',msgFilesTooLess:"你必须选择最少 {n} {files} 来上传. ",msgFilesTooMany:"选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.",msgFileNotFound:'文件 "{name}" 未找到!',msgFileSecured:'安全限制,为了防止读取文件 "{name}".',msgFileNotReadable:'文件 "{name}" 不可读.',msgFilePreviewAborted:'取消 "{name}" 的预览.',msgFilePreviewError:'读取 "{name}" 时出现了一个错误.',msgInvalidFileName:'文件名 "{name}" 包含非法字符.',msgInvalidFileType:'不正确的类型 "{name}". 只支持 "{types}" 类型的文件.',msgInvalidFileExtension:'不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.',msgFileTypes:{image:"image",html:"HTML",text:"text",video:"video",audio:"audio",flash:"flash",pdf:"PDF",object:"object"},msgUploadAborted:"该文件上传被中止",msgUploadThreshold:"处理中...",msgUploadBegin:"正在初始化...",msgUploadEnd:"完成",msgUploadEmpty:"无效的文件上传.",msgValidationError:"验证错误",msgLoading:"加载第 {index} 文件 共 {files} …",msgProgress:"加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.",msgSelected:"{n} {files} 选中",msgFoldersNotAllowed:"只支持拖拽文件! 跳过 {n} 拖拽的文件夹.",msgImageWidthSmall:'宽度的图像文件的"{name}"的必须是至少{size}像素.',msgImageHeightSmall:'图像文件的"{name}"的高度必须至少为{size}像素.',msgImageWidthLarge:'宽度的图像文件"{name}"不能超过{size}像素.',msgImageHeightLarge:'图像文件"{name}"的高度不能超过{size}像素.',msgImageResizeError:"无法获取的图像尺寸调整。",msgImageResizeException:"错误而调整图像大小。{errors}",msgAjaxError:"{operation} 发生错误. 请重试!",msgAjaxProgressError:"{operation} 失败",ajaxOperations:{deleteThumb:"删除文件",uploadThumb:"上传文件",uploadBatch:"批量上传",uploadExtra:"表单数据上传"},dropZoneTitle:"拖拽文件到这里 …
支持多文件同时上传",dropZoneClickTitle:"
(或点击{files}按钮选择文件)",fileActionSettings:{removeTitle:"删除文件",uploadTitle:"上传文件",zoomTitle:"查看详情",dragTitle:"移动 / 重置",indicatorNewTitle:"没有上传",indicatorSuccessTitle:"上传",indicatorErrorTitle:"上传错误",indicatorLoadingTitle:"上传 ..."},previewZoomButtonTitles:{prev:"预览上一个文件",next:"预览下一个文件",toggleheader:"缩放",fullscreen:"全屏",borderless:"无边界模式",close:"关闭当前预览"}}}(window.jQuery);
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/workflow/controllers/TaskController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.workflow.controllers;
2 |
3 | import com.oldguy.example.modules.common.exceptions.FormValidException;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.sys.services.UserEntityService;
6 | import com.oldguy.example.modules.workflow.service.CommonWorkEntityService;
7 | import com.oldguy.example.modules.workflow.service.UserTaskService;
8 | import com.oldguy.example.modules.workflow.utils.HttpUtils;
9 | import org.apache.commons.io.IOUtils;
10 | import org.apache.commons.lang3.StringUtils;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.web.bind.annotation.*;
13 |
14 | import javax.servlet.http.HttpServletResponse;
15 | import java.io.IOException;
16 | import java.io.InputStream;
17 | import java.io.OutputStream;
18 |
19 | /**
20 | * @author huangrenhao
21 | * @date 2019/1/21
22 | */
23 | @RestController
24 | @RequestMapping("Task")
25 | public class TaskController {
26 |
27 | @Autowired
28 | private UserTaskService userTaskService;
29 | @Autowired
30 | private CommonWorkEntityService commonWorkEntityService;
31 |
32 | @PostMapping("callBack/{taskId}")
33 | public Object callBack(@PathVariable("taskId") String taskId){
34 |
35 | userTaskService.callBack(taskId);
36 |
37 | return HttpJsonUtils.OK;
38 | }
39 |
40 | @GetMapping("ProcessInstanceImage/{taskId}")
41 | public void currentProcessInstanceImage(@PathVariable("taskId") String taskId, HttpServletResponse response) throws IOException {
42 | InputStream inputStream = userTaskService.currentProcessInstanceImage(taskId);
43 | OutputStream outputStream = response.getOutputStream();
44 | HttpUtils.copyImageStream(inputStream, outputStream);
45 | }
46 |
47 | @GetMapping("current/{taskId}")
48 | public Object taskInfo(@PathVariable("taskId") String taskId) {
49 | return commonWorkEntityService.getWorkEntityInfo(taskId);
50 | }
51 |
52 | /**
53 | * 获取当前用户列表
54 | *
55 | * @return
56 | */
57 | @GetMapping("current")
58 | public Object currentUserTask() {
59 |
60 | return userTaskService.currentTaskList(UserEntityService.getCurrentUserEntity().getUserId());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/utils/HttpJsonUtils.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.utils;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.springframework.http.HttpStatus;
5 |
6 | /**
7 | * @author huangrenhao
8 | * @date 2019/1/19
9 | */
10 | public class HttpJsonUtils {
11 |
12 | public static final HttpJsonResult OK = build(HttpStatus.OK, HttpStatus.OK.getReasonPhrase());
13 | public static final HttpJsonResult ERROR = build(HttpStatus.INTERNAL_SERVER_ERROR, "系统异常,请联系管理员!");
14 |
15 | public static HttpJsonResult buildValid(String message) {
16 | return build(HttpStatus.BAD_REQUEST, message);
17 | }
18 |
19 | public static HttpJsonResult buildError(String message) {
20 | return build(HttpStatus.INTERNAL_SERVER_ERROR, message);
21 | }
22 |
23 | public static HttpJsonResult buildSuccess(String message) {
24 | return build(HttpStatus.OK, message);
25 | }
26 |
27 | public static HttpJsonResult build(HttpStatus httpStatus, String message) {
28 | return build(httpStatus, message, null);
29 | }
30 |
31 | public static HttpJsonResult build(HttpStatus httpStatus, String message, Object object) {
32 | return new HttpJsonResult(httpStatus.value(), message, object);
33 | }
34 |
35 | private static class HttpJsonResult {
36 |
37 | private Integer code;
38 |
39 | @JsonInclude(JsonInclude.Include.NON_NULL)
40 | private String message;
41 |
42 | @JsonInclude(JsonInclude.Include.NON_NULL)
43 | private Object object;
44 |
45 | public HttpJsonResult(Integer code, String message, Object object) {
46 | this.code = code;
47 | this.message = message;
48 | this.object = object;
49 | }
50 |
51 | public Object getObject() {
52 | return object;
53 | }
54 |
55 | public void setObject(Object object) {
56 | this.object = object;
57 | }
58 |
59 | public Integer getCode() {
60 | return code;
61 | }
62 |
63 | public void setCode(Integer code) {
64 | this.code = code;
65 | }
66 |
67 | public String getMessage() {
68 | return message;
69 | }
70 |
71 | public void setMessage(String message) {
72 | this.message = message;
73 | }
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/controllers/Entity1ProcessController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.controllers;
2 |
3 | import com.oldguy.example.modules.common.utils.FormValidateUtils;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.test.dao.entities.Entity1Process;
6 | import com.oldguy.example.modules.test.dao.jpas.Entity1ProcessMapper;
7 | import com.oldguy.example.modules.test.service.Entity1ProcessService;
8 | import com.oldguy.example.modules.workflow.dto.TaskEntityInfo;
9 | import com.oldguy.example.modules.workflow.dto.TaskForm;
10 | import com.oldguy.example.modules.workflow.service.UserTaskService;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.web.bind.annotation.GetMapping;
13 | import org.springframework.web.bind.annotation.PostMapping;
14 | import org.springframework.web.bind.annotation.RequestMapping;
15 | import org.springframework.web.bind.annotation.RestController;
16 |
17 | import java.util.List;
18 |
19 | /**
20 | * @author huangrenhao
21 | * @date 2019/1/18
22 | */
23 | @RestController
24 | @RequestMapping("Entity1Process")
25 | public class Entity1ProcessController {
26 |
27 | @Autowired
28 | private Entity1ProcessService entity1ProcessService;
29 | @Autowired
30 | private Entity1ProcessMapper entity1ProcessMapper;
31 | @Autowired
32 | private UserTaskService userTaskService;
33 |
34 |
35 | @GetMapping("all")
36 | public List getList(Integer status) {
37 | return entity1ProcessMapper.findAllByStatus(status);
38 | }
39 |
40 | @PostMapping("step2/complete")
41 | public Object completeStep2Task(TaskForm form) {
42 | FormValidateUtils.validate(form);
43 | // 完成任务
44 | TaskEntityInfo info = entity1ProcessService.completeStep2Task(form);
45 | // 更新审核状态
46 | userTaskService.updateAuditStatus(info.getProcessInstanceId());
47 |
48 | return HttpJsonUtils.OK;
49 | }
50 |
51 |
52 | /**
53 | * 开启流程实例
54 | *
55 | * @return
56 | */
57 | @PostMapping("openProcessInstance")
58 | public Object openProcessInstance() {
59 | String processInstanceId = entity1ProcessService.openProcessInstance();
60 | // 更新审核状态
61 | userTaskService.updateAuditStatus(processInstanceId);
62 | return HttpJsonUtils.OK;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/dao/entities/WorkFlowEntity.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.dao.entities;
2 |
3 |
4 | import java.util.Date;
5 |
6 | /**
7 | * @author huangrenhao
8 | * @date 2018/11/27
9 | */
10 | public class WorkFlowEntity extends BaseEntity {
11 |
12 | /**
13 | * 审批流程状态
14 | */
15 | private String auditStatus;
16 |
17 | /**
18 | * 创建人ID
19 | */
20 | private String creatorId;
21 |
22 | /**
23 | * 创建人姓名
24 | */
25 | private String creatorName;
26 |
27 | /**
28 | * 流程确认人ID
29 | */
30 | private String confirmUserId;
31 |
32 | /**
33 | * 流程确认人姓名
34 | */
35 | private String confirmUsername;
36 |
37 | /**
38 | * 流程确认时间
39 | */
40 | private Date confirmDate;
41 |
42 | /**
43 | * 备注
44 | */
45 | private String remark;
46 |
47 | public String getRemark() {
48 | return remark;
49 | }
50 |
51 | public void setRemark(String remark) {
52 | this.remark = remark;
53 | }
54 |
55 | public String getAuditStatus() {
56 | return auditStatus;
57 | }
58 |
59 | public void setAuditStatus(String auditStatus) {
60 | this.auditStatus = auditStatus;
61 | }
62 |
63 | public String getCreatorId() {
64 | return creatorId;
65 | }
66 |
67 | public void setCreatorId(String creatorId) {
68 | this.creatorId = creatorId;
69 | }
70 |
71 | public String getCreatorName() {
72 | return creatorName;
73 | }
74 |
75 | public void setCreatorName(String creatorName) {
76 | this.creatorName = creatorName;
77 | }
78 |
79 | public String getConfirmUserId() {
80 | return confirmUserId;
81 | }
82 |
83 | public void setConfirmUserId(String confirmUserId) {
84 | this.confirmUserId = confirmUserId;
85 | }
86 |
87 | public String getConfirmUsername() {
88 | return confirmUsername;
89 | }
90 |
91 | public void setConfirmUsername(String confirmUsername) {
92 | this.confirmUsername = confirmUsername;
93 | }
94 |
95 | public Date getConfirmDate() {
96 | return confirmDate;
97 | }
98 |
99 | public void setConfirmDate(Date confirmDate) {
100 | this.confirmDate = confirmDate;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/main/resources/templates/workflow/ProcessTaskConfig.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ProcessTaskConfig
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
74 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/test/controllers/Entity2ProcessController.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.test.controllers;
2 |
3 | import com.oldguy.example.modules.common.utils.FormValidateUtils;
4 | import com.oldguy.example.modules.common.utils.HttpJsonUtils;
5 | import com.oldguy.example.modules.test.dao.entities.Entity1Process;
6 | import com.oldguy.example.modules.test.dao.entities.Entity2Process;
7 | import com.oldguy.example.modules.test.dao.jpas.Entity2ProcessMapper;
8 | import com.oldguy.example.modules.test.service.Entity2ProcessService;
9 | import com.oldguy.example.modules.workflow.dto.TaskEntityInfo;
10 | import com.oldguy.example.modules.workflow.dto.TaskForm;
11 | import com.oldguy.example.modules.workflow.service.UserTaskService;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.web.bind.annotation.GetMapping;
14 | import org.springframework.web.bind.annotation.PostMapping;
15 | import org.springframework.web.bind.annotation.RequestMapping;
16 | import org.springframework.web.bind.annotation.RestController;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * @author huangrenhao
22 | * @date 2019/1/23
23 | */
24 | @RestController
25 | @RequestMapping("Entity2Process")
26 | public class Entity2ProcessController {
27 |
28 | @Autowired
29 | private UserTaskService userTaskService;
30 | @Autowired
31 | private Entity2ProcessMapper entity2ProcessMapper;
32 | @Autowired
33 | private Entity2ProcessService entity2ProcessService;
34 |
35 | @PostMapping("completeTask")
36 | public Object completeTask(TaskForm form) {
37 | FormValidateUtils.validate(form);
38 | // 完成任务
39 | TaskEntityInfo info = entity2ProcessService.completeTask(form);
40 | // 更新审核状态
41 | userTaskService.updateAuditStatus(info.getProcessInstanceId());
42 |
43 | return HttpJsonUtils.OK;
44 | }
45 |
46 |
47 | /**
48 | * 开启流程实例
49 | *
50 | * @return
51 | */
52 | @PostMapping("openProcessInstance")
53 | public Object openProcessInstance() {
54 | String processInstanceId = entity2ProcessService.openProcessInstance();
55 | // 更新审核状态
56 | userTaskService.updateAuditStatus(processInstanceId);
57 | return HttpJsonUtils.OK;
58 | }
59 |
60 | @GetMapping("all")
61 | public List getList(Integer status) {
62 | return entity2ProcessMapper.findAllByStatus(status);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/com/oldguy/example/modules/common/configs/DbRegisterConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.oldguy.example.modules.common.configs;
2 |
3 |
4 |
5 | import com.oldguy.example.modules.common.services.DbRegister;
6 | import com.oldguy.example.modules.common.utils.Log4jUtils;
7 | import org.springframework.jdbc.core.JdbcTemplate;
8 | import org.springframework.util.StringUtils;
9 |
10 |
11 | import java.util.*;
12 |
13 | /**
14 | * @Description:
15 | * @Author: ren
16 | * @CreateTime: 2018-10-2018/10/15 0015 17:45
17 | */
18 | public class DbRegisterConfiguration {
19 |
20 | public void initDB(String typeAliasesPackage,JdbcTemplate jdbcTemplate) {
21 |
22 | DbRegister dbRegister = new DbRegister();
23 | Map tableMap = new HashMap<>(16);
24 | List typeAliasesPackages = splitPackagesPath(typeAliasesPackage);
25 |
26 | for (String path : typeAliasesPackages) {
27 | tableMap.putAll(dbRegister.registerClassToDB(path));
28 | }
29 |
30 | if (!tableMap.keySet().isEmpty()) {
31 |
32 | List