Commit 6f6a239d by huluobin

update

parent dd7dc2f8
...@@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface DcAutoSalesForecastConfigMapper extends BaseMapper<DcAutoSalesForecastConfig> { public interface DcAutoSalesForecastConfigMapper extends BaseMapper<DcAutoSalesForecastConfig> {
DcAutoSalesForecastConfig selectById(Integer id);
} }
...@@ -2,4 +2,9 @@ ...@@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bailuntec.mapper.DcAutoSalesForecastConfigMapper"> <mapper namespace="com.bailuntec.mapper.DcAutoSalesForecastConfigMapper">
<select id="selectById" resultType="com.bailuntec.domain.entity.DcAutoSalesForecastConfig">
select *
from dc_auto_sales_forecast_config
where id = #{id}
</select>
</mapper> </mapper>
...@@ -1387,6 +1387,7 @@ ...@@ -1387,6 +1387,7 @@
on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
where (t2.`status` = 0 or t2.`status` is null) where (t2.`status` = 0 or t2.`status` is null)
and t1.id % #{shardingContext.shardingTotalCount} = #{shardingContext.shardingItem} and t1.id % #{shardingContext.shardingTotalCount} = #{shardingContext.shardingItem}
order by t1.id desc
limit #{pageStart}, #{pageOffset}; limit #{pageStart}, #{pageOffset};
</select> </select>
......
...@@ -35,12 +35,12 @@ public abstract class PointJob implements SimpleJob { ...@@ -35,12 +35,12 @@ public abstract class PointJob implements SimpleJob {
} }
} }
private JobPointLog jobInit(ShardingContext shardingContext) { public JobPointLog jobInit(ShardingContext shardingContext) {
JobPointLog jobPointLog = null; JobPointLog jobPointLog = null;
try { try {
JobPointLogMapper mapper = SessionUtil.getSession().getMapper(JobPointLogMapper.class); JobPointLogMapper mapper = SessionUtil.getSession().getMapper(JobPointLogMapper.class);
jobPointLog = mapper.selectOneByExample(JobPointLogExample.newAndCreateCriteria().andJobNameEqualTo(shardingContext.getJobName()).example()); jobPointLog = mapper.selectOneByExample(JobPointLogExample.newAndCreateCriteria().andJobNameEqualTo(shardingContext.getJobName()).example());
if (jobPointLog == null) { if (jobPointLog == null) {
jobPointLog = new JobPointLog(shardingContext.getJobName(), 1, 100, 0, 1, LocalDateTime.now().minusDays(1), LocalDateTime.now()); jobPointLog = new JobPointLog(shardingContext.getJobName(), 1, 100, 0, 1, LocalDateTime.now().minusDays(1), LocalDateTime.now());
} }
...@@ -53,7 +53,7 @@ public abstract class PointJob implements SimpleJob { ...@@ -53,7 +53,7 @@ public abstract class PointJob implements SimpleJob {
return jobPointLog; return jobPointLog;
} }
public abstract void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) ; public abstract void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog);
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
import org.apache.ibatis.io.Resources; import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.Reader; import java.io.Reader;
...@@ -13,7 +14,7 @@ public class SessionUtil { ...@@ -13,7 +14,7 @@ public class SessionUtil {
private static final ThreadLocal<SqlSession> threadLocal = new ThreadLocal<>(); private static final ThreadLocal<SqlSession> threadLocal = new ThreadLocal<>();
private static final ThreadLocal<SqlSession> threadLocalTransction = new ThreadLocal<>(); private static final ThreadLocal<SqlSession> threadLocalTransction = new ThreadLocal<>();
private static Reader reader = null; private static Reader reader = null;
private static MybatisSqlSessionFactoryBuilder builder = null; private static SqlSessionFactoryBuilder builder = null;
private static SqlSessionFactory factory = null; private static SqlSessionFactory factory = null;
//不允许对该类进行new操作 //不允许对该类进行new操作
...@@ -25,7 +26,7 @@ public class SessionUtil { ...@@ -25,7 +26,7 @@ public class SessionUtil {
//1.加载配置文件 //1.加载配置文件
reader = Resources.getResourceAsReader(CommonConstant.MYBATIS_CONFIG); reader = Resources.getResourceAsReader(CommonConstant.MYBATIS_CONFIG);
//2.得到工厂的创建对象 //2.得到工厂的创建对象
builder = new MybatisSqlSessionFactoryBuilder(); builder = new SqlSessionFactoryBuilder();
//3.得到工厂对象 //3.得到工厂对象
factory = builder.build(reader); factory = builder.build(reader);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -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-dev.properties"/>
<!-- <properties resource="db-prod.properties"/>-->
<settings> <settings>
<setting name="mapUnderscoreToCamelCase" value="true"/> <setting name="mapUnderscoreToCamelCase" value="true"/>
</settings> </settings>
......
...@@ -33,11 +33,9 @@ ...@@ -33,11 +33,9 @@
<okhttp.version>3.12.0</okhttp.version> <okhttp.version>3.12.0</okhttp.version>
<slf4j.version>1.7.25</slf4j.version> <slf4j.version>1.7.25</slf4j.version>
<log4j.version>2.11.1</log4j.version> <log4j.version>2.11.1</log4j.version>
<mybatis.version>3.4.6</mybatis.version>
<fastjson.version>1.2.54</fastjson.version> <fastjson.version>1.2.54</fastjson.version>
<commons-beanutils.version>1.9.3</commons-beanutils.version> <commons-beanutils.version>1.9.3</commons-beanutils.version>
<data-common.version>1.0-SNAPSHOT</data-common.version> <data-common.version>1.0-SNAPSHOT</data-common.version>
<mybatis-spring-boot.version>1.3.1</mybatis-spring-boot.version>
<pagehelper-spring-boot.version>1.2.4</pagehelper-spring-boot.version> <pagehelper-spring-boot.version>1.2.4</pagehelper-spring-boot.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<lombok.version>1.18.4</lombok.version> <lombok.version>1.18.4</lombok.version>
...@@ -143,13 +141,6 @@ ...@@ -143,13 +141,6 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!--mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
...@@ -175,14 +166,6 @@ ...@@ -175,14 +166,6 @@
<version>${spring-boot.version}</version> <version>${spring-boot.version}</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.bailuntec</groupId> <groupId>com.bailuntec</groupId>
<artifactId>data-common</artifactId> <artifactId>data-common</artifactId>
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<relativePath>../data-parent/pom.xml</relativePath> <relativePath>../data-parent/pom.xml</relativePath>
</parent> </parent>
<groupId>com.bailuntec</groupId>
<artifactId>data-show</artifactId> <artifactId>data-show</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<modules> <modules>
<module>show-auto-turnover</module> <module>show-auto-turnover</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -51,13 +51,13 @@ public class AutoTurnoverJobTest { ...@@ -51,13 +51,13 @@ public class AutoTurnoverJobTest {
@Test @Test
public void syncAll() { public void syncAll0() {
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.executeJob(new ShardingContext(new ShardingContexts("x", null, 1, "NORMAL", new HashMap<>()), 0), autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", 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, 4, "NORMAL", new HashMap<>()), 1), autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", 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, 4, "NORMAL", new HashMap<>()), 2), autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 2),
jobPointLog); jobPointLog);
} }
...@@ -90,10 +90,64 @@ public class AutoTurnoverJobTest { ...@@ -90,10 +90,64 @@ 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, 4, "NORMAL", new HashMap<>()), 3), autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 3),
jobPointLog);
}
@Test
public void syncAll4() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 4),
jobPointLog);
}
@Test
public void syncAll5() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 5),
jobPointLog);
}
@Test
public void syncAll6() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 6),
jobPointLog);
}
@Test
public void syncAll7() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(2);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 7),
jobPointLog); jobPointLog);
} }
@Test
public void syncAll7_1() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.jobInit(new ShardingContext(new ShardingContexts("x", "show-auto-turnover2", 8, "NORMAL", new HashMap<>()), 7));
}
@Test @Test
public void syncIncrement() { public void syncIncrement() {
......
...@@ -29,13 +29,6 @@ ...@@ -29,13 +29,6 @@
<version>5.1.47</version> <version>5.1.47</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment