mirror of
https://github.com/valitydev/newway.git
synced 2024-11-06 09:25:22 +00:00
Fix ids
This commit is contained in:
parent
1c1268ca7d
commit
ae427dcce6
@ -94,7 +94,7 @@ public class ContractCreatedHandler extends AbstractClaimChangedHandler {
|
||||
contract.setContractorId(contractorId);
|
||||
|
||||
contractDao.save(contract).ifPresentOrElse(
|
||||
cntrctId -> updateContractReference(event, changeId, sequenceId, contractCreated, contractId, partyId, contractorId, cntrctId),
|
||||
cntrctId -> updateContractReference(event, changeId, sequenceId, contractCreated, contractId, partyId, contractorId, cntrctId, claimEffectId),
|
||||
() -> log.info("contract create duplicated, sequenceId={}, partyId={}, changeId={}", sequenceId, partyId, changeId)
|
||||
);
|
||||
}
|
||||
@ -110,9 +110,10 @@ public class ContractCreatedHandler extends AbstractClaimChangedHandler {
|
||||
}
|
||||
|
||||
private void updateContractReference(MachineEvent event, Integer changeId, long sequenceId, com.rbkmoney.damsel.domain.Contract contractCreated,
|
||||
String contractId, String partyId, String contractorId, Long cntrctId) {
|
||||
String contractId, String partyId, String contractorId, Long cntrctId, Integer claimEffectId) {
|
||||
if (contractCreated.isSetContractor()) {
|
||||
Contractor contractor = ContractorUtil.convertContractor(sequenceId, event.getCreatedAt(), partyId, contractCreated.getContractor(), contractorId, changeId);
|
||||
Contractor contractor = ContractorUtil.convertContractor(sequenceId, event.getCreatedAt(),
|
||||
partyId, contractCreated.getContractor(), contractorId, changeId, claimEffectId);
|
||||
contractorDao.save(contractor);
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ public class ContractorCreatedHandler extends AbstractClaimChangedHandler {
|
||||
log.info("Start contractor created handling, eventId={}, partyId={}, contractorId={}", eventId, partyId, contractorId);
|
||||
partyDao.get(partyId); //check party is exist
|
||||
|
||||
Contractor contractor = ContractorUtil.convertContractor(eventId, event.getCreatedAt(), partyId, contractorCreated, contractorId, changeId);
|
||||
Contractor contractor = ContractorUtil.convertContractor(eventId, event.getCreatedAt(), partyId, contractorCreated,
|
||||
contractorId, changeId, claimEffectId);
|
||||
contractor.setIdentificationalLevel(partyContractor.getStatus().name());
|
||||
contractor.setClaimEffectId(claimEffectId);
|
||||
contractorDao.save(contractor).ifPresentOrElse(
|
||||
cntrctId -> log.info("Contract contractor has been saved, eventId={}, partyId={}, contractorId={}", eventId, partyId, contractorId),
|
||||
() -> log.info("contract contractor duplicated, sequenceId={}, partyId={}, changeId={}", sequenceId, partyId, changeId)
|
||||
|
@ -131,7 +131,7 @@ public class PartyRevisionChangedHandler extends AbstractPartyManagementHandler
|
||||
contractIds.add(contractSourceId);
|
||||
Long contractId = ids.get(i);
|
||||
long sequenceId = event.getEventId();
|
||||
ContractUtil.resetBaseFields(event, changeId, sequenceId, contractSource, contractSource.getClaimEffectId());
|
||||
ContractUtil.resetBaseFields(event, changeId, sequenceId, contractSource, -1);
|
||||
contractSource.setId(contractId);
|
||||
contractSource.setRevision(revision);
|
||||
|
||||
|
@ -13,11 +13,13 @@ import com.rbkmoney.newway.domain.tables.pojos.Contractor;
|
||||
|
||||
public class ContractorUtil {
|
||||
public static Contractor convertContractor(long sequenceId, String eventCreatedAt, String partyId,
|
||||
com.rbkmoney.damsel.domain.Contractor contractorSource, String contractorId, Integer changeId) {
|
||||
com.rbkmoney.damsel.domain.Contractor contractorSource,
|
||||
String contractorId, Integer changeId, Integer claimEffectId) {
|
||||
Contractor contractor = new Contractor();
|
||||
contractor.setRevision(-1L);
|
||||
contractor.setSequenceId((int) sequenceId);
|
||||
contractor.setChangeId(changeId);
|
||||
contractor.setClaimEffectId(claimEffectId);
|
||||
contractor.setEventCreatedAt(TypeUtil.stringToLocalDateTime(eventCreatedAt));
|
||||
contractor.setPartyId(partyId);
|
||||
contractor.setContractorId(contractorId);
|
||||
|
@ -16,7 +16,7 @@ public class ShopUtil {
|
||||
|
||||
public static void resetBaseFields(MachineEvent event, Integer changeId, long sequenceId, Shop shopSource, Integer claimEffectId) {
|
||||
shopSource.setId(null);
|
||||
shopSource.setRevision(null);
|
||||
shopSource.setRevision(-1L);
|
||||
shopSource.setWtime(null);
|
||||
shopSource.setSequenceId((int) sequenceId);
|
||||
shopSource.setChangeId(changeId);
|
||||
|
2
src/main/resources/db/migration/V53__drop_fk_party.sql
Normal file
2
src/main/resources/db/migration/V53__drop_fk_party.sql
Normal file
@ -0,0 +1,2 @@
|
||||
alter table nw.contract_adjustment drop constraint if exists fk_adjustment_to_contract;
|
||||
alter table nw.payout_tool drop constraint if exists fk_payout_tool_to_contract;
|
Loading…
Reference in New Issue
Block a user