This commit is contained in:
parent
6dcba1dded
commit
7e8b3cc13e
1 changed files with 12 additions and 16 deletions
|
|
@ -78,7 +78,7 @@ public class TradeImporterService {
|
||||||
String countQuery = String.format("SELECT count(*) FROM %s.Trades", schema);
|
String countQuery = String.format("SELECT count(*) FROM %s.Trades", schema);
|
||||||
log.trace("Query: {}", countQuery);
|
log.trace("Query: {}", countQuery);
|
||||||
Collection<Long> tradesCountFromDB = jdbcTemplate.query(countQuery,
|
Collection<Long> tradesCountFromDB = jdbcTemplate.query(countQuery,
|
||||||
(resultSet, i) -> resultSet.getObject(1, Long.class));
|
(resultSet, i) -> resultSet.getObject(1, Long.class));
|
||||||
log.debug("Count of Trades in db: {}. Will be loading.", tradesCountFromDB);
|
log.debug("Count of Trades in db: {}. Will be loading.", tradesCountFromDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class TradeImporterService {
|
||||||
});
|
});
|
||||||
|
|
||||||
log.debug("From DB {} STrades has loaded. Created {} new STrades, {} updated.",
|
log.debug("From DB {} STrades has loaded. Created {} new STrades, {} updated.",
|
||||||
rows.get(), created.get(), updated.get());
|
rows.get(), created.get(), updated.get());
|
||||||
if (created.get() > 0 || (byCommand && updated.get() > 0)) {
|
if (created.get() > 0 || (byCommand && updated.get() > 0)) {
|
||||||
if (byCommand) {
|
if (byCommand) {
|
||||||
log.debug("Successfully import STrades from DB by command. Send to kafka command, topic={}", S_TRADES_IMPORTED);
|
log.debug("Successfully import STrades from DB by command. Send to kafka command, topic={}", S_TRADES_IMPORTED);
|
||||||
|
|
@ -150,18 +150,14 @@ public class TradeImporterService {
|
||||||
if (!Arrays.asList(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY).contains(today.getDayOfWeek())) {
|
if (!Arrays.asList(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY).contains(today.getDayOfWeek())) {
|
||||||
isTradingDate = true;
|
isTradingDate = true;
|
||||||
|
|
||||||
if (calendar != null && calendar.getClearingDate() == today) {
|
if (calendar != null && DayStatus.DayOff.equalsByKey(calendar.getDayStatus())) {
|
||||||
if (calendar.getDayStatus().equals(DayStatus.DayOff.toString())) {
|
isTradingDate = false;
|
||||||
isTradingDate = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isTradingDate = false;
|
isTradingDate = false;
|
||||||
|
|
||||||
if (calendar != null && calendar.getClearingDate() == today) {
|
if (calendar != null && DayStatus.Workday.equalsByKey(calendar.getDayStatus())) {
|
||||||
if (calendar.getDayStatus().equals(DayStatus.Workday.toString())) {
|
isTradingDate = true;
|
||||||
isTradingDate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,16 +200,16 @@ public class TradeImporterService {
|
||||||
|
|
||||||
public STrades getSTradesFromImdg(STrades tradesDb, Imdg<STrades> sTradesImdg) {
|
public STrades getSTradesFromImdg(STrades tradesDb, Imdg<STrades> sTradesImdg) {
|
||||||
return sTradesImdg.getFirstObjectByFieldValues(Map.of("tradeDate", tradesDb.getTradeDate(),
|
return sTradesImdg.getFirstObjectByFieldValues(Map.of("tradeDate", tradesDb.getTradeDate(),
|
||||||
"tradeNum", tradesDb.getTradeNum(),
|
"tradeNum", tradesDb.getTradeNum(),
|
||||||
"operation", tradesDb.getOperation(),
|
"operation", tradesDb.getOperation(),
|
||||||
"classCode", tradesDb.getClassCode()));
|
"classCode", tradesDb.getClassCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidTrades(STrades trades) {
|
private boolean isValidTrades(STrades trades) {
|
||||||
return trades.getTradeDate() != null
|
return trades.getTradeDate() != null
|
||||||
&& trades.getTradeNum() != null
|
&& trades.getTradeNum() != null
|
||||||
&& StringUtils.hasText(trades.getOperation())
|
&& StringUtils.hasText(trades.getOperation())
|
||||||
&& trades.getTradeNum() != null;
|
&& trades.getTradeNum() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public STrades readSTrades(ResultSet resultSet) throws SQLException {
|
public STrades readSTrades(ResultSet resultSet) throws SQLException {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue