|
@@ -11,6 +11,7 @@ import com.slibra.business.mapper.TXinyiRobotMapper;
|
|
import com.slibra.common.enums.DataSourceType;
|
|
import com.slibra.common.enums.DataSourceType;
|
|
import com.slibra.common.utils.DateUtils;
|
|
import com.slibra.common.utils.DateUtils;
|
|
import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
|
|
import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import com.slibra.common.utils.StringUtils;
|
|
import com.slibra.common.utils.StringUtils;
|
|
@@ -21,6 +22,7 @@ import java.math.BigDecimal;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 定时任务调度测试
|
|
* 定时任务调度测试
|
|
@@ -28,6 +30,7 @@ import java.util.*;
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
@Component("ryTask")
|
|
@Component("ryTask")
|
|
|
|
+@Slf4j
|
|
public class RyTask
|
|
public class RyTask
|
|
{
|
|
{
|
|
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
|
|
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
|
|
@@ -274,13 +277,19 @@ public class RyTask
|
|
* 定时从sqlserver获取数据
|
|
* 定时从sqlserver获取数据
|
|
*/
|
|
*/
|
|
public void sqlserverData(){
|
|
public void sqlserverData(){
|
|
-
|
|
|
|
|
|
+ //主库获取上次最新的同步日期
|
|
|
|
+ String lastTime = this.xinyiRobotMapper.selectLastTime();
|
|
//从
|
|
//从
|
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
- List<TXinyiRobot> tXinyiRobots = xinyiRobotMapper.selectTXinyiRobotList(null);
|
|
|
|
|
|
+ List<TXinyiRobot> tXinyiRobots = xinyiRobotMapper.selectTXinyiRobotListByTime(lastTime);
|
|
DynamicDataSourceContextHolder.clearDataSourceType();
|
|
DynamicDataSourceContextHolder.clearDataSourceType();
|
|
- System.out.println(JSON.toJSONString(tXinyiRobots));
|
|
|
|
- System.out.println("-------------");
|
|
|
|
|
|
+ try {
|
|
|
|
+ TimeUnit.SECONDS.sleep(3);
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+// System.out.println(JSON.toJSONString(tXinyiRobots));
|
|
|
|
+// System.out.println("-------------");
|
|
//主
|
|
//主
|
|
if(!CollectionUtils.isEmpty(tXinyiRobots)){
|
|
if(!CollectionUtils.isEmpty(tXinyiRobots)){
|
|
for (TXinyiRobot tXinyiRobot : tXinyiRobots) {
|
|
for (TXinyiRobot tXinyiRobot : tXinyiRobots) {
|