mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-02-11 05:19:14 +00:00
primera versión de pedido realizada
This commit is contained in:
@ -47,6 +47,26 @@ public class Utils {
|
||||
this.messageSource = messageSource;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> decodeJsonList(String json) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
return mapper.readValue(json, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, Object> decodeJsonMap(String json) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
return mapper.readValue(json, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static double round2(double value) {
|
||||
return BigDecimal.valueOf(value)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
|
||||
Reference in New Issue
Block a user