etreshenkov 2023-11-03 13:15:49 +03:00
parent 9b26fb2290
commit 60e7c6ac39

View file

@ -16,7 +16,6 @@ import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import static ru.spcex.clearing.imdg.base.ObjectBaseMapStore.MAX_IN_CLAUSE_SIZE;
@ -77,14 +76,8 @@ public abstract class AbstractSliceMapLoader<T extends WithId> implements Autoco
@Override
public Iterable<Long> loadAllKeys() {
log.debug("loading all keys from {}...", getTableName());
LocalDate yesterdayInstant = LocalDate.now().minus(0, ChronoUnit.DAYS);
// Instant yesterdayInstant = Instant.now().minus(0, ChronoUnit.DAYS);
LocalDate fewDaysAgo = yesterdayInstant.minus(2, ChronoUnit.DAYS);
String fieldOfDay = fieldOfDay();
List<Long> ids = jdbcTemplate.query("select id from " + getTableName() + " where " + fieldOfDay + " <= ? " +
"and " + fieldOfDay + " >= ? ",
(resultSet, i) -> resultSet.getLong("id"),
yesterdayInstant, fewDaysAgo);
List<Long> ids = jdbcTemplate.query("select id from " + getTableName(),
(resultSet, i) -> resultSet.getLong("id"));
log.debug("loading all keys from {} done; size={}", getTableName(), ids.size());
return ids;
}