浏览代码

收储进度报表2

chenendian 5 天之前
父节点
当前提交
5fa54b5c56

+ 6 - 4
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -69,7 +69,10 @@ public class StorageServiceImpl {
                 plan.setCount(categoryPlanList.size());
                 plan.setCount(categoryPlanList.size());
                 double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
                 double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
                 plan.setArea(totalArea);
                 plan.setArea(totalArea);
-                float totalCost = (float) categoryPlanList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+                float totalCost = (float) categoryPlanList.stream()
+                        .mapToDouble(item -> item.getCost() == null ? 0.0 : item.getCost().doubleValue())
+                        .sum();
+
                 plan.setCost(totalCost);
                 plan.setCost(totalCost);
 
 
                 Map<String, List<TdgyStatisticsRes>> resultMap = categoryPlanList.stream()
                 Map<String, List<TdgyStatisticsRes>> resultMap = categoryPlanList.stream()
@@ -148,12 +151,12 @@ public class StorageServiceImpl {
         totalCompleted.setCost(totalCost);
         totalCompleted.setCost(totalCost);
         double totalArea = completeList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
         double totalArea = completeList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
         totalCompleted.setArea(totalArea);
         totalCompleted.setArea(totalArea);
-
         //这里处理计划的数据
         //这里处理计划的数据
         LandStorageReportDTO.PlanDTO totalPlan = new LandStorageReportDTO.PlanDTO();
         LandStorageReportDTO.PlanDTO totalPlan = new LandStorageReportDTO.PlanDTO();
         totalPlan.setCount(planList.size());
         totalPlan.setCount(planList.size());
         //这里计算成本
         //这里计算成本
-        totalCost = (float) planList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+        totalCost = (float) planList.stream().mapToDouble(item -> item.getCost() == null ? 0.0 : item.getCost().doubleValue()).sum();
+
         totalPlan.setCost(totalCost);
         totalPlan.setCost(totalCost);
         //这里计算面积
         //这里计算面积
         totalArea = planList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
         totalArea = planList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
@@ -170,7 +173,6 @@ public class StorageServiceImpl {
 
 
 
 
 
 
-
     //统计分析
     //统计分析
     public List<TrendStatisticsData> getData1() {
     public List<TrendStatisticsData> getData1() {
         List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
         List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();