From b421e5d495390b8c68114d3aecf6fc014c07e478 Mon Sep 17 00:00:00 2001 From: Inal Arsanukaev Date: Mon, 1 Oct 2018 19:09:26 +0300 Subject: [PATCH] NEW: Null-check for contract report preferences --- pom.xml | 2 +- .../ContractReportPreferencesChangedHandler.java | 6 +++++- .../java/com/rbkmoney/newway/util/ContractUtil.java | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 00c7f2c..5a7a6b7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 newway - 1.0.17-SNAPSHOT + 1.0.18-SNAPSHOT jar newway diff --git a/src/main/java/com/rbkmoney/newway/poller/event_stock/impl/party_mngmnt/contract/ContractReportPreferencesChangedHandler.java b/src/main/java/com/rbkmoney/newway/poller/event_stock/impl/party_mngmnt/contract/ContractReportPreferencesChangedHandler.java index fc3921c..aa671ab 100644 --- a/src/main/java/com/rbkmoney/newway/poller/event_stock/impl/party_mngmnt/contract/ContractReportPreferencesChangedHandler.java +++ b/src/main/java/com/rbkmoney/newway/poller/event_stock/impl/party_mngmnt/contract/ContractReportPreferencesChangedHandler.java @@ -57,7 +57,11 @@ public class ContractReportPreferencesChangedHandler extends AbstractClaimChange contractSource.setWtime(null); contractSource.setEventId(eventId); contractSource.setEventCreatedAt(TypeUtil.stringToLocalDateTime(event.getCreatedAt())); - ContractUtil.fillReportPreferences(contractSource, reportPreferencesChanged.getServiceAcceptanceActPreferences()); + if (reportPreferencesChanged != null && reportPreferencesChanged.isSetServiceAcceptanceActPreferences()) { + ContractUtil.fillReportPreferences(contractSource, reportPreferencesChanged.getServiceAcceptanceActPreferences()); + } else { + ContractUtil.setNullReportPreferences(contractSource); + } contractDao.updateNotCurrent(partyId, contractId); long cntrctId = contractDao.save(contractSource); diff --git a/src/main/java/com/rbkmoney/newway/util/ContractUtil.java b/src/main/java/com/rbkmoney/newway/util/ContractUtil.java index 19a6e41..b28e49c 100644 --- a/src/main/java/com/rbkmoney/newway/util/ContractUtil.java +++ b/src/main/java/com/rbkmoney/newway/util/ContractUtil.java @@ -119,4 +119,14 @@ public class ContractUtil { } } } + + public static void setNullReportPreferences(com.rbkmoney.newway.domain.tables.pojos.Contract contract) { + contract.setReportActScheduleId(null); + contract.setReportActSignerPosition(null); + contract.setReportActSignerFullName(null); + contract.setReportActSignerDocument(null); + contract.setReportActSignerDocPowerOfAttorneyLegalAgreementId(null); + contract.setReportActSignerDocPowerOfAttorneySignedAt(null); + contract.setReportActSignerDocPowerOfAttorneyValidUntil(null); + } }