mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-29 22:56:40 +08:00
【ADD】集成原生Flowable-ui
This commit is contained in:
parent
25295fee34
commit
5125dc5af2
@ -14,6 +14,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-monitor-admin</module>
|
<module>ruoyi-monitor-admin</module>
|
||||||
<module>ruoyi-xxl-job-admin</module>
|
<module>ruoyi-xxl-job-admin</module>
|
||||||
|
<module>ruoyi-flow-ui</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
33
ruoyi-extend/ruoyi-flow-ui/.gitignore
vendored
Normal file
33
ruoyi-extend/ruoyi-flow-ui/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
16
ruoyi-extend/ruoyi-flow-ui/Dockerfile
Normal file
16
ruoyi-extend/ruoyi-flow-ui/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||||
|
|
||||||
|
MAINTAINER zmx
|
||||||
|
|
||||||
|
RUN mkdir -p /ruoyi/flow/ui/logs
|
||||||
|
|
||||||
|
WORKDIR /ruoyi/flow/ui
|
||||||
|
|
||||||
|
ENV TZ=PRC
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
EXPOSE 9205
|
||||||
|
|
||||||
|
ADD ./target/ruoyi-flow-ui.jar ./app.jar
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
10
ruoyi-extend/ruoyi-flow-ui/HELP.md
Normal file
10
ruoyi-extend/ruoyi-flow-ui/HELP.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
### Reference Documentation
|
||||||
|
|
||||||
|
For further reference, please consider the following sections:
|
||||||
|
|
||||||
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||||
|
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.1.0/maven-plugin/reference/html/)
|
||||||
|
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.1.0/maven-plugin/reference/html/#build-image)
|
||||||
|
|
137
ruoyi-extend/ruoyi-flow-ui/pom.xml
Normal file
137
ruoyi-extend/ruoyi-flow-ui/pom.xml
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi-extend</artifactId>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>ruoyi-flow-ui</artifactId>
|
||||||
|
<name>ruoyi-flow-ui</name>
|
||||||
|
<description>ruoyi-flow-ui</description>
|
||||||
|
<properties>
|
||||||
|
<spring-boot.version>2.7.12</spring-boot.version>
|
||||||
|
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
|
||||||
|
<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
|
||||||
|
<flowable.version>6.8.0</flowable.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mysql -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-starter</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-starter-ui-idm</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-starter-ui-modeler</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
<version>3.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-starter-ui-task</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-starter-ui-admin</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- starter-actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.dromara.flow.ui;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flowable-ui启动类
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class FlowUiApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(com.dromara.flow.ui.FlowUiApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.dromara.flow.ui.config;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dromara.flow.ui.config.idm.CustomGroupDataManager;
|
||||||
|
import com.dromara.flow.ui.config.idm.CustomPasswordEncoder;
|
||||||
|
import com.dromara.flow.ui.config.idm.CustomUserDataManager;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.GroupEntityManager;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.GroupEntityManagerImpl;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.UserEntityManager;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.UserEntityManagerImpl;
|
||||||
|
import org.flowable.idm.spring.SpringIdmEngineConfiguration;
|
||||||
|
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
||||||
|
import org.flowable.spring.boot.idm.FlowableIdmProperties;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 土豆仙
|
||||||
|
* @Date: 2021/9/28 19:30
|
||||||
|
* @Description: 一旦使用视图效率不高,在这注入覆写类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class FlowableIdmConfig implements EngineConfigurationConfigurer<SpringIdmEngineConfiguration> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomUserDataManager customUserDataManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomGroupDataManager customGroupDataManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(SpringIdmEngineConfiguration configuration) {
|
||||||
|
|
||||||
|
//密码加密器和自建用户体系保持一致
|
||||||
|
CustomPasswordEncoder bc = new CustomPasswordEncoder();
|
||||||
|
configuration.setPasswordEncoder(bc);
|
||||||
|
|
||||||
|
//用户
|
||||||
|
configuration.setUserDataManager(customUserDataManager);
|
||||||
|
UserEntityManager userEntityManager = configuration.getUserEntityManager();
|
||||||
|
if (userEntityManager != null) {
|
||||||
|
UserEntityManagerImpl userEntityManagerImpl = new UserEntityManagerImpl(configuration, customUserDataManager);
|
||||||
|
configuration.setUserEntityManager(userEntityManagerImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
//用户-组关系
|
||||||
|
/*configuration.setMembershipDataManager(customMembershipDataManager);
|
||||||
|
configuration.setMembershipEntityManager(customMembershipEntityManager);*/
|
||||||
|
|
||||||
|
|
||||||
|
//组
|
||||||
|
configuration.setGroupDataManager(customGroupDataManager);
|
||||||
|
GroupEntityManager groupEntityManager = configuration.getGroupEntityManager();
|
||||||
|
if (groupEntityManager == null) {
|
||||||
|
GroupEntityManagerImpl groupEntityManagerImpl = new GroupEntityManagerImpl(configuration, customGroupDataManager);
|
||||||
|
configuration.setGroupEntityManager(groupEntityManagerImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder(FlowableIdmProperties idmProperties) {
|
||||||
|
|
||||||
|
PasswordEncoder encoder = new CustomPasswordEncoder();
|
||||||
|
|
||||||
|
return encoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Bean
|
||||||
|
public CustomGroupEntityManager customGroupEntityManager(IdmEngineConfiguration configuration) {
|
||||||
|
return new CustomGroupEntityManager(configuration, configuration.getGroupDataManager());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/* @Bean
|
||||||
|
public CustomUserEntityManager customUserEntityManager(IdmEngineConfiguration configuration) {
|
||||||
|
return new CustomUserEntityManager(configuration, new CustomUserDataManager(configuration));
|
||||||
|
}*/
|
||||||
|
}
|
@ -0,0 +1,165 @@
|
|||||||
|
package com.dromara.flow.ui.config.idm;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dromara.flow.ui.domain.bo.GroupCodeBo;
|
||||||
|
import com.dromara.flow.ui.domain.bo.GroupNameBo;
|
||||||
|
import com.dromara.flow.ui.domain.bo.GroupQueryBo;
|
||||||
|
import com.dromara.flow.ui.mapper.CustomMybatisMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.flowable.engine.ManagementService;
|
||||||
|
import org.flowable.engine.impl.cmd.AbstractCustomSqlExecution;
|
||||||
|
import org.flowable.idm.api.Group;
|
||||||
|
import org.flowable.idm.engine.IdmEngineConfiguration;
|
||||||
|
import org.flowable.idm.engine.impl.GroupQueryImpl;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.GroupEntity;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.GroupEntityImpl;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.data.AbstractIdmDataManager;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.data.GroupDataManager;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 土豆仙
|
||||||
|
* @Date: 2021/11/12 10:05
|
||||||
|
* @Description: 覆写组查询
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CustomGroupDataManager extends AbstractIdmDataManager<GroupEntity> implements GroupDataManager {
|
||||||
|
|
||||||
|
|
||||||
|
public CustomGroupDataManager(IdmEngineConfiguration idmEngineConfiguration) {
|
||||||
|
super(idmEngineConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private ManagementService managementService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GroupEntity> getManagedEntityClass() {
|
||||||
|
return GroupEntityImpl.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GroupEntity create() {
|
||||||
|
return new GroupEntityImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<Group> findGroupByQueryCriteria(GroupQueryImpl query) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("已重写自定义组查询:findGroupByQueryCriteria");
|
||||||
|
}
|
||||||
|
boolean isReturnList = true;
|
||||||
|
GroupQueryBo groupQueryBo = transformQueryParamToGroupDTO(query);
|
||||||
|
if (StringUtils.isNotBlank(query.getId())) {
|
||||||
|
groupQueryBo.setReturnList(false);
|
||||||
|
isReturnList = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Group> groups = managementService.executeCustomSql(new AbstractCustomSqlExecution<CustomMybatisMapper, List<Group>>(CustomMybatisMapper.class) {
|
||||||
|
@Override
|
||||||
|
public List<Group> execute(CustomMybatisMapper customMybatisMapper) {
|
||||||
|
return customMybatisMapper.findGroupList(groupQueryBo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return groups;
|
||||||
|
//return getDbSqlSession().selectList("selectGroupByQueryCriteria", query, getManagedEntityClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupQueryBo transformQueryParamToGroupDTO(GroupQueryImpl query) {
|
||||||
|
GroupQueryBo groupQueryBo = new GroupQueryBo();
|
||||||
|
//约定 groupId 解析为 部门code.角色code
|
||||||
|
List<String> groupIds = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(query.getId())) {
|
||||||
|
groupIds.add(query.getId());
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(query.getIds())) {
|
||||||
|
groupIds.addAll(query.getIds());
|
||||||
|
}
|
||||||
|
List<GroupCodeBo> groupBoList = groupIds.stream()
|
||||||
|
.map(GroupCodeBo::new)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
groupQueryBo.setGroupCodeBos(groupBoList);
|
||||||
|
|
||||||
|
//约定 groupName 解析为 区域name/部门name/角色name
|
||||||
|
groupQueryBo.setGroupNameBo(new GroupNameBo(query.getName()));
|
||||||
|
|
||||||
|
|
||||||
|
//userId
|
||||||
|
List<String> userNames = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(query.getUserId())) {
|
||||||
|
userNames.add(query.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(query.getIds())) {
|
||||||
|
userNames.addAll(query.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
groupQueryBo.setUserNames(userNames);
|
||||||
|
|
||||||
|
return groupQueryBo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("已重写自定义组查询:findGroupCountByQueryCriteria");
|
||||||
|
}
|
||||||
|
//return (Long) getDbSqlSession().selectOne("selectGroupCountByQueryCriteria", query);
|
||||||
|
List<Group> groupByQueryCriteria = findGroupByQueryCriteria(query);
|
||||||
|
return groupByQueryCriteria.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<Group> findGroupsByUser(String userId) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("已重写自定义组查询:findGroupsByUser");
|
||||||
|
}
|
||||||
|
GroupQueryImpl groupQuery = new GroupQueryImpl();
|
||||||
|
groupQuery.groupMember(userId);
|
||||||
|
List<Group> groupByQueryCriteria = findGroupByQueryCriteria(groupQuery);
|
||||||
|
return groupByQueryCriteria;
|
||||||
|
//return getDbSqlSession().selectList("selectGroupsByUserId", userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<Group> findGroupsByPrivilegeId(String privilegeId) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findGroupsByPrivilegeId");
|
||||||
|
}
|
||||||
|
return getDbSqlSession().selectList("selectGroupsWithPrivilegeId", privilegeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<Group> findGroupsByNativeQuery(Map<String, Object> parameterMap) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findGroupsByNativeQuery");
|
||||||
|
}
|
||||||
|
return getDbSqlSession().selectListWithRawParameter("selectGroupByNativeQuery", parameterMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long findGroupCountByNativeQuery(Map<String, Object> parameterMap) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findGroupCountByNativeQuery");
|
||||||
|
}
|
||||||
|
return (Long) getDbSqlSession().selectOne("selectGroupCountByNativeQuery", parameterMap);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.dromara.flow.ui.config.idm;
|
||||||
|
|
||||||
|
import org.flowable.idm.api.PasswordEncoder;
|
||||||
|
import org.flowable.idm.api.PasswordSalt;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 土豆仙
|
||||||
|
* @Date: 2021/11/12 10:04
|
||||||
|
* @Description: 密码加密器
|
||||||
|
*/
|
||||||
|
public class CustomPasswordEncoder implements PasswordEncoder,org.springframework.security.crypto.password.PasswordEncoder {
|
||||||
|
@Override
|
||||||
|
public String encode(CharSequence rawPassword, PasswordSalt passwordSalt) {
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.encode(rawPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断密码是否相同
|
||||||
|
*
|
||||||
|
* @param rawPassword 真实密码
|
||||||
|
* @param encodedPassword 加密后字符
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isMatches(CharSequence rawPassword, String encodedPassword, PasswordSalt salt) {
|
||||||
|
/* BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String encode(CharSequence rawPassword) {
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.encode(rawPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(CharSequence rawPassword, String encodedPassword) {
|
||||||
|
/*BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean upgradeEncoding(String encodedPassword) {
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.upgradeEncoding(encodedPassword);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.dromara.flow.ui.config.idm;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dromara.flow.ui.domain.bo.GroupCodeBo;
|
||||||
|
import com.dromara.flow.ui.domain.bo.UserQueryBo;
|
||||||
|
import com.dromara.flow.ui.mapper.CustomMybatisMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.flowable.engine.ManagementService;
|
||||||
|
import org.flowable.engine.impl.cmd.AbstractCustomSqlExecution;
|
||||||
|
import org.flowable.idm.api.User;
|
||||||
|
import org.flowable.idm.engine.IdmEngineConfiguration;
|
||||||
|
import org.flowable.idm.engine.impl.UserQueryImpl;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.UserEntity;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.UserEntityImpl;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.data.AbstractIdmDataManager;
|
||||||
|
import org.flowable.idm.engine.impl.persistence.entity.data.UserDataManager;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 土豆仙
|
||||||
|
* @Date: 2021/11/12 10:07
|
||||||
|
* @Description: 覆写用户信息查询
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CustomUserDataManager extends AbstractIdmDataManager<UserEntity> implements UserDataManager {
|
||||||
|
public CustomUserDataManager(IdmEngineConfiguration idmEngineConfiguration) {
|
||||||
|
super(idmEngineConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private ManagementService managementService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends UserEntity> getManagedEntityClass() {
|
||||||
|
return UserEntityImpl.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserEntity create() {
|
||||||
|
return new UserEntityImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param query 流程引擎查询参数
|
||||||
|
* @return 流程引擎展示视图
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<User> findUserByQueryCriteria(UserQueryImpl query) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("已重写自定义组查询:findUserByQueryCriteria");
|
||||||
|
}
|
||||||
|
UserQueryBo userQueryBo = transformQueryImplToUserQueryBo(query);
|
||||||
|
|
||||||
|
List<User> users = managementService.executeCustomSql(new AbstractCustomSqlExecution<CustomMybatisMapper, List<User>>(CustomMybatisMapper.class) {
|
||||||
|
@Override
|
||||||
|
public List<User> execute(CustomMybatisMapper customMybatisMapper) {
|
||||||
|
return customMybatisMapper.selectUserList(userQueryBo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserQueryBo transformQueryImplToUserQueryBo(UserQueryImpl query) {
|
||||||
|
UserQueryBo userQueryBo = new UserQueryBo();
|
||||||
|
|
||||||
|
//设置userName
|
||||||
|
if (StringUtils.isNotBlank(query.getId())) {
|
||||||
|
userQueryBo.setUserName(query.getId());
|
||||||
|
} else {
|
||||||
|
userQueryBo.setUserName(query.getIdIgnoreCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
userQueryBo.setUserNames(query.getIds());
|
||||||
|
|
||||||
|
//设置nickName
|
||||||
|
if (StringUtils.isNotBlank(query.getFirstName()) || StringUtils.isNotBlank(query.getLastName())) {
|
||||||
|
String nickName = StringUtils.join(query.getFirstName(), query.getLastName());
|
||||||
|
userQueryBo.setNickName(nickName);
|
||||||
|
} else {
|
||||||
|
userQueryBo.setNickName(query.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置email
|
||||||
|
userQueryBo.setEmail(query.getEmail());
|
||||||
|
userQueryBo.setEmailLike(query.getEmailLike());
|
||||||
|
|
||||||
|
|
||||||
|
//处理组映射
|
||||||
|
List<GroupCodeBo> groupBoList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(query.getGroupId())) {
|
||||||
|
groupBoList.add(new GroupCodeBo(query.getGroupId()));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(query.getGroupIds())) {
|
||||||
|
|
||||||
|
List<GroupCodeBo> collect = query.getGroupIds().stream()
|
||||||
|
.map(GroupCodeBo::new)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
groupBoList.addAll(collect);
|
||||||
|
}
|
||||||
|
userQueryBo.setGroupBoList(groupBoList);
|
||||||
|
return userQueryBo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long findUserCountByQueryCriteria(UserQueryImpl query) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("已重写自定义组查询:findUserCountByQueryCriteria");
|
||||||
|
}
|
||||||
|
// return (Long) getDbSqlSession().selectOne("selectUserCountByQueryCriteria", query);
|
||||||
|
return findUserByQueryCriteria(query).size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<User> findUsersByPrivilegeId(String privilegeId) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findUsersByPrivilegeId");
|
||||||
|
}
|
||||||
|
return getDbSqlSession().selectList("selectUsersWithPrivilegeId", privilegeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<User> findUsersByNativeQuery(Map<String, Object> parameterMap) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findUsersByNativeQuery");
|
||||||
|
}
|
||||||
|
return getDbSqlSession().selectListWithRawParameter("selectUserByNativeQuery", parameterMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long findUserCountByNativeQuery(Map<String, Object> parameterMap) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("未重写自定义组查询:findUserCountByNativeQuery");
|
||||||
|
}
|
||||||
|
return (Long) getDbSqlSession().selectOne("selectUserCountByNativeQuery", parameterMap);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
package com.dromara.flow.ui.domain.bo;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import liquibase.repackaged.org.apache.commons.text.StringSubstitutor;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务组与流程组转换
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class GroupCodeBo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认占位符号 代表所有
|
||||||
|
*/
|
||||||
|
private static final String STAR = "*";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割符号
|
||||||
|
*/
|
||||||
|
private static final String DOT = ".";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占位字符串定义 - 后期放入配置中,用于扩展
|
||||||
|
*/
|
||||||
|
private static final String PLACEHOLDER_STRING = "${deptCode}.${roleCode}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取 定义中 ${}内的内容
|
||||||
|
*/
|
||||||
|
private static final String pattern = "\\$\\{(.*?)}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptCode:* 、roleCode:* ...
|
||||||
|
*/
|
||||||
|
private Map<String, String> codeMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptCode:* 、roleCode:* ...
|
||||||
|
*/
|
||||||
|
private static final Map<String, String> codeMapInit = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptCode、roleCode ...
|
||||||
|
*/
|
||||||
|
private static final List<String> codeList = new ArrayList<>();
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
static {
|
||||||
|
Pattern p = Pattern.compile(pattern);
|
||||||
|
Matcher m = p.matcher(PLACEHOLDER_STRING);
|
||||||
|
while (m.find()) {
|
||||||
|
// ${}和 里面的内容
|
||||||
|
String code = m.group(1);
|
||||||
|
codeList.add(code);
|
||||||
|
codeMapInit.put(code, STAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GroupCodeBo(String gourpCode) {
|
||||||
|
transferToBusiness(gourpCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gourpCode 流程引擎编码转换(约定)
|
||||||
|
*/
|
||||||
|
public void transferToBusiness(String gourpCode) {
|
||||||
|
|
||||||
|
List<String> split = StrUtil.split(gourpCode, DOT);
|
||||||
|
if (CollectionUtil.isNotEmpty(split) && split.size() == codeList.size()) {
|
||||||
|
|
||||||
|
//遍历
|
||||||
|
for (int i = 0; i < codeList.size(); i++) {
|
||||||
|
codeMap.put(codeList.get(i), split.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 组编码
|
||||||
|
*/
|
||||||
|
public String getGourpCode() {
|
||||||
|
|
||||||
|
if (MapUtil.isEmpty(codeMap)) {
|
||||||
|
codeMap.putAll(codeMapInit);
|
||||||
|
}
|
||||||
|
StringSubstitutor strSubstitutor = new StringSubstitutor(codeMap);
|
||||||
|
|
||||||
|
|
||||||
|
return strSubstitutor.replace(PLACEHOLDER_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 编码-值 键值对
|
||||||
|
*/
|
||||||
|
public Map<String, String> getCodeMap() {
|
||||||
|
|
||||||
|
if (MapUtil.isEmpty(codeMap)) {
|
||||||
|
codeMap.putAll(codeMapInit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return codeMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package com.dromara.flow.ui.domain.bo;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import liquibase.repackaged.org.apache.commons.text.StringSubstitutor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务组名与流程组转换
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class GroupNameBo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认占位符号 代表所有
|
||||||
|
*/
|
||||||
|
private static final String STAR = "*";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割符号
|
||||||
|
*/
|
||||||
|
private static final String DOT = ".";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占位字符串定义 - 后期放入配置中,用于扩展
|
||||||
|
*/
|
||||||
|
private static final String PLACEHOLDER_STRING = "${deptName}.${roleName}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取 定义中 ${}内的内容
|
||||||
|
*/
|
||||||
|
private static final String pattern = "\\$\\{(.*?)}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptName:* 、roleName:* ...
|
||||||
|
*/
|
||||||
|
private static final Map<String, String> nameMapInit = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptName:* 、roleName:* ...
|
||||||
|
*/
|
||||||
|
private Map<String, String> nameMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deptName、roleName ...
|
||||||
|
*/
|
||||||
|
private static final List<String> nameList = new ArrayList<>();
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
static {
|
||||||
|
Pattern p = Pattern.compile(pattern);
|
||||||
|
Matcher m = p.matcher(PLACEHOLDER_STRING);
|
||||||
|
while (m.find()) {
|
||||||
|
// ${}和 里面的内容
|
||||||
|
String Name = m.group(1);
|
||||||
|
nameList.add(Name);
|
||||||
|
nameMapInit.put(Name, STAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GroupNameBo(String gourpName) {
|
||||||
|
transferToBusiness(gourpName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gourpName 流程引擎编码转换(约定)
|
||||||
|
*/
|
||||||
|
public void transferToBusiness(String gourpName) {
|
||||||
|
|
||||||
|
List<String> split = StrUtil.split(gourpName, DOT);
|
||||||
|
if (CollectionUtil.isNotEmpty(split) && split.size() <= nameList.size()) {
|
||||||
|
|
||||||
|
//遍历
|
||||||
|
for (int i = 0; i < split.size(); i++) {
|
||||||
|
nameMap.put(nameList.get(i), split.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 组名
|
||||||
|
*/
|
||||||
|
public String getGourpname() {
|
||||||
|
|
||||||
|
if (MapUtil.isEmpty(nameMap)) {
|
||||||
|
nameMap.putAll(nameMapInit);
|
||||||
|
}
|
||||||
|
StringSubstitutor strSubstitutor = new StringSubstitutor(nameMap);
|
||||||
|
|
||||||
|
|
||||||
|
return strSubstitutor.replace(PLACEHOLDER_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 名称编码-值 键值对
|
||||||
|
*/
|
||||||
|
public Map<String, String> getnameMap() {
|
||||||
|
|
||||||
|
if (MapUtil.isEmpty(nameMap)) {
|
||||||
|
nameMap.putAll(nameMapInit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nameMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.dromara.flow.ui.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义group查询条件
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GroupQueryBo {
|
||||||
|
|
||||||
|
|
||||||
|
//约定 解析为 区域code/部门code/角色code
|
||||||
|
/* protected String id;
|
||||||
|
protected List<String> ids;*/
|
||||||
|
|
||||||
|
private boolean isReturnList = true;
|
||||||
|
|
||||||
|
// private DdrCodeDTO ddrCodeDTO;
|
||||||
|
|
||||||
|
private List<GroupCodeBo> groupCodeBos;
|
||||||
|
|
||||||
|
//约定 解析为 区域name/部门name/角色name
|
||||||
|
/* protected String name;
|
||||||
|
protected String nameLike;
|
||||||
|
protected String nameLikeIgnoreCase;*/
|
||||||
|
|
||||||
|
private GroupNameBo groupNameBo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
protected String type;
|
||||||
|
protected String userId;
|
||||||
|
protected List<String> userIds;*/
|
||||||
|
|
||||||
|
protected List<String> userNames;
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.dromara.flow.ui.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义user查询条件
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserQueryBo {
|
||||||
|
|
||||||
|
//用户ID -对应账号
|
||||||
|
/* protected String id;
|
||||||
|
protected List<String> ids;
|
||||||
|
protected String idIgnoreCase;*/
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private List<String> userNames;
|
||||||
|
|
||||||
|
//用户名称
|
||||||
|
/*protected String firstName;
|
||||||
|
protected String firstNameLike;
|
||||||
|
protected String firstNameLikeIgnoreCase;
|
||||||
|
protected String lastName;
|
||||||
|
protected String lastNameLike;
|
||||||
|
protected String lastNameLikeIgnoreCase;
|
||||||
|
protected String fullNameLike;
|
||||||
|
protected String fullNameLikeIgnoreCase;
|
||||||
|
protected String displayName;
|
||||||
|
protected String displayNameLike;
|
||||||
|
protected String displayNameLikeIgnoreCase;*/
|
||||||
|
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
//邮箱
|
||||||
|
/*protected String email;
|
||||||
|
protected String emailLike;*/
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private String emailLike;
|
||||||
|
|
||||||
|
//用户组
|
||||||
|
/*protected String groupId;
|
||||||
|
protected List<String> groupIds;*/
|
||||||
|
|
||||||
|
//约定:用户组转换成 区化、部门、角色 最后使用稳定的code值
|
||||||
|
private List<GroupCodeBo> groupBoList;
|
||||||
|
|
||||||
|
//租户
|
||||||
|
protected String tenantId;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.dromara.flow.ui.mapper;
|
||||||
|
|
||||||
|
import com.dromara.flow.ui.domain.bo.GroupQueryBo;
|
||||||
|
import com.dromara.flow.ui.domain.bo.UserQueryBo;
|
||||||
|
import org.flowable.idm.api.Group;
|
||||||
|
import org.flowable.idm.api.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义mapperSQl
|
||||||
|
* Author: 土豆仙
|
||||||
|
*/
|
||||||
|
public interface CustomMybatisMapper {
|
||||||
|
|
||||||
|
|
||||||
|
List<User> selectUserList(UserQueryBo userQueryBo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param groupQueryBo
|
||||||
|
* @return (id name)
|
||||||
|
*/
|
||||||
|
List<Group> findGroupList(GroupQueryBo groupQueryBo);
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
--- # 监控配置
|
||||||
|
spring.boot.admin.client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: true
|
||||||
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
url: http://localhost:9090/admin
|
||||||
|
instance:
|
||||||
|
service-host-type: IP
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
# Spring配置
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: flow-ui
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
liquibase:
|
||||||
|
enabled: false
|
||||||
|
# jackson:
|
||||||
|
# date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
# 资源信息
|
||||||
|
messages:
|
||||||
|
# 国际化资源文件路径
|
||||||
|
basename: i18n/messages
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/ry-vue?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&nullCatalogMeansCurrent=true
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
flowable:
|
||||||
|
databaseSchemaUpdate: true
|
||||||
|
# databaseSchema:
|
||||||
|
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org.flowable.engine.impl.persistence.entity.*: DEBUG
|
||||||
|
org.flowable.task.service.impl.persistence.entity.*: DEBUG # 日志配置
|
@ -0,0 +1,38 @@
|
|||||||
|
--- # 监控配置
|
||||||
|
spring.boot.admin.client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: true
|
||||||
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
url: http://localhost:9090/admin
|
||||||
|
instance:
|
||||||
|
service-host-type: IP
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
# Spring配置
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: flow-ui
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
liquibase:
|
||||||
|
enabled: false
|
||||||
|
# jackson:
|
||||||
|
# date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
# 资源信息
|
||||||
|
messages:
|
||||||
|
# 国际化资源文件路径
|
||||||
|
basename: i18n/messages
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/ry-vue?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&nullCatalogMeansCurrent=true
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
flowable:
|
||||||
|
databaseSchemaUpdate: true
|
||||||
|
# databaseSchema:
|
||||||
|
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org.flowable.engine.impl.persistence.entity.*: DEBUG
|
||||||
|
org.flowable.task.service.impl.persistence.entity.*: DEBUG # 日志配置
|
@ -0,0 +1,38 @@
|
|||||||
|
# 开发环境配置
|
||||||
|
server:
|
||||||
|
# 服务器的HTTP端口,默认为8080
|
||||||
|
port: 9205
|
||||||
|
servlet:
|
||||||
|
# 应用的访问路径
|
||||||
|
context-path: /flowable-ui
|
||||||
|
tomcat:
|
||||||
|
# tomcat的URI编码
|
||||||
|
uri-encoding: UTF-8
|
||||||
|
# tomcat最大线程数,默认为200
|
||||||
|
#max-threads: 800
|
||||||
|
# Tomcat启动初始化的线程数,默认值25
|
||||||
|
#min-spare-threads: 30
|
||||||
|
flowable:
|
||||||
|
customMybatisXMLMappers:
|
||||||
|
- mappers/CustomMybatisXmlMapper.xml
|
||||||
|
customMybatisMappers:
|
||||||
|
- com.dromara.flow.ui.mapper.CustomMybatisMapper
|
||||||
|
--- # Actuator 监控端点的配置项
|
||||||
|
management:
|
||||||
|
health:
|
||||||
|
ldap:
|
||||||
|
enabled: false
|
||||||
|
mail:
|
||||||
|
enabled: false
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
|
logfile:
|
||||||
|
external-file: ./logs/ruoyi-flow-ui.log
|
||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: @profiles.active@
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration debug="false" scan="true" scanPeriod="1 seconds">
|
||||||
|
|
||||||
|
<contextName>logback</contextName>
|
||||||
|
<property name="log.path" value="./logs/ruoyi-flow-ui"/>
|
||||||
|
<property name="console.log.pattern"
|
||||||
|
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
||||||
|
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
||||||
|
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${console.log.pattern}</pattern>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
<appender-ref ref="file"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.dromara.flow.ui.mapper.CustomMybatisMapper">
|
||||||
|
|
||||||
|
<!-- SELECT ALL PROCESS DEFINITION ID -->
|
||||||
|
<select id="selectProcessDefinitionDeploymentIdByKey" parameterType="String" resultType="String">
|
||||||
|
SELECT DEPLOYMENT_ID_ FROM ACT_RE_PROCDEF WHERE KEY_ = #{value}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectUserList" resultType="org.flowable.idm.engine.impl.persistence.entity.UserEntityImpl">
|
||||||
|
|
||||||
|
select distinct
|
||||||
|
u.user_name as id,
|
||||||
|
u.nick_name as firstName,
|
||||||
|
u.nick_name as displayName,
|
||||||
|
u.email as email,
|
||||||
|
u.password as password
|
||||||
|
from sys_user u
|
||||||
|
left join sys_user d on u.dept_id = d.dept_id
|
||||||
|
<where>
|
||||||
|
u.status = '0'
|
||||||
|
<if test="userName != null and userName != ''">
|
||||||
|
AND u.user_name = #{userName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="findGroupList" resultType="org.flowable.idm.engine.impl.persistence.entity.GroupEntityImpl">
|
||||||
|
SELECT
|
||||||
|
CONCAT_WS(".",d.dept_id,r.role_id) as id,
|
||||||
|
CONCAT_WS(".",d.dept_name,r.role_name) as name
|
||||||
|
FROM sys_dept d,sys_role r
|
||||||
|
<where>
|
||||||
|
d.status = '0' and r.status = '0'
|
||||||
|
<if test="groupCodeBos !=null and groupCodeBos.size() >0 ">
|
||||||
|
AND r.role_id in
|
||||||
|
<foreach collection="groupCodeBos" item="groupCodeBo" open="(" separator="," close=")">
|
||||||
|
#{groupCodeBo}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</where>
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
CONCAT_WS(".",d.dept_id,"*") as id,
|
||||||
|
CONCAT_WS(".",d.dept_name,"*") as name
|
||||||
|
FROM sys_dept d
|
||||||
|
<where>
|
||||||
|
d.status = '0'
|
||||||
|
|
||||||
|
</where>
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
CONCAT_WS(".","*",r.role_id) as id,
|
||||||
|
CONCAT_WS(".","*",r.role_name) as name
|
||||||
|
FROM sys_role r
|
||||||
|
<where>
|
||||||
|
r.status = '0'
|
||||||
|
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,13 @@
|
|||||||
|
package org.dromara.flow.ui;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class RuoyiFlowUiApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user