diff --git a/pom.xml b/pom.xml
index deaf84f..6ffcd51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,7 +94,6 @@
${bitwalker.version}
-
com.github.oshi
@@ -204,14 +203,12 @@
${mapstruct.version}
-
com.google.guava
guava
33.2.1-jre
-
com.baomidou
mybatis-plus-core
@@ -219,6 +216,11 @@
compile
+
+ org.redisson
+ redisson-spring-boot-starter
+ 3.15.2
+
diff --git a/sync-common/pom.xml b/sync-common/pom.xml
index 2e95df9..991a7e0 100644
--- a/sync-common/pom.xml
+++ b/sync-common/pom.xml
@@ -96,10 +96,10 @@
jaxb-api
-
+
- org.springframework.boot
- spring-boot-starter-data-redis
+ org.redisson
+ redisson-spring-boot-starter
diff --git a/sync-common/src/main/java/com/lyr/common/core/redis/RedissonConfig.java b/sync-common/src/main/java/com/lyr/common/core/redis/RedissonConfig.java
new file mode 100644
index 0000000..7d2751a
--- /dev/null
+++ b/sync-common/src/main/java/com/lyr/common/core/redis/RedissonConfig.java
@@ -0,0 +1,45 @@
+package com.lyr.common.core.redis;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.redisson.Redisson;
+import org.redisson.api.RedissonClient;
+import org.redisson.config.Config;
+import org.redisson.config.SingleServerConfig;
+import org.redisson.config.TransportMode;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * packageName com.ktg.mes.config
+ *
+ * @author liyc
+ * @date 2024/9/3
+ * @description TODO
+ **/
+@Configuration
+public class RedissonConfig {
+
+
+ @Value("${spring.redis.host}")
+ private String host;
+ @Value("${spring.redis.port}")
+ private String port;
+ @Value("${spring.redis.password}")
+ private String password;
+
+ @Bean
+ public RedissonClient redissonClient() {
+ Config config = new Config();
+ config.setTransportMode(TransportMode.NIO);
+ SingleServerConfig singleServerConfig = config.useSingleServer();
+ String address = String.format("redis://%s:%s", host, port);
+ singleServerConfig.setAddress(address);
+ if (StringUtils.isNotEmpty(password)) {
+ singleServerConfig.setPassword(password);
+ }
+ RedissonClient redisson = Redisson.create(config);
+ return redisson;
+ }
+}
diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/Sync.java b/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/Sync.java
deleted file mode 100644
index f71b14a..0000000
--- a/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/Sync.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.lyr.gather.kis.domain.strategy;
-
-
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.*;
-
-/**
- * 同步服务策略
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Component
-public @interface Sync {
-
- String value();
-
- String tableName() default "";
-}
-
-
diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/SyncServicesStrategyContext.java b/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/SyncServicesStrategyContext.java
index 37dfade..fd8f1f7 100644
--- a/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/SyncServicesStrategyContext.java
+++ b/sync-gather/src/main/java/com/lyr/gather/kis/domain/strategy/SyncServicesStrategyContext.java
@@ -1,7 +1,7 @@
package com.lyr.gather.kis.domain.strategy;
+import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.lyr.common.annotation.DataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.annotation.AnnotationUtils;
@@ -35,7 +35,7 @@ public class SyncServicesStrategyContext implements BeanPostProcessor {
*/
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws SecurityException {
- Sync annotation = AnnotationUtils.findAnnotation(bean.getClass(), Sync.class);
+ TableName annotation = AnnotationUtils.findAnnotation(bean.getClass(), TableName.class);
if (ClassUtils.isAssignableValue(IService.class, bean) && annotation != null) {
handlerMap.put(annotation.value().toUpperCase().trim(), (IService) bean);
}
diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java
index 125dc6c..8fbaed6 100644
--- a/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java
+++ b/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java
@@ -1,11 +1,11 @@
package com.lyr.gather.kis.service.impl;
+import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyr.gather.kis.convert.TSupplierConvert;
import com.lyr.gather.kis.domain.model.TSupplier;
-import com.lyr.gather.kis.domain.strategy.Sync;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
import com.lyr.gather.kis.mapper.TSupplierMapper;
import com.lyr.gather.kis.service.TSupplierService;
@@ -21,7 +21,7 @@ import java.util.Map;
* @description TODO
**/
@Service
-@Sync("t_Supplier")
+@TableName("t_Supplier")
public class TSupplierServiceImpl extends ServiceImpl implements TSupplierService {
diff --git a/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java
index 6661a29..afcd0a3 100644
--- a/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java
+++ b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.ImmutableMap;
+import com.lyr.common.core.redis.RedisCache;
import com.lyr.gather.kis.domain.model.TSupplier;
import com.lyr.gather.kis.domain.strategy.SyncServicesStrategyContext;
import com.lyr.gather.local.convert.ConfigTaskConvert;
@@ -30,9 +31,11 @@ public class ConfigTaskServiceImpl extends ServiceImpl page(ConfigTaskReq req) {
@@ -71,6 +74,8 @@ public class ConfigTaskServiceImpl extends ServiceImpl handler = syncServicesStrategyContext.getHandler(tableName);
List tSuppliers = handler.listByMap(ImmutableMap.of(handler.getClass().getName(), dataSource));
+ long cacheList = redisCache.setCacheList(tableName, tSuppliers);
+ System.out.println("cacheList = " + cacheList);
return 0;
}
diff --git a/sync-gather/target/generated-sources/annotations/com/lyr/gather/kis/convert/TSupplierConvertImpl.java b/sync-gather/target/generated-sources/annotations/com/lyr/gather/kis/convert/TSupplierConvertImpl.java
index accde9a..d1cb3ca 100644
--- a/sync-gather/target/generated-sources/annotations/com/lyr/gather/kis/convert/TSupplierConvertImpl.java
+++ b/sync-gather/target/generated-sources/annotations/com/lyr/gather/kis/convert/TSupplierConvertImpl.java
@@ -6,7 +6,7 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
- date = "2024-11-07T18:10:07+0800",
+ date = "2024-11-07T18:23:20+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class TSupplierConvertImpl implements TSupplierConvert {
diff --git a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java
index 664f038..c516217 100644
--- a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java
+++ b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java
@@ -6,7 +6,7 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
- date = "2024-11-06T10:37:36+0800",
+ date = "2024-11-07T18:23:20+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class ConfigTaskConvertImpl implements ConfigTaskConvert {
diff --git a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java
index 763a89c..34386dc 100644
--- a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java
+++ b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java
@@ -8,7 +8,7 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
- date = "2024-11-06T10:37:36+0800",
+ date = "2024-11-07T18:23:21+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class DataSourceConfigConvertImpl implements DataSourceConfigConvert {