Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
dc-java
Commits
7be08f88
Commit
7be08f88
authored
Nov 14, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
23b1d38f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
28 deletions
+27
-28
DruidDataSourceFactory.java
...in/java/com/bailuntec/support/DruidDataSourceFactory.java
+10
-14
mybatis-config.xml
data-common/src/main/resources/mybatis-config.xml
+2
-2
job.properties
...show/show-auto-turnover/src/main/resources/job.properties
+1
-1
AutoTurnoverJobTest.java
.../src/test/java/com/bailuntec/job/AutoTurnoverJobTest.java
+14
-11
No files found.
data-common/src/main/java/com/bailuntec/support/DruidDataSourceFactory.java
View file @
7be08f88
package
com
.
bailuntec
.
support
;
package
com
.
bailuntec
.
support
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.ibatis.datasource.DataSourceFactory
;
import
org.apache.ibatis.datasource.DataSourceFactory
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
import
java.util.Properties
;
import
java.util.Properties
;
public
class
DruidDataSourceFactory
implements
DataSourceFactory
{
public
class
DruidDataSourceFactory
implements
DataSourceFactory
{
private
Properties
props
;
private
Properties
props
;
@Override
@Override
public
void
setProperties
(
Properties
props
)
{
public
void
setProperties
(
Properties
props
)
{
this
.
props
=
props
;
this
.
props
=
props
;
...
@@ -16,17 +17,12 @@ public class DruidDataSourceFactory implements DataSourceFactory {
...
@@ -16,17 +17,12 @@ public class DruidDataSourceFactory implements DataSourceFactory {
@Override
@Override
public
DataSource
getDataSource
()
{
public
DataSource
getDataSource
()
{
DruidDataSource
dds
=
new
DruidDataSource
();
HikariConfig
hikariConfig
=
new
HikariConfig
();
dds
.
setDriverClassName
(
this
.
props
.
getProperty
(
"driver"
));
hikariConfig
.
setDriverClassName
(
this
.
props
.
getProperty
(
"driver"
));
dds
.
setUrl
(
this
.
props
.
getProperty
(
"url"
));
hikariConfig
.
setJdbcUrl
(
this
.
props
.
getProperty
(
"url"
));
dds
.
setUsername
(
this
.
props
.
getProperty
(
"username"
));
hikariConfig
.
setUsername
(
this
.
props
.
getProperty
(
"username"
));
dds
.
setPassword
(
this
.
props
.
getProperty
(
"password"
));
hikariConfig
.
setPassword
(
this
.
props
.
getProperty
(
"password"
));
// 其他配置可以根据MyBatis主配置文件进行配置
try
{
return
new
HikariDataSource
(
hikariConfig
);
dds
.
init
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
return
dds
;
}
}
}
}
data-common/src/main/resources/mybatis-config.xml
View file @
7be08f88
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
<configuration>
<configuration>
<!--<properties resource="db-tj.properties"/>-->
<!--<properties resource="db-tj.properties"/>-->
<properties
resource=
"db-dev.properties"
/>
<properties
resource=
"db-dev.properties"
/>
<!-- <properties resource="db-prod.properties"/>-->
<!-- <properties resource="db-prod.properties"/>-->
<settings>
<settings>
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
</settings>
...
...
data-show/show-auto-turnover/src/main/resources/job.properties
View file @
7be08f88
...
@@ -20,6 +20,6 @@ JOB_CRON_NE_NORMAL=0 0 1 ? * MON
...
@@ -20,6 +20,6 @@ JOB_CRON_NE_NORMAL=0 0 1 ? * MON
JOB_NAME_INCREMENT
=
show-auto-turnover-increment
JOB_NAME_INCREMENT
=
show-auto-turnover-increment
JOB_CRON_INCREMENT
=
0
0 14
* * ?
JOB_CRON_INCREMENT
=
0
52 17
* * ?
SHARDING_TOTAL_COUNT_INCREMENT
=
8
SHARDING_TOTAL_COUNT_INCREMENT
=
8
data-show/show-auto-turnover/src/test/java/com/bailuntec/job/AutoTurnoverJobTest.java
View file @
7be08f88
...
@@ -57,7 +57,7 @@ public class AutoTurnoverJobTest {
...
@@ -57,7 +57,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
0
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
0
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -68,7 +68,7 @@ public class AutoTurnoverJobTest {
...
@@ -68,7 +68,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
1
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
1
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -79,7 +79,7 @@ public class AutoTurnoverJobTest {
...
@@ -79,7 +79,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
2
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
2
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -90,7 +90,7 @@ public class AutoTurnoverJobTest {
...
@@ -90,7 +90,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
3
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
3
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -101,7 +101,7 @@ public class AutoTurnoverJobTest {
...
@@ -101,7 +101,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
4
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
4
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -112,7 +112,7 @@ public class AutoTurnoverJobTest {
...
@@ -112,7 +112,7 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
5
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
5
),
jobPointLog
);
jobPointLog
);
}
}
...
@@ -123,29 +123,32 @@ public class AutoTurnoverJobTest {
...
@@ -123,29 +123,32 @@ public class AutoTurnoverJobTest {
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
6
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
6
),
jobPointLog
);
jobPointLog
);
}
}
@Test
@Test
public
void
syncAll7
()
{
public
void
syncAll7
()
{
JobPointLog
jobPointLog
=
new
JobPointLog
();
JobPointLog
jobPointLog
=
new
JobPointLog
();
jobPointLog
.
setPageIndex
(
2
);
jobPointLog
.
setPageIndex
(
1
);
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
NORMAL
"
,
new
HashMap
<>()),
7
),
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
null
,
8
,
"
INCREMENT
"
,
new
HashMap
<>()),
7
),
jobPointLog
);
jobPointLog
);
}
}
@Test
@Test
public
void
sync
All
7_1
()
{
public
void
sync7_1
()
{
JobPointLog
jobPointLog
=
new
JobPointLog
();
JobPointLog
jobPointLog
=
new
JobPointLog
();
jobPointLog
.
setPageIndex
(
1
);
jobPointLog
.
setPageIndex
(
1
);
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageSize
(
1000
);
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
autoTurnoverJob
.
jobInit
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
"show-auto-turnover2"
,
8
,
"NORMAL"
,
new
HashMap
<>()),
7
));
autoTurnoverJob
.
executeJob
(
new
ShardingContext
(
new
ShardingContexts
(
"x"
,
"show-auto-turnover3"
,
1
,
"INCREMENT"
,
new
HashMap
<>()),
0
),
jobPointLog
);
}
}
...
...
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