.....
This commit is contained in:
parent
f9dbd1956d
commit
ac9fb347b4
7
pom.xml
7
pom.xml
@ -209,6 +209,13 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 整合 Elasticsearch -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- 测试用, 配置devtools实现热部署 -->
|
<!-- 测试用, 配置devtools实现热部署 -->
|
||||||
<!--
|
<!--
|
||||||
会导致ClassCastException异常
|
会导致ClassCastException异常
|
||||||
|
|||||||
@ -48,6 +48,8 @@ public class ShiroService {
|
|||||||
filterChainDefinitionMap.put("/favicon.ico", "anon");
|
filterChainDefinitionMap.put("/favicon.ico", "anon");
|
||||||
filterChainDefinitionMap.put("/verificationCode", "anon");
|
filterChainDefinitionMap.put("/verificationCode", "anon");
|
||||||
|
|
||||||
|
filterChainDefinitionMap.put("/test/**", "anon");
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/api/**" ,"anon"); // 前端接口
|
filterChainDefinitionMap.put("/api/**" ,"anon"); // 前端接口
|
||||||
filterChainDefinitionMap.put("/", "anon"); // 网站首页
|
filterChainDefinitionMap.put("/", "anon"); // 网站首页
|
||||||
// 静态资源按后缀排除
|
// 静态资源按后缀排除
|
||||||
|
|||||||
@ -133,7 +133,7 @@ public class SystemController{
|
|||||||
return ResultUtil.error("用户名或者密码错误!");
|
return ResultUtil.error("用户名或者密码错误!");
|
||||||
}
|
}
|
||||||
//更新最后登录时间
|
//更新最后登录时间
|
||||||
userService.updateLastLoginTime((User) SecurityUtils.getSubject().getPrincipal());
|
// userService.updateLastLoginTime((User) SecurityUtils.getSubject().getPrincipal());
|
||||||
return ResultUtil.success("登录成功!");
|
return ResultUtil.success("登录成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
126
src/main/java/com/nbclass/szxgl/config/BackDataBaseConfig.java
Normal file
126
src/main/java/com/nbclass/szxgl/config/BackDataBaseConfig.java
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName
|
||||||
|
* @Description: 后台数据源配置类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "back.datasource.druid")
|
||||||
|
@MapperScan(basePackages = BackDataBaseConfig.PACKAGE, sqlSessionFactoryRef = "backSqlSessionFactory")
|
||||||
|
public class BackDataBaseConfig {
|
||||||
|
/**
|
||||||
|
* dao层的包路径
|
||||||
|
*/
|
||||||
|
static final String PACKAGE = "com.nbclass.szxgl.mapper2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mapper文件的相对路径
|
||||||
|
*/
|
||||||
|
private static final String MAPPER_LOCATION = "classpath*:mapper/szxgl/*.xml";
|
||||||
|
|
||||||
|
@Value("${back.datasource.druid.filters}")
|
||||||
|
private String filters;
|
||||||
|
@Value("${back.datasource.druid.driverClassName}")
|
||||||
|
private String url;
|
||||||
|
@Value("${back.datasource.druid.url}")
|
||||||
|
private String username;
|
||||||
|
@Value("${back.datasource.druid.username}")
|
||||||
|
private String password;
|
||||||
|
@Value("${back.datasource.druid.password}")
|
||||||
|
private String driverClassName;
|
||||||
|
@Value("${back.datasource.druid.initialSize}")
|
||||||
|
private int initialSize;
|
||||||
|
@Value("${back.datasource.druid.minIdle}")
|
||||||
|
private int minIdle;
|
||||||
|
@Value("${back.datasource.druid.maxActive}")
|
||||||
|
private int maxActive;
|
||||||
|
@Value("${back.datasource.druid.maxWait}")
|
||||||
|
private long maxWait;
|
||||||
|
@Value("${back.datasource.druid.timeBetweenEvictionRunsMillis}")
|
||||||
|
private long timeBetweenEvictionRunsMillis;
|
||||||
|
@Value("${back.datasource.druid.minEvictableIdleTimeMillis}")
|
||||||
|
private long minEvictableIdleTimeMillis;
|
||||||
|
@Value("${back.datasource.druid.validationQuery}")
|
||||||
|
private String validationQuery;
|
||||||
|
@Value("${back.datasource.druid.testWhileIdle}")
|
||||||
|
private boolean testWhileIdle;
|
||||||
|
@Value("${back.datasource.druid.testOnBorrow}")
|
||||||
|
private boolean testOnBorrow;
|
||||||
|
@Value("${back.datasource.druid.testOnReturn}")
|
||||||
|
private boolean testOnReturn;
|
||||||
|
@Value("${back.datasource.druid.poolPreparedStatements}")
|
||||||
|
private boolean poolPreparedStatements;
|
||||||
|
@Value("${back.datasource.druid.maxPoolPreparedStatementPerConnectionSize}")
|
||||||
|
private int maxPoolPreparedStatementPerConnectionSize;
|
||||||
|
|
||||||
|
|
||||||
|
@Bean(name = "backDataSource")
|
||||||
|
public DataSource backDataSource() throws SQLException {
|
||||||
|
DruidDataSource druid = new DruidDataSource();
|
||||||
|
// 监控统计拦截的filters
|
||||||
|
druid.setFilters(filters);
|
||||||
|
|
||||||
|
// 配置基本属性
|
||||||
|
druid.setDriverClassName(driverClassName);
|
||||||
|
druid.setUsername(username);
|
||||||
|
druid.setPassword(password);
|
||||||
|
druid.setUrl(url);
|
||||||
|
|
||||||
|
//初始化时建立物理连接的个数
|
||||||
|
druid.setInitialSize(initialSize);
|
||||||
|
//最大连接池数量
|
||||||
|
druid.setMaxActive(maxActive);
|
||||||
|
//最小连接池数量
|
||||||
|
druid.setMinIdle(minIdle);
|
||||||
|
//获取连接时最大等待时间,单位毫秒。
|
||||||
|
druid.setMaxWait(maxWait);
|
||||||
|
//间隔多久进行一次检测,检测需要关闭的空闲连接
|
||||||
|
druid.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
||||||
|
//一个连接在池中最小生存的时间
|
||||||
|
druid.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
||||||
|
//用来检测连接是否有效的sql
|
||||||
|
druid.setValidationQuery(validationQuery);
|
||||||
|
//建议配置为true,不影响性能,并且保证安全性。
|
||||||
|
druid.setTestWhileIdle(testWhileIdle);
|
||||||
|
//申请连接时执行validationQuery检测连接是否有效
|
||||||
|
druid.setTestOnBorrow(testOnBorrow);
|
||||||
|
druid.setTestOnReturn(testOnReturn);
|
||||||
|
//是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
|
||||||
|
druid.setPoolPreparedStatements(poolPreparedStatements);
|
||||||
|
// 打开PSCache时,指定每个连接上PSCache的大小
|
||||||
|
druid.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|
||||||
|
return druid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "backTransactionManager")
|
||||||
|
public DataSourceTransactionManager backTransactionManager() throws SQLException {
|
||||||
|
return new DataSourceTransactionManager(backDataSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "backSqlSessionFactory")
|
||||||
|
public SqlSessionFactory backSqlSessionFactory(@Qualifier("backDataSource") DataSource backDataSource) throws Exception {
|
||||||
|
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||||
|
sessionFactory.setDataSource(backDataSource);
|
||||||
|
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
|
||||||
|
.getResources(BackDataBaseConfig.MAPPER_LOCATION));
|
||||||
|
|
||||||
|
return sessionFactory.getObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/main/java/com/nbclass/szxgl/config/DataSourceConfig.java
Normal file
47
src/main/java/com/nbclass/szxgl/config/DataSourceConfig.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源配置
|
||||||
|
*/
|
||||||
|
//@Configuration
|
||||||
|
//public class DataSourceConfig {
|
||||||
|
//
|
||||||
|
// //主数据源配置 ds1数据源
|
||||||
|
// @Primary
|
||||||
|
// @Bean(name = "ds1DataSourceProperties")
|
||||||
|
// @ConfigurationProperties(prefix = "fastdep.datasource.test")
|
||||||
|
// public DataSourceProperties ds1DataSourceProperties() {
|
||||||
|
// return new DataSourceProperties();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //主数据源 ds1数据源
|
||||||
|
// @Primary
|
||||||
|
// @Bean(name = "ds1DataSource")
|
||||||
|
// public DataSource ds1DataSource(@Qualifier("ds1DataSourceProperties") DataSourceProperties dataSourceProperties) {
|
||||||
|
//
|
||||||
|
// return dataSourceProperties.initializeDataSourceBuilder().build();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //第二个ds2数据源配置
|
||||||
|
// @Bean(name = "ds2DataSourceProperties")
|
||||||
|
// @ConfigurationProperties(prefix = "fastdep.datasource.test2")
|
||||||
|
// public DataSourceProperties ds2DataSourceProperties() {
|
||||||
|
// return new DataSourceProperties();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //第二个ds2数据源
|
||||||
|
// @Bean("ds2DataSource")
|
||||||
|
// public DataSource ds2DataSource(@Qualifier("ds2DataSourceProperties") DataSourceProperties dataSourceProperties) {
|
||||||
|
// return dataSourceProperties.initializeDataSourceBuilder().build();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JdbcTemplate多数据源配置
|
||||||
|
* 依赖于数据源配置
|
||||||
|
*
|
||||||
|
* @see DataSourceConfig
|
||||||
|
*/
|
||||||
|
//@Configuration
|
||||||
|
//public class JdbcTemplateDataSourceConfig {
|
||||||
|
//
|
||||||
|
// //JdbcTemplate主数据源ds1数据源
|
||||||
|
// @Primary
|
||||||
|
// @Bean(name = "ds1JdbcTemplate")
|
||||||
|
// public JdbcTemplate ds1JdbcTemplate(@Qualifier("ds1DataSource") DataSource dataSource) {
|
||||||
|
// return new JdbcTemplate(dataSource);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //JdbcTemplate第二个ds2数据源
|
||||||
|
// @Bean(name = "ds2JdbcTemplate")
|
||||||
|
// public JdbcTemplate ds2JdbcTemplate(@Qualifier("ds2DataSource") DataSource dataSource) {
|
||||||
|
// return new JdbcTemplate(dataSource);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mybatis主数据源ds1配置
|
||||||
|
* 多数据源配置依赖数据源配置
|
||||||
|
* @see DataSourceConfig
|
||||||
|
*/
|
||||||
|
//@Configuration
|
||||||
|
//@MapperScan(basePackages ="com.nbclass.szxgl.mapper", sqlSessionTemplateRef = "ds1SqlSessionTemplate")
|
||||||
|
//public class MybatisPlusConfig4ds1 {
|
||||||
|
//
|
||||||
|
// //主数据源 ds1数据源
|
||||||
|
// @Primary
|
||||||
|
// @Bean("ds1SqlSessionFactory")
|
||||||
|
// public SqlSessionFactory ds1SqlSessionFactory(@Qualifier("ds1DataSource") DataSource dataSource) throws Exception {
|
||||||
|
// SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
|
||||||
|
// sqlSessionFactory.setDataSource(dataSource);
|
||||||
|
// sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().
|
||||||
|
// getResources("classpath*:mapper/szxgl/*.xml"));
|
||||||
|
// return sqlSessionFactory.getObject();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Primary
|
||||||
|
// @Bean(name = "ds1TransactionManager")
|
||||||
|
// public DataSourceTransactionManager ds1TransactionManager(@Qualifier("ds1DataSource") DataSource dataSource) {
|
||||||
|
// return new DataSourceTransactionManager(dataSource);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Primary
|
||||||
|
// @Bean(name = "ds1SqlSessionTemplate")
|
||||||
|
// public SqlSessionTemplate ds1SqlSessionTemplate(@Qualifier("ds1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||||
|
// return new SqlSessionTemplate(sqlSessionFactory);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mybatis 第二个ds2数据源配置
|
||||||
|
* 多数据源配置依赖数据源配置
|
||||||
|
* @see DataSourceConfig
|
||||||
|
*/
|
||||||
|
//@Configuration
|
||||||
|
//@MapperScan(basePackages ="com.nbclass.szxgl.mapper2", sqlSessionTemplateRef = "ds2SqlSessionTemplate")
|
||||||
|
//public class MybatisPlusConfig4ds2 {
|
||||||
|
//
|
||||||
|
// //ds2数据源
|
||||||
|
// @Bean("ds2SqlSessionFactory")
|
||||||
|
// public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("ds2DataSource") DataSource dataSource) throws Exception {
|
||||||
|
// SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
|
||||||
|
// sqlSessionFactory.setDataSource(dataSource);
|
||||||
|
// sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().
|
||||||
|
// getResources("classpath*:mapper/szxgl/*.xml"));
|
||||||
|
// return sqlSessionFactory.getObject();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
////事务支持
|
||||||
|
// @Bean(name = "ds2TransactionManager")
|
||||||
|
// public DataSourceTransactionManager ds2TransactionManager(@Qualifier("ds2DataSource") DataSource dataSource) {
|
||||||
|
// return new DataSourceTransactionManager(dataSource);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Bean(name = "ds2SqlSessionTemplate")
|
||||||
|
// public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("ds2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||||
|
// return new SqlSessionTemplate(sqlSessionFactory);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,123 @@
|
|||||||
|
package com.nbclass.szxgl.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
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;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 主数据源配置类
|
||||||
|
* 前缀为primary.datasource.druid的配置信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "primary.datasource.druid")
|
||||||
|
@MapperScan(basePackages = PrimaryDataBaseConfig.PACKAGE, sqlSessionFactoryRef = "primarySqlSessionFactory")
|
||||||
|
public class PrimaryDataBaseConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dao层的包路径
|
||||||
|
*/
|
||||||
|
static final String PACKAGE = "com.nbclass.szxgl.mapper";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mapper文件的相对路径
|
||||||
|
*/
|
||||||
|
private static final String MAPPER_LOCATION = "classpath*:mapper/szxgl/*.xml";
|
||||||
|
|
||||||
|
private String filters;
|
||||||
|
private String url;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String driverClassName;
|
||||||
|
private int initialSize;
|
||||||
|
private int minIdle;
|
||||||
|
private int maxActive;
|
||||||
|
private long maxWait;
|
||||||
|
private long timeBetweenEvictionRunsMillis;
|
||||||
|
private long minEvictableIdleTimeMillis;
|
||||||
|
private String validationQuery;
|
||||||
|
private boolean testWhileIdle;
|
||||||
|
private boolean testOnBorrow;
|
||||||
|
private boolean testOnReturn;
|
||||||
|
private boolean poolPreparedStatements;
|
||||||
|
private int maxPoolPreparedStatementPerConnectionSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主数据源使用@Primary注解进行标识
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Primary
|
||||||
|
@Bean(name = "primaryDataSource")
|
||||||
|
public DataSource primaryDataSource() throws SQLException {
|
||||||
|
DruidDataSource druid = new DruidDataSource();
|
||||||
|
// 监控统计拦截的filters
|
||||||
|
druid.setFilters(filters);
|
||||||
|
|
||||||
|
// 配置基本属性
|
||||||
|
druid.setDriverClassName(driverClassName);
|
||||||
|
druid.setUsername(username);
|
||||||
|
druid.setPassword(password);
|
||||||
|
druid.setUrl(url);
|
||||||
|
|
||||||
|
//初始化时建立物理连接的个数
|
||||||
|
druid.setInitialSize(initialSize);
|
||||||
|
//最大连接池数量
|
||||||
|
druid.setMaxActive(maxActive);
|
||||||
|
//最小连接池数量
|
||||||
|
druid.setMinIdle(minIdle);
|
||||||
|
//获取连接时最大等待时间,单位毫秒。
|
||||||
|
druid.setMaxWait(maxWait);
|
||||||
|
//间隔多久进行一次检测,检测需要关闭的空闲连接
|
||||||
|
druid.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
||||||
|
//一个连接在池中最小生存的时间
|
||||||
|
druid.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
||||||
|
//用来检测连接是否有效的sql
|
||||||
|
druid.setValidationQuery(validationQuery);
|
||||||
|
//建议配置为true,不影响性能,并且保证安全性。
|
||||||
|
druid.setTestWhileIdle(testWhileIdle);
|
||||||
|
//申请连接时执行validationQuery检测连接是否有效
|
||||||
|
druid.setTestOnBorrow(testOnBorrow);
|
||||||
|
druid.setTestOnReturn(testOnReturn);
|
||||||
|
//是否缓存preparedStatement,也就是PSCache,oracle设为true,mysql设为false。分库分表较多推荐设置为false
|
||||||
|
druid.setPoolPreparedStatements(poolPreparedStatements);
|
||||||
|
// 打开PSCache时,指定每个连接上PSCache的大小
|
||||||
|
druid.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|
||||||
|
|
||||||
|
return druid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建该数据源的事务管理
|
||||||
|
*/
|
||||||
|
@Primary
|
||||||
|
@Bean(name = "primaryTransactionManager")
|
||||||
|
public DataSourceTransactionManager primaryTransactionManager() throws SQLException {
|
||||||
|
return new DataSourceTransactionManager(primaryDataSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建Mybatis的连接会话工厂实例
|
||||||
|
*/
|
||||||
|
@Primary
|
||||||
|
@Bean(name = "primarySqlSessionFactory")
|
||||||
|
public SqlSessionFactory primarySqlSessionFactory(@Qualifier("primaryDataSource") DataSource primaryDataSource) throws Exception {
|
||||||
|
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||||
|
sessionFactory.setDataSource(primaryDataSource); // 设置数据源bean
|
||||||
|
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
|
||||||
|
.getResources(PrimaryDataBaseConfig.MAPPER_LOCATION)); // 设置mapper文件路径
|
||||||
|
|
||||||
|
return sessionFactory.getObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.nbclass.szxgl.controller;
|
||||||
|
|
||||||
|
import com.nbclass.szxgl.service.TestService;
|
||||||
|
import com.nbclass.util.ResultUtil;
|
||||||
|
import com.nbclass.vo.base.ResponseVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TestService testService;
|
||||||
|
|
||||||
|
@GetMapping("/getContent")
|
||||||
|
public ResponseVo getContent(){
|
||||||
|
return ResultUtil.success(testService.getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.nbclass.szxgl.controller.mobile;
|
||||||
|
|
||||||
|
import com.nbclass.system.controller.BaseController;
|
||||||
|
import com.nbclass.szxgl.mapper2.DataDictItemMapper;
|
||||||
|
import com.nbclass.szxgl.service.ElasticSearchService;
|
||||||
|
import com.nbclass.util.ResultUtil;
|
||||||
|
import com.nbclass.vo.base.ResponseVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class ElasticSearchController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ElasticSearchService elasticSearchService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataDictItemMapper dataDictItemMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全文检索
|
||||||
|
* @param tagIds 标签
|
||||||
|
* @param caseName 项目名称
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getCaseName")
|
||||||
|
public ResponseVo getCaseName(String tagIds,String caseName,Integer pageNum, Integer pageSize){
|
||||||
|
Map<String, Object> map = elasticSearchService.getList(tagIds,caseName, pageNum, pageSize);
|
||||||
|
return ResultUtil.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数模糊匹配标签
|
||||||
|
* @param tagNames
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getCaseTags")
|
||||||
|
public ResponseVo getCaseTags(String tagNames){
|
||||||
|
List<Map<String,Object>> list = dataDictItemMapper.getTagNames(tagNames);
|
||||||
|
return ResultUtil.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -278,4 +278,5 @@ public class ProjectController extends BaseController {
|
|||||||
service.updateProjectStatus(id, contractno, status);
|
service.updateProjectStatus(id, contractno, status);
|
||||||
return ResultUtil.success("success");
|
return ResultUtil.success("success");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.nbclass.exception.ParameterException;
|
|||||||
import com.nbclass.holder.SpringContextHolder;
|
import com.nbclass.holder.SpringContextHolder;
|
||||||
import com.nbclass.system.controller.BaseController;
|
import com.nbclass.system.controller.BaseController;
|
||||||
import com.nbclass.system.model.User;
|
import com.nbclass.system.model.User;
|
||||||
|
import com.nbclass.szxgl.mapper.ListTypeMapper;
|
||||||
|
import com.nbclass.szxgl.model.ListType;
|
||||||
import com.nbclass.szxgl.model.ProjectTask;
|
import com.nbclass.szxgl.model.ProjectTask;
|
||||||
import com.nbclass.szxgl.model.ProjectTaskJournal;
|
import com.nbclass.szxgl.model.ProjectTaskJournal;
|
||||||
import com.nbclass.szxgl.service.ProjectService;
|
import com.nbclass.szxgl.service.ProjectService;
|
||||||
@ -20,10 +22,8 @@ import org.springframework.beans.propertyeditors.CustomDateEditor;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -45,6 +45,9 @@ public class ProjectTaskController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ProjectTaskService projectTaskService;
|
private ProjectTaskService projectTaskService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ListTypeMapper listTypeMapper;
|
||||||
|
|
||||||
@InitBinder
|
@InitBinder
|
||||||
public void initBinder(WebDataBinder binder) {
|
public void initBinder(WebDataBinder binder) {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
@ -119,11 +122,11 @@ public class ProjectTaskController extends BaseController {
|
|||||||
|
|
||||||
@RequestMapping("add")
|
@RequestMapping("add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseVo add(@Valid ProjectTask t, Errors errors, Integer isSendMsg, String[] userIds) {
|
public ResponseVo add(@Valid ProjectTask t, Errors errors, Integer isSendMsg, String[] userIds,String listValues) {
|
||||||
if (errors.hasErrors()) {
|
if (errors.hasErrors()) {
|
||||||
return ResultUtil.error("参数验证失败");
|
return ResultUtil.error("参数验证失败");
|
||||||
}
|
}
|
||||||
projectTaskService.addProjectTask(t, isSendMsg, userIds);
|
projectTaskService.addProjectTask(t, isSendMsg, userIds,listValues);
|
||||||
return ResultUtil.success("success");
|
return ResultUtil.success("success");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,4 +198,16 @@ public class ProjectTaskController extends BaseController {
|
|||||||
projectTaskService.addProjectTaskJournal(j, speed);
|
projectTaskService.addProjectTaskJournal(j, speed);
|
||||||
return ResultUtil.success("success");
|
return ResultUtil.success("success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取下拉列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/myTask/getComboBox")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseVo getComboBox(){
|
||||||
|
List<ListType> listTypes = listTypeMapper.getComboBox();
|
||||||
|
return ResultUtil.success(listTypes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,70 +39,70 @@ public class WxWorkFilter implements Filter {
|
|||||||
throws IOException, ServletException {
|
throws IOException, ServletException {
|
||||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
response.setHeader("Cache-Control", "no-store");
|
// response.setHeader("Cache-Control", "no-store");
|
||||||
|
//
|
||||||
String httpRequestFullURL = getHttpRequestFullURL(request);
|
// String httpRequestFullURL = getHttpRequestFullURL(request);
|
||||||
String redirect_uri = ActivityConstants.qywx_api_domain + "/api/oauth?agentid="+ActivityConstants.qywx_agentid+"&redirect_uri="+httpRequestFullURL;
|
// String redirect_uri = ActivityConstants.qywx_api_domain + "/api/oauth?agentid="+ActivityConstants.qywx_agentid+"&redirect_uri="+httpRequestFullURL;
|
||||||
|
//
|
||||||
Subject subject = SecurityUtils.getSubject();
|
// Subject subject = SecurityUtils.getSubject();
|
||||||
|
//
|
||||||
// String userkey = (String) request.getSession().getAttribute(ActivityConstants.session_key_user_id);
|
// // String userkey = (String) request.getSession().getAttribute(ActivityConstants.session_key_user_id);
|
||||||
// logger.info("[企业微信授权拦截器] userkey="+userkey+", requrl: "+httpRequestFullURL);
|
// // logger.info("[企业微信授权拦截器] userkey="+userkey+", requrl: "+httpRequestFullURL);
|
||||||
|
//
|
||||||
if(subject.isAuthenticated()){ // 已登录状态
|
// if(subject.isAuthenticated()){ // 已登录状态
|
||||||
chain.doFilter(request, response);
|
// chain.doFilter(request, response);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String key = StringUtils.trimToEmpty(request.getParameter("key"));
|
// String key = StringUtils.trimToEmpty(request.getParameter("key"));
|
||||||
if("xglgg".equals(key)){ // 测试时传key绕过登录
|
// if("xglgg".equals(key)){ // 测试时传key绕过登录
|
||||||
MyUsernamePasswordToken token = new MyUsernamePasswordToken("liixi"); // 免密登录
|
// MyUsernamePasswordToken token = new MyUsernamePasswordToken("liixi"); // 免密登录
|
||||||
token.setRememberMe(true);
|
// token.setRememberMe(true);
|
||||||
try {
|
// try {
|
||||||
subject.login(token);
|
// subject.login(token);
|
||||||
} catch (AuthenticationException e) {
|
// } catch (AuthenticationException e) {
|
||||||
outPrintError(response, "该登录账号不存在,如有疑问请联系企业管理员!");
|
// outPrintError(response, "该登录账号不存在,如有疑问请联系企业管理员!");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
chain.doFilter(request, response);
|
// chain.doFilter(request, response);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
String code = request.getParameter("code");
|
// String code = request.getParameter("code");
|
||||||
if(StringUtils.isBlank(code)){
|
// if(StringUtils.isBlank(code)){
|
||||||
response.sendRedirect(redirect_uri);
|
// response.sendRedirect(redirect_uri);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String url = ActivityConstants.qywx_api_domain + "/api/oauthInfo?agentid="+ActivityConstants.qywx_agentid+"&code=" + code;
|
// String url = ActivityConstants.qywx_api_domain + "/api/oauthInfo?agentid="+ActivityConstants.qywx_agentid+"&code=" + code;
|
||||||
JSONObject result = HttpUtils.httpGet(url);
|
// JSONObject result = HttpUtils.httpGet(url);
|
||||||
if(result != null && result.getIntValue("ret") == 0 && StringUtils.isNotBlank(result.getString("userid"))
|
// if(result != null && result.getIntValue("ret") == 0 && StringUtils.isNotBlank(result.getString("userid"))
|
||||||
&& !"null".equalsIgnoreCase(result.getString("userid"))){
|
// && !"null".equalsIgnoreCase(result.getString("userid"))){
|
||||||
logger.info("企业微信授权获取到用户信息: "+result.toString());
|
// logger.info("企业微信授权获取到用户信息: "+result.toString());
|
||||||
String userid = result.getString("userid");
|
// String userid = result.getString("userid");
|
||||||
request.getSession().setAttribute(ActivityConstants.session_key_user_id, userid);
|
// request.getSession().setAttribute(ActivityConstants.session_key_user_id, userid);
|
||||||
|
//
|
||||||
// OA系统shiro登录
|
// // OA系统shiro登录
|
||||||
MyUsernamePasswordToken token = new MyUsernamePasswordToken(userid); // 免密登录
|
// MyUsernamePasswordToken token = new MyUsernamePasswordToken(userid); // 免密登录
|
||||||
token.setRememberMe(true);
|
// token.setRememberMe(true);
|
||||||
try {
|
// try {
|
||||||
subject.login(token);
|
// subject.login(token);
|
||||||
} catch (AuthenticationException e) {
|
// } catch (AuthenticationException e) {
|
||||||
outPrintError(response, "该登录账号不存在,如有疑问请联系企业管理员!");
|
// outPrintError(response, "该登录账号不存在,如有疑问请联系企业管理员!");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
if(result!=null && (result.getIntValue("errcode") == 40029 || result.getIntValue("errcode") == 40163)){
|
// if(result!=null && (result.getIntValue("errcode") == 40029 || result.getIntValue("errcode") == 40163)){
|
||||||
logger.info("授权失败, 将重新跳转到微信授权, RedirectURL : " + redirect_uri);
|
// logger.info("授权失败, 将重新跳转到微信授权, RedirectURL : " + redirect_uri);
|
||||||
redirect_uri = CommonUtils.removeParamValue(redirect_uri, "code");
|
// redirect_uri = CommonUtils.removeParamValue(redirect_uri, "code");
|
||||||
response.sendRedirect(redirect_uri);
|
// response.sendRedirect(redirect_uri);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
outPrintError(response, "微信授权失败,你可能未关注该企业号,请关注后重试!");
|
// outPrintError(response, "微信授权失败,你可能未关注该企业号,请关注后重试!");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,4 +15,6 @@ public interface ListTypeMapper extends MyMapper<ListType> {
|
|||||||
public String getListValue(@Param("listType")String listType,@Param("id")String id);
|
public String getListValue(@Param("listType")String listType,@Param("id")String id);
|
||||||
|
|
||||||
public String getAreaIdByName(@Param("areaName")String areaName);
|
public String getAreaIdByName(@Param("areaName")String areaName);
|
||||||
|
|
||||||
|
List<ListType> getComboBox();
|
||||||
}
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.nbclass.szxgl.mapper;
|
||||||
|
|
||||||
|
import com.nbclass.szxgl.model.ProjectTaskTerm;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ProjectTaskTermMapper {
|
||||||
|
|
||||||
|
void addProjectTaskTerm(ProjectTaskTerm projectTaskTerm);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.nbclass.szxgl.mapper2;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DataDictItemMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数模糊匹配标签
|
||||||
|
* @param tagNames
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> getTagNames(String tagNames);
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/nbclass/szxgl/mapper2/TestMapper.java
Normal file
13
src/main/java/com/nbclass/szxgl/mapper2/TestMapper.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.nbclass.szxgl.mapper2;
|
||||||
|
|
||||||
|
import com.nbclass.szxgl.model.Content;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TestMapper {
|
||||||
|
|
||||||
|
List<Content> getContent();
|
||||||
|
|
||||||
|
}
|
||||||
30
src/main/java/com/nbclass/szxgl/model/Content.java
Normal file
30
src/main/java/com/nbclass/szxgl/model/Content.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.nbclass.szxgl.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table(name = "content")
|
||||||
|
public class Content implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -6422276602170816740L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID, 主键,自增
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ package com.nbclass.szxgl.model;
|
|||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Table(name = "list_values")
|
@Table(name = "list_values")
|
||||||
public class ListType {
|
public class ListType {
|
||||||
@ -16,6 +17,8 @@ public class ListType {
|
|||||||
@Column(name = "list_type")
|
@Column(name = "list_type")
|
||||||
private String listType;
|
private String listType;
|
||||||
|
|
||||||
|
private List<ListType> listTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@ -46,11 +49,12 @@ public class ListType {
|
|||||||
this.listValue = listValue;
|
this.listValue = listValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ListType> getListTypes() {
|
||||||
|
return listTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListTypes(List<ListType> listTypes) {
|
||||||
|
this.listTypes = listTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -48,6 +48,12 @@ public class ProjectTaskJournal {
|
|||||||
@Column(name = "_create_user_id")
|
@Column(name = "_create_user_id")
|
||||||
private String createUserId;
|
private String createUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*素材是否有侵权风险(1、无风险 2、有风险)
|
||||||
|
*/
|
||||||
|
@Column(name = "_risk")
|
||||||
|
private Integer risk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@ -236,5 +242,11 @@ public class ProjectTaskJournal {
|
|||||||
this.createUserName = createUserName;
|
this.createUserName = createUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getRisk() {
|
||||||
|
return risk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRisk(Integer risk) {
|
||||||
|
this.risk = risk;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
25
src/main/java/com/nbclass/szxgl/model/ProjectTaskTerm.java
Normal file
25
src/main/java/com/nbclass/szxgl/model/ProjectTaskTerm.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.nbclass.szxgl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProjectTaskTerm {
|
||||||
|
|
||||||
|
private String id ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典值id
|
||||||
|
*/
|
||||||
|
private String listValuesId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工期(天)
|
||||||
|
*/
|
||||||
|
private Integer term;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.nbclass.szxgl.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ES搜索
|
||||||
|
* @author Leon
|
||||||
|
* @datetime 2020年6月1日 下午3:00:41
|
||||||
|
*/
|
||||||
|
public interface ElasticSearchService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件查询列表
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getList(String tagIds,String caseName,Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -27,7 +27,7 @@ public interface ProjectTaskService {
|
|||||||
* @param userIds
|
* @param userIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void addProjectTask(ProjectTask t, Integer isSendMsg, String[] userIds);
|
public void addProjectTask(ProjectTask t, Integer isSendMsg, String[] userIds,String listValues);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改项目任务
|
* 修改项目任务
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.nbclass.szxgl.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.nbclass.system.model.User;
|
||||||
import com.nbclass.szxgl.model.SyUsers;
|
import com.nbclass.szxgl.model.SyUsers;
|
||||||
|
|
||||||
public interface SyUsersService {
|
public interface SyUsersService {
|
||||||
@ -15,4 +16,5 @@ public interface SyUsersService {
|
|||||||
public SyUsers selectByUsername(String username);
|
public SyUsers selectByUsername(String username);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/main/java/com/nbclass/szxgl/service/TestService.java
Normal file
11
src/main/java/com/nbclass/szxgl/service/TestService.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.nbclass.szxgl.service;
|
||||||
|
|
||||||
|
import com.nbclass.szxgl.model.Content;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TestService {
|
||||||
|
|
||||||
|
List<Content> getContent();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.nbclass.szxgl.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.nbclass.szxgl.model.Content;
|
||||||
|
import com.nbclass.szxgl.service.ElasticSearchService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.index.query.*;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ElasticSearchServiceImpl implements ElasticSearchService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getList(String tagIds,String caseName,Integer pageNum, Integer pageSize) {
|
||||||
|
// 封装Map参数返回
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
// 选择标签或来源过滤时,从数据库查询记录
|
||||||
|
/*if(StringUtils.isNotBlank(tagIds) || StringUtils.isNotBlank(sourceIds)) {
|
||||||
|
return getListByMySQL(pageNum, pageSize, type, keyWord, tagIds, sourceIds);
|
||||||
|
}*/
|
||||||
|
if(StringUtils.isNoneBlank(tagIds) || StringUtils.isNoneBlank(caseName)){
|
||||||
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||||
|
// 分页采用简单的from + size分页,适用数据量小的,了解更多分页方式可自行查阅资料
|
||||||
|
searchSourceBuilder.from((pageNum - 1) * pageSize); // 从0开始
|
||||||
|
searchSourceBuilder.size(pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||||
|
boolQueryBuilder.must(QueryBuilders.termQuery("release", 2));
|
||||||
|
|
||||||
|
|
||||||
|
// if(StringUtils.isNoneBlank(tagIds) && StringUtils.isNoneBlank(caseName)){
|
||||||
|
// boolQueryBuilder.must(QueryBuilders.termQuery("release", 2));
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (StringUtils.isNoneBlank(tagIds)){
|
||||||
|
List<String> list = Arrays.asList(tagIds.split(","));
|
||||||
|
for(String tagId:list) {
|
||||||
|
boolQueryBuilder.must(QueryBuilders.termQuery("tagList.tid", tagId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(StringUtils.isNoneBlank(caseName)){
|
||||||
|
BoolQueryBuilder keywordQuery = QueryBuilders.boolQuery();
|
||||||
|
keywordQuery.must(QueryBuilders.matchQuery("title", caseName)).boost(2F);
|
||||||
|
boolQueryBuilder.should(keywordQuery);
|
||||||
|
}else {
|
||||||
|
// 排序,根据点赞数倒叙
|
||||||
|
searchSourceBuilder.sort("praiseno", SortOrder.DESC);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchSourceBuilder.query(boolQueryBuilder);
|
||||||
|
|
||||||
|
// SearchRequest
|
||||||
|
SearchRequest searchRequest = new SearchRequest();
|
||||||
|
searchRequest.source(searchSourceBuilder);
|
||||||
|
// 查询ES
|
||||||
|
SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = searchResponse.getHits();
|
||||||
|
// 获取总数
|
||||||
|
Long total = hits.getTotalHits().value;
|
||||||
|
// 遍历封装列表对象
|
||||||
|
List<Content> dataList = new ArrayList<>();
|
||||||
|
SearchHit[] searchHits = hits.getHits();
|
||||||
|
for (SearchHit searchHit : searchHits) {
|
||||||
|
Content entity = JSON.parseObject(searchHit.getSourceAsString(), Content.class);
|
||||||
|
dataList.add(entity);
|
||||||
|
System.out.println(searchHit.getSourceAsString());
|
||||||
|
}
|
||||||
|
result.put("total", total); // 总记录数
|
||||||
|
result.put("rows", dataList); // 数据体
|
||||||
|
int totalPage = (int)(total % pageSize==0 ? total/pageSize : total/pageSize+1);
|
||||||
|
result.put("totalPage", totalPage); // 总页数
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("从es查询数据列表异常", e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
package com.nbclass.szxgl.service.impl;
|
package com.nbclass.szxgl.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.nbclass.exception.ParameterException;
|
import com.nbclass.exception.ParameterException;
|
||||||
import com.nbclass.exception.ServiceException;
|
import com.nbclass.exception.ServiceException;
|
||||||
import com.nbclass.system.model.User;
|
import com.nbclass.system.model.User;
|
||||||
@ -48,6 +50,9 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|||||||
@Resource
|
@Resource
|
||||||
ProjectService projectService;
|
ProjectService projectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProjectTaskTermMapper projectTaskTermMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteProjectTask(String projectId, String[] ids) {
|
public boolean deleteProjectTask(String projectId, String[] ids) {
|
||||||
@ -79,7 +84,7 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void addProjectTask(ProjectTask t, Integer isSendMsg, String[] userIds) {
|
public void addProjectTask(ProjectTask t, Integer isSendMsg, String[] userIds,String listValues) {
|
||||||
if(t.getStartTime().getTime() > t.getEndTime().getTime()) {
|
if(t.getStartTime().getTime() > t.getEndTime().getTime()) {
|
||||||
throw new ParameterException("项目任务时间范围不对!");
|
throw new ParameterException("项目任务时间范围不对!");
|
||||||
}
|
}
|
||||||
@ -98,6 +103,16 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|||||||
t.setNotify((short) 0);//默认0,生产环境改为1
|
t.setNotify((short) 0);//默认0,生产环境改为1
|
||||||
projectTaskMapper.insert(t);
|
projectTaskMapper.insert(t);
|
||||||
|
|
||||||
|
JSONArray jsonArray = JSONObject.parseArray(listValues);
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
//添加工期信息
|
||||||
|
ProjectTaskTerm projectTaskTerm = jsonArray.getObject(i, ProjectTaskTerm.class);
|
||||||
|
projectTaskTerm.setProjectId(t.getId());
|
||||||
|
projectTaskTerm.setId(UUIDUtil.uuid());
|
||||||
|
projectTaskTermMapper.addProjectTaskTerm(projectTaskTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 等待保存的对象集合
|
// 等待保存的对象集合
|
||||||
List<ProjectTaskUser> c = new ArrayList<ProjectTaskUser>();
|
List<ProjectTaskUser> c = new ArrayList<ProjectTaskUser>();
|
||||||
Set<String> sendIds = new HashSet<String>();// 需要发送消息提醒的用户
|
Set<String> sendIds = new HashSet<String>();// 需要发送消息提醒的用户
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.nbclass.szxgl.service.impl;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import com.nbclass.system.model.User;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.nbclass.szxgl.mapper.QywxUserMapper;
|
import com.nbclass.szxgl.mapper.QywxUserMapper;
|
||||||
@ -25,6 +26,4 @@ public class SyUsersServiceImpl implements SyUsersService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.nbclass.szxgl.service.impl;
|
||||||
|
|
||||||
|
import com.nbclass.szxgl.mapper2.TestMapper;
|
||||||
|
import com.nbclass.szxgl.model.Content;
|
||||||
|
import com.nbclass.szxgl.service.TestService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TestServiceImpl implements TestService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TestMapper testMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Content> getContent() {
|
||||||
|
return testMapper.getContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
package com.nbclass.util;
|
package com.nbclass.util;
|
||||||
|
|
||||||
|
import com.nbclass.system.model.User;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
@ -774,4 +776,5 @@ public class BCrypt {
|
|||||||
ret |= hashed_bytes[i] ^ try_bytes[i];
|
ret |= hashed_bytes[i] ^ try_bytes[i];
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
package com.nbclass.util;
|
package com.nbclass.util;
|
||||||
|
|
||||||
|
import org.apache.shiro.codec.Base64;
|
||||||
|
import org.apache.shiro.codec.Hex;
|
||||||
|
import org.apache.shiro.crypto.AesCipherService;
|
||||||
import org.apache.shiro.crypto.RandomNumberGenerator;
|
import org.apache.shiro.crypto.RandomNumberGenerator;
|
||||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||||
|
import org.apache.shiro.crypto.hash.Md5Hash;
|
||||||
import org.apache.shiro.crypto.hash.SimpleHash;
|
import org.apache.shiro.crypto.hash.SimpleHash;
|
||||||
import org.apache.shiro.util.ByteSource;
|
import org.apache.shiro.util.ByteSource;
|
||||||
|
|
||||||
import com.nbclass.system.model.User;
|
import com.nbclass.system.model.User;
|
||||||
|
|
||||||
|
import java.security.Key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码加密
|
* 密码加密
|
||||||
* @author Leon
|
* @author Leon
|
||||||
@ -53,11 +59,20 @@ public class PasswordHelper {
|
|||||||
user.setUsername("admin");
|
user.setUsername("admin");
|
||||||
user.setPassword("szxgl.com");
|
user.setPassword("szxgl.com");
|
||||||
encryptPassword(user);
|
encryptPassword(user);
|
||||||
|
|
||||||
System.out.println("salt="+user.getSalt());
|
System.out.println("salt="+user.getSalt());
|
||||||
System.out.println("password="+user.getPassword());
|
System.out.println("password="+user.getPassword());
|
||||||
|
|
||||||
String pwd1 = encryptPwdByBCrypt("123456");
|
String pwd1 = encryptPwdByBCrypt("123456");
|
||||||
boolean result = checkPwdByBCrypt("123456", pwd1);
|
boolean result = checkPwdByBCrypt("123456", pwd1);
|
||||||
System.out.println("pwd1="+pwd1+", result="+result);
|
System.out.println("pwd1="+pwd1+", result="+result);
|
||||||
|
|
||||||
|
String hashAlgorithmName = "MD5";//加密方式
|
||||||
|
Object crdentials = "123456";//密码原值
|
||||||
|
Object salt = null;//盐值
|
||||||
|
int hashIterations = 2;//加密1024次
|
||||||
|
Object result2 = new SimpleHash(hashAlgorithmName,crdentials,salt,hashIterations);
|
||||||
|
System.out.println(result2);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,23 +23,20 @@ import java.sql.PreparedStatement;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.Vector;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.nbclass.szxgl.model.ProjectTaskTerm;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.commons.codec.digest.UnixCrypt;
|
import org.apache.commons.codec.digest.UnixCrypt;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具类
|
* 工具类
|
||||||
@ -1217,6 +1214,25 @@ public class Utility implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
Map<String, Object> map2 = new HashMap<>();
|
||||||
|
map.put("402880817dfaaae1017dfaac17ee0010","主kv");
|
||||||
|
map.put("402880817dfaaae1017dfaac17ee0011","海报");
|
||||||
|
map.put("402880817dfaaae1017dfaac17ee0012","长图");
|
||||||
|
String s2 = "[{\"listValuesId\": 244,\"term\": \"1\"},{\"listValuesId\": 245,\"term\": \"3\"}]";
|
||||||
|
System.out.println(s2);
|
||||||
|
System.out.println(map);
|
||||||
|
String s = JSONObject.toJSONString(map);
|
||||||
|
System.out.println(s);
|
||||||
|
//List<String> list = Arrays.asList(s.split(","));
|
||||||
|
JSONArray jsonArray = JSONObject.parseArray(s2);
|
||||||
|
System.out.println(jsonArray);
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
ProjectTaskTerm projectTaskTerm = jsonArray.getObject(i, ProjectTaskTerm.class);
|
||||||
|
projectTaskTerm.setProjectId(UUIDUtil.uuid());
|
||||||
|
projectTaskTerm.setId(UUIDUtil.uuid());
|
||||||
|
System.out.println(projectTaskTerm);
|
||||||
|
}
|
||||||
System.out.println(getDouble2(2.31468d));
|
System.out.println(getDouble2(2.31468d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,37 +1,17 @@
|
|||||||
spring:
|
spring:
|
||||||
# 数据库配置
|
# 数据库配置
|
||||||
datasource:
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
# url: jdbc:mysql://39.108.110.167:13376/xgl_oa?autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
# username: root
|
||||||
url: jdbc:mysql://120.25.121.117:3306/xgl_oa?autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
|
# password: 'szxgl@2001B'
|
||||||
username: root
|
#
|
||||||
password: 'szxgl@2001B'
|
# url2: jdbc:mysql://39.108.110.167:13376/xgl_cases?autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
|
||||||
druid:
|
# username2: root
|
||||||
initial-size: 3
|
# password2: 'szxgl@2001B'
|
||||||
min-idle: 1
|
|
||||||
max-active: 500
|
|
||||||
max-wait: 60000 # 获取连接等待超时的时间
|
|
||||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
test-while-idle: true # 申请连接的时候检测, 建议配置为true,不影响性能
|
|
||||||
test-on-borrow: false # 申请连接时执行validationQuery检测连接是否有效
|
|
||||||
test-on-return: false # 归还连接时执行validationQuery检测连接是否有效
|
|
||||||
validation-query: SELECT 1
|
|
||||||
log-abandoned: true # 关闭abanded连接时输出错误日志
|
|
||||||
remove-abandoned: false # 是否开启连接泄漏监测,对性能会有一些影响,建议怀疑存在泄漏之后再打开
|
|
||||||
remove-abandoned-timeout: 1800 # 1800秒,也就是30分钟
|
|
||||||
filters: stat, wall
|
|
||||||
web-stat-filter:
|
|
||||||
exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
|
|
||||||
stat-view-servlet:
|
|
||||||
enabled: true
|
|
||||||
url-pattern: /druid/*
|
|
||||||
login-username: admin
|
|
||||||
login-password: szxgl.com
|
|
||||||
# Redis配置(springboot2.x版本中默认客户端是用lettuce实现的)
|
# Redis配置(springboot2.x版本中默认客户端是用lettuce实现的)
|
||||||
redis:
|
redis:
|
||||||
database: 0 # Redis数据库索引,默认为0
|
database: 0 # Redis数据库索引,默认为0
|
||||||
host: 120.25.121.117
|
host: 39.108.110.167
|
||||||
port: 8266
|
port: 8266
|
||||||
password: 'Qiween@4531871'
|
password: 'Qiween@4531871'
|
||||||
#timeout: 5000ms # 连接超时时间(毫秒)
|
#timeout: 5000ms # 连接超时时间(毫秒)
|
||||||
@ -44,4 +24,78 @@ spring:
|
|||||||
max-idle: 8 # 连接池中的最大空闲连接
|
max-idle: 8 # 连接池中的最大空闲连接
|
||||||
min-idle: 1 # 连接池中的最小空闲连接
|
min-idle: 1 # 连接池中的最小空闲连接
|
||||||
|
|
||||||
|
data:
|
||||||
|
elasticsearch:
|
||||||
|
repositories:
|
||||||
|
enabled: true # 开启 Elasticsearch仓库(默认值:true)
|
||||||
|
client:
|
||||||
|
reactive:
|
||||||
|
endpoints: 39.108.110.167:9200
|
||||||
|
connection-timeout: 5000
|
||||||
|
socket-timeout: 5000
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
#使用druid连接池
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
# 自定义的主数据源配置信息
|
||||||
|
primary:
|
||||||
|
datasource:
|
||||||
|
#druid相关配置
|
||||||
|
druid:
|
||||||
|
#监控统计拦截的filters
|
||||||
|
filters: stat
|
||||||
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
|
#配置基本属性
|
||||||
|
url: jdbc:mysql://39.108.110.167:13376/xgl_oa?autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
|
||||||
|
username: root
|
||||||
|
password: 'szxgl@2001B'
|
||||||
|
#配置初始化大小/最小/最大
|
||||||
|
initialSize: 1
|
||||||
|
minIdle: 1
|
||||||
|
maxActive: 10
|
||||||
|
#获取连接等待超时时间
|
||||||
|
maxWait: 60000
|
||||||
|
#间隔多久进行一次检测,检测需要关闭的空闲连接
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
#一个连接在池中最小生存的时间
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
validationQuery: SELECT 'x'
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
|
||||||
|
poolPreparedStatements: false
|
||||||
|
maxPoolPreparedStatementPerConnectionSize: 20
|
||||||
|
# 自定义的从数据源配置信息
|
||||||
|
back:
|
||||||
|
datasource:
|
||||||
|
#druid相关配置
|
||||||
|
druid:
|
||||||
|
#监控统计拦截的filters
|
||||||
|
filters: stat
|
||||||
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
|
#配置基本属性
|
||||||
|
url: jdbc:mysql://39.108.110.167:13376/xgl_cases?autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
|
||||||
|
username: root
|
||||||
|
password: 'szxgl@2001B'
|
||||||
|
#配置初始化大小/最小/最大
|
||||||
|
initialSize: 1
|
||||||
|
minIdle: 1
|
||||||
|
maxActive: 10
|
||||||
|
#获取连接等待超时时间
|
||||||
|
maxWait: 60000
|
||||||
|
#间隔多久进行一次检测,检测需要关闭的空闲连接
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
#一个连接在池中最小生存的时间
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
validationQuery: SELECT 'x'
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
|
||||||
|
poolPreparedStatements: false
|
||||||
|
maxPoolPreparedStatementPerConnectionSize: 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.nbclass.szxgl.mapper.ListTypeMapper">
|
<mapper namespace="com.nbclass.szxgl.mapper.ListTypeMapper">
|
||||||
<!--<resultMap id="BaseResultMap" type="com.nbclass.szxgl.model.ListType">-->
|
<resultMap id="BaseResultMap" type="com.nbclass.szxgl.model.ListType">
|
||||||
<!--<id column="id" jdbcType="CHAR" property="id" />-->
|
<id column="id" jdbcType="CHAR" property="id" />
|
||||||
<!--<result column="_list_type" jdbcType="VARCHAR" property="" />-->
|
<result column="list_type" jdbcType="VARCHAR" property="listType" />
|
||||||
<!--<result column="_list_value" jdbcType="VARCHAR" property="list_value" />-->
|
<result column="list_value" jdbcType="VARCHAR" property="listValue" />
|
||||||
<!--</resultMap> -->
|
<collection property="listTypes" ofType="com.nbclass.szxgl.model.ListType" column="id" select="getComboBoxPid">
|
||||||
|
<id column="id" jdbcType="CHAR" property="id" />
|
||||||
|
<result column="list_type" jdbcType="VARCHAR" property="listType" />
|
||||||
|
<result column="list_value" jdbcType="VARCHAR" property="listValue" />
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="getList" resultType="com.nbclass.szxgl.model.ListType">
|
<select id="getList" resultType="com.nbclass.szxgl.model.ListType">
|
||||||
SELECT * FROM list_values lv WHERE list_type = #{listType}
|
SELECT * FROM list_values lv WHERE list_type = #{listType}
|
||||||
@ -18,4 +23,13 @@
|
|||||||
<select id="getAreaIdByName" resultType="string">
|
<select id="getAreaIdByName" resultType="string">
|
||||||
SELECT id FROM list_values WHERE list_value = #{areaName}
|
SELECT id FROM list_values WHERE list_value = #{areaName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getComboBox" resultMap="BaseResultMap">
|
||||||
|
select * from list_values WHERE parent_id = 0 and parent_id !='' and parent_id is not null
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getComboBoxPid" resultMap="BaseResultMap">
|
||||||
|
select * from list_values WHERE parent_id = #{id} and parent_id !='' and parent_id is not null
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
22
src/main/resources/mapper/szxgl/ProjectTaskTermMapper.xml
Normal file
22
src/main/resources/mapper/szxgl/ProjectTaskTermMapper.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?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.nbclass.szxgl.mapper.ProjectTaskTermMapper">
|
||||||
|
|
||||||
|
<insert id="addProjectTaskTerm">
|
||||||
|
insert into project_task_term
|
||||||
|
(
|
||||||
|
id,
|
||||||
|
project_id,
|
||||||
|
list_values_id,
|
||||||
|
term
|
||||||
|
)
|
||||||
|
values
|
||||||
|
(
|
||||||
|
#{id},
|
||||||
|
#{projectId},
|
||||||
|
#{listValuesId},
|
||||||
|
#{term}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
9
src/main/resources/mapper/szxgl/TestMapper.xml
Normal file
9
src/main/resources/mapper/szxgl/TestMapper.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?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.nbclass.szxgl.mapper2.TestMapper">
|
||||||
|
|
||||||
|
<select id="getContent" resultType="com.nbclass.szxgl.model.Content">
|
||||||
|
select * from content
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
9
src/main/resources/mapper/szxgl/dataDictItemMapper.xml
Normal file
9
src/main/resources/mapper/szxgl/dataDictItemMapper.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?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.nbclass.szxgl.mapper2.DataDictItemMapper">
|
||||||
|
|
||||||
|
<select id="getTagNames" resultType="java.util.Map">
|
||||||
|
select id,value from data_dict_item where dictid = 25 and value like concat('%',#{tagNames},'%')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
0
tmlog0.log
Normal file
0
tmlog0.log
Normal file
Loading…
Reference in New Issue
Block a user