feat(视图): 增加小数精度

This commit is contained in:
junjun 2022-07-19 15:45:58 +08:00
parent 2af01a0667
commit eb085a489d
2 changed files with 3 additions and 3 deletions

View File

@ -997,9 +997,9 @@ public class ChartViewService {
item[dataIndex] = null; item[dataIndex] = null;
} else { } else {
item[dataIndex] = new BigDecimal(cValue) item[dataIndex] = new BigDecimal(cValue)
.divide(new BigDecimal(lastValue), 2, RoundingMode.HALF_UP) .divide(new BigDecimal(lastValue), 8, RoundingMode.HALF_UP)
.subtract(new BigDecimal(1)) .subtract(new BigDecimal(1))
.setScale(2, RoundingMode.HALF_UP) .setScale(8, RoundingMode.HALF_UP)
.toString(); .toString();
} }
} }

View File

@ -902,7 +902,7 @@ public class ChartDataBuild {
if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) { if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) {
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]); d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]);
} else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) { } else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) {
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(2, RoundingMode.HALF_UP)); d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(8, RoundingMode.HALF_UP));
} }
} }
tableRow.add(d); tableRow.add(d);