|
|
@ -17,6 +17,7 @@ import java.util.ArrayList; |
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map.Entry; |
|
|
import java.util.Map.Entry; |
|
|
|
|
|
import java.util.Objects; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -158,6 +159,14 @@ public class JsonConverter { |
|
|
.map(node -> (ObjectNode) node) |
|
|
.map(node -> (ObjectNode) node) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static <T> ObjectNode convertToJsonObjectObjectNode(T record) { |
|
|
|
|
|
if(Objects.isNull(record)){ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return (ObjectNode)objectMapper.valueToTree(record); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static <T> List<JSONObject> convertToJsonObjectList2(List<T> records) { |
|
|
public static <T> List<JSONObject> convertToJsonObjectList2(List<T> records) { |
|
|
if(CollectionUtils.isEmpty(records)){ |
|
|
if(CollectionUtils.isEmpty(records)){ |
|
|
return Collections.emptyList(); |
|
|
return Collections.emptyList(); |
|
|
|