File tree Expand file tree Collapse file tree
backend/src/main/java/com/park/utmstack/domain/shared_types/alert Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
44import com .fasterxml .jackson .annotation .JsonInclude ;
55import com .fasterxml .jackson .annotation .JsonProperty ;
6+ import com .park .utmstack .util .MapUtil ;
67import lombok .Data ;
8+ import lombok .Getter ;
9+ import org .springframework .util .StringUtils ;
710
11+ import java .time .Instant ;
12+ import java .time .ZoneId ;
13+ import java .time .format .DateTimeFormatter ;
814import java .util .List ;
15+ import java .util .Locale ;
916import java .util .Map ;
1017
1118@ Data
19+ @ Getter
1220@ JsonInclude (JsonInclude .Include .NON_NULL )
1321@ JsonIgnoreProperties (ignoreUnknown = true )
1422public class Event {
@@ -39,5 +47,18 @@ public class Event {
3947
4048 private List <String > errors ;
4149 private Map <String , ComplianceValues > compliance ;
50+
51+ public Map <String , String > getLogxFlatted () {
52+ return MapUtil .flattenToStringMap (log , true );
53+ }
54+
55+ public String getTimestampFormatted () {
56+ try {
57+ return StringUtils .hasText (timestamp ) ? DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" ).withLocale (Locale .getDefault ()).withZone (
58+ ZoneId .systemDefault ()).format (Instant .parse (timestamp )) : null ;
59+ } catch (Exception e ) {
60+ return null ;
61+ }
62+ }
4263}
4364
You can’t perform that action at this time.
0 commit comments