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);
|
||||
log.trace("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);
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ public class TradeImporterService {
|
|||
});
|
||||
|
||||
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 (byCommand) {
|
||||
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())) {
|
||||
isTradingDate = true;
|
||||
|
||||
if (calendar != null && calendar.getClearingDate() == today) {
|
||||
if (calendar.getDayStatus().equals(DayStatus.DayOff.toString())) {
|
||||
isTradingDate = false;
|
||||
}
|
||||
if (calendar != null && DayStatus.DayOff.equalsByKey(calendar.getDayStatus())) {
|
||||
isTradingDate = false;
|
||||
}
|
||||
} else {
|
||||
isTradingDate = false;
|
||||
|
||||
if (calendar != null && calendar.getClearingDate() == today) {
|
||||
if (calendar.getDayStatus().equals(DayStatus.Workday.toString())) {
|
||||
isTradingDate = true;
|
||||
}
|
||||
if (calendar != null && DayStatus.Workday.equalsByKey(calendar.getDayStatus())) {
|
||||
isTradingDate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,16 +200,16 @@ public class TradeImporterService {
|
|||
|
||||
public STrades getSTradesFromImdg(STrades tradesDb, Imdg<STrades> sTradesImdg) {
|
||||
return sTradesImdg.getFirstObjectByFieldValues(Map.of("tradeDate", tradesDb.getTradeDate(),
|
||||
"tradeNum", tradesDb.getTradeNum(),
|
||||
"operation", tradesDb.getOperation(),
|
||||
"classCode", tradesDb.getClassCode()));
|
||||
"tradeNum", tradesDb.getTradeNum(),
|
||||
"operation", tradesDb.getOperation(),
|
||||
"classCode", tradesDb.getClassCode()));
|
||||
}
|
||||
|
||||
private boolean isValidTrades(STrades trades) {
|
||||
return trades.getTradeDate() != null
|
||||
&& trades.getTradeNum() != null
|
||||
&& StringUtils.hasText(trades.getOperation())
|
||||
&& trades.getTradeNum() != null;
|
||||
&& trades.getTradeNum() != null
|
||||
&& StringUtils.hasText(trades.getOperation())
|
||||
&& trades.getTradeNum() != null;
|
||||
}
|
||||
|
||||
public STrades readSTrades(ResultSet resultSet) throws SQLException {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue