Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
82a2c2c7
Commit
82a2c2c7
authored
Feb 05, 2020
by
李秋伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_protocol' into 'master'
Feature protocol See merge request mall/arch/matrix!51
parents
bc8d1e7d
48570d40
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
72 deletions
+69
-72
pom.xml
common-util/pom.xml
+0
-3
StringUtil.java
common-util/src/main/java/com/secoo/mall/common/util/string/StringUtil.java
+26
-4
DataSourceConfig.java
matrix-datasource/matrix-datasource-core/src/main/java/com/secoo/mall/datasource/config/DataSourceConfig.java
+11
-11
MatrixDataSourceConfig.java
matrix-datasource/matrix-datasource-core/src/main/java/com/secoo/mall/datasource/config/MatrixDataSourceConfig.java
+10
-39
DruidDataSourceFactory.java
matrix-datasource/matrix-datasource-druid/src/main/java/com/secoo/mall/datasource/factory/DruidDataSourceFactory.java
+2
-1
MatrixDruidDataSourceProperties.java
matrix-datasource/matrix-datasource-druid/src/main/java/com/secoo/mall/datasource/properties/MatrixDruidDataSourceProperties.java
+3
-0
MatrixPerformanceInterceptor.java
matrix-mybatis/matrix-mybatis-core/src/main/java/com/secoo/mall/mybatis/interceptor/MatrixPerformanceInterceptor.java
+3
-8
pom.xml
matrix-protocol/matrix-protocol-dubbo-core/pom.xml
+0
-1
MatrixWebAutoConfiguration.java
matrix-protocol/matrix-protocol-web-starter/src/main/java/com/secoo/mall/web/spring/boot/autoconfigure/MatrixWebAutoConfiguration.java
+2
-0
pom.xml
matrix-protocol/pom.xml
+12
-5
No files found.
common-util/pom.xml
View file @
82a2c2c7
...
...
@@ -50,18 +50,15 @@
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-web
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
common-util/src/main/java/com/secoo/mall/common/util/string/StringUtil.java
View file @
82a2c2c7
...
...
@@ -42,8 +42,9 @@ public class StringUtil extends StringUtils {
/**
* camel转换为snake
*
*
转换为下划线
* @param str
* @param ch 原字符串中的连接符号
* @return
*/
public
static
String
toSnakeCase
(
String
str
,
char
ch
)
{
...
...
@@ -58,14 +59,35 @@ public class StringUtil extends StringUtils {
}
}
/**
* 连接字符串连接,如order-pay
* @return
*/
public
static
String
toHyphen
(
String
str
){
return
toSnakeCase
(
str
,
CharConstant
.
UNDERLINE
);
}
public
static
String
toHyphen
(
String
str
,
char
ch
)
{
switch
(
ch
)
{
case
CharConstant
.
UNDERLINE
:
return
CaseFormat
.
LOWER_UNDERSCORE
.
to
(
CaseFormat
.
LOWER_HYPHEN
,
str
);
default
:
return
CaseFormat
.
LOWER_CAMEL
.
to
(
CaseFormat
.
LOWER_HYPHEN
,
str
);
}
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"test
_jata
"
;
String
str
=
"test
Jdate_order
"
;
System
.
out
.
println
(
toCamelCase
(
str
));
System
.
out
.
println
(
toCamelCase
(
"test-jdate"
,
'-'
));
String
str2
=
"testJdate"
;
System
.
out
.
println
(
toSnakeCase
(
str
));
String
str2
=
"testJdate_order"
;
System
.
out
.
println
(
toSnakeCase
(
str2
,
'-'
));
String
str3
=
"testJdateOrderj"
;
System
.
out
.
println
(
"toHyphen=="
+
toHyphen
(
str3
,
'-'
));
System
.
out
.
println
(
toSnakeCase
(
"test-jdate"
,
'-'
));
}
...
...
matrix-datasource/matrix-datasource-core/src/main/java/com/secoo/mall/datasource/config/DataSourceConfig.java
View file @
82a2c2c7
...
...
@@ -20,16 +20,16 @@ public interface DataSourceConfig {
*
* @return the connection timeout in milliseconds
*/
l
ong
getConnectionTimeout
();
L
ong
getConnectionTimeout
();
/**
* Set the maximum number of milliseconds that a client will wait for a connection from the pool. If this
* time is exceeded without a connection becoming available, a SQLException will be thrown from
* {@link javax.sql.DataSource#getConnection()}.
*
* @param connectionTimeout
Ms
the connection timeout in milliseconds
* @param connectionTimeout the connection timeout in milliseconds
*/
void
setConnectionTimeout
(
long
connectionTimeoutMs
);
void
setConnectionTimeout
(
Long
connectionTimeout
);
/**
* This property controls the maximum amount of time (in milliseconds) that a connection is allowed to sit
...
...
@@ -39,7 +39,7 @@ public interface DataSourceConfig {
*
* @return the idle timeout in milliseconds
*/
l
ong
getIdleTimeout
();
L
ong
getIdleTimeout
();
/**
* This property controls the maximum amount of time (in milliseconds) that a connection is allowed to sit
...
...
@@ -49,7 +49,7 @@ public interface DataSourceConfig {
*
* @param idleTimeoutMs the idle timeout in milliseconds
*/
void
setIdleTimeout
(
l
ong
idleTimeoutMs
);
void
setIdleTimeout
(
L
ong
idleTimeoutMs
);
/**
* This property controls the maximum lifetime of a connection in the pool. When a connection reaches this
...
...
@@ -58,7 +58,7 @@ public interface DataSourceConfig {
*
* @return the maximum connection lifetime in milliseconds
*/
l
ong
getMaxLifetime
();
L
ong
getMaxLifetime
();
/**
* This property controls the maximum lifetime of a connection in the pool. When a connection reaches this
...
...
@@ -67,7 +67,7 @@ public interface DataSourceConfig {
*
* @param maxLifetimeMs the maximum connection lifetime in milliseconds
*/
void
setMaxLifetime
(
l
ong
maxLifetimeMs
);
void
setMaxLifetime
(
L
ong
maxLifetimeMs
);
/**
* The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool,
...
...
@@ -76,7 +76,7 @@ public interface DataSourceConfig {
*
* @return the minimum number of connections in the pool
*/
int
getMinimumIdle
();
Integer
getMinimumIdle
();
/**
* The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool,
...
...
@@ -85,7 +85,7 @@ public interface DataSourceConfig {
*
* @param minIdle the minimum number of idle connections in the pool to maintain
*/
void
setMinimumIdle
(
int
minIdle
);
void
setMinimumIdle
(
Integer
minIdle
);
/**
* The property controls the maximum number of connections that HikariCP will keep in the pool,
...
...
@@ -93,7 +93,7 @@ public interface DataSourceConfig {
*
* @return the maximum number of connections in the pool
*/
int
getMaximumPoolSize
();
Integer
getMaximumPoolSize
();
/**
* The property controls the maximum size that the pool is allowed to reach, including both idle and in-use
...
...
@@ -105,7 +105,7 @@ public interface DataSourceConfig {
*
* @param maxPoolSize the maximum number of connections in the pool
*/
void
setMaximumPoolSize
(
int
maxPoolSize
);
void
setMaximumPoolSize
(
Integer
maxPoolSize
);
/**
* Set the password used for authentication. Changing this at runtime will apply to new connections only.
...
...
matrix-datasource/matrix-datasource-core/src/main/java/com/secoo/mall/datasource/config/MatrixDataSourceConfig.java
View file @
82a2c2c7
...
...
@@ -13,14 +13,15 @@ public class MatrixDataSourceConfig implements DataSourceConfig {
*/
private
String
url
;
private
int
minimumIdle
=
DEFAULT_MIN_IDLE
;
private
int
maxPoolSize
=
DEFAULT_POOL_SIZE
;
private
Integer
minimumIdle
=
DEFAULT_MIN_IDLE
;
private
Integer
maxPoolSize
=
DEFAULT_POOL_SIZE
;
/**
* Unit:Millis
*/
private
l
ong
connectionTimeout
=
CONNECTION_TIMEOUT
;
private
l
ong
idleTimeout
=
IDLE_TIMEOUT
;
private
l
ong
maxLifetime
=
MAX_LIFETIME
;
private
L
ong
connectionTimeout
=
CONNECTION_TIMEOUT
;
private
L
ong
idleTimeout
=
IDLE_TIMEOUT
;
private
L
ong
maxLifetime
=
MAX_LIFETIME
;
public
void
setName
(
String
name
)
{
...
...
@@ -28,52 +29,22 @@ public class MatrixDataSourceConfig implements DataSourceConfig {
}
@Override
public
long
getConnectionTimeout
()
{
return
connectionTimeout
;
}
@Override
public
void
setConnectionTimeout
(
long
connectionTimeoutMs
)
{
this
.
connectionTimeout
=
connectionTimeoutMs
;
}
@Override
public
long
getIdleTimeout
()
{
return
idleTimeout
;
}
@Override
public
void
setIdleTimeout
(
long
idleTimeoutMs
)
{
this
.
idleTimeout
=
idleTimeoutMs
;
}
@Override
public
long
getMaxLifetime
()
{
return
maxLifetime
;
}
@Override
public
void
setMaxLifetime
(
long
maxLifetimeMs
)
{
this
.
maxLifetime
=
maxLifetimeMs
;
}
@Override
public
int
getMinimumIdle
()
{
public
Integer
getMinimumIdle
()
{
return
this
.
minimumIdle
;
}
@Override
public
void
setMinimumIdle
(
int
minIdle
)
{
public
void
setMinimumIdle
(
Integer
minIdle
)
{
this
.
minimumIdle
=
minIdle
;
}
@Override
public
int
getMaximumPoolSize
()
{
public
Integer
getMaximumPoolSize
()
{
return
maxPoolSize
;
}
@Override
public
void
setMaximumPoolSize
(
int
maxPoolSize
)
{
public
void
setMaximumPoolSize
(
Integer
maxPoolSize
)
{
this
.
maxPoolSize
=
maxPoolSize
;
}
...
...
matrix-datasource/matrix-datasource-druid/src/main/java/com/secoo/mall/datasource/factory/DruidDataSourceFactory.java
View file @
82a2c2c7
...
...
@@ -21,9 +21,10 @@ public class DruidDataSourceFactory extends AbsDataSourceFactory<DruidDataSource
dataSource
.
setPassword
(
config
.
getPassword
());
dataSource
.
setMinIdle
(
config
.
getMinimumIdle
());
dataSource
.
setMaxActive
(
config
.
getMaximumPoolSize
());
/*屏蔽时间属性,使用druid个性化属性
dataSource.setPhyTimeoutMillis(config.getConnectionTimeout());
dataSource.setTimeBetweenEvictionRunsMillis(config.getIdleTimeout());
dataSource
.
setMaxEvictableIdleTimeMillis
(
config
.
getMaxLifetime
());
dataSource.setMaxEvictableIdleTimeMillis(config.getMaxLifetime());
*/
try
{
dataSource
.
init
();
}
catch
(
SQLException
e
)
{
...
...
matrix-datasource/matrix-datasource-druid/src/main/java/com/secoo/mall/datasource/properties/MatrixDruidDataSourceProperties.java
View file @
82a2c2c7
...
...
@@ -12,6 +12,9 @@ public class MatrixDruidDataSourceProperties extends MatrixDataSourceProperties
private
Integer
initialSize
;
private
Long
timeBetweenEvictionRunsMillis
=
DruidAbstractDataSource
.
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
;
private
Long
timeBetweenLogStatsMillis
;
private
Integer
minIdle
;
private
Integer
maxIdle
;
private
Long
maxWait
;
private
Integer
statSqlMaxSize
;
private
Long
minEvictableIdleTimeMillis
;
private
Long
maxEvictableIdleTimeMillis
;
...
...
matrix-mybatis/matrix-mybatis-core/src/main/java/com/secoo/mall/mybatis/interceptor/MatrixPerformanceInterceptor.java
View file @
82a2c2c7
...
...
@@ -17,10 +17,10 @@ package com.secoo.mall.mybatis.interceptor;
import
com.baomidou.mybatisplus.core.toolkit.*
;
import
com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils
;
import
com.mysql.cj.jdbc.ClientPreparedStatement
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.apache.commons.lang3.reflect.MethodUtils
;
import
org.apache.ibatis.executor.statement.StatementHandler
;
import
org.apache.ibatis.logging.Log
;
import
org.apache.ibatis.logging.LogFactory
;
...
...
@@ -101,14 +101,9 @@ public class MatrixPerformanceInterceptor implements Interceptor {
String
originalSql
=
null
;
String
stmtClassName
=
statement
.
getClass
().
getName
();
if
(
DruidPooledPreparedStatement
.
equals
(
stmtClassName
))
{
try
{
if
(
statement
instanceof
ClientPreparedStatement
)
{
originalSql
=
ClientPreparedStatement
.
class
.
cast
(
Statement
.
class
).
asSql
();
}
Object
rawPreparedStatement
=
MethodUtils
.
invokeExactMethod
(
statement
,
"getRawPreparedStatement"
);
originalSql
=
MethodUtils
.
invokeExactMethod
(
rawPreparedStatement
,
"asSql"
).
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
else
if
(
T4CPreparedStatement
.
equals
(
stmtClassName
)
||
OraclePreparedStatementWrapper
.
equals
(
stmtClassName
))
{
try
{
...
...
matrix-protocol/matrix-protocol-dubbo-core/pom.xml
View file @
82a2c2c7
...
...
@@ -28,7 +28,6 @@
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-web
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
...
...
matrix-protocol/matrix-protocol-web-starter/src/main/java/com/secoo/mall/web/spring/boot/autoconfigure/MatrixWebAutoConfiguration.java
View file @
82a2c2c7
...
...
@@ -6,6 +6,7 @@ import com.secoo.mall.common.util.sys.SystemUtil;
import
com.secoo.mall.web.annotation.ApiController
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
...
...
@@ -29,6 +30,7 @@ public class MatrixWebAutoConfiguration {
private
String
appVersion
;
@Bean
@ConditionalOnMissingBean
(
Docket
.
class
)
public
Docket
createWebApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
()).
enable
(
SystemUtil
.
isBetaEnv
())
...
...
matrix-protocol/pom.xml
View file @
82a2c2c7
...
...
@@ -66,11 +66,7 @@
</exclusion>
</exclusions>
</dependency>-->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
${dubbo-starter.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
...
...
@@ -90,6 +86,17 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
${dubbo-starter.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--zookeeper-->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment