imdg http://jira.mfd.msk:8088/browse/CLS-473 ExecutionFondMapStore выгрузка по SETTLEMENT_DATE
This commit is contained in:
parent
31fee0e8f3
commit
63eab63c48
2 changed files with 14 additions and 5 deletions
|
|
@ -122,21 +122,30 @@ public abstract class SimpleObjectMapStore<T extends SpcexObjectBase> implements
|
|||
return keys;
|
||||
}
|
||||
|
||||
public Iterable<Long> defaultLoadAllKeysOnTodayByTradingDate() {
|
||||
/**
|
||||
* Выгружает ID по таблице по условию dateField >= today
|
||||
* @param dateField оле даты
|
||||
* @return ID's
|
||||
*/
|
||||
public Iterable<Long> defaultLoadAllKeysOnTodayByField(String dateField) {
|
||||
LocalDate today = LocalDate.now();
|
||||
log.debug("loadAllKeys from {} on today {}", getTableName(), today);
|
||||
log.debug("loadAllKeys from {} on {} >= today {}", getTableName(), dateField, today);
|
||||
List<Long> keys;
|
||||
try {
|
||||
keys = jdbcTemplate.query("select id from " + getTableName() + " where trading_date = ?",
|
||||
keys = jdbcTemplate.query("select id from " + getTableName() + " where "+ dateField +" >= ?",
|
||||
(resultSet, i) -> resultSet.getLong("id"),
|
||||
new Object[]{today});
|
||||
} catch (Throwable e) {
|
||||
log.error("At load keys from {}: {}", getTableName(), ExceptionUtils.getStackTrace(e));
|
||||
log.error("At load keys from {} (by field {}): {}", getTableName(), dateField, ExceptionUtils.getStackTrace(e));
|
||||
throw e;
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
public Iterable<Long> defaultLoadAllKeysOnTodayByTradingDate() {
|
||||
return defaultLoadAllKeysOnTodayByField("trading_date");
|
||||
}
|
||||
|
||||
protected void batchInsertUpdate(@NonNull String insertStatement, @NonNull List<Object[]> args) {
|
||||
try {
|
||||
int[][] ret = jdbcTemplate.batchUpdate(insertStatement, args, BATCH_SIZE, (ps, params) -> {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ExecutionFondMapStore extends TemplateMapStore<ExecutionFond> {
|
|||
|
||||
@Override
|
||||
public Iterable<Long> loadAllKeys() {
|
||||
return defaultLoadAllKeysOnTodayByTradingDate();
|
||||
return defaultLoadAllKeysOnTodayByField("SETTLEMENT_DATE");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue