工作流集成
This commit is contained in:
parent
45233e402e
commit
4a74e71a52
@ -1 +1 @@
|
||||
EWEPEPEOGMGTELIZJUGECKIUJDBCJTCNISGPBNHLJTJUBHEWGNAKGEGAIOHJDQAJGNCFDRFZJEDMJTGEDVIQGKEJIKACHIIXDEELIWCCEEELCVCEHFHAJGIPGIIKJRASJFEHAMIKCIGXAPGEHIIZGFBBJMFJJNGFHUGDGDFGFAITGDAXBGAZGKAMBMDABKBAERDUHDAUDOEBIBGBBMCUIZGABKCABIDMFHFRILIIANEBEWBOAIJHBYFAIREBFQFFCHHREKFTFJJQIAGFDSDZHMHUCGBVHIAUENBCJIBBJDIHHDIQFKFNDEBJCKCFGLJKBMHFAZHTHOIRGLJFDUHWEVFGFHDKIBEKFVCGAQJGCYBZAMHDJBJREAIOJPIAJDCJFXHKHPJTHUBTJPDWISESIEIPISDWDRAMFVFFBJCTFVFAARGJHFIMELIQJEAHFRFQDTERDCCGDCIKCAGBJVDLGHEXEBAWAMAFITJDANGBCRDPBPEECBAVAEBBBYBUERFXCYIOHWAOHQBVDFJGCEFZFHAUJGJNJGAPDRJMESBAFHGACOCDDHCOCCEXDDDVDRAVDEHOGBBRANCXEJFVBIABDLDOAVCQBICYCDIBAXJRBQGVDFHQAKDYEDHRHVAGGUJHIAHSFIFUCIDCBRHZDOASDAIDHCJNDEJCFDHIBCFLCQBYFWGNFKAIJQFKFBAPEBGMDOBXGGCAIUENJHDRATFCHIGBCCGZBDJLHQFSHDINHJEVIJESEWANJFEQIVBAILJLBACPHNCHEMAYHJGBAOHLCTGAGLFWBQHFFPEKBYHDEUAOBAABJSBNFFINFDAAGUJTAVBVDHDTEEFNBSJKJNCODGHEECIRGXARCCFZFBFMDJCDGREDCNFOAWEPFIFCGWEBBZHPFVHDBUHFCHFDACJCGSARHMCMBMDDCRCWHBAZJBHHJMDKFWBKFQIHAFADBLGFCSJBEWFAJLGVGPBNANFPINAHIRIJEYJRFWDPCDCSBEGHHTGMATCWEYGQHGAHEJIEHQDZEHCRIRGLJHDABFJKDKBPGUJFJICIGVHRIZHXDWADHMDTABAXCGJIBLHIBYDJELBYBJIFJNDCCICIJDELBOJBJEBRFZDCBUHXGDBKCVBGGQHUFUJIIYHFAAIBBDCEAYDLFHBDBJCADMDFCDGMAYHLHDBGDSCHCECOEAEYJOIFHZ
|
||||
EWEPEPEOGMGTELIZJUGECKIUJDBCJTCNISGPBNHLJTJUBHEWGNAKGEGAIOHJDQAJGNCFDRFZJEDMJTGEDVIQGKEJIKACHIIXDEELIWCCEEELCVCEHFHAJGIPGIIKJRASJFEHAMIKCIGXAPGEHIIZGFBBJMFJJNGFHUGDGDFGFAITGDAXBGAZGKAMBMDABKBAERDUHDAUDOEBIBGBBMCUIZGABKCABIDMFHFRILIIANEBEWBOAIJHBYFAIREBFQFFCHHREKFTFJJQIAGFDSDZHMHUCGBVHIAUENBCJIBBJDIHHDIQFKFNDEBJCKCFGLJKBMHFAZHTHOIRGLJFDUHWEVFGFHDKIBEKFVCGAQJGCYBZAMHDJBJREAIOJPIAJDCJFXHKHPJTHUBTJPDWISESIEIPISDWDRAMFVFFBJCTFVFAARGJHFIMELIQJEAHFRFQDTERDCCGDCIKCAGBJVDLGHEXEBAWAMAFITJDANGBCRDPBPEECBAVAEBNJADGIPJAFWFJCYDZHFBFDHCMDCGNGTJTARACGRGOCDFWBPIRHKJACZAEHDJLGUFUGJDTHNJODDEBEVJLJUDDAAIJGNBPIQJOFNDHGKDQGOIBCWEGDBHDHDDBDPCFGLIBCRIPDSHECTAJBKGHGYAPDFJHFEDMCPAUHBDXAXEQCOEVCFDLGKAUASEZDAESETEUAJGHJFHLCTANBPDDCOGABTJJBBJHGLJPFMCQJOBTHPCNBMGFIPGNCHJSHOJGFQFSHGGUBVACADCHEDFDJHCKFEHBDIFJIUINCVJUDUENFHIUEFJFDBEPFHHGJAGLJGAOEMJNDYANAADPDODKGXFMHUCVHVCXGLCFHLFLETEZIWCTEFBRAOFFADEUIDFCGWDBCSAVDQJOANHKGHCSBFIBEACRITIEJGETGEJIAFDAIRJLHMEIBRCUIKDLBTHWHIEPHOGABGBBCCFFHKIECJJQHUDFHDITIQBQBCANARGIBPDUFTDHFKGOCMEEFHGXCTJVCOIXFUFDEAGZGNILISHSHKJGHQAEEAHLDWAWJADUGGELCKBACPAEINFSJHBQIFBVJHJICEAEGEFKBHCIHZCNJUJLIHGPFLILBRJTIYFUAZJVCPHPFQFYIDGZAUFXANHWBFJGJJHWFFBRCVBOCXJDIMBNBQJGJEFPGTAEDJFLHGITESAKCFBZBD
|
||||
64
pom.xml
64
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.zhgd</groupId>
|
||||
@ -27,7 +27,7 @@
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<commons.version>2.6</commons.version>
|
||||
<swagger.ui.version>1.9.6</swagger.ui.version>
|
||||
<tomcat.version>9.0.12</tomcat.version>
|
||||
<tomcat.version>9.0.30</tomcat.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@ -807,6 +807,66 @@
|
||||
<artifactId>mpxj</artifactId>
|
||||
<version>10.11.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>wflow-server1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/resources/lib/wflow-server-1.0-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-spring-boot-starter-actuator</artifactId>
|
||||
<version>6.7.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||
<version>1.30.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.googlecode.aviator</groupId>
|
||||
<artifactId>aviator</artifactId>
|
||||
<version>5.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.javadelight</groupId>
|
||||
<artifactId>delight-nashorn-sandbox</artifactId>
|
||||
<version>0.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.40</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
55
src/main/java/com/zhgd/config/DataSourceOneConfig.java
Normal file
55
src/main/java/com/zhgd/config/DataSourceOneConfig.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.zhgd.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@MapperScan(basePackages = {"com.zhgd.*.*.*.*.mapper", "com.zhgd.*.*.*.mapper"}, sqlSessionTemplateRef = "db1SqlSessionTemplate")
|
||||
public class DataSourceOneConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spring.datasource.db1")
|
||||
public DataSource db1DataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Lazy //这个是懒加载的注解,根据自己项目需要看是否添加
|
||||
public SqlSessionFactory db1SqlSessionFactory(@Qualifier("db1DataSource") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
//开启驼峰
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
configuration.setLogImpl(StdOutImpl.class);
|
||||
bean.setConfiguration(configuration);
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/zhgd/xmgl/**/*.xml"));
|
||||
return bean.getObject();
|
||||
}
|
||||
@Bean
|
||||
@Primary
|
||||
public DataSourceTransactionManager db1TransactionManager(@Qualifier("db1DataSource") DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
@Bean
|
||||
@Primary
|
||||
@Lazy
|
||||
public SqlSessionTemplate db1SqlSessionTemplate(@Qualifier("db1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
52
src/main/java/com/zhgd/config/DataSourceTwoConfig.java
Normal file
52
src/main/java/com/zhgd/config/DataSourceTwoConfig.java
Normal file
@ -0,0 +1,52 @@
|
||||
package com.zhgd.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.wflow.mapper", sqlSessionTemplateRef = "sqlSessionTemplate2")
|
||||
public class DataSourceTwoConfig {
|
||||
|
||||
@Primary
|
||||
@Bean(name = "dataSource2")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.db2")
|
||||
public DataSource dataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "sqlSessionFactory2")
|
||||
public SqlSessionFactory db1SqlSessionFactory(@Qualifier("dataSource2") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
//开启驼峰
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
configuration.setLogImpl(StdOutImpl.class);
|
||||
bean.setConfiguration(configuration);
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/*.xml"));
|
||||
return bean.getObject();
|
||||
}
|
||||
@Bean(name = "transactionManager2")
|
||||
public DataSourceTransactionManager transactionManager(@Qualifier("dataSource2") DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
@Bean(name = "sqlSessionTemplate2")
|
||||
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlSessionFactory2") SqlSessionFactory sqlSessionFactory) throws Exception {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import io.netty.util.concurrent.EventExecutorGroup;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* @Author: Zpsw
|
||||
@ -30,6 +31,7 @@ public class EventLoopGroupConfig {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Primary
|
||||
@Bean(name = "bossGroup")
|
||||
public NioEventLoopGroup bossGroup() {
|
||||
return new NioEventLoopGroup(bossThreadsNum);
|
||||
|
||||
@ -1,326 +1,331 @@
|
||||
package com.zhgd.xmgl.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* @program: wisdomSite
|
||||
* @description: 线程池配置
|
||||
* @author: Mr.Peng
|
||||
* @create: 2021-02-23 10:04
|
||||
**/
|
||||
@Configuration
|
||||
public class AsyncConfig {
|
||||
/**
|
||||
* Set the ThreadPoolExecutor's core pool size.
|
||||
*/
|
||||
private int corePoolSize = 8;
|
||||
/**
|
||||
* Set the ThreadPoolExecutor's maximum pool size.
|
||||
*/
|
||||
private int maxPoolSize = 16;
|
||||
/**
|
||||
* Set the capacity for the ThreadPoolExecutor's BlockingQueue.
|
||||
*/
|
||||
private int queueCapacity = 200;
|
||||
|
||||
/**
|
||||
* 默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
|
||||
* 当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
|
||||
* 当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
|
||||
*/
|
||||
|
||||
@Bean("taskExecutor")
|
||||
public ThreadPoolTaskExecutor taskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("taskExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
|
||||
* 当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
|
||||
* 当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
|
||||
*/
|
||||
|
||||
@Bean("doubleCarbonExecutor")
|
||||
public ThreadPoolTaskExecutor doubleCarbonExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("doubleCarbonExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("countAttendanceExecutor")
|
||||
public ThreadPoolTaskExecutor attendanceExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("countAttendanceExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("sendAttendanceExecutor")
|
||||
public ThreadPoolTaskExecutor sendAttendanceExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("sendAttendanceExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("sendWorkerExecutor")
|
||||
public ThreadPoolTaskExecutor sendWorkerExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("sendWorkerExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("sendExitWorkerExecutor")
|
||||
public ThreadPoolTaskExecutor sendExitWorkerExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("sendExitWorkerExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("environmentNoiseDataExecutor")
|
||||
public ThreadPoolTaskExecutor sendEnvironmentNoiseDataExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("environmentNoiseDataExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("electricalExecutor")
|
||||
public ThreadPoolTaskExecutor sendElectricalExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("electricalExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("towerExecutor")
|
||||
public ThreadPoolTaskExecutor sendTowerExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("towerExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("lifterExecutor")
|
||||
public ThreadPoolTaskExecutor sendLifterExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("lifterExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("devExcavationExecutor")
|
||||
public ThreadPoolTaskExecutor sendDevExcavationEExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("devExcavationExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("gantryCraneExecutor")
|
||||
public ThreadPoolTaskExecutor sendGantryCraneExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("gantryCraneExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("fileExecutor")
|
||||
public ThreadPoolTaskExecutor fileExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("fileExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("asyncExecutor")
|
||||
public ThreadPoolTaskExecutor asyncExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("asyncExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("bimExecutor")
|
||||
public ThreadPoolTaskExecutor bimExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
/** 核心线程数(默认线程数) */
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
/** 最大线程数 */
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(2000);
|
||||
/** 允许线程空闲时间(单位:默认为秒) */
|
||||
executor.setKeepAliveSeconds(60);
|
||||
/** 线程池名前缀 */
|
||||
executor.setThreadNamePrefix("bimExecutor-");
|
||||
// 线程池对拒绝任务的处理策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
//package com.zhgd.xmgl.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.Primary;
|
||||
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
//
|
||||
//import java.util.concurrent.ThreadPoolExecutor;
|
||||
//
|
||||
///**
|
||||
// * @program: wisdomSite
|
||||
// * @description: 线程池配置
|
||||
// * @author: Mr.Peng
|
||||
// * @create: 2021-02-23 10:04
|
||||
// **/
|
||||
//@Configuration
|
||||
//public class AsyncConfig {
|
||||
// /**
|
||||
// * Set the ThreadPoolExecutor's core pool size.
|
||||
// */
|
||||
// private int corePoolSize = 8;
|
||||
// /**
|
||||
// * Set the ThreadPoolExecutor's maximum pool size.
|
||||
// */
|
||||
// private int maxPoolSize = 16;
|
||||
// /**
|
||||
// * Set the capacity for the ThreadPoolExecutor's BlockingQueue.
|
||||
// */
|
||||
// private int queueCapacity = 200;
|
||||
//
|
||||
// /**
|
||||
// * 默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
|
||||
// * 当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
|
||||
// * 当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
|
||||
// */
|
||||
//
|
||||
// @Primary
|
||||
// @Bean("taskExecutor")
|
||||
// public ThreadPoolTaskExecutor taskExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("taskExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
|
||||
// * 当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
|
||||
// * 当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
|
||||
// */
|
||||
//
|
||||
// @Primary
|
||||
// @Bean("doubleCarbonExecutor")
|
||||
// public ThreadPoolTaskExecutor doubleCarbonExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("doubleCarbonExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Primary
|
||||
// @Bean("countAttendanceExecutor")
|
||||
// public ThreadPoolTaskExecutor attendanceExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("countAttendanceExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Primary
|
||||
// @Bean("sendAttendanceExecutor")
|
||||
// public ThreadPoolTaskExecutor sendAttendanceExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("sendAttendanceExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("sendWorkerExecutor")
|
||||
// public ThreadPoolTaskExecutor sendWorkerExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("sendWorkerExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("sendExitWorkerExecutor")
|
||||
// public ThreadPoolTaskExecutor sendExitWorkerExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("sendExitWorkerExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("environmentNoiseDataExecutor")
|
||||
// public ThreadPoolTaskExecutor sendEnvironmentNoiseDataExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("environmentNoiseDataExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("electricalExecutor")
|
||||
// public ThreadPoolTaskExecutor sendElectricalExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("electricalExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("towerExecutor")
|
||||
// public ThreadPoolTaskExecutor sendTowerExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("towerExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("lifterExecutor")
|
||||
// public ThreadPoolTaskExecutor sendLifterExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("lifterExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("devExcavationExecutor")
|
||||
// public ThreadPoolTaskExecutor sendDevExcavationEExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("devExcavationExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("gantryCraneExecutor")
|
||||
// public ThreadPoolTaskExecutor sendGantryCraneExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("gantryCraneExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("fileExecutor")
|
||||
// public ThreadPoolTaskExecutor fileExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("fileExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("asyncExecutor")
|
||||
// public ThreadPoolTaskExecutor asyncExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(queueCapacity);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("asyncExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//
|
||||
// @Bean("bimExecutor")
|
||||
// public ThreadPoolTaskExecutor bimExecutor() {
|
||||
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// /** 核心线程数(默认线程数) */
|
||||
// executor.setCorePoolSize(corePoolSize);
|
||||
// /** 最大线程数 */
|
||||
// executor.setMaxPoolSize(maxPoolSize);
|
||||
// executor.setQueueCapacity(2000);
|
||||
// /** 允许线程空闲时间(单位:默认为秒) */
|
||||
// executor.setKeepAliveSeconds(60);
|
||||
// /** 线程池名前缀 */
|
||||
// executor.setThreadNamePrefix("bimExecutor-");
|
||||
// // 线程池对拒绝任务的处理策略
|
||||
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// // 初始化
|
||||
// executor.initialize();
|
||||
// return executor;
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -67,6 +67,11 @@ public class SystemUser implements Serializable {
|
||||
@Excel(name = "人员姓名", width = 15)
|
||||
@ApiModelProperty(value = "人员姓名")
|
||||
private java.lang.String realName;
|
||||
|
||||
@Excel(name = "头像", width = 15)
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 人员电话
|
||||
*/
|
||||
|
||||
@ -2,11 +2,13 @@ package com.zhgd.xmgl.modules.basicdata.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wflow.bean.vo.OrgTreeVo;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Company;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -49,4 +51,12 @@ public interface CompanyMapper extends BaseMapper<Company> {
|
||||
* @return
|
||||
*/
|
||||
Company getHeadquarterCompany(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 查询某部门下的子部门列表
|
||||
* @param deptId 父部门
|
||||
* @return 子部门列表,type字段固定返回固定值 dept
|
||||
*/
|
||||
@Select("SELECT company_sn id, company_name `name`, 'dept' AS 'type' FROM company WHERE parent_id=#{deptId}")
|
||||
List<OrgTreeVo> selectByDept(@Param("deptId") String deptId);
|
||||
}
|
||||
|
||||
@ -3,10 +3,17 @@ package com.zhgd.xmgl.modules.basicdata.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wflow.bean.do_.DeptDo;
|
||||
import com.wflow.bean.do_.UserDeptDo;
|
||||
import com.wflow.bean.vo.OrgTreeVo;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -52,4 +59,37 @@ public interface SystemUserMapper extends BaseMapper<SystemUser> {
|
||||
List<String> getOrgSnListByUserId(HashMap<String, Object> paramMap);
|
||||
|
||||
List<SystemUser> getTenantListBySn(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 查询该部门下的所有用户
|
||||
* @param deptId 部门ID
|
||||
* @return 用户列表 type为固定值user
|
||||
*/
|
||||
@Select("SELECT user_id id, real_name `name`, 'user' AS 'type', avatar " +
|
||||
"FROM system_user" +
|
||||
" WHERE sn = #{deptId}")
|
||||
List<OrgTreeVo> selectUsersByDept(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 查询指定用户所在的部门,一个用户可能同时在多个部门下
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户所在的部门列表
|
||||
*/
|
||||
@Select("SELECT d.company_sn id, d.company_name FROM system_user u, company d WHERE u.sn = d.company_sn AND u.user_id = #{userId}")
|
||||
List<DeptDo> getUserDepts(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 批量查询指定用户及部门信息
|
||||
*
|
||||
* @param udIds 用户ID_部门id 字符串拼接的集合
|
||||
* @return 用户部门信息列表
|
||||
*/
|
||||
@Select({"<script>",
|
||||
"SELECT tb.* FROM (SELECT CONCAT(wu.user_id, '_', wd.company_sn) tid, wu.user_id, wu.real_name, wd.company_sn, wu.avatar, wd.company_name",
|
||||
"FROM system_user wu, company wd ",
|
||||
"WHERE wu.sn = wd.company_sn) tb WHERE tb.tid IN",
|
||||
"<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>#{item}</foreach>",
|
||||
"</script>"})
|
||||
List<UserDeptDo> getUserDepInfosBatch(@Param("list") Collection<String> udIds);
|
||||
}
|
||||
|
||||
@ -0,0 +1,201 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.wflow.bean.do_.DeptDo;
|
||||
import com.wflow.bean.do_.RoleDo;
|
||||
import com.wflow.bean.do_.UserDeptDo;
|
||||
import com.wflow.bean.do_.UserDo;
|
||||
import com.wflow.bean.vo.ModelGroupVo;
|
||||
import com.wflow.bean.vo.OrgTreeVo;
|
||||
import com.wflow.bean.vo.UserVo;
|
||||
import com.wflow.service.OrgRepositoryService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseRoleUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Company;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseRoleMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseRoleUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.CompanyMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Primary
|
||||
@Service
|
||||
public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
||||
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
|
||||
@Autowired
|
||||
private BaseRoleUserMapper baseRoleUserMapper;
|
||||
|
||||
@Autowired
|
||||
private BaseRoleMapper systemRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
@Override
|
||||
public List<ModelGroupVo.Form> getModelsByPerm(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDo getUserById(String userId) {
|
||||
SystemUser systemUser = systemUserMapper.selectById(userId);
|
||||
if (Objects.nonNull(systemUser)){
|
||||
UserDo userDo = new UserDo();
|
||||
userDo.setUserId(systemUser.getUserId().toString());
|
||||
userDo.setUserName(systemUser.getRealName());
|
||||
userDo.setAvatar(systemUser.getAvatar());
|
||||
return userDo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgTreeVo> selectUsersByPy(String py) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgTreeVo> selectUsersByDept(String deptId) {
|
||||
return systemUserMapper.selectUsersByDept(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDo> getUsersBatch(Collection<String> userIds) {
|
||||
try {
|
||||
return systemUserMapper.selectBatchIds(userIds).stream()
|
||||
.map(u -> new UserDo(u.getUserId().toString(), u.getRealName(), u.getAvatar()))
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUsersByDepts(Collection<String> deptIds) {
|
||||
try {
|
||||
return systemUserMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUser>()
|
||||
.select(SystemUser::getUserId)
|
||||
.in(SystemUser::getDepartment, deptIds))
|
||||
.stream().map(Object::toString)
|
||||
.collect(Collectors.toSet());
|
||||
} catch (Exception e) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeptDo getDeptById(String deptId) {
|
||||
Company departments = companyMapper.selectOne(Wrappers.<Company>lambdaQuery().eq(Company::getCompanySn, deptId));
|
||||
if (Objects.nonNull(departments)){
|
||||
DeptDo deptDo = new DeptDo();
|
||||
deptDo.setId(departments.getCompanySn().toString());
|
||||
deptDo.setDeptName(departments.getCompanyName());
|
||||
deptDo.setLeader("");
|
||||
deptDo.setParentId(departments.getParentId().toString());
|
||||
return deptDo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDo> getDeptsByUser(String userId) {
|
||||
return systemUserMapper.getUserDepts(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDo> getSysAllDepts() {
|
||||
try {
|
||||
return companyMapper.selectList(null).stream()
|
||||
.map(d -> new DeptDo(d.getCompanySn().toString(), d.getCompanyName(), "", d.getParentId().toString()))
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDeptDo> getSysAllUserDepts() {
|
||||
try {
|
||||
return systemUserMapper.selectList(null).stream()
|
||||
.map(d -> new UserDeptDo(d.getUserId().toString(), d.getDepartment()))
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgTreeVo> getSubDeptById(String parentId) {
|
||||
return companyMapper.selectByDept(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRecursiveSubDept(String parentId) {
|
||||
List<String> list = new ArrayList<>();
|
||||
loadSubDept(parentId, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归加载所有子部门
|
||||
* @param parentId 父部门ID
|
||||
* @param subDepts 所有子部门缓存
|
||||
*/
|
||||
private void loadSubDept(String parentId, List<String> subDepts){
|
||||
List<Company> departments = companyMapper.selectList(
|
||||
new LambdaQueryWrapper<Company>()
|
||||
.eq(Company::getParentId, parentId));
|
||||
subDepts.addAll(departments.stream().map(Company::getCompanySn).collect(Collectors.toList()).stream().map(Object::toString).collect(Collectors.toList()));
|
||||
departments.forEach(d -> loadSubDept(d.getCompanySn().toString(), subDepts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleDo> getSysAllRoles() {
|
||||
try {
|
||||
return systemRoleMapper.selectList(null).stream()
|
||||
.map(r -> new RoleDo(r.getRoleId().toString(), r.getRoleName()))
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUsersByRoles(List<String> roles) {
|
||||
return baseRoleUserMapper.selectList(new LambdaQueryWrapper<BaseRoleUser>()
|
||||
.select(BaseRoleUser::getUserId)
|
||||
.in(BaseRoleUser::getRoleId, roles)).stream()
|
||||
.map(Object::toString).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserSign(String userId) {
|
||||
return systemUserMapper.selectById(userId).getUserId().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserSign(String userId, String signature) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVo getUserDetail(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, UserDeptDo> getUserDeptInfos(Collection<String> userDeptIds) {
|
||||
return systemUserMapper.getUserDepInfosBatch(userDeptIds)
|
||||
.stream().collect(Collectors.toMap(UserDeptDo::getUserId, v -> v));
|
||||
}
|
||||
}
|
||||
@ -6,10 +6,18 @@ http.port=23912
|
||||
#spring.datasource.url=jdbc:mysql://139.9.66.234:3386/wisdomsite_ty?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
#spring.datasource.url=jdbc:mysql://182.90.224.237:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
#spring.datasource.url=jdbc:mysql://139.9.66.234:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
spring.datasource.url=jdbc:mysql://192.168.34.221:3306/wisdomsite_other_env_show?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://192.168.34.221:3306/wisdomsite_other_env_show?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.db1.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
|
||||
#spring.datasource.password=ENC(hHkiHEc6vSWjqfOtg2/2Uiihs0vX3l7V)
|
||||
spring.datasource.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)
|
||||
spring.datasource.db1.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)
|
||||
|
||||
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://192.168.34.155:3306/wflow_pro?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
|
||||
spring.datasource.db2.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.db2.username=root
|
||||
spring.datasource.db2.password=root
|
||||
|
||||
server.port=19111
|
||||
#server.port=30246
|
||||
basePath=C:/jxj/prod/backEnd/itbgpImage/
|
||||
@ -110,3 +118,15 @@ xiwon.url=http://openapi.xiwon588.com/
|
||||
udp.port=51236
|
||||
#上传的图片的url前缀
|
||||
upload.image.url.prefix=http://192.168.34.221:9111/image/
|
||||
|
||||
|
||||
spring.mail.host=smtp.qq.com
|
||||
spring.mail.username=smartiots@qq.com
|
||||
spring.mail.password=fnrruelrccqaeaefx0
|
||||
spring.mail.protocol=smtps
|
||||
spring.mail.default-encoding=UTF-8
|
||||
spring.mail.properties.default-encoding=UTF-8
|
||||
spring.mail.properties.mail.smtp.port=465
|
||||
spring.mail.properties.mail.smtp.auth=true
|
||||
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||
spring.mail.properties.mail.smtp.starttls.required=true
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# 环境选择
|
||||
spring.profiles.active=dev
|
||||
spring.profiles.active=gsx-other-env-show
|
||||
# 国际化配置
|
||||
spring.messages.basename=i18n/messages
|
||||
spring.messages.encoding=utf-8
|
||||
|
||||
BIN
src/main/resources/lib/wflow-server-1.0-SNAPSHOT.jar
Normal file
BIN
src/main/resources/lib/wflow-server-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user