imdg http://jira.mfd.msk:8088/browse/CLS-520 RegistryMapStore
This commit is contained in:
parent
5135ddcd99
commit
ccdd38ad1a
1 changed files with 22 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.spcex.clearing.imdg.businessobject;
|
package ru.spcex.clearing.imdg.businessobject;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.classes.statics.data.registry.Registry;
|
import ru.clearing.classes.statics.data.registry.Registry;
|
||||||
|
|
@ -10,6 +11,7 @@ import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
@ -34,6 +36,26 @@ public class RegistryMapStore extends TemplateMapStore<Registry> {
|
||||||
return new String[]{"sessionId"};
|
return new String[]{"sessionId"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<Long> loadAllKeys() {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
log.debug("loadAllKeys from {} with condition and today {}", getTableName(), today);
|
||||||
|
List<Long> keys;
|
||||||
|
String sql = "select id from " + getTableName() + " WHERE registry_designation='A' OR " +
|
||||||
|
"(registry_designation='D' AND (clearing_date = ? OR registry_status='PROC' OR registry_status='MNG')) OR" +
|
||||||
|
"((registry_designation='C' OR registry_designation='L') AND clearing_date=?) OR" +
|
||||||
|
"((registry_designation='O' OR registry_designation='T') AND (clearing_date=? OR registry_status='PROC' OR registry_status='MNG'))";
|
||||||
|
try {
|
||||||
|
keys = jdbcTemplate.query(sql,
|
||||||
|
(resultSet, i) -> resultSet.getLong("id"),
|
||||||
|
new Object[]{today, today, today});
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("At load keys from {} (sql \"{}\"): {}", getTableName(), sql, ExceptionUtils.getStackTrace(e));
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue