Commit b4357a72 by 杨林龙

新E盾 1.30 版本开发 修改日里程统计 小数点准确度问题

1 parent 8ae95316
...@@ -35,5 +35,5 @@ public class DailyMileageReportExport { ...@@ -35,5 +35,5 @@ public class DailyMileageReportExport {
private Integer drivingTimeNum; private Integer drivingTimeNum;
@ExcelProperty(value = "行驶里程km", index = 7) @ExcelProperty(value = "行驶里程km", index = 7)
private String drivingMileage; private double drivingMileage;
} }
...@@ -12,5 +12,5 @@ public class DeviceDailyExport { ...@@ -12,5 +12,5 @@ public class DeviceDailyExport {
private String mileageTime; private String mileageTime;
private String drivingMileage; private double drivingMileage;
} }
...@@ -26,5 +26,4 @@ public class MileageReportExport { ...@@ -26,5 +26,4 @@ public class MileageReportExport {
@ExcelProperty(value = "总里程(Km)", index = 5) @ExcelProperty(value = "总里程(Km)", index = 5)
private double totalMileage; private double totalMileage;
} }
...@@ -137,5 +137,5 @@ public class OilReportExport extends ReportOrgDto { ...@@ -137,5 +137,5 @@ public class OilReportExport extends ReportOrgDto {
private double dayNum31; private double dayNum31;
@ExcelProperty(value = "总计(升)", index = 41) @ExcelProperty(value = "总计(升)", index = 41)
private double summation; private String summation;
} }
...@@ -57,8 +57,8 @@ public class MileageService { ...@@ -57,8 +57,8 @@ public class MileageService {
boolean flag = true; boolean flag = true;
for (DeviceDailyExport deviceDailyExport : dailyExportList) { for (DeviceDailyExport deviceDailyExport : dailyExportList) {
if (deviceDailyExport.getMileageTime().equals(dataTime) && flag) { if (deviceDailyExport.getMileageTime().equals(dataTime) && flag) {
String drivingMileage = deviceDailyExport.getDrivingMileage(); double drivingMileage = deviceDailyExport.getDrivingMileage();
drivingMileage = drivingMileage == null ? "0" : drivingMileage; drivingMileage = Double.isNaN(drivingMileage) ? 0.0 : drivingMileage;
oneData.add(drivingMileage + "公里"); oneData.add(drivingMileage + "公里");
flag = false; flag = false;
} else { } else {
......
...@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.util.List; import java.util.List;
/** /**
...@@ -192,7 +193,8 @@ public class OilService { ...@@ -192,7 +193,8 @@ public class OilService {
} }
// 设置总计数量 // 设置总计数量
oilReportExport.setSummation(summation); DecimalFormat df = new DecimalFormat("0.000");
oilReportExport.setSummation(df.format(summation));
} }
return oilReportExportList; return oilReportExportList;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!