From 1f007356859c3a4a70774536c6140d9a53da09d1 Mon Sep 17 00:00:00 2001 From: azizbekxm Date: Wed, 15 Nov 2023 18:00:53 +0500 Subject: [PATCH] [MODAUD-174] - Fixed ZoneOffset --- .../org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java | 5 +++-- .../folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java | 5 +++-- .../org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java index e81a7f0..b20d22a 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java @@ -13,6 +13,7 @@ import static org.folio.util.DbUtils.formatDBTableName; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.ZoneOffset; import java.util.Date; import java.util.UUID; @@ -89,8 +90,8 @@ private void makeSaveCall(Promise> promise, String query, OrderAudit orderAuditEvent.getAction(), orderAuditEvent.getOrderId(), orderAuditEvent.getUserId(), - LocalDateTime.ofInstant(orderAuditEvent.getEventDate().toInstant(), ZoneOffset.UTC), - LocalDateTime.ofInstant(orderAuditEvent.getActionDate().toInstant(), ZoneOffset.UTC), + LocalDateTime.ofInstant(orderAuditEvent.getEventDate().toInstant(), ZoneId.systemDefault()), + LocalDateTime.ofInstant(orderAuditEvent.getActionDate().toInstant(), ZoneId.systemDefault()), JsonObject.mapFrom(orderAuditEvent.getOrderSnapshot())), promise); } catch (Exception e) { LOGGER.error("Failed to save record with id: {} for order id: {} in to table {}", diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java index 83881be..78def8e 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java @@ -14,6 +14,7 @@ import static org.folio.util.DbUtils.formatDBTableName; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.ZoneOffset; import java.util.Date; import java.util.UUID; @@ -92,8 +93,8 @@ private void makeSaveCall(Promise> promise, String query, OrderLineA orderLineAuditEvent.getOrderId(), orderLineAuditEvent.getOrderLineId(), orderLineAuditEvent.getUserId(), - LocalDateTime.ofInstant(orderLineAuditEvent.getEventDate().toInstant(), ZoneOffset.UTC), - LocalDateTime.ofInstant(orderLineAuditEvent.getActionDate().toInstant(), ZoneOffset.UTC), + LocalDateTime.ofInstant(orderLineAuditEvent.getEventDate().toInstant(), ZoneId.systemDefault()), + LocalDateTime.ofInstant(orderLineAuditEvent.getActionDate().toInstant(), ZoneId.systemDefault()), JsonObject.mapFrom(orderLineAuditEvent.getOrderLineSnapshot())), promise); } catch (Exception e) { LOGGER.error("Failed to save record with id: {} for order line id: {} in to table {}", diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java index 11c1aed..5e69e1a 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java @@ -13,6 +13,7 @@ import static org.folio.util.DbUtils.formatDBTableName; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.ZoneOffset; import java.util.Date; import java.util.UUID; @@ -142,8 +143,8 @@ private void makeSaveCall(Promise> promise, String query, PieceAudit pieceAuditEvent.getAction(), pieceAuditEvent.getPieceId(), pieceAuditEvent.getUserId(), - LocalDateTime.ofInstant(pieceAuditEvent.getEventDate().toInstant(), ZoneOffset.UTC), - LocalDateTime.ofInstant(pieceAuditEvent.getActionDate().toInstant(), ZoneOffset.UTC), + LocalDateTime.ofInstant(pieceAuditEvent.getEventDate().toInstant(), ZoneId.systemDefault()), + LocalDateTime.ofInstant(pieceAuditEvent.getActionDate().toInstant(), ZoneId.systemDefault()), JsonObject.mapFrom(pieceAuditEvent.getPieceSnapshot())), promise); } catch (Exception e) {