Parcourir la source

Merge branch 'develop' into develop-kjf-dev

Pota1ovO il y a 2 ans
Parent
commit
9932475589

+ 2 - 2
kxs-stat/kxs-stat-biz/src/main/java/com/kxs/stat/biz/service/impl/KxsUserTradeServiceImpl.java

@@ -78,8 +78,8 @@ public class KxsUserTradeServiceImpl extends ServiceImpl<KxsUserTradeMapper, Kxs
 
         String version = LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_FORMATTER);
         //计算增量的pos交易
-        String tableName = PREFIX_TABLE_NAME + "after_" + thisMoth;
-//        String tableName = PREFIX_TABLE_NAME + thisMoth;
+//        String tableName = PREFIX_TABLE_NAME + "after_" + thisMoth;
+        String tableName = PREFIX_TABLE_NAME + thisMoth;
         String tempTableName = PREFIX_TABLE_NAME_TEMP + thisMoth;
 
         int batchSize = 20;

+ 12 - 0
kxs-transfer/src/main/java/com/kxs/transfer/api/task/taskJob.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.aliyun.dts.subscribe.clients.record.OperationType;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.kxs.transfer.api.model.KxsDtsErrorLog;
+import com.kxs.transfer.api.model.KxsDtsLog;
 import com.kxs.transfer.api.model.table.DMLData;
 import com.kxs.transfer.api.service.KxsDtsErrorLogService;
 import com.kxs.transfer.api.service.KxsDtsLogService;
@@ -23,6 +24,7 @@ import org.apache.commons.lang.exception.ExceptionUtils;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -123,4 +125,14 @@ public class taskJob {
 
     }
 
+    /**
+     * 由于每天同步数据量太大,必须每天清除一次日志
+     * 删除 DTS 日志
+     */
+    @Scheduled(cron = "0 0 1 * * ?")
+    public void removeDtsLogBeforeDay(){
+        LocalDateTime oneDayAgo = LocalDateTime.now().minusDays(1);
+        kxsDtsLogService.remove(Wrappers.<KxsDtsLog>lambdaQuery().lt(KxsDtsLog::getCreateTime,oneDayAgo));
+    }
+
 }