springboot2.5.2與 flowable6.6.0整合流程引擎應(yīng)用分析
1.pom
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<flowable.version>6.6.0</flowable.version>
</properties>
<!--flowable工作流依賴(lài)-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flowable/flowable-json-converter -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- app 依賴(lài) 包含 rest,logic,conf -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-rest</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-logic</artifactId>
<version>${flowable.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-conf</artifactId>
<version>${flowable.version}</version>
</dependency>
2.FlowableConfig配置類(lèi)
package org.fh.config;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
/**
* 說(shuō)明:Flowable配置
* 作者:FH Admin
* from:fhadmin.cn
*/
@Controller
@Configuration
public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
@Override
public void configure(SpringProcessEngineConfiguration engineConfiguration) {
engineConfiguration.setActivityFontName("宋體");
engineConfiguration.setLabelFontName("宋體");
engineConfiguration.setAnnotationFontName("宋體");
}
}
3.重寫(xiě) SecurityUtils 重構(gòu)流程編輯器獲取用戶(hù)信息
package org.flowable.ui.common.security;
import org.fh.util.Jurisdiction;
import org.flowable.common.engine.api.FlowableIllegalStateException;
import org.flowable.idm.api.User;
import org.flowable.ui.common.model.RemoteUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.ArrayList;
import java.util.List;
/**
* 說(shuō)明:重構(gòu)流程編輯器獲取用戶(hù)信息
* 作者:FH Admin
* from:fhadmin.cn
*/
public class SecurityUtils {
private static User assumeUser;
private static SecurityScopeProvider securityScopeProvider = new FlowableSecurityScopeProvider();
private SecurityUtils() {
}
/**
* Get the login of the current user.
*/
public static String getCurrentUserId() {
User user = getCurrentUserObject();
if (user != null) {
return user.getId();
}
return null;
}
/**
* @return the {@link User} object associated with the current logged in user.
*/
public static User getCurrentUserObject() {
if (assumeUser != null) {
return assumeUser;
}
RemoteUser user = new RemoteUser();
user.setId(Jurisdiction.getUsername());
user.setDisplayName(Jurisdiction.getName());
user.setFirstName(Jurisdiction.getName());
user.setLastName(Jurisdiction.getName());
user.setEmail("admin@flowable.com");
user.setPassword("123456");
List<String> pris = new ArrayList<>();
pris.add(DefaultPrivileges.ACCESS_MODELER);
pris.add(DefaultPrivileges.ACCESS_IDM);
pris.add(DefaultPrivileges.ACCESS_ADMIN);
pris.add(DefaultPrivileges.ACCESS_TASK);
pris.add(DefaultPrivileges.ACCESS_REST_API);
user.setPrivileges(pris);
return user;
}
public static void setSecurityScopeProvider(SecurityScopeProvider securityScopeProvider) {
SecurityUtils.securityScopeProvider = securityScopeProvider;
}
public static SecurityScope getCurrentSecurityScope() {
SecurityContext securityContext = SecurityContextHolder.getContext();
if (securityContext != null && securityContext.getAuthentication() != null) {
return getSecurityScope(securityContext.getAuthentication());
}
return null;
}
public static SecurityScope getSecurityScope(Authentication authentication) {
return securityScopeProvider.getSecurityScope(authentication);
}
public static SecurityScope getAuthenticatedSecurityScope() {
SecurityScope currentSecurityScope = getCurrentSecurityScope();
if (currentSecurityScope != null) {
return currentSecurityScope;
}
throw new FlowableIllegalStateException("User is not authenticated");
}
public static void assumeUser(User user) {
assumeUser = user;
}
public static void clearAssumeUser() {
assumeUser = null;
}
}
工作流模塊----------------www.fhadmin.cn---------------
1.模型管理:web在線流程設(shè)計(jì)器、導(dǎo)入導(dǎo)出xml、復(fù)制流程、部署流程
2.流程管理:導(dǎo)入導(dǎo)出流程資源文件、查看流程圖、根據(jù)流程實(shí)例反射出流程模型、激活掛起
3.運(yùn)行中流程:查看流程信息、當(dāng)前任務(wù)節(jié)點(diǎn)、當(dāng)前流程圖、作廢暫停流程、指派待辦人、自由跳轉(zhuǎn)
4.歷史的流程:查看流程信息、流程用時(shí)、流程狀態(tài)、查看任務(wù)發(fā)起人信息
5.待辦任務(wù):查看本人個(gè)人任務(wù)以及本角色下的任務(wù)、辦理、駁回、作廢、指派一下代理人
6.已辦任務(wù):查看自己辦理過(guò)的任務(wù)以及流程信息、流程圖、流程狀態(tài)(作廢 駁回 正常完成)
辦理任務(wù)時(shí)候可以選擇用戶(hù)進(jìn)行抄送,就是給被抄送人發(fā)送站內(nèi)信通知當(dāng)前審批意見(jiàn)以及備注信息
注:當(dāng)辦理完當(dāng)前任務(wù)時(shí),下一任務(wù)待辦人會(huì)即時(shí)通訊收到新任務(wù)消息提醒,當(dāng)作廢和完結(jié)任務(wù)時(shí),任務(wù)發(fā)起人會(huì)收到站內(nèi)信消息通知
到此這篇關(guān)于springboot2.5.2與 flowable6.6.0整合流程引擎應(yīng)用分析的文章就介紹到這了,更多相關(guān)springboot整合 flowable內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Spring中@Transactional(rollbackFor=Exception.class)屬性用法介紹
這篇文章介紹了Spring中@Transactional(rollbackFor=Exception.class)屬性的用法,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-12-12
Spring Boot2中如何優(yōu)雅地個(gè)性化定制Jackson實(shí)現(xiàn)示例
這篇文章主要為大家介紹了Spring Boot2中如何優(yōu)雅地個(gè)性化定制Jackson實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05
基于java SSM springboot實(shí)現(xiàn)抗疫物質(zhì)信息管理系統(tǒng)
這篇文章主要介紹了基于JAVA SSM springboot實(shí)現(xiàn)的抗疫物質(zhì)信息管理系統(tǒng),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-08-08
使用MultipartFile來(lái)上傳單個(gè)及多個(gè)文件代碼示例
這篇文章主要介紹了使用MultipartFile來(lái)上傳單個(gè)及多個(gè)文件代碼示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-01-01
Java Swing JLabel標(biāo)簽的使用方法
這篇文章主要介紹了Java Swing JLabel標(biāo)簽的使用方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-12-12

