[Core] [Editor] Increased editor buffering prompt limit

This commit is contained in:
qianmoQ 2023-05-17 19:26:51 +08:00
parent a2c184038f
commit 19974018c9
3 changed files with 43 additions and 22 deletions

View File

@ -8,6 +8,9 @@ spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
datacap.security.secret=DataCapSecretKey
datacap.security.expiration=86400000
### datacap editor configuration
datacap.editor.sugs.maxSize=1000
################################ Web configure #################################
### Forwarding system preset related errors to custom processing
spring.mvc.throw-exception-if-no-handler-found=true

View File

@ -8,6 +8,7 @@ import io.edurt.datacap.server.repository.TemplateSqlRepository;
import io.edurt.datacap.server.scheduled.SourceScheduledRunnable;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -22,8 +23,9 @@ public class ScheduleTaskRunnerConfigure
private final TemplateSqlRepository templateSqlRepository;
private final ScheduledCronRegistrar scheduledCronRegistrar;
private final RedisTemplate redisTemplate;
private final Environment environment;
public ScheduleTaskRunnerConfigure(Injector injector, ScheduledTaskRepository scheduledTaskRepository, SourceRepository sourceRepository, TemplateSqlRepository templateSqlRepository, ScheduledCronRegistrar scheduledCronRegistrar, RedisTemplate redisTemplate)
public ScheduleTaskRunnerConfigure(Injector injector, ScheduledTaskRepository scheduledTaskRepository, SourceRepository sourceRepository, TemplateSqlRepository templateSqlRepository, ScheduledCronRegistrar scheduledCronRegistrar, RedisTemplate redisTemplate, Environment environment)
{
this.injector = injector;
this.scheduledTaskRepository = scheduledTaskRepository;
@ -31,6 +33,7 @@ public class ScheduleTaskRunnerConfigure
this.templateSqlRepository = templateSqlRepository;
this.scheduledCronRegistrar = scheduledCronRegistrar;
this.redisTemplate = redisTemplate;
this.environment = environment;
}
@Override
@ -38,7 +41,7 @@ public class ScheduleTaskRunnerConfigure
{
this.scheduledTaskRepository.findAllByActiveIsTrueAndIsSystemIsTrue().forEach(task -> {
log.info("Add new task " + task.getName() + " to scheduler");
SourceScheduledRunnable scheduled = new SourceScheduledRunnable(task.getName(), this.injector, this.sourceRepository, templateSqlRepository, redisTemplate);
SourceScheduledRunnable scheduled = new SourceScheduledRunnable(task.getName(), this.injector, this.sourceRepository, templateSqlRepository, redisTemplate, environment);
this.scheduledCronRegistrar.addCronTask(scheduled, task.getExpression());
});
}

View File

@ -17,6 +17,7 @@ import io.edurt.datacap.spi.model.Response;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.HashMap;
@ -40,14 +41,19 @@ public class SourceScheduledRunnable
private final SourceRepository sourceRepository;
private final TemplateSqlRepository templateSqlRepository;
private final RedisTemplate redisTemplate;
private final Environment environment;
public SourceScheduledRunnable(String name, Injector injector, SourceRepository sourceRepository, TemplateSqlRepository templateSqlRepository, RedisTemplate redisTemplate)
private int maxSuggestions;
public SourceScheduledRunnable(String name, Injector injector, SourceRepository sourceRepository, TemplateSqlRepository templateSqlRepository, RedisTemplate redisTemplate, Environment environment)
{
super(name);
this.injector = injector;
this.sourceRepository = sourceRepository;
this.templateSqlRepository = templateSqlRepository;
this.redisTemplate = redisTemplate;
this.environment = environment;
this.maxSuggestions = Integer.valueOf(environment.getProperty("datacap.editor.sugs.maxSize"));
}
@Override
@ -139,13 +145,16 @@ public class SourceScheduledRunnable
log.warn("The scheduled task {} template {} is not available", this.getName(), entity.getName(), GET_ALL_TABLES);
}
else {
response.getColumns().forEach(column -> {
String database = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} sync data from source : {}", this.getName(), entity.getName(), database);
Map<String, String> configure = new HashMap<>();
configure.put("database", database);
this.processTable(entity, this.getContent(getAllTableEntity, configure), database, plugin, key);
});
response.getColumns()
.stream()
.limit(maxSuggestions)
.forEach(column -> {
String database = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} sync data from source : {}", this.getName(), entity.getName(), database);
Map<String, String> configure = new HashMap<>();
configure.put("database", database);
this.processTable(entity, this.getContent(getAllTableEntity, configure), database, plugin, key);
});
}
}
else {
@ -164,13 +173,16 @@ public class SourceScheduledRunnable
log.warn("The scheduled task {} template {} is not available", this.getName(), entity.getName(), GET_ALL_COLUMNS);
}
else {
response.getColumns().forEach(column -> {
String table = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} database {} sync data from source is : {}", this.getName(), entity.getName(), database, table);
Map<String, String> configure = new HashMap<>();
configure.put("table", String.join(".", database, table));
this.processColumn(entity, this.getContent(getAllChildEntity, configure), database, table, plugin, key);
});
response.getColumns()
.stream()
.limit(maxSuggestions)
.forEach(column -> {
String table = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} database {} sync data from source is : {}", this.getName(), entity.getName(), database, table);
Map<String, String> configure = new HashMap<>();
configure.put("table", String.join(".", database, table));
this.processColumn(entity, this.getContent(getAllChildEntity, configure), database, table, plugin, key);
});
}
}
else {
@ -189,11 +201,14 @@ public class SourceScheduledRunnable
log.warn("The scheduled task {} template {} is not available", this.getName(), entity.getName(), GET_ALL_COLUMNS);
}
else {
response.getColumns().forEach(column -> {
String value = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} database {} table {} sync data from source is : {}", this.getName(), entity.getName(), database, table, value);
redisTemplate.opsForSet().add(key, String.join(".", database, table, value));
});
response.getColumns()
.stream()
.limit(maxSuggestions)
.forEach(column -> {
String value = ((List<String>) column).get(0);
log.info("The scheduled task {} child {} database {} table {} sync data from source is : {}", this.getName(), entity.getName(), database, table, value);
redisTemplate.opsForSet().add(key, String.join(".", database, table, value));
});
}
}
else {