Browse Source

pms 瑞都汇总 按照项目部或队伍统计 同时显示项目部队伍。

zhangcl 1 day ago
parent
commit
e38270621a

+ 26 - 7
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrddailyreport/IotRdDailyReportServiceImpl.java

@@ -1381,14 +1381,15 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                 if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
                     // projectDeptId可能是项目部 也可能是项目的上级
                     Long detailDeptId = 0l;
-                    if (teamDeptPair.containsKey(report.getDeptId())) {
+                    detailDeptId = report.getDeptId();
+                    /* if (teamDeptPair.containsKey(report.getDeptId())) {
                         // 日报deptId如果是队伍 获取队伍的上级项目部
                         detailDeptId = teamProjectIdPair.get(report.getDeptId());
                     }
                     if (projectDeptPair.containsKey(report.getDeptId())) {
                         // 日报deptId如果是项目部 使用当前项目部
                         detailDeptId = report.getDeptId();
-                    }
+                    } */
                     if (ObjUtil.isNotEmpty(detailDeptId) && (detailDeptId > 0)) {
                         if (cumulativeFuelsPair.containsKey(detailDeptId)) {
                             BigDecimal existTotalFuel = cumulativeFuelsPair.get(detailDeptId);
@@ -1516,7 +1517,29 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             });
         }
 
-        // 生成返回的数据列表集合
+        // 项目部数据
+        projectDeptPair.forEach((projectDeptId, dept) -> {
+            IotRdDailyReportStatisticsRespVO statistics = new IotRdDailyReportStatisticsRespVO();
+            statistics.setTeamId(projectDeptId);
+            statistics.setTeamName(dept.getName());
+            statistics.setSort(dept.getSort());
+            if (projectDeptPair.containsKey(projectDeptId)) {
+                statistics.setSort(0);
+                statistics.setType("2");
+            }
+            statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(projectDeptId));
+            statistics.setCumulativeRunCount(cumulativeRunCountPair.get(projectDeptId));
+            statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(projectDeptId));
+            statistics.setCumulativeHourCount(cumulativeHourCountPair.get(projectDeptId));
+            statistics.setCumulativeWaterVolume(cumulativeWaterVolumePair.get(projectDeptId));
+            statistics.setCumulativeWorkingLayers(cumulativeWorkingLayersPair.get(projectDeptId));
+            statistics.setCumulativeMixSand(cumulativeMixSandPair.get(projectDeptId));
+            statistics.setCumulativePumpTrips(cumulativePumpTripsPair.get(projectDeptId));
+            statistics.setTotalDailyFuel(cumulativeFuelsPair.get(projectDeptId));
+            result.add(statistics);
+        });
+
+        // 队伍数据  生成返回的数据列表集合
         teamDeptPair.forEach((teamDeptId, dept) -> {
             IotRdDailyReportStatisticsRespVO statistics = new IotRdDailyReportStatisticsRespVO();
             statistics.setTeamId(teamDeptId);
@@ -1525,10 +1548,6 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             if (teamDeptPair.containsKey(teamDeptId)) {
                 statistics.setType("3");    // 最好是 项目部小队同时展示 因为有的瑞都日报挂在了项目部下
             }
-            if (projectDeptPair.containsKey(teamDeptId)) {
-                statistics.setSort(0);
-                statistics.setType("2");
-            }
             statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(teamDeptId));
             statistics.setCumulativeRunCount(cumulativeRunCountPair.get(teamDeptId));
             statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(teamDeptId));