Commit 843caafd authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer' into developer

parents f35e8410 17cfda8c
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
......@@ -47,7 +48,14 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
List returnList = data.getJSONArray("data");
logger.info("获取并网容量接口调用对端返回结果:{}",returnList.toString());
Page<Map<String, Object>> pageIPage;
returnList.forEach(result -> {
JSONObject jsonObject = (JSONObject) result;
String actualInstalledCapacity = jsonObject.getString("actual_installed_capacity");
if (StringUtils.isNotEmpty(actualInstalledCapacity)) {
BigDecimal bd = new BigDecimal(actualInstalledCapacity);
jsonObject.put("actual_installed_capacity", bd.setScale(4,BigDecimal.ROUND_HALF_UP));
}
});
int newCurrent = Integer.parseInt(current);
int newPageSize = Integer.parseInt(pageSize);
if (StringUtils.isBlank(pageSize) || StringUtils.isBlank(pageSize)) {
......@@ -114,9 +122,23 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
String newRate = "";
if (StringUtils.isNotEmpty(rate)) {
newRate = rate.replace("%", "");
jsonObject.put("rate", newRate);
BigDecimal bd = new BigDecimal(newRate);
jsonObject.put("rate", bd.setScale(4,BigDecimal.ROUND_HALF_UP));
}
jsonObject.put("seriesData", StringUtils.isNotEmpty(newRate) ? Arrays.asList(Double.parseDouble(newRate)) : 0D);
String quota = jsonObject.getString("quota");
if (StringUtils.isNotEmpty(quota)) {
BigDecimal bd = new BigDecimal(quota);
jsonObject.put("quota", bd.setScale(4,BigDecimal.ROUND_HALF_UP));
}
String generatingCapacity = jsonObject.getString("generating_capacity");
if (StringUtils.isNotEmpty(generatingCapacity)) {
BigDecimal bd = new BigDecimal(generatingCapacity);
jsonObject.put("generating_capacity", bd.setScale(4,BigDecimal.ROUND_HALF_UP));
}
jsonObject.put("seriesData", StringUtils.isNotEmpty(newRate) ? Arrays.asList(new BigDecimal(newRate).setScale(4,BigDecimal.ROUND_HALF_UP)) : 0D);
jsonObject.put("axisData", Arrays.asList("RATE"));
if ("1".equals(tp)) {
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