|
|
|
@ -45,13 +45,15 @@ public class IfsConverterToMap { |
|
|
|
} else if (dataType == DataType.FLOAT) { |
|
|
|
//区分数据的类型 |
|
|
|
if (objValue instanceof Float) { |
|
|
|
BigDecimal bigDecimal = new BigDecimal((Double) objValue); |
|
|
|
// 去除尾部的零 |
|
|
|
BigDecimal bigDecimal = new BigDecimal(objValue.toString()); |
|
|
|
bigDecimal = bigDecimal.stripTrailingZeros(); |
|
|
|
String formatterValue = bigDecimal.toPlainString(); |
|
|
|
tempMap.put(key, formatterValue); |
|
|
|
} else if (objValue instanceof Double) { |
|
|
|
tempMap.put(key, objValue.toString()); |
|
|
|
BigDecimal bigDecimal = new BigDecimal(objValue.toString()); |
|
|
|
bigDecimal = bigDecimal.stripTrailingZeros(); |
|
|
|
String formatterValue = bigDecimal.toPlainString(); |
|
|
|
tempMap.put(key, formatterValue); |
|
|
|
} else if (objValue instanceof Integer) { |
|
|
|
BigDecimal bigDecimal = new BigDecimal((Integer) objValue); |
|
|
|
// 设置小数位数,最多保留 16 位有效数字 |
|
|
|
@ -115,19 +117,17 @@ public class IfsConverterToMap { |
|
|
|
} else if (dataType == DataType.FLOAT) { |
|
|
|
//区分数据的类型 |
|
|
|
if (objValue instanceof Float) { |
|
|
|
BigDecimal bigDecimal = new BigDecimal((Double) objValue); |
|
|
|
// 设置小数位数,最多保留 16 位有效数字 |
|
|
|
bigDecimal = bigDecimal.setScale(16, BigDecimal.ROUND_HALF_UP); |
|
|
|
// 去除尾部的零 |
|
|
|
BigDecimal bigDecimal = new BigDecimal(objValue.toString()); |
|
|
|
bigDecimal = bigDecimal.stripTrailingZeros(); |
|
|
|
String formatterValue = bigDecimal.toPlainString(); |
|
|
|
resultMap.put(key, formatterValue); |
|
|
|
} else if (objValue instanceof Double) { |
|
|
|
resultMap.put(key, objValue.toString()); |
|
|
|
BigDecimal bigDecimal = new BigDecimal(objValue.toString()); |
|
|
|
bigDecimal = bigDecimal.stripTrailingZeros(); |
|
|
|
String formatterValue = bigDecimal.toPlainString(); |
|
|
|
resultMap.put(key, formatterValue); |
|
|
|
} else if (objValue instanceof Integer) { |
|
|
|
BigDecimal bigDecimal = new BigDecimal((Integer) objValue); |
|
|
|
// 去除尾部的零 |
|
|
|
bigDecimal = bigDecimal.stripTrailingZeros(); |
|
|
|
// 设置小数位数,最多保留 16 位有效数字 |
|
|
|
String formatterValue = bigDecimal.toPlainString(); |
|
|
|
resultMap.put(key, formatterValue); |
|
|
|
|