Commit 5b55792b authored by lilongyang's avatar lilongyang

1、获取片区指标完成情况接口处理rate小数位数

parent c19ec00e
...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
...@@ -111,7 +112,9 @@ public class EnergyAccessServiceImpl implements EnergyAccessService { ...@@ -111,7 +112,9 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
JSONObject jsonObject = (JSONObject) result; JSONObject jsonObject = (JSONObject) result;
String rate = jsonObject.getString("rate"); String rate = jsonObject.getString("rate");
if (StringUtils.isNotEmpty(rate)) { if (StringUtils.isNotEmpty(rate)) {
jsonObject.put("rate", rate.replace("%", "")); rate = rate.replace("%", "");
BigDecimal bd = new BigDecimal(rate);
jsonObject.put("rate", bd.setScale(4,BigDecimal.ROUND_HALF_UP));
} }
if ("1".equals(tp)) { if ("1".equals(tp)) {
oldName = jsonObject.getString("station_name"); oldName = jsonObject.getString("station_name");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment