|
@@ -0,0 +1,27 @@
|
|
|
|
|
+package com.webflux.launchadmin.mysql.task;
|
|
|
|
|
+
|
|
|
|
|
+import com.webflux.launchadmin.context.UserContext;
|
|
|
|
|
+import com.webflux.launchadmin.global.BaseException;
|
|
|
|
|
+import com.webflux.launchadmin.mysql.entity.listening.ListeningPlanNew;
|
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
+import org.springframework.data.relational.core.query.Criteria;
|
|
|
|
|
+import org.springframework.data.relational.core.query.Query;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
+import reactor.core.publisher.Flux;
|
|
|
|
|
+import reactor.core.publisher.Mono;
|
|
|
|
|
+
|
|
|
|
|
+public class SyncPlanToRedis {
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private R2dbcEntityTemplate template;
|
|
|
|
|
+
|
|
|
|
|
+ @Scheduled(cron="0 */1 * * * ?")
|
|
|
|
|
+ public void syncListenBook(){
|
|
|
|
|
+ Flux<ListeningPlanNew> plans = template.select(ListeningPlanNew.class).all();
|
|
|
|
|
+ plans.toIterable().forEach(one -> {
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|