springboot2.5.2与 flowable6.6.0整合流程引擎应用分析

网友投稿 1123 2022-12-24

springboot2.5.2与 flowable6.6.0整合流程引擎应用分析

springboot2.5.2与 flowable6.6.0整合流程引擎应用分析

1.pom

org.springframework.boot

spring-boot-starter-parent

2.5.2

UTF-8

UTF-8

1.8

6.6.0

org.flowable

flowable-spring-boot-starter

${flowable.version}

org.flowable

flowable-json-converter

${flowable.version}

org.flowable

flowable-ui-modeler-rest

${flowable.version}

org.flowable

flowable-ui-modeler-logic

${flowable.version}

org.apache.logging.log4j

log4j-slf4j-impl

org.flowable

flowable-ui-modeler-conf

${flowable.version}

2.FlowableConfig配置类

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;

/**

* 说明:Flowable配置

* from:fhadmin-

*/

@Controller

@Configuration

public class FlowableConfig implements EngineConfigurationConfigurer {

@Override

public void configure(SpringProcessEngineConfiguration engineConfiguration) {

engineConfiguration.setActivityFontName("宋体");

engineConfiguration.setLabelFontName("宋体");

engineConfiguration.setAnnotationFontName("宋体");

}

tXciAU

}

3.重写 SecurityUtils 重构流程编辑器获取用户信息

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;

/**

* 说明:重构流程编辑器获取用户信息

* from:fhadmin-

*/

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 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 = getCurrentSecurityScohttp://pe();

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;

}

}

工作流模块----------------fhadmin----------------

1.模型管理:web在线流程设计器、导入导出xml、复制流程、部署流程

2.流程管理:导入导出流程资源文件、查看流程图、根据流程实例反射出流程模型、激活挂起

3.运行中流程:查看流程信息、当前任务节点、当前流程图、作废暂停流程、指派待办人、自由跳转

4.历史的流程:查看流程信息、流程用时、流程状态、查看任务发起人信息

5.待办任务:查看本人个人任务以及本角色下的任务、办理、驳回、作废、指派一下代理人

6.已办任务:查看自己办理过的任务以及流程信息、流程图、流程状态(作废 驳回 正常完成)

办理任务时候可以选择用户进行抄送,就是给被抄送人发送站内信通知当前审批意见以及备注信息

注:当办理完当前任务时,下一任务待办人会即时通讯收到新任务消息提醒,当作废和完结任务时,任务发起人会收到站内信消息通知

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:小程序app商城(小程序商城购买)
下一篇:智能车载终端系统 英文(智能终端的英文)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~