Explorar el Código

pms 瑞都看板 生产动态简报列表

zhangcl hace 12 horas
padre
commit
9fb995c3fa

+ 90 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/IotRdDailyReportController.java

@@ -2667,7 +2667,31 @@ public class IotRdDailyReportController {
         Map<String, List<BigDecimal>> platformNonProductPair = new HashMap<>();
         // key平台井标识  value平台井非生产时效集合
         Map<String, BigDecimal> platformNptPair = new HashMap<>();
+        // key项目部id  value项目部排序值
+        Map<Long, Integer> projectSortPair = new HashMap<>();
+        // key项目部id  value项目部名称
+        Map<Long, String> projectNamePair = new HashMap<>();
+        // key施工队伍id  value队伍所属项目部
+        Map<Long, Long> projectIdPair = new HashMap<>();
+        //  施工工艺 key字典键值     value字典标签
+        Map<String, String> techniqueDictPair = new HashMap<>();
+        // key日报id  value日报关联的施工工艺名称集合
+        Map<Long, String> techniqueNamesPair = new HashMap<>();
+        // key设备id  value日报关联的设备名称集合
+        Map<String, String> deviceNamesPair = new HashMap<>();
+        // key日报id  value日报关联的设备名称集合
+        Map<Long, String> reportDeviceNamesPair = new HashMap<>();
 
+        // 设备id集合
+        Set<Long> deviceIds = new HashSet<>();
+
+        // 查询施工工艺字典数据
+        List<DictDataDO> rdTechniques = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rd");
+        if (CollUtil.isNotEmpty(rdTechniques)) {
+            rdTechniques.forEach(tech -> {
+                techniqueDictPair.put(tech.getValue(), tech.getLabel());
+            });
+        }
 
         // 平台井 筛选关联的井的生产动态明细 赋值到 平台井列表 的 日报对象
 
@@ -2758,6 +2782,22 @@ public class IotRdDailyReportController {
                 Long reportId = report.getId();
                 String platformGroup = platformWellPair.get(reportId);
 
+                Set<Long> thisDeviceIds = report.getDeviceIds();
+                if (CollUtil.isNotEmpty(thisDeviceIds)) {
+                    deviceIds.addAll(thisDeviceIds);
+                }
+
+                Set<Long> techniqueIds = report.getTechniqueIds();
+                String thisTechniqueNames = Optional.ofNullable(techniqueIds)
+                        .filter(CollUtil::isNotEmpty)
+                        .map(techIds -> techIds.stream()
+                                .map(String::valueOf)  // 将 Long 转为 String
+                                .map(techniqueDictPair::get)  // 从字典获取名称
+                                .filter(Objects::nonNull)  // 过滤空值
+                                .filter(StrUtil::isNotBlank)  // 过滤空白值
+                                .collect(Collectors.joining(",")))  // 用逗号连接
+                        .orElse("");  // 如果为空,返回空字符串
+                techniqueNamesPair.put(report.getId(), thisTechniqueNames);
                 // 如果当前日报没有明细 && 同组有共享明细 → 赋值
                 if (!reportDetailsPair.containsKey(reportId)
                         && StrUtil.isNotBlank(platformGroup)
@@ -2871,6 +2911,14 @@ public class IotRdDailyReportController {
                 if (StrUtil.isNotBlank(report.getCreator())) {
                     userIds.add(Long.valueOf(report.getCreator()));
                 }
+                // 查询所有设备信息 设备名称 设备编码
+                if (CollUtil.isNotEmpty(deviceIds)) {
+                    Map<Long, IotDeviceRespVO> deviceMap = iotDeviceService.getDeviceMap(new ArrayList<>(deviceIds));
+                    deviceMap.forEach((deviceId, device) -> {
+                        deviceNamesPair.put(String.valueOf(deviceId), StrUtil.join("-", device.getDeviceCode(), device.getDeviceName()));
+                    });
+                }
+
             });
 
             // 查询当前页所有日报关联的任务的施工队伍名称
@@ -2954,6 +3002,19 @@ public class IotRdDailyReportController {
             }
             // 查询所有任务的工作量数据 单位相同的工作量属性值合并处理
             for (IotRdDailyReportDO report : reports) {
+                // 设置每个日报关联的 设备信息集合
+                Set<Long> thisDeviceIds = report.getDeviceIds();
+                String thisDeviceCodeNames = Optional.ofNullable(thisDeviceIds)
+                        .filter(CollUtil::isNotEmpty)
+                        .map(devIds -> devIds.stream()
+                                .map(String::valueOf)  // 将 Long 转为 String
+                                .map(deviceNamesPair::get)  // 从字典获取名称
+                                .filter(Objects::nonNull)  // 过滤空值
+                                .filter(StrUtil::isNotBlank)  // 过滤空白值
+                                .collect(Collectors.joining(",")))  // 用逗号连接
+                        .orElse("");  // 如果为空,返回空字符串
+                reportDeviceNamesPair.put(report.getId(), thisDeviceCodeNames);
+
                 // 处理临时创建的日报 带班干部 填报人 有单独的逻辑规则
                 Set<Long> personIds = report.getResponsiblePerson();
                 if (CollUtil.isNotEmpty(personIds)) {
@@ -3064,6 +3125,22 @@ public class IotRdDailyReportController {
                     report.setHourCount(tempTotalHourCount);
                 }
             }
+            // 查询所有队伍对应的上级部门 sort
+            Set<Long> parentDeptIds = new HashSet<>();
+            if (CollUtil.isNotEmpty(tempDeptMap)) {
+                tempDeptMap.forEach((deptId, dept) -> {
+                    parentDeptIds.add(dept.getParentId());
+                    projectIdPair.put(deptId, dept.getParentId());
+                });
+                // 查询所有上级项目部信息
+                Map<Long, DeptDO> projectDeptMap = deptService.getDeptMap(parentDeptIds);
+                if (CollUtil.isNotEmpty(projectDeptMap)) {
+                    projectDeptMap.forEach((deptId, dept) -> {
+                        projectSortPair.put(deptId, dept.getSort());
+                        projectNamePair.put(deptId, dept.getName());
+                    });
+                }
+            }
         });
         return BeanUtils.toBean(reports, IotRdDailyReportRespVO.class, (reportVO) -> {
             // 施工状态 导出使用
@@ -3095,6 +3172,13 @@ public class IotRdDailyReportController {
             if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
                 reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
             }
+
+            // 日报 关联的施工工艺名称集合
+            findAndThen(techniqueNamesPair, reportVO.getId(), techniqueNames -> reportVO.setTechniqueNames(techniqueNames));
+            // 日报 关联的设备名称集合
+            findAndThen(reportDeviceNamesPair, reportVO.getId(), deviceNames -> reportVO.setDeviceNames(deviceNames));
+            // 日报 所属 上级项目部
+            findAndThen(projectIdPair, reportVO.getDeptId(), projectId -> reportVO.setProjectDeptId(projectId));
             // 生产动态明细
             findAndThen(reportDetailsPair, reportVO.getId(), details -> reportVO.setReportDetails(details));
             // 平台井 非生产时效
@@ -3103,6 +3187,12 @@ public class IotRdDailyReportController {
             findAndThen(taskTeamsPair, reportVO.getTaskId(), deptNames -> reportVO.setDeptName(deptNames));
             // 临时新建的日报的 施工队伍
             findAndThen(tempDeptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
+            // 所有施工队伍的排序值
+            findAndThen(tempDeptMap, reportVO.getDeptId(), dept -> reportVO.setTeamSort(dept.getSort()));
+            // 所有施工队伍所属项目部的名称
+            findAndThen(projectNamePair, reportVO.getProjectDeptId(), name -> reportVO.setProjectName(name));
+            // 所有施工队伍所属项目部的排序值
+            findAndThen(projectSortPair, reportVO.getProjectDeptId(), sort -> reportVO.setProjectSort(sort));
             // 日报关联的项目信息
             findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
             // 日报关联的任务井号

+ 12 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/vo/IotRdDailyReportRespVO.java

@@ -67,6 +67,9 @@ public class IotRdDailyReportRespVO {
     @Schema(description = "施工队伍id", example = "22577")
     private Long deptId;
 
+    @Schema(description = "施工队伍所属上级项目部id", example = "32587")
+    private Long projectDeptId;
+
     @Schema(description = "平台井标识 2非平台井 1平台井 0默认值", example = "1")
     private Integer platformWell;
 
@@ -377,4 +380,13 @@ public class IotRdDailyReportRespVO {
 
     @Schema(description = "生产动态明细")
     private List<IotRdDailyReportDetailRespVO> reportDetails;
+
+    @Schema(description = "队伍排序值")
+    private Integer teamSort;
+
+    @Schema(description = "项目部排序值")
+    private Integer projectSort;
+
+    @Schema(description = "项目部名称")
+    private String projectName;
 }