mirror of
https://github.com/valitydev/deanonimus.git
synced 2024-11-06 02:05:16 +00:00
fix review
This commit is contained in:
parent
486cfd3137
commit
24e4ba3874
@ -2,6 +2,7 @@ package com.rbkmoney.deanonimus.converter;
|
||||
|
||||
import com.rbkmoney.damsel.deanonimus.*;
|
||||
import com.rbkmoney.deanonimus.domain.Contractor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -39,32 +40,38 @@ public class ContractorConverter {
|
||||
}
|
||||
|
||||
private LegalEntity convertLegalEntity(Contractor contractor) {
|
||||
switch (contractor.getLegalEntity()) {
|
||||
case international_legal_entity -> {
|
||||
InternationalLegalEntity internationalLegalEntity = new InternationalLegalEntity()
|
||||
.setLegalName(contractor.getInternationalLegalEntityLegalName())
|
||||
.setTradingName(contractor.getInternationalLegalEntityTradingName())
|
||||
.setRegisteredAddress(contractor.getInternationalLegalEntityRegisteredAddress())
|
||||
.setActualAddress(contractor.getInternationalLegalEntityActualAddress())
|
||||
.setRegisteredNumber(contractor.getInternationalLegalEntityRegisteredNumber());
|
||||
return LegalEntity.international_legal_entity(internationalLegalEntity);
|
||||
}
|
||||
case russian_legal_entity -> {
|
||||
RussianLegalEntity russianLegalEntity = new RussianLegalEntity()
|
||||
.setRegisteredName(contractor.getRussianLegalEntityRegisteredName())
|
||||
.setRegisteredNumber(contractor.getRussianLegalEntityRegisteredNumber())
|
||||
.setInn(contractor.getRussianLegalEntityInn())
|
||||
.setActualAddress(contractor.getRussianLegalEntityActualAddress())
|
||||
.setPostAddress(contractor.getRussianLegalEntityPostAddress())
|
||||
.setRussianBankAccount(new RussianBankAccount(
|
||||
contractor.getRussianLegalEntityRussianBankAccount(),
|
||||
contractor.getRussianLegalEntityRussianBankName(),
|
||||
contractor.getRussianLegalEntityRussianBankPostAccount(),
|
||||
contractor.getRussianLegalEntityRussianBankBik()
|
||||
));
|
||||
return LegalEntity.russian_legal_entity(russianLegalEntity);
|
||||
}
|
||||
return switch (contractor.getLegalEntity()) {
|
||||
case international_legal_entity -> buildInternationalLegalEntity(contractor);
|
||||
case russian_legal_entity -> buildRussianLegalEntity(contractor);
|
||||
default -> throw new IllegalArgumentException("No such legalEntity " + contractor.getLegalEntity());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LegalEntity buildInternationalLegalEntity(Contractor contractor) {
|
||||
InternationalLegalEntity internationalLegalEntity = new InternationalLegalEntity()
|
||||
.setLegalName(contractor.getInternationalLegalEntityLegalName())
|
||||
.setTradingName(contractor.getInternationalLegalEntityTradingName())
|
||||
.setRegisteredAddress(contractor.getInternationalLegalEntityRegisteredAddress())
|
||||
.setActualAddress(contractor.getInternationalLegalEntityActualAddress())
|
||||
.setRegisteredNumber(contractor.getInternationalLegalEntityRegisteredNumber());
|
||||
return LegalEntity.international_legal_entity(internationalLegalEntity);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LegalEntity buildRussianLegalEntity(Contractor contractor) {
|
||||
RussianLegalEntity russianLegalEntity = new RussianLegalEntity()
|
||||
.setRegisteredName(contractor.getRussianLegalEntityRegisteredName())
|
||||
.setRegisteredNumber(contractor.getRussianLegalEntityRegisteredNumber())
|
||||
.setInn(contractor.getRussianLegalEntityInn())
|
||||
.setActualAddress(contractor.getRussianLegalEntityActualAddress())
|
||||
.setPostAddress(contractor.getRussianLegalEntityPostAddress())
|
||||
.setRussianBankAccount(new RussianBankAccount(
|
||||
contractor.getRussianLegalEntityRussianBankAccount(),
|
||||
contractor.getRussianLegalEntityRussianBankName(),
|
||||
contractor.getRussianLegalEntityRussianBankPostAccount(),
|
||||
contractor.getRussianLegalEntityRussianBankBik()
|
||||
));
|
||||
return LegalEntity.russian_legal_entity(russianLegalEntity);
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +46,11 @@ public class ContractLegalAgreementBoundHandler extends AbstractClaimChangedHand
|
||||
String partyId = event.getSourceId();
|
||||
log.info("Start contract legal agreement bound handling, sequenceId={}, partyId={}, contractId={}, changeId={}",
|
||||
sequenceId, partyId, contractId, changeId);
|
||||
|
||||
Party party = partyRepository.findById(partyId).orElseThrow(() -> new PartyNotFoundException(partyId));
|
||||
|
||||
Contract contract =
|
||||
party.getContractById(contractId).orElseThrow(() -> new ContractNotFoundException(contractId));
|
||||
Party party = partyRepository.findById(partyId)
|
||||
.orElseThrow(() -> new PartyNotFoundException(partyId));
|
||||
Contract contract = party.getContractById(contractId)
|
||||
.orElseThrow(() -> new ContractNotFoundException(contractId));
|
||||
contract.setLegalAgreementId(legalAgreement.getLegalAgreementId());
|
||||
|
||||
partyRepository.save(party);
|
||||
|
||||
log.info("End contract legal agreement bound handling, sequenceId={}, partyId={}, contractId={}, changeId={}",
|
||||
|
@ -48,7 +48,7 @@ public class ContractReportPreferencesChangedHandler extends AbstractClaimChange
|
||||
log.info(
|
||||
"""
|
||||
Start contract report preferences changed handling,
|
||||
"sequenceId={}, partyId={}, contractId={}, changeId={}
|
||||
sequenceId={}, partyId={}, contractId={}, changeId={}
|
||||
""",
|
||||
sequenceId, partyId, contractId, changeId);
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class PartyManagementListener {
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
ack.acknowledge();
|
||||
log.info("Batch partyManagement has been committed, size={}, {}", messages.size(),
|
||||
LogUtil.toSummaryStringWithSinkEventValues(messages));
|
||||
log.info("Batch partyManagement has been committed, size={}, {}",
|
||||
messages.size(), LogUtil.toSummaryStringWithSinkEventValues(messages));
|
||||
}
|
||||
}
|
@ -15,8 +15,7 @@ public class ContractUtil {
|
||||
public static void fillReportPreferences(Contract contract,
|
||||
ServiceAcceptanceActPreferences serviceAcceptanceActPreferences) {
|
||||
contract.setReportActSignerFullName(serviceAcceptanceActPreferences.getSigner().getFullName());
|
||||
final com.rbkmoney.damsel.domain.RepresentativeDocument document =
|
||||
serviceAcceptanceActPreferences.getSigner().getDocument();
|
||||
var document = serviceAcceptanceActPreferences.getSigner().getDocument();
|
||||
RepresentativeDocument reportActSignerDocument =
|
||||
TypeUtil.toEnumField(document.getSetField().getFieldName(), RepresentativeDocument.class);
|
||||
if (reportActSignerDocument == null) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rbkmoney.deanonimus.util;
|
||||
|
||||
import com.rbkmoney.damsel.domain.InternationalLegalEntity;
|
||||
import com.rbkmoney.damsel.domain.RussianBankAccount;
|
||||
import com.rbkmoney.damsel.domain.RussianLegalEntity;
|
||||
import com.rbkmoney.deanonimus.domain.Contractor;
|
||||
import com.rbkmoney.deanonimus.domain.ContractorType;
|
||||
@ -30,20 +31,18 @@ public class ContractorUtil {
|
||||
contractor.setRussianLegalEntityInn(russianLegalEntity.getInn());
|
||||
contractor.setRussianLegalEntityActualAddress(russianLegalEntity.getActualAddress());
|
||||
contractor.setRussianLegalEntityPostAddress(russianLegalEntity.getPostAddress());
|
||||
contractor.setRussianLegalEntityRussianBankAccount(
|
||||
russianLegalEntity.getRussianBankAccount().getAccount());
|
||||
contractor
|
||||
.setRussianLegalEntityRussianBankName(russianLegalEntity.getRussianBankAccount().getBankName());
|
||||
contractor.setRussianLegalEntityRussianBankPostAccount(
|
||||
russianLegalEntity.getRussianBankAccount().getBankPostAccount());
|
||||
contractor.setRussianLegalEntityRussianBankBik(russianLegalEntity.getRussianBankAccount().getBankBik());
|
||||
RussianBankAccount russianBankAccount = russianLegalEntity.getRussianBankAccount();
|
||||
contractor.setRussianLegalEntityRussianBankAccount(russianBankAccount.getAccount());
|
||||
contractor.setRussianLegalEntityRussianBankName(russianBankAccount.getBankName());
|
||||
contractor.setRussianLegalEntityRussianBankPostAccount(russianBankAccount.getBankPostAccount());
|
||||
contractor.setRussianLegalEntityRussianBankBik(russianBankAccount.getBankBik());
|
||||
} else if (contractorSource.getLegalEntity().isSetInternationalLegalEntity()) {
|
||||
InternationalLegalEntity internationalLegalEntity =
|
||||
contractorSource.getLegalEntity().getInternationalLegalEntity();
|
||||
contractor.setInternationalLegalEntityLegalName(internationalLegalEntity.getLegalName());
|
||||
contractor.setInternationalLegalEntityTradingName(internationalLegalEntity.getTradingName());
|
||||
contractor
|
||||
.setInternationalLegalEntityRegisteredAddress(internationalLegalEntity.getRegisteredAddress());
|
||||
contractor.setInternationalLegalEntityRegisteredAddress(
|
||||
internationalLegalEntity.getRegisteredAddress());
|
||||
contractor.setInternationalLegalEntityActualAddress(internationalLegalEntity.getActualAddress());
|
||||
contractor.setInternationalLegalEntityRegisteredNumber(internationalLegalEntity.getRegisteredNumber());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user