From be5d8b0156a9ab5e99f783544f6f433b5aa91522 Mon Sep 17 00:00:00 2001 From: infin_caishuxiao Date: Sat, 24 Feb 2018 16:44:06 +0800 Subject: [PATCH] 1 --- .../config}/Application.java | 2 +- .../config/DataSourceConfig.java | 2 +- .../config/PrdDbConfig.java | 4 +- .../config/XxlJobConfig.java | 2 +- .../collection/CronCollectionServiceImpl.java | 3 +- .../executor/core/config/StatsDbConfig.java | 39 ------------------- .../src/main/resources/application.properties | 6 +-- ...obExecutorExampleBootApplicationTests.java | 2 +- 8 files changed, 11 insertions(+), 49 deletions(-) rename infintech-executors/executor-collection-dispatcher/src/main/java/com/{xxl/job/executor => infincash/config}/Application.java (94%) rename infintech-executors/executor-collection-dispatcher/src/main/java/com/{xxl/job/executor/core => infincash}/config/DataSourceConfig.java (94%) rename infintech-executors/executor-collection-dispatcher/src/main/java/com/{xxl/job/executor/core => infincash}/config/PrdDbConfig.java (88%) rename infintech-executors/executor-collection-dispatcher/src/main/java/com/{xxl/job/executor/core => infincash}/config/XxlJobConfig.java (97%) delete mode 100644 infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/StatsDbConfig.java diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/Application.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/Application.java similarity index 94% rename from infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/Application.java rename to infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/Application.java index c98c3811..f4eb2694 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/Application.java +++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/Application.java @@ -1,4 +1,4 @@ -package com.xxl.job.executor; +package com.infincash.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/DataSourceConfig.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/DataSourceConfig.java similarity index 94% rename from infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/DataSourceConfig.java rename to infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/DataSourceConfig.java index b5411e32..44f4f9ef 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/DataSourceConfig.java +++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/DataSourceConfig.java @@ -1,4 +1,4 @@ -package com.xxl.job.executor.core.config; +package com.infincash.config; import javax.sql.DataSource; diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/PrdDbConfig.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/PrdDbConfig.java similarity index 88% rename from infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/PrdDbConfig.java rename to infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/PrdDbConfig.java index c890aa05..9c7c8243 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/PrdDbConfig.java +++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/PrdDbConfig.java @@ -1,4 +1,4 @@ -package com.xxl.job.executor.core.config; +package com.infincash.config; import javax.sql.DataSource; @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @Configuration -@MapperScan(basePackages = {"com.infincash.statistics.risk.mapper.prd"}, sqlSessionFactoryRef = "sqlSessionFactoryPrd") +@MapperScan(basePackages = {"com.infincash.cron.collection.mapper"}, sqlSessionFactoryRef = "sqlSessionFactoryPrd") public class PrdDbConfig { static final String MAPPER_LOCATION = "classpath:mapping/prd/*.xml"; diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/XxlJobConfig.java similarity index 97% rename from infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java rename to infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/XxlJobConfig.java index 76436502..b3ccce37 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java +++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/config/XxlJobConfig.java @@ -1,4 +1,4 @@ -package com.xxl.job.executor.core.config; +package com.infincash.config; import com.xxl.job.core.executor.XxlJobExecutor; import org.slf4j.Logger; diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java index c92c11ad..a23e2314 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java +++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java @@ -4,12 +4,12 @@ import static com.infincash.util.Jdk8DateUtils.dateSubstract; import static com.infincash.util.Jdk8DateUtils.getDateAfter; import java.util.Date; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -19,6 +19,7 @@ import com.infincash.cron.collection.table.TBizCollection; import com.infincash.cron.collection.table.TBizCollectionOverdueBucket; import com.xxl.job.core.log.XxlJobLogger; +@Service public class CronCollectionServiceImpl implements CronCollectionService { @Autowired diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/StatsDbConfig.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/StatsDbConfig.java deleted file mode 100644 index ce4fb563..00000000 --- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/xxl/job/executor/core/config/StatsDbConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.xxl.job.executor.core.config; - -import javax.sql.DataSource; - -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; - -@Configuration -@MapperScan(basePackages = {"com.infincash.statistics.risk.mapper.stats"}, sqlSessionFactoryRef = "sqlSessionFactoryStats") -public class StatsDbConfig { - static final String MAPPER_LOCATION = "classpath:mapping/stats/*.xml"; - - @Autowired - @Qualifier("stats") - private DataSource stats; - - @Bean - public SqlSessionFactory sqlSessionFactoryStats() throws Exception { - SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); - factoryBean.setDataSource(stats); - factoryBean.setMapperLocations( - new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION) - ); - return factoryBean.getObject(); - } - - @Bean - public SqlSessionTemplate sqlSessionTemplateStats() throws Exception { - SqlSessionTemplate template = new SqlSessionTemplate(sqlSessionFactoryStats()); // 使用上面配置的Factory - return template; - } -} \ No newline at end of file diff --git a/infintech-executors/executor-collection-dispatcher/src/main/resources/application.properties b/infintech-executors/executor-collection-dispatcher/src/main/resources/application.properties index cbeb5538..158ce552 100644 --- a/infintech-executors/executor-collection-dispatcher/src/main/resources/application.properties +++ b/infintech-executors/executor-collection-dispatcher/src/main/resources/application.properties @@ -1,9 +1,9 @@ -spring.datasource.prd.url=jdbc:mysql://47.74.188.197:3306/microfinance?autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false +spring.datasource.prd.url=jdbc:mysql://172.16.16.99:3306/microfinance?autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false spring.datasource.prd.username=jobopr spring.datasource.prd.password=jobopr666 spring.datasource.prd.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.stats.url=jdbc:mysql://47.74.188.197:3306/microfinance1?autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false +spring.datasource.stats.url=jdbc:mysql://172.16.16.99:3306/microfinance1?autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false spring.datasource.stats.username=jobopr spring.datasource.stats.password=jobopr666 spring.datasource.stats.driver-class-name=com.mysql.jdbc.Driver @@ -19,7 +19,7 @@ logging.config=classpath:logback.xml ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" -xxl.job.admin.addresses=http://127.0.0.1:8090 +xxl.job.admin.addresses=http://172.16.16.101:8090 #xxl.job.admin.addresses=http://dispatch-center.infincash.com ### xxl-job executor address diff --git a/infintech-executors/executor-collection-dispatcher/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java b/infintech-executors/executor-collection-dispatcher/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java index f8e35772..4344788d 100644 --- a/infintech-executors/executor-collection-dispatcher/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java +++ b/infintech-executors/executor-collection-dispatcher/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java @@ -5,7 +5,7 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.xxl.job.executor.Application; +import com.infincash.config.Application; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class ,webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT)