clearing-service http://jira.mfd.msk:8088/browse/CLS-647 добавил логи

This commit is contained in:
AKurakin 2024-02-12 12:57:29 +03:00
parent 96a0ef78aa
commit 0815f66ee7
2 changed files with 12 additions and 0 deletions

View file

@ -99,12 +99,16 @@ public class BalanceRevise implements ISessionStage {
Collection<Long> currencies = currencyImdg.projectSingleAttribute("id");
Long millis = null;
if (fromTime != null) {
log.debug("sendSdf, parameter fromTime={}", fromTime);
Instant fromInstant = TimeUtil.localDateTimeToInstant(LocalDateTime.of(LocalDate.now(), fromTime));
millis = fromInstant.toEpochMilli();
} else {
Statement statement = statementImdg.aggregateByMax("created", StatementRevisePredicate.get(statementImdg, currencies));
if (statement != null) {
log.debug("sendSdf, parameter fromTime not set, use max(statement.created)={}", statement.getCreated());
millis = statement.getCreated().toEpochMilli();
} else {
log.debug("sendSdf, parameter fromTime not set, and statement's not found.");
}
}
newSDf56(millis);

View file

@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static org.junit.jupiter.api.Assertions.*;
@ -15,4 +16,11 @@ class TimeUtilTest {
LocalDate date2 = TimeUtil.toLocalDate(date1);
assertEquals("2009-02-14", date2.toString());
}
@Test
void localDateTimeToInstant() {
Instant theI = TimeUtil.localDateTimeToInstant(LocalDateTime.of(2024, 2, 9, 10, 11, 22));
assertEquals("2024-02-09T07:11:22Z", theI.toString()); // msk = UTC+3
assertEquals(1707462682L, theI.getEpochSecond());
}
}