Commit c1bf43fb authored by caotao's avatar caotao

小数点问题修改

parent 79afe702
......@@ -42,14 +42,14 @@ public class MonitoringMapController extends BaseController {
@Autowired
MonitoringServiceImpl monitoringServiceImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图数据")
@GetMapping("/nationwide")
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取区域电量指标完成情况")
@GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
......
......@@ -7,7 +7,7 @@ public class SocialContributionDto {
/**
* 社会贡献值
*/
private Double title;
private String title;
/**
* 贡献单位
*/
......
......@@ -36,7 +36,7 @@ public class CommonServiceImpl {
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
List<Double> doubleList = indicatorsDtoList.stream().map(indicatorsDto -> Double.parseDouble(indicatorsDto.getValue())).collect(Collectors.toList());
totalvalue = doubleList.stream().mapToDouble(Double::doubleValue).sum();
return Double.valueOf(String.format(".2f%",totalvalue));
return Double.valueOf(String.format("%.2f",totalvalue));
}
/**
* @deprecated 获取指标值平均值
......@@ -50,7 +50,7 @@ public class CommonServiceImpl {
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
List<Double> doubleList = indicatorsDtoList.stream().map(indicatorsDto -> Double.parseDouble(indicatorsDto.getValue())).collect(Collectors.toList());
avageValue = doubleList.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
return Double.valueOf(String.format(".2f%",avageValue));
return Double.valueOf(String.format("%.2f",avageValue));
}
public Double getStationCapactityByStationWerks(String WERKS){
......@@ -77,16 +77,16 @@ public class CommonServiceImpl {
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
*/
co2.setUnit("二氧化碳减排量(万t)");
co2.setTitle(totalSocialContribution * 0.000832);
co2.setTitle(String.format("%.2f",totalSocialContribution * 0.000832));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(万t)");
coal.setTitle(totalSocialContribution * 0.0003049);
coal.setTitle(String.format("%.2f",totalSocialContribution * 0.0003049));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(万t)");
toner.setTitle(totalSocialContribution * 0.00032);
toner.setTitle(String.format("%.2f",totalSocialContribution * 0.00032));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(万t)");
so2.setTitle(totalSocialContribution * 0.0016);
so2.setTitle(String.format("%.2f",totalSocialContribution * 0.0016));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......
......@@ -104,16 +104,16 @@ public class MonitoringServiceIMQTTmpl {
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
*/
co2.setUnit("二氧化碳减排量(万t)");
co2.setTitle(totalSocialContribution.get() * 0.000832);
co2.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.000832));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(万t)");
coal.setTitle(totalSocialContribution.get() * 0.0003049);
coal.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.0003049));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(万t)");
toner.setTitle(totalSocialContribution.get() * 0.00032);
toner.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.00032));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(万t)");
so2.setTitle(totalSocialContribution.get() * 0.0016);
so2.setTitle(String.format("%.2f",totalSocialContribution.get() * 0.0016));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......@@ -143,7 +143,7 @@ public class MonitoringServiceIMQTTmpl {
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
Double completionRatio = 23.11;
String completionRatio = "23.11";
//年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.01);
stationBasicList.forEach(stationBasic -> {
......@@ -153,19 +153,19 @@ public class MonitoringServiceIMQTTmpl {
useHours.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日工作时间"));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(dailyPower.get());
dailyPowerdto.setTitle(String.format("%.2f",dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
SocialContributionDto monthlyPowerdto = new SocialContributionDto();
monthlyPowerdto.setTitle(monthlyPower.get());
monthlyPowerdto.setTitle(String.format("%.2f",monthlyPower.get()));
monthlyPowerdto.setUnit("万kWh");
SocialContributionDto annualPowerdto = new SocialContributionDto();
annualPowerdto.setTitle(annualPower.get());
annualPowerdto.setTitle(String.format("%.2f",annualPower.get()));
annualPowerdto.setUnit("万kWh");
SocialContributionDto completionRatioDto = new SocialContributionDto();
completionRatioDto.setTitle(completionRatio);
completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(useHours.get());
useHoursDto.setTitle(String.format("%.2f",useHours.get()));
useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto);
......
......@@ -107,10 +107,10 @@ public class MonitoringServiceImpl {
regionNationWideDto.setGuangfuMW("0");
regionNationWideDto.setFengdianMV("0");
if (!ObjectUtils.isEmpty(guangfuMW.get())) {
regionNationWideDto.setGuangfuMW(guangfuMW.toString());
regionNationWideDto.setGuangfuMW(String.format("%.2f",guangfuMW.get()));
}
if (!ObjectUtils.isEmpty(fengdianMW.get())) {
regionNationWideDto.setFengdianMV(fengdianMW.toString());
regionNationWideDto.setFengdianMV(String.format("%.2f",fengdianMW.get()));
}
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
......@@ -178,7 +178,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setStationName(stationBasic.getStationName());
completionOfPowerIndicatorsDto.setInstallCapactity("0");
if (getStationCaPACITYL(stationBasic.getStationNumber()) != null) {
completionOfPowerIndicatorsDto.setInstallCapactity(String.valueOf(getStationCaPACITYL(stationBasic.getStationNumber())));
completionOfPowerIndicatorsDto.setInstallCapactity(String.format("%.2f",getStationCaPACITYL(stationBasic.getStationNumber())));
}
try {
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速")));
......
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