json handling service changes

This commit is contained in:
amentis 2024-07-17 17:26:24 +03:00
parent 788cef46cd
commit ae80f1e0cb
2 changed files with 12 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package org.opencdmp.commons;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -19,6 +20,7 @@ public class JsonHandlingService {
public JsonHandlingService() { public JsonHandlingService() {
this.objectMapper = new ObjectMapper(); this.objectMapper = new ObjectMapper();
this.objectMapper.registerModule(new JavaTimeModule()); this.objectMapper.registerModule(new JavaTimeModule());
this.objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
} }
public String toJson(Object item) throws JsonProcessingException { public String toJson(Object item) throws JsonProcessingException {

View File

@ -23,6 +23,8 @@ public class AccountingEntryCreatedIntegrationEvent extends TrackedEvent {
private AccountingValueType type; private AccountingValueType type;
private Double value;
private UUID tenant; private UUID tenant;
public Instant getTimeStamp() { public Instant getTimeStamp() {
@ -81,6 +83,14 @@ public class AccountingEntryCreatedIntegrationEvent extends TrackedEvent {
this.type = type; this.type = type;
} }
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
public UUID getTenant() { public UUID getTenant() {
return tenant; return tenant;
} }