fixed notification confirm from SEB client

This commit is contained in:
anhefti 2021-09-16 11:33:25 +02:00
parent c126056959
commit 0546b97b0a

View file

@ -210,17 +210,26 @@ public class ClientEventDAOImpl implements ClientEventDAO {
.selectByExample() .selectByExample()
.where(ClientEventRecordDynamicSqlSupport.clientConnectionId, isEqualTo(clientConnectionId)) .where(ClientEventRecordDynamicSqlSupport.clientConnectionId, isEqualTo(clientConnectionId))
.and(ClientEventRecordDynamicSqlSupport.type, isEqualTo(EventType.NOTIFICATION.id)) .and(ClientEventRecordDynamicSqlSupport.type, isEqualTo(EventType.NOTIFICATION.id))
.and(
ClientEventRecordDynamicSqlSupport.numericValue,
isEqualTo(new BigDecimal(notificationValueId)))
.build() .build()
.execute(); .execute();
if (records.size() != 1) { if (log.isDebugEnabled()) {
log.warn("Expected one notification event log but found: ", records.size()); log.debug("Found notification for clientConnectionId: {} notification: {}",
clientConnectionId,
records);
} }
return records.get(0); return records.stream()
.filter(rec -> {
final BigDecimal numericValue = rec.getNumericValue();
if (numericValue == null) {
return false;
}
return numericValue.longValue() == notificationValueId;
})
.findFirst()
.orElseThrow(() -> new IllegalStateException(
"Failed to find pending notification event for confirm:" + notificationValueId));
}) })
.flatMap(ClientEventDAOImpl::toClientNotificationModel); .flatMap(ClientEventDAOImpl::toClientNotificationModel);