This commit is contained in:
k.struzhkin 2019-08-27 19:32:00 +03:00
parent d951db6de5
commit a271e6f674
2 changed files with 12 additions and 2 deletions

View File

@ -204,7 +204,7 @@ public class PlanDaoImpl extends NamedParameterJdbcDaoSupport implements PlanDao
"from shm.posting_log " + "from shm.posting_log " +
"where plan_id = :planId and batch_id= :batchId"; "where plan_id = :planId and batch_id= :batchId";
return getNamedParameterJdbcTemplate().queryForObject(sqlGetClock, params, Long.class); return queryForLong(params, sqlGetClock);
} }
@Override @Override
@ -215,7 +215,13 @@ public class PlanDaoImpl extends NamedParameterJdbcDaoSupport implements PlanDao
"from shm.posting_log " + "from shm.posting_log " +
"where from_account_id = :accId or to_account_id= :accId"; "where from_account_id = :accId or to_account_id= :accId";
return getNamedParameterJdbcTemplate().queryForObject(sqlGetClock, params, Long.class); return queryForLong(params, sqlGetClock);
}
private long queryForLong(MapSqlParameterSource params, String sqlGetClock) {
Long clock = getNamedParameterJdbcTemplate()
.queryForObject(sqlGetClock, params, Long.class);
return clock != null ? clock : 0L;
} }
private void checkBatchUpdate(int[][] updateCounts) { private void checkBatchUpdate(int[][] updateCounts) {

View File

@ -293,6 +293,10 @@ public class ShumpuneServiceHandlerTest extends DaoTestBase {
Balance balanceSecond = handler.getBalanceByID(firstAcc, Clock.latest(new LatestClock())); Balance balanceSecond = handler.getBalanceByID(firstAcc, Clock.latest(new LatestClock()));
Assert.assertEquals(balance.getClock(), balanceSecond.getClock()); Assert.assertEquals(balance.getClock(), balanceSecond.getClock());
Balance unknownAccount = handler.getBalanceByID(12321L, Clock.latest(new LatestClock()));
Assert.assertEquals(0L, unknownAccount.getOwnAmount());
} }
private void assertAccount(Account account, AccountPrototype accountPrototype) { private void assertAccount(Account account, AccountPrototype accountPrototype) {