From 5d5eefa9c52430d833f14a890afcb52bdeee52be Mon Sep 17 00:00:00 2001 From: rushang7-eGov Date: Wed, 11 May 2022 15:46:45 +0530 Subject: [PATCH] Fixed Timestamp mapper in adapter (#90) --- .../java/org/egov/ifix/mapper/impl/bill/BillEventMapper.java | 3 ++- .../org/egov/ifix/mapper/impl/demand/DemandEventMapper.java | 3 ++- .../org/egov/ifix/mapper/impl/payment/PaymentEventMapper.java | 2 +- .../org/egov/ifix/mapper/impl/receipt/ReceiptEventMapper.java | 2 +- .../src/main/java/org/egov/ifix/utils/EventConstants.java | 4 ++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/bill/BillEventMapper.java b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/bill/BillEventMapper.java index f02794e7f..48b6932bd 100644 --- a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/bill/BillEventMapper.java +++ b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/bill/BillEventMapper.java @@ -57,10 +57,11 @@ public List transformData(JsonObject data) { demandJsonArray.forEach(demandJsonElement -> { JsonObject demandJsonObject = demandJsonElement.getAsJsonObject(); + JsonObject demandAuditDetails = demandJsonObject.get(BILL_DEMAND_AUDIT_DETAILS).getAsJsonObject(); FiscalEvent fiscalEvent = FiscalEvent.builder().tenantId(applicationConfiguration.getTenantId()) .eventType(getEventType()) - .eventTime(Instant.now().toEpochMilli()) + .eventTime(demandAuditDetails.get(BILL_DEMAND_LAST_MODIFIED_TIME).getAsLong()) .referenceId(demandJsonObject.get(ID).getAsString()) .parentEventId(null) .parentReferenceId(null) diff --git a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/demand/DemandEventMapper.java b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/demand/DemandEventMapper.java index 39081502c..4c31ec63a 100644 --- a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/demand/DemandEventMapper.java +++ b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/demand/DemandEventMapper.java @@ -58,11 +58,12 @@ public List transformData(JsonObject data) { demandJA.forEach(demandJE -> { JsonObject demandJO = demandJE.getAsJsonObject(); + JsonObject demandAuditDetails = demandJO.get(BILL_DEMAND_AUDIT_DETAILS).getAsJsonObject(); FiscalEvent fiscalEvent = FiscalEvent.builder() .tenantId(applicationConfiguration.getTenantId()) .eventType(getEventType()) - .eventTime(Instant.now().toEpochMilli()) + .eventTime(demandAuditDetails.get(BILL_DEMAND_LAST_MODIFIED_TIME).getAsLong()) .referenceId(demandJO.get(ID).getAsString()) .parentEventId(null) .parentReferenceId(null) diff --git a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/payment/PaymentEventMapper.java b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/payment/PaymentEventMapper.java index ac7ea3072..c2c660327 100644 --- a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/payment/PaymentEventMapper.java +++ b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/payment/PaymentEventMapper.java @@ -56,7 +56,7 @@ public List transformData(JsonObject data) { FiscalEvent fiscalEvent = FiscalEvent.builder() .tenantId(applicationConfiguration.getTenantId()) .eventType(getEventType()) - .eventTime(Instant.now().toEpochMilli()) + .eventTime(paymentJO.get(PAYMENT_RECEIPT_TRANSACTION_DATE).getAsLong()) .referenceId(paymentJO.get(ID).getAsString()) .parentEventId(null).parentReferenceId(null) .amountDetails(getAmounts(paymentJO, data)).build(); diff --git a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/receipt/ReceiptEventMapper.java b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/receipt/ReceiptEventMapper.java index 978f2ac26..b89cef4c7 100644 --- a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/receipt/ReceiptEventMapper.java +++ b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/mapper/impl/receipt/ReceiptEventMapper.java @@ -56,7 +56,7 @@ public List transformData(JsonObject data) { FiscalEvent fiscalEvent = FiscalEvent.builder() .tenantId(applicationConfiguration.getTenantId()) .eventType(getEventType()) - .eventTime(Instant.now().toEpochMilli()) + .eventTime(paymentJsonObject.get(PAYMENT_RECEIPT_TRANSACTION_DATE).getAsLong()) .referenceId(paymentJsonObject.get(ID).getAsString()) .parentEventId(null).parentReferenceId(null) .amountDetails(getAmountDetails(paymentJsonObject, data)).build(); diff --git a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/utils/EventConstants.java b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/utils/EventConstants.java index 475e2969c..5083e8b42 100644 --- a/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/utils/EventConstants.java +++ b/reference-adapter/mgramseva-ifix-adapter/src/main/java/org/egov/ifix/utils/EventConstants.java @@ -31,10 +31,14 @@ public class EventConstants { public static final String DEMAND_DETAILS = "demandDetails"; public static final String BILL_DEMAND_CLIENT_COA_AMOUNT = "taxAmount"; public static final String BILL_DEMAND_CLIENT_COA_CODE = "taxHeadMasterCode"; + public static final String BILL_DEMAND_AUDIT_DETAILS = "auditDetails"; + public static final String BILL_DEMAND_LAST_MODIFIED_TIME = "lastModifiedTime"; public static final String PROJECT_CODE_DATA_NAME = "PROJECT_CODE"; public static final String CODE = "code"; public static final String PROJECT_CODE = "PROJECT_CODE"; public static final String CLIENT_PROJECT_CODE = "CLIENT_PROJECT_CODE"; + + public static final String PAYMENT_RECEIPT_TRANSACTION_DATE = "transactionDate"; public static final String PAYMENT_RECEIPT_FROM_BILLING_PERIOD = "fromPeriod"; public static final String PAYMENT_RECEIPT_TO_BILLING_PERIOD = "toPeriod"; public static final String PAYMENT_RECEIPT_CLIENT_COA_AMOUNT = "adjustedAmount";