diff --git a/arex-storage-config/pom.xml b/arex-storage-config/pom.xml
index 041cee85..8dd21e3a 100644
--- a/arex-storage-config/pom.xml
+++ b/arex-storage-config/pom.xml
@@ -45,7 +45,7 @@
arex-storage-service
com.arextest
- 1.1.11
+ 1.1.12
diff --git a/arex-storage-config/src/main/java/com/arextest/config/mapper/SystemConfigurationMapper.java b/arex-storage-config/src/main/java/com/arextest/config/mapper/SystemConfigurationMapper.java
new file mode 100644
index 00000000..439f5a42
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/mapper/SystemConfigurationMapper.java
@@ -0,0 +1,26 @@
+package com.arextest.config.mapper;
+
+import com.arextest.config.model.dao.config.SystemConfigurationCollection;
+import com.arextest.config.model.dto.SystemConfiguration;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Mappings;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/21 19:53
+ */
+@Mapper
+public interface SystemConfigurationMapper {
+
+ SystemConfigurationMapper INSTANCE = Mappers.getMapper(SystemConfigurationMapper.class);
+
+ SystemConfiguration dtoFromDao(SystemConfigurationCollection dao);
+
+ @Mappings({@Mapping(target = "id", expression = "java(null)"),
+ @Mapping(target = "dataChangeCreateTime", expression = "java(System.currentTimeMillis())"),
+ @Mapping(target = "dataChangeUpdateTime", expression = "java(System.currentTimeMillis())")})
+ SystemConfigurationCollection daoFromDto(SystemConfiguration dto);
+}
+
diff --git a/arex-storage-config/src/main/java/com/arextest/config/model/dao/config/SystemConfigurationCollection.java b/arex-storage-config/src/main/java/com/arextest/config/model/dao/config/SystemConfigurationCollection.java
new file mode 100644
index 00000000..695a7764
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/model/dao/config/SystemConfigurationCollection.java
@@ -0,0 +1,35 @@
+package com.arextest.config.model.dao.config;
+
+import com.arextest.config.model.dao.BaseEntity;
+import com.arextest.config.model.dto.DesensitizationJar;
+import java.util.Map;
+import lombok.Data;
+import lombok.experimental.FieldNameConstants;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/21 19:43
+ */
+@Data
+@FieldNameConstants
+public class SystemConfigurationCollection extends BaseEntity {
+
+ public static final String DOCUMENT_NAME = "SystemConfiguration";
+
+ /**
+ * The problem of prohibiting concurrent repeated insertions, the key is unique the function of
+ * this record
+ */
+ private String key;
+ private Map refreshTaskMark;
+ private DesensitizationJar desensitizationJar;
+ private String callbackUrl;
+
+
+ public interface KeySummary {
+ String REFRESH_DATA = "refresh_data";
+ String DESERIALIZATION_JAR = "deserialization_jar";
+ String CALLBACK_URL = "callback_url";
+
+ }
+}
diff --git a/arex-storage-config/src/main/java/com/arextest/config/model/dto/DesensitizationJar.java b/arex-storage-config/src/main/java/com/arextest/config/model/dto/DesensitizationJar.java
new file mode 100644
index 00000000..2fe5fa1d
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/model/dto/DesensitizationJar.java
@@ -0,0 +1,13 @@
+package com.arextest.config.model.dto;
+
+import lombok.Data;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/20 20:11
+ */
+@Data
+public class DesensitizationJar {
+ private String jarUrl;
+ private String remark;
+}
diff --git a/arex-storage-config/src/main/java/com/arextest/config/model/dto/SystemConfiguration.java b/arex-storage-config/src/main/java/com/arextest/config/model/dto/SystemConfiguration.java
new file mode 100644
index 00000000..0d6afffa
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/model/dto/SystemConfiguration.java
@@ -0,0 +1,43 @@
+package com.arextest.config.model.dto;
+
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/21 19:54
+ */
+@Data
+public class SystemConfiguration {
+ /**
+ * The problem of prohibiting concurrent repeated insertions, the key is unique the function of
+ * this record
+ */
+ private String key;
+ private Map refreshTaskMark;
+ private DesensitizationJar desensitizationJar;
+ private String callbackUrl;
+
+ public static SystemConfiguration mergeConfigs(List systemConfigurations) {
+ if (systemConfigurations == null || systemConfigurations.isEmpty()) {
+ return new SystemConfiguration();
+ }
+ SystemConfiguration result = new SystemConfiguration();
+ for (SystemConfiguration systemConfiguration : systemConfigurations) {
+ if (systemConfiguration == null) {
+ continue;
+ }
+ if (systemConfiguration.getRefreshTaskMark() != null) {
+ result.setRefreshTaskMark(systemConfiguration.getRefreshTaskMark());
+ }
+ if (systemConfiguration.getDesensitizationJar() != null) {
+ result.setDesensitizationJar(systemConfiguration.getDesensitizationJar());
+ }
+ if (systemConfiguration.getCallbackUrl() != null) {
+ result.setCallbackUrl(systemConfiguration.getCallbackUrl());
+ }
+ }
+ return result;
+ }
+}
diff --git a/arex-storage-config/src/main/java/com/arextest/config/repository/SystemConfigurationRepository.java b/arex-storage-config/src/main/java/com/arextest/config/repository/SystemConfigurationRepository.java
new file mode 100644
index 00000000..11d4510d
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/repository/SystemConfigurationRepository.java
@@ -0,0 +1,17 @@
+package com.arextest.config.repository;
+
+import com.arextest.config.model.dto.SystemConfiguration;
+import java.util.List;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/21 19:57
+ */
+public interface SystemConfigurationRepository {
+ boolean saveConfig(SystemConfiguration systemConfig);
+
+ List getAllSystemConfigList();
+
+ SystemConfiguration getSystemConfigByKey(String key);
+
+}
diff --git a/arex-storage-config/src/main/java/com/arextest/config/repository/impl/SystemConfigurationRepositoryImpl.java b/arex-storage-config/src/main/java/com/arextest/config/repository/impl/SystemConfigurationRepositoryImpl.java
new file mode 100644
index 00000000..9b08a412
--- /dev/null
+++ b/arex-storage-config/src/main/java/com/arextest/config/repository/impl/SystemConfigurationRepositoryImpl.java
@@ -0,0 +1,69 @@
+package com.arextest.config.repository.impl;
+
+import com.arextest.config.mapper.SystemConfigurationMapper;
+import com.arextest.config.model.dao.config.SystemConfigurationCollection;
+import com.arextest.config.model.dao.config.SystemConfigurationCollection.Fields;
+import com.arextest.config.model.dto.SystemConfiguration;
+import com.arextest.config.repository.SystemConfigurationRepository;
+import com.arextest.config.utils.MongoHelper;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoCursor;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.Filters;
+import com.mongodb.client.model.UpdateOptions;
+import com.mongodb.client.model.Updates;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import org.bson.conversions.Bson;
+
+/**
+ * @author wildeslam.
+ * @create 2024/2/21 19:58
+ */
+public class SystemConfigurationRepositoryImpl implements SystemConfigurationRepository {
+
+ MongoCollection mongoCollection;
+ private MongoDatabase mongoDatabase;
+
+ public SystemConfigurationRepositoryImpl(MongoDatabase mongoDatabase) {
+ this.mongoDatabase = mongoDatabase;
+ }
+
+ @PostConstruct
+ public void init() {
+ this.mongoCollection = mongoDatabase.getCollection(SystemConfigurationCollection.DOCUMENT_NAME,
+ SystemConfigurationCollection.class);
+ }
+
+ @Override
+ public boolean saveConfig(SystemConfiguration systemConfig) {
+ Bson filter = Filters.eq(Fields.key, systemConfig.getKey());
+ List updateList = Arrays.asList(MongoHelper.getUpdate(),
+ MongoHelper.getFullProperties(systemConfig));
+ Bson updateCombine = Updates.combine(updateList);
+ return mongoCollection.updateOne(filter, updateCombine, new UpdateOptions().upsert(true))
+ .getModifiedCount() > 0;
+ }
+
+ @Override
+ public List getAllSystemConfigList() {
+ List systemConfigurations = new ArrayList<>();
+ try (MongoCursor cursor = mongoCollection.find().iterator()) {
+ while (cursor.hasNext()) {
+ SystemConfigurationCollection document = cursor.next();
+ SystemConfiguration dto = SystemConfigurationMapper.INSTANCE.dtoFromDao(document);
+ systemConfigurations.add(dto);
+ }
+ }
+ return systemConfigurations;
+ }
+
+ @Override
+ public SystemConfiguration getSystemConfigByKey(String key) {
+ Bson filter = Filters.eq(Fields.key, key);
+ SystemConfigurationCollection collection = mongoCollection.find(filter).first();
+ return collection == null ? null : SystemConfigurationMapper.INSTANCE.dtoFromDao(collection);
+ }
+}
diff --git a/arex-storage-model/pom.xml b/arex-storage-model/pom.xml
index fdf497a8..d72101e5 100644
--- a/arex-storage-model/pom.xml
+++ b/arex-storage-model/pom.xml
@@ -7,7 +7,7 @@
arex-storage-service
com.arextest
- 1.1.11
+ 1.1.12
diff --git a/arex-storage-web-api/pom.xml b/arex-storage-web-api/pom.xml
index 9e277f0e..80b90f08 100644
--- a/arex-storage-web-api/pom.xml
+++ b/arex-storage-web-api/pom.xml
@@ -123,7 +123,7 @@
arex-storage-service
com.arextest
- 1.1.11
+ 1.1.12
diff --git a/arex-storage-web-api/src/main/java/com/arextest/storage/beans/ConfigServiceAutoConfiguration.java b/arex-storage-web-api/src/main/java/com/arextest/storage/beans/ConfigServiceAutoConfiguration.java
index a88c1b0b..69408bd4 100644
--- a/arex-storage-web-api/src/main/java/com/arextest/storage/beans/ConfigServiceAutoConfiguration.java
+++ b/arex-storage-web-api/src/main/java/com/arextest/storage/beans/ConfigServiceAutoConfiguration.java
@@ -6,6 +6,7 @@
import com.arextest.config.repository.impl.DynamicClassConfigurationRepositoryImpl;
import com.arextest.config.repository.impl.InstancesConfigurationRepositoryImpl;
import com.arextest.config.repository.impl.ServiceCollectConfigurationRepositoryImpl;
+import com.arextest.config.repository.impl.SystemConfigurationRepositoryImpl;
import com.mongodb.client.MongoDatabase;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -49,4 +50,10 @@ public InstancesConfigurationRepositoryImpl instancesConfigurationRepositoryImpl
dynamicClassConfigurationRepositoryImpl(MongoDatabase mongoDatabase) {
return new DynamicClassConfigurationRepositoryImpl(mongoDatabase);
}
+
+ @Bean
+ public SystemConfigurationRepositoryImpl systemConfigurationRepositoryImpl(
+ MongoDatabase mongoDatabase) {
+ return new SystemConfigurationRepositoryImpl(mongoDatabase);
+ }
}
diff --git a/pom.xml b/pom.xml
index afecb1ad..b639b672 100644
--- a/pom.xml
+++ b/pom.xml
@@ -408,5 +408,5 @@
https://github.com/arextest/arex-storage
- 1.1.11
+ 1.1.12