NEW: Null-check for contract report preferences

This commit is contained in:
Inal Arsanukaev 2018-10-01 19:09:26 +03:00
parent b96d1210a3
commit b421e5d495
3 changed files with 16 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>newway</artifactId>
<version>1.0.17-SNAPSHOT</version>
<version>1.0.18-SNAPSHOT</version>
<packaging>jar</packaging>
<name>newway</name>

View File

@ -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);

View File

@ -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);
}
}