Explorar el Código

pms 日报 兼容没有配置任务的情况 列表查询搬迁安装天数

zhangcl hace 2 semanas
padre
commit
adfeede23e

+ 9 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/IotRhDailyReportController.java

@@ -36,6 +36,7 @@ import javax.validation.Valid;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -167,6 +168,8 @@ public class IotRhDailyReportController {
         Map<Long, String> taskExtPropertyPair = new HashMap<>();
         // 搬迁安装天数
         Map<Long, BigDecimal> relocationDaysPair = new HashMap<>();
+        // key部门id  value产能
+        AtomicReference<Map<Long, BigDecimal>> capacityPair = new AtomicReference<>(new HashMap<>());
         DataPermissionUtils.executeIgnore(() -> {
             // 查询日报关联的项目信息
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
@@ -197,12 +200,13 @@ public class IotRhDailyReportController {
                     }
                 });
             }
+            // 查询当前日报所属施工队伍中包含 增压机 的产能
+            capacityPair.set(iotRhDailyReportService.queryCapacities(convertList(reports, IotRhDailyReportDO::getDeptId)));
             // 查询每个任务的搬迁安装天数
             List<IotRhDailyReportDO> relocationDays = iotRhDailyReportService.relocationDays(null);
-
             if (CollUtil.isNotEmpty(relocationDays)) {
                 relocationDays.forEach(day -> {
-                    relocationDaysPair.put(day.getTaskId(), day.getRelocationDays());
+                    relocationDaysPair.put(day.getDeptId(), day.getRelocationDays());
                 });
             }
         });
@@ -217,7 +221,9 @@ public class IotRhDailyReportController {
             // 2.4 设计注气量
             findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
             // 2.5 搬迁安装天数
-            findAndThen(relocationDaysPair, reportVO.getTaskId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
+            findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
+            // 2.6 产能
+            findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
         });
     }
 

+ 2 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/iotprojecttask/IotRhDailyReportMapper.xml

@@ -101,7 +101,7 @@
     <select id="relocationDays" resultMap="BaseResultMap"
             parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO">
         SELECT
-            task_id,
+            dept_id,
             DATEDIFF(
                     MIN(CASE WHEN construction_status = 3 THEN construction_start_date END),
                     MIN(CASE WHEN construction_status = 1 THEN construction_start_date END)
@@ -109,7 +109,7 @@
         FROM rq_iot_rh_daily_report
         WHERE construction_status IN (1, 3)
           AND deleted = 0
-        GROUP BY task_id;
+        GROUP BY dept_id;
     </select>
 
 </mapper>