Pre Merge pull request !52 from nzdm/master
commit
3a6552a0a6
3
pom.xml
3
pom.xml
|
|
@ -19,6 +19,9 @@
|
|||
<module>yudao-module-pay</module>
|
||||
<module>yudao-module-report</module>
|
||||
<module>yudao-module-mp</module>
|
||||
<module>yudao-module-market</module>
|
||||
<module>yudao-module-market/yudao-module-market-api</module>
|
||||
<module>yudao-module-market/yudao-module-market-biz</module>
|
||||
</modules>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<dynamic-datasource.version>3.6.1</dynamic-datasource.version>
|
||||
<mybatis-plus-join-boot-starter.version>1.4.5</mybatis-plus-join-boot-starter.version>
|
||||
<redisson.version>3.18.0</redisson.version>
|
||||
<clickhouse.version>0.3.2</clickhouse.version>
|
||||
<dm8.jdbc.version>8.1.2.141</dm8.jdbc.version>
|
||||
<!-- RPC 相关 -->
|
||||
<!-- Config 配置中心相关 -->
|
||||
|
|
@ -287,6 +288,24 @@
|
|||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-clickhouse</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>${redisson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ru.yandex.clickhouse</groupId>
|
||||
<artifactId>clickhouse-jdbc</artifactId>
|
||||
<version>${clickhouse.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<module>yudao-spring-boot-starter-banner</module>
|
||||
<module>yudao-spring-boot-starter-mybatis</module>
|
||||
<module>yudao-spring-boot-starter-redis</module>
|
||||
<module>yudao-spring-boot-starter-clickhouse</module>
|
||||
<module>yudao-spring-boot-starter-web</module>
|
||||
<module>yudao-spring-boot-starter-security</module>
|
||||
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
<module>yudao-spring-boot-starter-mq</module>
|
||||
<module>yudao-spring-boot-starter-rpc</module>
|
||||
|
||||
|
||||
<module>yudao-spring-boot-starter-excel</module>
|
||||
<module>yudao-spring-boot-starter-test</module>
|
||||
|
||||
|
|
@ -44,6 +46,7 @@
|
|||
<module>yudao-spring-boot-starter-flowable</module>
|
||||
<module>yudao-spring-boot-starter-captcha</module>
|
||||
<module>yudao-spring-boot-starter-desensitize</module>
|
||||
<module>yudao-spring-boot-starter-clickhouse</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>yudao-framework</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yudao-spring-boot-starter-clickhouse</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>验证码拓展
|
||||
1. springBoot集成clickhouse数据源
|
||||
</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <groupId>com.clickhouse</groupId>-->
|
||||
<groupId>ru.yandex.clickhouse</groupId>
|
||||
<artifactId>clickhouse-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector;
|
||||
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.enums.SqlMethodDiv;
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.methods.DeleteClickHouse;
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.methods.UpdateByIdClickHouse;
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.methods.UpdateClickHouse;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 注册方法
|
||||
*
|
||||
* @author coder
|
||||
*/
|
||||
public class ClickHouseSqlInjector extends DefaultSqlInjector {
|
||||
|
||||
@Override
|
||||
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
|
||||
/**
|
||||
* 这里很重要,先要通过父类方法,获取到原有的集合,不然会自带的通用方法会失效的
|
||||
*/
|
||||
List<AbstractMethod> methodList = super.getMethodList(mapperClass,tableInfo);
|
||||
/***
|
||||
* 添加自定义方法类
|
||||
*/
|
||||
methodList.add(new UpdateByIdClickHouse(SqlMethodDiv.UPDATE_BY_ID.getMethod()));
|
||||
methodList.add(new UpdateClickHouse(SqlMethodDiv.UPDATE.getMethod()));
|
||||
methodList.add(new DeleteClickHouse(SqlMethodDiv.DELETE_BY_ID.getMethod()));
|
||||
return methodList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.config;//package com.w3.framework.clickhouse.config;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//
|
||||
///**
|
||||
// * jdbc基本配置参数
|
||||
// */
|
||||
//@ConfigurationProperties(prefix = "spring.datasource.click")
|
||||
//@Data
|
||||
//public class CkProperties {
|
||||
//
|
||||
// public String address;
|
||||
//
|
||||
// public String username;
|
||||
//
|
||||
// public String password;
|
||||
//
|
||||
// public String dbName;
|
||||
//
|
||||
// public int socketTimeout;
|
||||
//
|
||||
// private String driverClassName;
|
||||
//
|
||||
// private String url;
|
||||
//
|
||||
// private int initialSize;
|
||||
//
|
||||
// private int maxActive;
|
||||
//
|
||||
// private int minIdle;
|
||||
//
|
||||
// private int maxWait;
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.config;//package com.w3.framework.clickhouse.config;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import ru.yandex.clickhouse.ClickHouseDataSource;
|
||||
//import ru.yandex.clickhouse.settings.ClickHouseProperties;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @desc ClickHouse基本配置参数
|
||||
// * SQL方式执行
|
||||
// */
|
||||
//@AutoConfiguration
|
||||
//@EnableConfigurationProperties({CkProperties.class})
|
||||
//@Data
|
||||
//public class ClickHouseConfig {
|
||||
//
|
||||
//// private static ClickHouseDataSource clickHouseDataSource;
|
||||
//
|
||||
// @Bean
|
||||
// public ClickHouseDataSource clickHouseDataSource(CkProperties ckProperties) {
|
||||
// ClickHouseProperties properties = new ClickHouseProperties();
|
||||
// properties.setUser(ckProperties.username);
|
||||
// properties.setPassword(ckProperties.getPassword());
|
||||
// properties.setDatabase(ckProperties.dbName);
|
||||
// properties.setSocketTimeout(ckProperties.socketTimeout);
|
||||
//// clickHouseDataSource = new ClickHouseDataSource(clickhouseProperties.address, properties);
|
||||
//// return clickHouseDataSource;
|
||||
// return new ClickHouseDataSource(ckProperties.address, properties);
|
||||
// }
|
||||
//
|
||||
//// public static List<Map<String, String>> exeSql(String sql) {
|
||||
//// System.out.println("cliockhouse 执行sql:" + sql);
|
||||
//// Connection connection = null;
|
||||
//// try {
|
||||
//// connection = clickHouseDataSource.getConnection();
|
||||
//// assert connection != null;
|
||||
//// Statement statement = connection.createStatement();
|
||||
//// ResultSet results = statement.executeQuery(sql);
|
||||
//// ResultSetMetaData rsmd = results.getMetaData();
|
||||
//// List<Map<String, String>> list = new ArrayList<>();
|
||||
//// while (results.next()) {
|
||||
//// Map<String, String> row = new HashMap<>();
|
||||
//// for (int i = 1; i <= rsmd.getColumnCount(); i++) {
|
||||
//// row.put(rsmd.getColumnName(i), results.getString(rsmd.getColumnName(i)));
|
||||
//// }
|
||||
//// list.add(row);
|
||||
//// }
|
||||
//// return list;
|
||||
//// } catch (SQLException e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
//// return null;
|
||||
//// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.enums;
|
||||
|
||||
public enum SqlMethodDiv {
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE_BY_ID("deleteByIdClickHouse", "根据ID 删除一条数据", "<script>\nALTER TABLE %s DELETE WHERE %s=#{%s}\n</script>"),
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
LOGIC_DELETE_BY_ID("deleteByIdClickHouse", "根据ID 逻辑删除一条数据", "<script>\nALTER TABLE %s UPDATE %s where %s=#{%s} %s\n</script>"),
|
||||
|
||||
/**
|
||||
* 修改 条件主键
|
||||
*/
|
||||
UPDATE_BY_ID("updateByIdClickHouse", "根据ID 选择修改数据", "<script>\nALTER TABLE %s UPDATE %s where %s=#{%s} %s\n</script>"),
|
||||
/**
|
||||
* 修改 条件主键
|
||||
*/
|
||||
UPDATE("updateClickHouse", "根据 whereEntity 条件,更新记录", "<script>\nALTER TABLE %s UPDATE %s %s %s\n</script>");
|
||||
|
||||
private final String method;
|
||||
private final String desc;
|
||||
private final String sql;
|
||||
|
||||
SqlMethodDiv(String method, String desc, String sql) {
|
||||
this.method = method;
|
||||
this.desc = desc;
|
||||
this.sql = sql;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.methods;
|
||||
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.enums.SqlMethodDiv;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
|
||||
/**
|
||||
* @author coder
|
||||
* @date 2023-08-27
|
||||
* @desc 通过MybatisPlus源码 扩展修改
|
||||
*/
|
||||
public class DeleteClickHouse extends AbstractMethod {
|
||||
|
||||
public DeleteClickHouse(String methodName) {
|
||||
super(methodName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
|
||||
String sql;
|
||||
SqlMethodDiv sqlMethod = SqlMethodDiv.LOGIC_DELETE_BY_ID;
|
||||
if (tableInfo.isWithLogicDelete()) {
|
||||
sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), sqlLogicSet(tableInfo),
|
||||
tableInfo.getKeyColumn(), tableInfo.getKeyProperty(),
|
||||
tableInfo.getLogicDeleteSql(true, true));
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, Object.class);
|
||||
return addUpdateMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource);
|
||||
} else {
|
||||
sqlMethod = SqlMethodDiv.DELETE_BY_ID;
|
||||
sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), tableInfo.getKeyColumn(),
|
||||
tableInfo.getKeyProperty());
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, Object.class);
|
||||
return this.addDeleteMappedStatement(mapperClass, sqlMethod.getMethod(), sqlSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SQL 更新 set 语句
|
||||
*
|
||||
* @param logic 是否逻辑删除注入器
|
||||
* @param ew 是否存在 UpdateWrapper 条件
|
||||
* @param table 表信息
|
||||
* @param alias 别名
|
||||
* @param prefix 前缀
|
||||
* @return sql
|
||||
*/
|
||||
@Override
|
||||
protected String sqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias,
|
||||
final String prefix) {
|
||||
String sqlScript = table.getAllSqlSet(logic, prefix);
|
||||
if (judgeAliasNull) {
|
||||
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true);
|
||||
}
|
||||
if (ew) {
|
||||
sqlScript += NEWLINE;
|
||||
sqlScript += SqlScriptUtils.convertIf(SqlScriptUtils.unSafeParam(U_WRAPPER_SQL_SET),
|
||||
String.format("%s != null and %s != null", WRAPPER, U_WRAPPER_SQL_SET), false);
|
||||
}
|
||||
sqlScript = convertSet(sqlScript);
|
||||
return sqlScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉sest 和 suffixOverrides=","代表去掉第一个逗号
|
||||
*
|
||||
* @param sqlScript
|
||||
* @return
|
||||
*/
|
||||
public static String convertSet(final String sqlScript) {
|
||||
return "<trim prefix=\"\" suffixOverrides=\",\"> " + sqlScript + "\n" + "</trim>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.methods;
|
||||
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.enums.SqlMethodDiv;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import org.apache.ibatis.executor.keygen.NoKeyGenerator;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
/**
|
||||
* @author coder
|
||||
* @date 2023-08-27
|
||||
* @desc 通过MybatisPlus源码 扩展修改
|
||||
*/
|
||||
public class UpdateByIdClickHouse extends AbstractMethod {
|
||||
|
||||
public UpdateByIdClickHouse(String methodName) {
|
||||
super(methodName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
|
||||
SqlMethodDiv sqlMethod = SqlMethodDiv.UPDATE_BY_ID;
|
||||
|
||||
final String additional = optlockVersion(tableInfo) + tableInfo.getLogicDeleteSql(true, true);
|
||||
String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(),
|
||||
this.sqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, ENTITY, ENTITY_DOT),
|
||||
tableInfo.getKeyColumn(), ENTITY_DOT + tableInfo.getKeyProperty(), additional);
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
|
||||
return this.addInsertMappedStatement(mapperClass, modelClass,
|
||||
sqlMethod.getMethod(), sqlSource, new NoKeyGenerator(), null, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SQL 更新 set 语句
|
||||
*
|
||||
* @param logic 是否逻辑删除注入器
|
||||
* @param ew 是否存在 UpdateWrapper 条件
|
||||
* @param table 表信息
|
||||
* @param alias 别名
|
||||
* @param prefix 前缀
|
||||
* @return sql
|
||||
*/
|
||||
@Override
|
||||
protected String sqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias,
|
||||
final String prefix) {
|
||||
String sqlScript = table.getAllSqlSet(logic, prefix);
|
||||
if (judgeAliasNull) {
|
||||
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true);
|
||||
}
|
||||
if (ew) {
|
||||
sqlScript += NEWLINE;
|
||||
sqlScript += SqlScriptUtils.convertIf(SqlScriptUtils.unSafeParam(U_WRAPPER_SQL_SET),
|
||||
String.format("%s != null and %s != null", WRAPPER, U_WRAPPER_SQL_SET), false);
|
||||
}
|
||||
sqlScript = convertSet(sqlScript);
|
||||
return sqlScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉sest 和 suffixOverrides=","代表去掉第一个逗号
|
||||
*
|
||||
* @param sqlScript
|
||||
* @return
|
||||
*/
|
||||
public static String convertSet(final String sqlScript) {
|
||||
return "<trim prefix=\"\" suffixOverrides=\",\"> " + sqlScript + "\n" + "</trim>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package cn.iocoder.yudao.framework.clickhouse.injector.methods;
|
||||
|
||||
import cn.iocoder.yudao.framework.clickhouse.injector.enums.SqlMethodDiv;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
|
||||
/**
|
||||
* @author coder
|
||||
* @date 2023-08-27
|
||||
* @desc 通过MybatisPlus源码 扩展修改
|
||||
*/
|
||||
public class UpdateClickHouse extends AbstractMethod {
|
||||
|
||||
public UpdateClickHouse(String methodName) {
|
||||
super(methodName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
|
||||
SqlMethodDiv sqlMethod = SqlMethodDiv.UPDATE;
|
||||
String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(),
|
||||
sqlSet(true, true, tableInfo, true, ENTITY, ENTITY_DOT),
|
||||
sqlWhereEntityWrapper(true, tableInfo), sqlComment());
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
|
||||
return this.addUpdateMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SQL 更新 set 语句
|
||||
*
|
||||
* @param logic 是否逻辑删除注入器
|
||||
* @param ew 是否存在 UpdateWrapper 条件
|
||||
* @param table 表信息
|
||||
* @param alias 别名
|
||||
* @param prefix 前缀
|
||||
* @return sql
|
||||
*/
|
||||
@Override
|
||||
protected String sqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias,
|
||||
final String prefix) {
|
||||
String sqlScript = table.getAllSqlSet(logic, prefix);
|
||||
if (judgeAliasNull) {
|
||||
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true);
|
||||
}
|
||||
if (ew) {
|
||||
sqlScript += NEWLINE;
|
||||
sqlScript += SqlScriptUtils.convertIf(SqlScriptUtils.unSafeParam(U_WRAPPER_SQL_SET),
|
||||
String.format("%s != null and %s != null", WRAPPER, U_WRAPPER_SQL_SET), false);
|
||||
}
|
||||
sqlScript = convertSet(sqlScript);
|
||||
return sqlScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉sest 和 suffixOverrides=","代表去掉第一个逗号
|
||||
*
|
||||
* @param sqlScript
|
||||
* @return
|
||||
*/
|
||||
public static String convertSet(final String sqlScript) {
|
||||
return "<trim prefix=\"\" suffixOverrides=\",\"> " + sqlScript + "\n" + "</trim>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
## com.w3.framework.clickhouse.config.ClickHouseConfig
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>yudao-module-market-api</module>
|
||||
<module>yudao-module-market-biz</module>
|
||||
</modules>
|
||||
<artifactId>yudao-module-market</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
market 模块,主要提供两块能力:
|
||||
1. 交易市场数据收集,基本清理维护
|
||||
2. 定时任务采集数据计算数据,对外提供数据接口。
|
||||
</description>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-market</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>yudao-module-market-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
market 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId> <!-- 接口文档:使用最新版本的 Swagger 模型 -->
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package cn.iocoder.yudao.module.market.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Market 错误码枚举类 TODO
|
||||
*
|
||||
* market 系统,使用 1-008-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 公众号账号 1008000000============
|
||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1008000000, "公众号账号不存在");
|
||||
ErrorCode ACCOUNT_GENERATE_QR_CODE_FAIL = new ErrorCode(1008000001, "生成公众号二维码失败,原因:{}");
|
||||
ErrorCode ACCOUNT_CLEAR_QUOTA_FAIL = new ErrorCode(1008000002, "清空公众号的 API 配额失败,原因:{}");
|
||||
|
||||
// ========== 公众号统计 1008001000============
|
||||
ErrorCode STATISTICS_GET_USER_SUMMARY_FAIL = new ErrorCode(1008001000, "获取粉丝增减数据失败,原因:{}");
|
||||
ErrorCode STATISTICS_GET_USER_CUMULATE_FAIL = new ErrorCode(1008001001, "获得粉丝累计数据失败,原因:{}");
|
||||
ErrorCode STATISTICS_GET_UPSTREAM_MESSAGE_FAIL = new ErrorCode(1008001002, "获得消息发送概况数据失败,原因:{}");
|
||||
ErrorCode STATISTICS_GET_INTERFACE_SUMMARY_FAIL = new ErrorCode(1008001003, "获得接口分析数据失败,原因:{}");
|
||||
|
||||
// ========== 公众号标签 1008002000============
|
||||
ErrorCode TAG_NOT_EXISTS = new ErrorCode(1008002000, "标签不存在");
|
||||
ErrorCode TAG_CREATE_FAIL = new ErrorCode(1008002001, "创建标签失败,原因:{}");
|
||||
ErrorCode TAG_UPDATE_FAIL = new ErrorCode(1008002002, "更新标签失败,原因:{}");
|
||||
ErrorCode TAG_DELETE_FAIL = new ErrorCode(1008002003, "删除标签失败,原因:{}");
|
||||
ErrorCode TAG_GET_FAIL = new ErrorCode(1008002004, "获得标签失败,原因:{}");
|
||||
|
||||
// ========== 公众号粉丝 1008003000============
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1008003000, "粉丝不存在");
|
||||
ErrorCode USER_UPDATE_TAG_FAIL = new ErrorCode(1008003001, "更新粉丝标签失败,原因:{}");
|
||||
|
||||
// ========== 公众号素材 1008004000============
|
||||
ErrorCode MATERIAL_NOT_EXISTS = new ErrorCode(1008004000, "素材不存在");
|
||||
ErrorCode MATERIAL_UPLOAD_FAIL = new ErrorCode(1008004001, "上传素材失败,原因:{}");
|
||||
ErrorCode MATERIAL_IMAGE_UPLOAD_FAIL = new ErrorCode(1008004002, "上传图片失败,原因:{}");
|
||||
ErrorCode MATERIAL_DELETE_FAIL = new ErrorCode(1008004003, "删除素材失败,原因:{}");
|
||||
|
||||
// ========== 公众号消息 1008005000============
|
||||
ErrorCode MESSAGE_SEND_FAIL = new ErrorCode(1008005000, "发送消息失败,原因:{}");
|
||||
|
||||
// ========== 公众号发布能力 1008006000============
|
||||
ErrorCode FREE_PUBLISH_LIST_FAIL = new ErrorCode(1008006000, "获得已成功发布列表失败,原因:{}");
|
||||
ErrorCode FREE_PUBLISH_SUBMIT_FAIL = new ErrorCode(1008006001, "提交发布失败,原因:{}");
|
||||
ErrorCode FREE_PUBLISH_DELETE_FAIL = new ErrorCode(1008006002, "删除发布失败,原因:{}");
|
||||
|
||||
// ========== 公众号草稿 1008007000============
|
||||
ErrorCode DRAFT_LIST_FAIL = new ErrorCode(1008007000, "获得草稿列表失败,原因:{}");
|
||||
ErrorCode DRAFT_CREATE_FAIL = new ErrorCode(1008007001, "创建草稿失败,原因:{}");
|
||||
ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1008007002, "更新草稿失败,原因:{}");
|
||||
ErrorCode DRAFT_DELETE_FAIL = new ErrorCode(1008007003, "删除草稿失败,原因:{}");
|
||||
|
||||
// ========== 公众号菜单 1008008000============
|
||||
ErrorCode MENU_SAVE_FAIL = new ErrorCode(1008008000, "创建菜单失败,原因:{}");
|
||||
ErrorCode MENU_DELETE_FAIL = new ErrorCode(1008008001, "删除菜单失败,原因:{}");
|
||||
|
||||
// ========== 公众号自动回复 1008009000============
|
||||
ErrorCode AUTO_REPLY_NOT_EXISTS = new ErrorCode(1008009000, "自动回复不存在");
|
||||
ErrorCode AUTO_REPLY_ADD_SUBSCRIBE_FAIL_EXISTS = new ErrorCode(1008009001, "操作失败,原因:已存在关注时的回复");
|
||||
ErrorCode AUTO_REPLY_ADD_MESSAGE_FAIL_EXISTS = new ErrorCode(1008009002, "操作失败,原因:已存在该消息类型的回复");
|
||||
ErrorCode AUTO_REPLY_ADD_KEYWORD_FAIL_EXISTS = new ErrorCode(1008009003, "操作失败,原因:已关在该关键字的回复");
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* market 模块,我们放市场数据收集处理业务模块。
|
||||
* 例如说:提供市场数据收集,基础清理,基础计算,基础统计,消息通等功能
|
||||
*
|
||||
* 1. Controller URL:以 /market/ 开头,避免和其它 Module 冲突
|
||||
* 2. DataObject 表名:以 market_ 开头,方便在数据库中区分
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market;
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||
## 感谢复旦核博士的建议!灰子哥,牛皮!
|
||||
FROM eclipse-temurin:8-jre
|
||||
|
||||
## 创建目录,并使用它作为工作目录
|
||||
RUN mkdir -p /yudao-module-market-biz
|
||||
WORKDIR /yudao-module-market-biz
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ./target/yudao-module-market-biz.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m"
|
||||
|
||||
## 暴露后端项目的 48080 端口
|
||||
EXPOSE 48082
|
||||
|
||||
## 启动后端项目
|
||||
CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-market</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>yudao-module-market-biz</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
market 模块,主要提供两块能力:
|
||||
1. 市场数据收集维护,基础清理
|
||||
2. 对外提供数据http接口提供
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 依赖服务 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-market-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-banner</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Job 定时任务相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package cn.iocoder.yudao.module.market;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
*
|
||||
* 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class MarketServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
|
||||
SpringApplication.run(MarketServerApplication.class, args);
|
||||
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 https://cloud.iocoder.cn/quick-start/ 文章
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.market;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.market.service.info.TokenInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 公众号账号")
|
||||
@RestController
|
||||
@RequestMapping("/mp/account")
|
||||
@Validated
|
||||
public class TokenInfoController {
|
||||
|
||||
@Resource
|
||||
private TokenInfoService tokenInfoService;
|
||||
|
||||
|
||||
|
||||
|
||||
// @GetMapping("/page")
|
||||
// @Operation(summary = "获得公众号账号分页")
|
||||
// @PreAuthorize("@ss.hasPermission('mp:account:query')")
|
||||
// public CommonResult<PageResult<MpAccountRespVO>> getAccountPage(@Valid MpAccountPageReqVO pageVO) {
|
||||
// PageResult<MpAccountDO> pageResult = tokenInfoService.getAccountPage(pageVO);
|
||||
// return success(MpAccountConvert.INSTANCE.convertPage(pageResult));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.market.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 公众号账号 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*
|
||||
* @author fengdan
|
||||
*/
|
||||
@Data
|
||||
public class TokenInfoBaseVO {
|
||||
|
||||
@Schema(description = "公众号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
|
||||
@NotEmpty(message = "公众号名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "公众号微信号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudaoyuanma")
|
||||
@NotEmpty(message = "公众号微信号不能为空")
|
||||
private String account;
|
||||
|
||||
@Schema(description = "公众号 appId", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx5b23ba7a5589ecbb")
|
||||
@NotEmpty(message = "公众号 appId 不能为空")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "公众号密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "3a7b3b20c537e52e74afd395eb85f61f")
|
||||
@NotEmpty(message = "公众号密钥不能为空")
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "公众号 token", requiredMode = Schema.RequiredMode.REQUIRED, example = "kangdayuzhen")
|
||||
@NotEmpty(message = "公众号 token 不能为空")
|
||||
private String token;
|
||||
|
||||
@Schema(description = "加密密钥", example = "gjN+Ksei")
|
||||
private String aesKey;
|
||||
|
||||
@Schema(description = "备注", example = "请关注芋道源码,学习技术")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.market.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 公众号账号分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TokenInfoageReqVO extends PageParam {
|
||||
|
||||
@Schema(name = "公众号名称", description = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "公众号账号", description = "模糊匹配")
|
||||
private String account;
|
||||
|
||||
@Schema(name = "公众号 appid", description = "模糊匹配")
|
||||
private String appId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
### 请求 /mp/material/page 接口 => 成功
|
||||
GET {{baseUrl}}/mp/material/page?permanent=true&pageNo=1&pageSize=10
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenentId}}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.material;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.market.service.rank.TokenRankService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 公众号素材")
|
||||
@RestController
|
||||
@RequestMapping("/mp/material")
|
||||
@Validated
|
||||
public class MpMaterialController {
|
||||
|
||||
@Resource
|
||||
private TokenRankService tokenRankService;
|
||||
|
||||
// @GetMapping("/page")
|
||||
// @Operation(summary = "获得公众号账号分页")
|
||||
// @PreAuthorize("@ss.hasPermission('mp:account:query')")
|
||||
// public CommonResult<PageResult<MpAccountRespVO>> getAccountPage(@Valid MpAccountPageReqVO pageVO) {
|
||||
// PageResult<MpAccountDO> pageResult = tokenRankService.getAccountPage(pageVO);
|
||||
// return success(MpAccountConvert.INSTANCE.convertPage(pageResult));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.material.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 公众号素材的分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TokenRankPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "公众号账号的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
|
||||
@NotNull(message = "公众号账号的编号不能为空")
|
||||
private Long accountId;
|
||||
|
||||
@Schema(description = "是否永久", example = "true")
|
||||
private Boolean permanent;
|
||||
|
||||
@Schema(description = "文件类型 参见 WxConsts.MediaFileType 枚举", example = "image")
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* 提供 RESTful API 给前端:
|
||||
* 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
|
||||
* 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.controller;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package cn.iocoder.yudao.module.market.convert.account;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.account.vo.MpAccountCreateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.account.vo.MpAccountRespVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.account.vo.MpAccountSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.account.vo.MpAccountUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MpAccountConvert {
|
||||
|
||||
MpAccountConvert INSTANCE = Mappers.getMapper(MpAccountConvert.class);
|
||||
|
||||
MpAccountDO convert(MpAccountCreateReqVO bean);
|
||||
|
||||
MpAccountDO convert(MpAccountUpdateReqVO bean);
|
||||
|
||||
MpAccountRespVO convert(MpAccountDO bean);
|
||||
|
||||
List<MpAccountRespVO> convertList(List<MpAccountDO> list);
|
||||
|
||||
PageResult<MpAccountRespVO> convertPage(PageResult<MpAccountDO> page);
|
||||
|
||||
List<MpAccountSimpleRespVO> convertList02(List<MpAccountDO> list);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package cn.iocoder.yudao.module.market.convert.material;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialRespVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadRespVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO;
|
||||
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Mapper
|
||||
public interface MpMaterialConvert {
|
||||
|
||||
MpMaterialConvert INSTANCE = Mappers.getMapper(MpMaterialConvert.class);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "id", ignore = true),
|
||||
@Mapping(source = "account.id", target = "accountId"),
|
||||
@Mapping(source = "account.appId", target = "appId"),
|
||||
@Mapping(source = "name", target = "name")
|
||||
})
|
||||
MpMaterialDO convert(String mediaId, String type, String url, MpAccountDO account,
|
||||
String name);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "id", ignore = true),
|
||||
@Mapping(source = "account.id", target = "accountId"),
|
||||
@Mapping(source = "account.appId", target = "appId"),
|
||||
@Mapping(source = "name", target = "name")
|
||||
})
|
||||
MpMaterialDO convert(String mediaId, String type, String url, MpAccountDO account,
|
||||
String name, String title, String introduction, String mpUrl);
|
||||
|
||||
MpMaterialUploadRespVO convert(MpMaterialDO bean);
|
||||
|
||||
default WxMpMaterial convert(String name, File file, String title, String introduction) {
|
||||
return new WxMpMaterial(name, file, title, introduction);
|
||||
}
|
||||
|
||||
PageResult<MpMaterialRespVO> convertPage(PageResult<MpMaterialDO> page);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package cn.iocoder.yudao.module.market.dal.dataobject.info;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* TOKEN基本信息 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("mk_token_info")
|
||||
@KeySequence("mk_token_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TokenInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 交易货币币种
|
||||
*/
|
||||
private String baseCcy;
|
||||
/**
|
||||
* 合约乘数,仅适用于交割/永续/期权
|
||||
*/
|
||||
private String ctMult;
|
||||
/**
|
||||
* 上线日期
|
||||
*/
|
||||
private LocalDateTime listDate;
|
||||
/**
|
||||
* 合约面值,仅适用于交割/永续/期权
|
||||
*/
|
||||
private String ctVal;
|
||||
/**
|
||||
* 合约面值计价币种,仅适用于交割/永续/期权
|
||||
*/
|
||||
private String ctValCcy;
|
||||
/**
|
||||
* 交割/行权日期,仅适用于交割 和 期权
|
||||
*/
|
||||
private LocalDateTime expDate;
|
||||
/**
|
||||
* 交易品种,如 BTC-USD,仅适用于交割/永续/期权
|
||||
*/
|
||||
private String instFamily;
|
||||
/**
|
||||
* 产品id, 如 BTC-USD-SWAP
|
||||
*/
|
||||
private String instId;
|
||||
/**
|
||||
* 产品类型 币币 SPOT 币币杠杆 MARGIN 永续合约 SWAP 交割合约 FUTURES 期权 OPTION
|
||||
*/
|
||||
private String instType;
|
||||
/**
|
||||
* 该instId支持的最大杠杆倍数,不适用于币币、期权
|
||||
*/
|
||||
private String lever;
|
||||
/**
|
||||
* 下单数量精度,如 BTC-USDT-SWAP:1
|
||||
*/
|
||||
private String lotSz;
|
||||
/**
|
||||
* 合约或现货冰山委托的单笔最大委托数量
|
||||
*/
|
||||
private String maxIcebergSz;
|
||||
/**
|
||||
* 最大限制数量
|
||||
*/
|
||||
private String maxLmtSz;
|
||||
/**
|
||||
* 合约或现货市价单的单笔最大委托数量
|
||||
*/
|
||||
private String maxMktSz;
|
||||
/**
|
||||
* 合约或现货止盈止损委托的单笔最大委托数量
|
||||
*/
|
||||
private String maxStopSz;
|
||||
/**
|
||||
* 合约或现货计划委托委托的单笔最大委托数量
|
||||
*/
|
||||
private String maxTriggerSz;
|
||||
/**
|
||||
* 合约或现货时间加权单的单笔最大委托数量
|
||||
*/
|
||||
private String maxTwapSz;
|
||||
/**
|
||||
* 最小下单数量
|
||||
*/
|
||||
private String minSz;
|
||||
/**
|
||||
* 期权类型,C或P 仅适用于期权
|
||||
*/
|
||||
private String optType;
|
||||
/**
|
||||
* 计价货币币种,如 BTC-USDT 中的USDT ,仅适用于币币/币币杠杆
|
||||
*/
|
||||
private String quoteCcy;
|
||||
/**
|
||||
* 盈亏结算和保证金币种,如 BTC 仅适用于交割/永续/期权
|
||||
*/
|
||||
private String settleCcy;
|
||||
/**
|
||||
* * 产品状态 * live:交易中 * suspend:暂停中 * preopen:预上线 * test:测试中(测试产品,不可交易) * 当合约预上线时,状态变更为预上线(即新生成一个合约,新合约会处于预上线状态); * 当产品下线的时候(如交割合约被交割的时候,期权合约被行权的时候),查询不到该产品
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 行权价格,仅适用于期权
|
||||
*/
|
||||
private String stk;
|
||||
/**
|
||||
* 下单价格精度,如 0.0001
|
||||
*/
|
||||
private String tickSz;
|
||||
/**
|
||||
* 标的指数,如 BTC-USD,仅适用于交割/永续/期权
|
||||
*/
|
||||
private String uly;
|
||||
/**
|
||||
* 交易所类型 1 币安交易所 2 欧易交易所 3 芝麻开门交易所
|
||||
*/
|
||||
private Byte exchangeType;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package cn.iocoder.yudao.module.market.dal.dataobject.rank;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* TOKEN排名信息 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("mk_token_rank")
|
||||
@KeySequence("mk_token_rank_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TokenRankDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 币种基础名称
|
||||
*/
|
||||
private String tokenBaseName;
|
||||
/**
|
||||
* 是否有最新事件触发(0:没有 1:有)
|
||||
*/
|
||||
private Byte event;
|
||||
/**
|
||||
* 是否有近期热点消息(0:没有 1:有)
|
||||
*/
|
||||
private Byte hot;
|
||||
/**
|
||||
* 市值排名
|
||||
*/
|
||||
private Integer capRanking;
|
||||
/**
|
||||
* 近期交易量
|
||||
*/
|
||||
private Object volRanking;
|
||||
/**
|
||||
* 板块概念
|
||||
*/
|
||||
private String concept;
|
||||
/**
|
||||
* 根据币种成交量 热度等生成的排名值 排名值越高币种策略价值越高
|
||||
*/
|
||||
private Byte comprehensiveRanking;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package cn.iocoder.yudao.module.market.dal.mysql.info;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.market.vo.TokenInfoageReqVO;
|
||||
import cn.iocoder.yudao.module.market.dal.dataobject.info.TokenInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TokenInfoMapper extends BaseMapperX<TokenInfoDO> {
|
||||
|
||||
default PageResult<TokenInfoDO> selectPage(TokenInfoageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TokenInfoDO>()
|
||||
.likeIfPresent(TokenInfoDO::getInstId, reqVO.getName())
|
||||
.likeIfPresent(TokenInfoDO::getExchangeType, reqVO.getAccount())
|
||||
.orderByDesc(TokenInfoDO::getId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package cn.iocoder.yudao.module.market.dal.mysql.rank;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.material.vo.TokenRankPageReqVO;
|
||||
import cn.iocoder.yudao.module.market.dal.dataobject.rank.TokenRankDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TokenRankMapper extends BaseMapperX<TokenRankDO> {
|
||||
|
||||
default PageResult<TokenRankDO> selectPage(TokenRankPageReqVO pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<TokenRankDO>()
|
||||
.eq(TokenRankDO::getHot, pageReqVO.getAccountId())
|
||||
.eqIfPresent(TokenRankDO::getTokenBaseName, pageReqVO.getPermanent())
|
||||
.orderByDesc(TokenRankDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package cn.iocoder.yudao.module.market.framework.market.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 微信公众号的配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration
|
||||
public class MarketConfiguration {
|
||||
|
||||
// @Bean
|
||||
// @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||
// public RedisTemplateWxRedisOps redisTemplateWxRedisOps(StringRedisTemplate stringRedisTemplate) {
|
||||
// return new RedisTemplateWxRedisOps(stringRedisTemplate);
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||
// public MpServiceFactory mpServiceFactory(RedisTemplateWxRedisOps redisTemplateWxRedisOps,
|
||||
// WxMpProperties wxMpProperties,
|
||||
// MessageReceiveHandler messageReceiveHandler,
|
||||
// KfSessionHandler kfSessionHandler,
|
||||
// StoreCheckNotifyHandler storeCheckNotifyHandler,
|
||||
// MenuHandler menuHandler,
|
||||
// NullHandler nullHandler,
|
||||
// SubscribeHandler subscribeHandler,
|
||||
// UnsubscribeHandler unsubscribeHandler,
|
||||
// LocationHandler locationHandler,
|
||||
// ScanHandler scanHandler,
|
||||
// MessageAutoReplyHandler messageAutoReplyHandler) {
|
||||
// return new DefaultMpServiceFactory(redisTemplateWxRedisOps, wxMpProperties,
|
||||
// messageReceiveHandler, kfSessionHandler, storeCheckNotifyHandler, menuHandler,
|
||||
// nullHandler, subscribeHandler, unsubscribeHandler, locationHandler, scanHandler, messageAutoReplyHandler);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package cn.iocoder.yudao.module.market.framework.market.core;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 默认的 {@link MarketServiceFactory} 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultMarketServiceFactory implements MarketServiceFactory {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package cn.iocoder.yudao.module.market.framework.market.core;
|
||||
|
||||
/**
|
||||
* {@link WxMpService} 工厂接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MarketServiceFactory {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2025, zengtao All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: zengtao (w1999wtw3537@gmail.com)
|
||||
*/
|
||||
|
||||
package cn.iocoder.yudao.module.market.framework.market.core.context;
|
||||
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
|
||||
/**
|
||||
* 微信上下文 Context
|
||||
*
|
||||
* 目的:解决微信多公众号的问题,在 {@link WxMpMessageHandler} 实现类中,可以通过 {@link #getAppId()} 获取到当前的 appId
|
||||
*
|
||||
* @see MpOpenController#handleMessage(String, String, MpOpenHandleMessageReqVO)
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class MarketContextHolder {
|
||||
|
||||
/**
|
||||
* 微信公众号的 appId 上下文
|
||||
*/
|
||||
private static final ThreadLocal<String> APPID = new TransmittableThreadLocal<>();
|
||||
|
||||
public static void setAppId(String appId) {
|
||||
APPID.set(appId);
|
||||
}
|
||||
|
||||
public static String getAppId() {
|
||||
return APPID.get();
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
APPID.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package cn.iocoder.yudao.module.market.framework.market.core.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.Validator;
|
||||
|
||||
/**
|
||||
* 公众号工具类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Slf4j
|
||||
public class MarketUtils {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* 属于 mp 模块的 framework 封装
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.framework;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package cn.iocoder.yudao.module.market.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = FileApi.class)
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.framework.rpc;
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package cn.iocoder.yudao.module.market.framework.security.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
|
||||
/**
|
||||
* System 模块的 Security 配置
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false, value = "systemSecurityConfiguration")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Bean("systemAuthorizeRequestsCustomizer")
|
||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||
return new AuthorizeRequestsCustomizer() {
|
||||
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
// Druid 监控
|
||||
registry.antMatchers("/druid/**").anonymous();
|
||||
// Spring Boot Actuator 的安全配置
|
||||
registry.antMatchers("/actuator").anonymous()
|
||||
.antMatchers("/actuator/**").anonymous();
|
||||
// RPC 服务的安全配置
|
||||
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.framework.security.core;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package cn.iocoder.yudao.module.market.framework.web.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* market 模块的 web 组件的 Configuration
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MpWebConfiguration {
|
||||
|
||||
/**
|
||||
* mp 模块的 API 分组
|
||||
*/
|
||||
@Bean
|
||||
public GroupedOpenApi mpGroupedOpenApi() {
|
||||
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("market");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* mp 模块的 web 配置
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.framework.web;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* mp 模块,我们放微信微信公众号。
|
||||
* 例如说:提供微信公众号的账号、菜单、粉丝、标签、消息、自动回复、素材、模板通知、运营数据等功能
|
||||
*
|
||||
* 1. Controller URL:以 /mp/ 开头,避免和其它 Module 冲突
|
||||
* 2. DataObject 表名:以 mp_ 开头,方便在数据库中区分
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package cn.iocoder.yudao.module.market.service.info;
|
||||
|
||||
/**
|
||||
* 公众号账号 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface TokenInfoService {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package cn.iocoder.yudao.module.market.service.info;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 公众号账号 Service 实现类
|
||||
*
|
||||
* @author fengdan
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
public class TokenInfoServiceImpl implements TokenInfoService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package cn.iocoder.yudao.module.market.service.rank;
|
||||
|
||||
|
||||
/**
|
||||
* TokenRank Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface TokenRankService {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package cn.iocoder.yudao.module.market.service.rank;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 公众号素材 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class TokenRankServiceImpl implements TokenRankService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 5 # 初始连接数
|
||||
min-idle: 10 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 3WLiVUBEwTbvAfsh
|
||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 3WLiVUBEwTbvAfsh
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 1 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
xss:
|
||||
enable: false
|
||||
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
|
||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||
demo: true # 开启演示模式
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 5 # 初始连接数
|
||||
min-idle: 10 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
slave: # 模拟从库,可根据自己需要修改
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
|
||||
# 日志文件配置
|
||||
logging:
|
||||
level:
|
||||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
cn.iocoder.yudao.module.report.dal.mysql: debug
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
env: # 多环境的配置项
|
||||
tag: ${HOSTNAME}
|
||||
security:
|
||||
mock-enable: true
|
||||
xss:
|
||||
enable: false
|
||||
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
|
||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||
access-log: # 访问日志的配置项
|
||||
enable: false
|
||||
error-code: # 错误码相关配置项
|
||||
enable: false
|
||||
demo: false # 关闭演示模式
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||
|
||||
# Servlet 配置
|
||||
servlet:
|
||||
# 文件上传相关配置项
|
||||
multipart:
|
||||
max-file-size: 16MB # 单个文件大小
|
||||
max-request-size: 32MB # 设置总上传的文件大小
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
||||
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
||||
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
||||
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
||||
|
||||
# Cache 配置项
|
||||
cache:
|
||||
type: REDIS
|
||||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||
path: /swagger-ui.html
|
||||
|
||||
knife4j:
|
||||
enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
db-config:
|
||||
# 重要说明:如果将配置放到 Nacos 时,请注意将 id-type 设置为对应 DB 的类型,否则会报错;详细见 https://gitee.com/zhijiantianya/yudao-cloud/issues/I5W2N0 讨论
|
||||
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||
# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
|
||||
# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
|
||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
type-aliases-package: ${yudao.info.base-package}.dal.dataobject
|
||||
encryptor:
|
||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||
|
||||
--- #################### RPC 远程调用相关配置 ####################
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
yudao:
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.yudao.module.report
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
swagger:
|
||||
title: 管理后台
|
||||
description: 提供管理员管理的所有功能
|
||||
version: ${yudao.info.version}
|
||||
base-package: ${yudao.info.base-package}
|
||||
error-code: # 错误码相关配置项
|
||||
constants-class-list:
|
||||
- cn.iocoder.yudao.module.report.enums.ErrorCodeConstants
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
|
||||
debug: false
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
spring:
|
||||
application:
|
||||
name: report-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
server:
|
||||
port: 48084
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
||||
|
|
@ -40,20 +40,20 @@ spring:
|
|||
datasource:
|
||||
master:
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 3WLiVUBEwTbvAfsh
|
||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&nullCatalogMeansCurrent=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 3WLiVUBEwTbvAfsh
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 400-infra.server.iocoder.cn # 地址
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 1 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
|
|
|||
|
|
@ -61,7 +61,12 @@ spring:
|
|||
password: 123456
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
|
||||
click:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.clickhouse.jdbc.ClickHouseDriver
|
||||
url: jdbc:clickhouse://127.0.0.1:8123/default?socket_timeout=600000
|
||||
username: default
|
||||
password: 123456
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ mybatis-plus:
|
|||
yudao:
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.yudao.module.report
|
||||
base-package: cn.iocoder.yudao.module.market
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
spring:
|
||||
application:
|
||||
name: report-server
|
||||
name: market-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
|
|
|||
Loading…
Reference in New Issue