From 48341ebc0fb3678e9372e6584420a65a91c34e54 Mon Sep 17 00:00:00 2001 From: MagzhanArtykov Date: Mon, 29 Jan 2024 19:56:54 +0600 Subject: [PATCH] MODTLR-13 Handle request update event from data tenant to update ECS TLR --- src/main/java/org/folio/domain/entity/EcsTlrEntity.java | 1 + src/main/java/org/folio/repository/EcsTlrRepository.java | 2 +- src/main/java/org/folio/service/impl/EcsTlrServiceImpl.java | 3 +-- src/main/resources/db/changelog/changes/initial_schema.xml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/folio/domain/entity/EcsTlrEntity.java b/src/main/java/org/folio/domain/entity/EcsTlrEntity.java index 84343d04..f069c9e4 100644 --- a/src/main/java/org/folio/domain/entity/EcsTlrEntity.java +++ b/src/main/java/org/folio/domain/entity/EcsTlrEntity.java @@ -23,6 +23,7 @@ public class EcsTlrEntity { private UUID id; private UUID instanceId; private UUID requesterId; + private UUID tlrId; private String requestType; private String requestLevel; private Date requestExpirationDate; diff --git a/src/main/java/org/folio/repository/EcsTlrRepository.java b/src/main/java/org/folio/repository/EcsTlrRepository.java index f4e6d8d8..ee89e0b5 100644 --- a/src/main/java/org/folio/repository/EcsTlrRepository.java +++ b/src/main/java/org/folio/repository/EcsTlrRepository.java @@ -9,5 +9,5 @@ @Repository public interface EcsTlrRepository extends JpaRepository { - //Optional findByTlrId(UUID tlrRequestId); + Optional findByTlrId(UUID tlrRequestId); } diff --git a/src/main/java/org/folio/service/impl/EcsTlrServiceImpl.java b/src/main/java/org/folio/service/impl/EcsTlrServiceImpl.java index f2b64af8..2db6c012 100644 --- a/src/main/java/org/folio/service/impl/EcsTlrServiceImpl.java +++ b/src/main/java/org/folio/service/impl/EcsTlrServiceImpl.java @@ -6,7 +6,6 @@ import org.folio.client.CirculationClient; import org.folio.domain.dto.EcsTlr; import org.folio.domain.dto.Request; -import org.folio.domain.entity.EcsTlrEntity; import org.folio.domain.mapper.EcsTlrMapper; import org.folio.repository.EcsTlrRepository; import org.folio.service.TenantScopedExecutionService; @@ -46,7 +45,7 @@ public EcsTlr post(EcsTlr ecsTlr) { @Override public void updateRequestItem(UUID tlrRequestId, UUID itemId) { log.debug("updateRequestItem:: parameters tlrRequestId: {}, itemId: {}", tlrRequestId, itemId); - ecsTlrRepository.findById(tlrRequestId).ifPresentOrElse( + ecsTlrRepository.findByTlrId(tlrRequestId).ifPresentOrElse( ecsTlrEntity -> { ecsTlrEntity.setItemId(itemId); ecsTlrRepository.save(ecsTlrEntity); diff --git a/src/main/resources/db/changelog/changes/initial_schema.xml b/src/main/resources/db/changelog/changes/initial_schema.xml index d0ea0ae6..61747d75 100644 --- a/src/main/resources/db/changelog/changes/initial_schema.xml +++ b/src/main/resources/db/changelog/changes/initial_schema.xml @@ -15,6 +15,7 @@ +