Преглед на файлове

Merge remote-tracking branch 'origin/master'

Zimo преди 1 ден
родител
ревизия
28ed4558d7

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

@@ -106,7 +106,7 @@ public class IotRhDailyReportController {
 
     @PutMapping("/update")
     @Operation(summary = "更新瑞恒日报")
-    @PreAuthorize("@ss.hasPermission('pms:iot-rh-daily-report:update')")
+    @PreAuthorize("@ss.hasPermission('pms:iot-rh-daily-report:modify')")
     public CommonResult<Boolean> updateIotRhDailyReport(@Valid @RequestBody IotRhDailyReportSaveReqVO updateReqVO) {
         iotRhDailyReportService.updateIotRhDailyReport(updateReqVO);
         return success(true);

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/vo/IotRhDailyReportSaveReqVO.java

@@ -43,6 +43,9 @@ public class IotRhDailyReportSaveReqVO {
     @Schema(description = "当日注水时间(H)")
     private BigDecimal dailyInjectWaterTime;
 
+    @Schema(description = "当日油耗(L)")
+    private BigDecimal dailyOilUsage;
+
     @Schema(description = "当日用电量(kWh)")
     private BigDecimal dailyPowerUsage;
 

+ 5 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/message/PmsMessage.java

@@ -112,7 +112,7 @@ public class PmsMessage {
 
             // 生产异常
             if (PmsConstants.PRODUCTION_EXCEPTION.equals(businessType)) {
-                msg = "生产异常 \n" + name + "["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+                msg = "生产异常  \n" + name + "["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
             }
 
             // 瑞鹰项目启动设备整改
@@ -159,9 +159,12 @@ public class PmsMessage {
             }
 
             if (PmsConstants.FAILURE_NO_PASS.equals(businessType) || PmsConstants.ALARM_MESSAGE.equals(businessType)
-                    || PmsConstants.GENERATE_QHSE_CERT.equals(businessType) || PmsConstants.WEEK_ALARM_MESSAGE.equals(businessType) || PmsConstants.PRODUCTION_EXCEPTION.equals(businessType)) {
+                    || PmsConstants.GENERATE_QHSE_CERT.equals(businessType) || PmsConstants.WEEK_ALARM_MESSAGE.equals(businessType)) {
                 //通知设备状态变更为观察使用
                 dingtalkSendApi.send(mobile, msg, "text",url,  title);
+            } else if (PmsConstants.PRODUCTION_EXCEPTION.equals(businessType)) {
+                // markdown 类型消息 支持 文字加粗
+                dingtalkSendApi.send(mobile, msg, "markdown",url,  title);
             } else {
                 dingtalkSendApi.send(mobile, msg,"link", url, title);
             }

+ 40 - 30
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotfivedailyreport/IotFiveDailyReportServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
 import cn.iocoder.yudao.module.pms.constant.PmsConstants;
 import cn.iocoder.yudao.module.pms.controller.admin.iotfivedailyreport.vo.IotFiveDailyReportPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotfivedailyreport.vo.IotFiveDailyReportSaveReqVO;
@@ -117,12 +118,40 @@ public class IotFiveDailyReportServiceImpl implements IotFiveDailyReportService
             // 异常情况
             String malfunction = StrUtil.blankToDefault(updateObj.getMalfunction(), "无");
             DeptDO dept = deptService.getDept(deptId);
-            // 查询当前队伍的上级项目部
-            DeptDO projectDept = deptService.getDept(dept.getParentId());
+
+            List<String> projectDeptNames = new ArrayList<>();
+            // 查询瑞鹰 163l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+            Set<Long> userIds = new HashSet<>();
+            Set<Long> deptIds = new HashSet<>();
+            DataPermissionUtils.executeIgnore(() -> {
+                // 封装以上消息内容 发送到公司 角色 (生产异常通知)
+                // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                deptIds.add(388l);
+                List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
+                if (CollUtil.isNotEmpty(companyUsers)) {
+                    companyUsers.forEach(user -> {
+                        userIds.add(user.getId());
+                    });
+                }
+                deptIds.clear();
+                deptIds.add(156l);
+                List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
+                if (CollUtil.isNotEmpty(groupUsers)) {
+                    groupUsers.forEach(user -> {
+                        userIds.add(user.getId());
+                    });
+                }
+                // 查询当前队伍的上级项目部 过滤掉数据权限
+                DeptDO projectDept = deptService.getDept(dept.getParentId());
+                if (ObjUtil.isNotEmpty(projectDept)) {
+                    projectDeptNames.add(projectDept.getName());
+                }
+            });
+
             // 队伍名称
             String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
             // 项目部名称
-            String projectDeptName = ObjUtil.isNotEmpty(projectDept) ? projectDept.getName() : StrUtil.EMPTY;
+            String projectDeptName = CollUtil.isNotEmpty(projectDeptNames) ? projectDeptNames.get(0) : StrUtil.EMPTY;
 
             String wellName = "无";
             if (ObjUtil.isNotEmpty(taskId)) {
@@ -138,39 +167,20 @@ public class IotFiveDailyReportServiceImpl implements IotFiveDailyReportService
             // 故障误工时间 accidentTime H
 
             String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
-                    "[公司]:{}\n" +
-                    "[项目部]:{}\n" +
-                    "[队伍]:{}\n" +
-                    "[井号]:{}\n" +
-                    "[故障描述]:{}\n" +
-                    "[当前处理进度]:{}\n" +
-                    "[下步处理计划]:{}\n" +
-                    "[累计误工时间]:{}\n";
+                    "[**公司**]:{}  \n" +
+                    "[**项目部**]:{}  \n" +
+                    "[**队伍**]:{}  \n" +
+                    "[**井号**]:{}  \n" +
+                    "[**故障描述**]:{}  \n" +
+                    "[**当前处理进度**]:{}  \n" +
+                    "[**下步处理计划**]:{}  \n" +
+                    "[**累计误工时间**]:{}  \n";
 
             String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
                     companyName, projectDeptName, deptName, wellName,
                     malfunction, brief, nextPlan, accidentDay
             );
 
-            // 封装以上消息内容 发送到公司 角色 (生产异常通知)
-            // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
-            Set<Long> userIds = new HashSet<>();
-            Set<Long> deptIds = new HashSet<>();
-            deptIds.add(388l);
-            List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(companyUsers)) {
-                companyUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
-            deptIds.clear();
-            deptIds.add(156l);
-            List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(groupUsers)) {
-                groupUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
             RoleDO role = roleService.getRoleByCode("生产异常通知");
             if (ObjUtil.isNotEmpty(role)) {
                 Set<Long> roleIds = new HashSet<>();

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

@@ -277,12 +277,40 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                 // 异常情况
                 String malfunction = StrUtil.blankToDefault(dailyReport.getMalfunction(), "无");
                 DeptDO dept = deptService.getDept(deptId);
-                // 查询当前队伍的上级项目部
-                DeptDO projectDept = deptService.getDept(dept.getParentId());
+
+                List<String> projectDeptNames = new ArrayList<>();
+                // 查询瑞鹰 163l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                Set<Long> userIds = new HashSet<>();
+                Set<Long> deptIds = new HashSet<>();
+                DataPermissionUtils.executeIgnore(() -> {
+                    // 封装以上消息内容 发送到公司 角色 (生产异常通知)
+                    // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                    deptIds.add(163l);
+                    List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(companyUsers)) {
+                        companyUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    deptIds.clear();
+                    deptIds.add(156l);
+                    List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(groupUsers)) {
+                        groupUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    // 查询当前队伍的上级项目部 过滤掉数据权限
+                    DeptDO projectDept = deptService.getDept(dept.getParentId());
+                    if (ObjUtil.isNotEmpty(projectDept)) {
+                        projectDeptNames.add(projectDept.getName());
+                    }
+                });
+
                 // 队伍名称
                 String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
                 // 项目部名称
-                String projectDeptName = ObjUtil.isNotEmpty(projectDept) ? projectDept.getName() : StrUtil.EMPTY;
+                String projectDeptName = CollUtil.isNotEmpty(projectDeptNames) ? projectDeptNames.get(0) : StrUtil.EMPTY;
                 String wellName = "无";
                 if (ObjUtil.isNotEmpty(taskId)) {
                     IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
@@ -297,39 +325,20 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                 // 故障误工时间 accidentTime H
 
                 String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
-                        "[公司]:{}\n" +
-                        "[项目部]:{}\n" +
-                        "[队伍]:{}\n" +
-                        "[井号]:{}\n" +
-                        "[故障描述]:{}\n" +
-                        "[当前处理进度]:{}\n" +
-                        "[下步处理计划]:{}\n" +
-                        "[累计误工时间]:{}\n";
+                        "[**公司**]:{}  \n" +
+                        "[**项目部**]:{}  \n" +
+                        "[**队伍**]:{}  \n" +
+                        "[**井号**]:{}  \n" +
+                        "[**故障描述**]:{}  \n" +
+                        "[**当前处理进度**]:{}  \n" +
+                        "[**下步处理计划**]:{}  \n" +
+                        "[**累计误工时间**]:{}  \n";
 
                 String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
                         companyName, projectDeptName, deptName, wellName,
                         malfunction, brief, nextPlan, accidentDay
                 );
 
-                // 封装以上消息内容 发送到公司 角色 (生产异常通知)
-                // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
-                Set<Long> userIds = new HashSet<>();
-                Set<Long> deptIds = new HashSet<>();
-                deptIds.add(163l);
-                List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
-                if (CollUtil.isNotEmpty(companyUsers)) {
-                    companyUsers.forEach(user -> {
-                        userIds.add(user.getId());
-                    });
-                }
-                deptIds.clear();
-                deptIds.add(156l);
-                List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
-                if (CollUtil.isNotEmpty(groupUsers)) {
-                    groupUsers.forEach(user -> {
-                        userIds.add(user.getId());
-                    });
-                }
                 RoleDO role = roleService.getRoleByCode("生产异常通知");
                 if (ObjUtil.isNotEmpty(role)) {
                     Set<Long> roleIds = new HashSet<>();
@@ -493,6 +502,7 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         // 平台井需要更新任务施工状态的关联井
         List<IotProjectTaskDO> relatedPlatformTasks = new ArrayList<>();
         if (SupplierAuditStatusEnum.REJECT.getStatus().equals(updateReqVO.getAuditStatus())) {
+            // 审批拒绝
             dailyReport.setStatus(0);
         } else {
             // 审核通过 更新关联任务状态
@@ -1601,6 +1611,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         // key项目部id  value 压裂井数
         Map<Long, Set<Long>> ylWellsPair = new HashMap<>();
 
+        // 已经完工的任务id集合
+        Set<Long> finishedTaskIds = new HashSet<>();
+        // key队伍id/项目部id   value累计 油耗
+        Map<Long, Set<Long>> cumulativeWellsPair = new HashMap<>();
+
         // 队伍id 集合
         Set<Long> teamIds = new HashSet<>();
 
@@ -1746,12 +1761,26 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             daysCount = 0L;
         }
 
+        // 遍历日报 找到每个日报关联的任务的 施工队伍
+        List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
+        Set<Long> uniqueTaskIds = new HashSet<>(taskIds);
+        IotProjectTaskPageReqVO relatedTaskReqVO = new IotProjectTaskPageReqVO();
+        relatedTaskReqVO.setTaskIds(new ArrayList<>(uniqueTaskIds));
+        List<IotProjectTaskDO> relatedTasks = iotProjectTaskMapper.selectList(relatedTaskReqVO);
+        if (CollUtil.isNotEmpty(relatedTasks)) {
+            relatedTasks.forEach(task -> {
+                // 筛选出 完工 的任务集合 任务完工 施工井数 +1
+                if ("wg".equals(task.getRdStatus())) {
+                    finishedTaskIds.add(task.getId());
+                }
+            });
+        }
+
         // 累计计算各项 工作量
         if (CollUtil.isNotEmpty(dailyReports)) {
             dailyReports.forEach(report -> {
                 // 统计日报包含施工AB类设备的利用率
                 // 利用率暂时不考虑日报状态
-                // if (lyStatuses.contains(report.getRdStatus())) {
                 Set<Long> reportDeviceIds = report.getDeviceIds();
                 // 获得当前日报施工队伍的上级项目部
                 if (teamProjectIdPair.containsKey(report.getDeptId())) {
@@ -1777,11 +1806,14 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                         }
                     }
                 }
-                // }
 
+                // 油耗
                 BigDecimal dailyFuel = report.getDailyFuel();
                 dailyFuel = ObjUtil.isEmpty(dailyFuel) ? BigDecimal.ZERO : dailyFuel;
 
+                // 日报关联的任务井id
+                Long taskId = report.getTaskId();
+
                 if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
                     // projectDeptId可能是项目部 也可能是项目的上级
                     Long projectDeptId = 0l;
@@ -1794,6 +1826,21 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                         projectDeptId = report.getDeptId();
                     }
                     if (ObjUtil.isNotEmpty(projectDeptId) && (projectDeptId > 0)) {
+                        // 完工井
+                        if (ObjUtil.isNotEmpty(taskId) && finishedTaskIds.contains(taskId)) {
+                            // 统计各项目部下的完工井
+                            if (cumulativeWellsPair.containsKey(projectDeptId)) {
+                                Set<Long> existTaskIds = cumulativeWellsPair.get(projectDeptId);
+                                existTaskIds.add(taskId);
+                                cumulativeWellsPair.put(projectDeptId, existTaskIds);
+                            } else {
+                                Set<Long> existTaskIds = new HashSet<>();
+                                existTaskIds.add(taskId);
+                                cumulativeWellsPair.put(projectDeptId, existTaskIds);
+                            }
+                        }
+
+                        // 油耗
                         if (cumulativeFuelsPair.containsKey(projectDeptId)) {
                             BigDecimal existTotalFuel = cumulativeFuelsPair.get(projectDeptId);
                             BigDecimal tempTotalFuel = existTotalFuel.add(dailyFuel);
@@ -1978,7 +2025,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             statistics.setUtilizationRate(utilizationRatePair.get(deptId));
             statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(deptId));
             statistics.setCumulativeRunCount(cumulativeRunCountPair.get(deptId));
-            statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(deptId));
+            // 累计施工井 设置 查询区间累计已经完工的井数
+            if (cumulativeWellsPair.containsKey(deptId)) {
+                Set<Long> projectFinishedTaskIds = cumulativeWellsPair.get(deptId);
+                statistics.setCumulativeWorkingWell(BigDecimal.valueOf(projectFinishedTaskIds.size()));
+            }
             statistics.setCumulativeHourCount(cumulativeHourCountPair.get(deptId));
             statistics.setCumulativeWaterVolume(cumulativeWaterVolumePair.get(deptId));
             statistics.setCumulativeWorkingLayers(cumulativeWorkingLayersPair.get(deptId));
@@ -2042,6 +2093,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         // key队伍id/项目部id   value累计 台次 当日泵车台次
         Map<Long, BigDecimal> cumulativePumpTripsPair = new HashMap<>();
 
+        // 已经完工的任务id集合
+        Set<Long> finishedTaskIds = new HashSet<>();
+        // key队伍id/项目部id   value累计 油耗
+        Map<Long, Set<Long>> cumulativeWellsPair = new HashMap<>();
+
         // 以 队伍 为维度统计数据
         // 找到所有项目部与队伍的对应关系
         // 查询指定根部门下的所有子部门
@@ -2158,6 +2214,21 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             }
         }
 
+        // 遍历日报 找到每个日报关联的任务的 施工队伍
+        List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
+        Set<Long> uniqueTaskIds = new HashSet<>(taskIds);
+        IotProjectTaskPageReqVO relatedTaskReqVO = new IotProjectTaskPageReqVO();
+        relatedTaskReqVO.setTaskIds(new ArrayList<>(uniqueTaskIds));
+        List<IotProjectTaskDO> relatedTasks = iotProjectTaskMapper.selectList(relatedTaskReqVO);
+        if (CollUtil.isNotEmpty(relatedTasks)) {
+            relatedTasks.forEach(task -> {
+                // 筛选出 完工 的任务集合 任务完工 施工井数 +1
+                if ("wg".equals(task.getRdStatus())) {
+                    finishedTaskIds.add(task.getId());
+                }
+            });
+        }
+
         // 累计计算 工作量
         if (CollUtil.isNotEmpty(dailyReports)) {
             dailyReports.forEach(report -> {
@@ -2186,22 +2257,33 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                         }
                     }
                 }
-
+                // 油耗
                 BigDecimal dailyFuel = report.getDailyFuel();
                 dailyFuel = ObjUtil.isEmpty(dailyFuel) ? BigDecimal.ZERO : dailyFuel;
+
+                // 日报关联的任务井id
+                Long taskId = report.getTaskId();
+
                 if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
                     // projectDeptId可能是项目部 也可能是项目的上级
                     Long detailDeptId = 0l;
                     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 (ObjUtil.isNotEmpty(taskId) && finishedTaskIds.contains(taskId)) {
+                            // 统计各项目部下的完工井
+                            if (cumulativeWellsPair.containsKey(detailDeptId)) {
+                                Set<Long> existTaskIds = cumulativeWellsPair.get(detailDeptId);
+                                existTaskIds.add(taskId);
+                                cumulativeWellsPair.put(detailDeptId, existTaskIds);
+                            } else {
+                                Set<Long> existTaskIds = new HashSet<>();
+                                existTaskIds.add(taskId);
+                                cumulativeWellsPair.put(detailDeptId, existTaskIds);
+                            }
+                        }
+                        // 油耗
                         if (cumulativeFuelsPair.containsKey(detailDeptId)) {
                             BigDecimal existTotalFuel = cumulativeFuelsPair.get(detailDeptId);
                             BigDecimal tempTotalFuel = existTotalFuel.add(dailyFuel);
@@ -2363,7 +2445,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             statistics.setUtilizationRate(utilizationRatePair.get(teamDeptId));
             statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(teamDeptId));
             statistics.setCumulativeRunCount(cumulativeRunCountPair.get(teamDeptId));
-            statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(teamDeptId));
+            // 累计施工井 设置 查询区间累计已经完工的井数
+            if (cumulativeWellsPair.containsKey(teamDeptId)) {
+                Set<Long> teamFinishedTaskIds = cumulativeWellsPair.get(teamDeptId);
+                statistics.setCumulativeWorkingWell(BigDecimal.valueOf(teamFinishedTaskIds.size()));
+            }
             statistics.setCumulativeHourCount(cumulativeHourCountPair.get(teamDeptId));
             statistics.setCumulativeWaterVolume(cumulativeWaterVolumePair.get(teamDeptId));
             statistics.setCumulativeWorkingLayers(cumulativeWorkingLayersPair.get(teamDeptId));

+ 115 - 106
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportServiceImpl.java

@@ -26,7 +26,6 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotcarzhbd.IotCarZhbdDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotdailyreportfuel.IotDailyReportFuelDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
-import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojectinfo.IotProjectInfoDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
@@ -37,7 +36,6 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapp
 import cn.iocoder.yudao.module.pms.dal.mysql.iotprojectinfo.IotProjectInfoMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
-import cn.iocoder.yudao.module.pms.enums.common.FailureAuditStatusEnum;
 import cn.iocoder.yudao.module.pms.job.IotDeviceCarFuelVO;
 import cn.iocoder.yudao.module.pms.message.PmsMessage;
 import cn.iocoder.yudao.module.pms.util.ZHBDUtil;
@@ -852,6 +850,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         Long deptId = dailyReport.getDeptId();
         Long taskId = dailyReport.getTaskId();
         if (SupplierAuditStatusEnum.REJECT.getStatus().equals(updateReqVO.getAuditStatus())) {
+            // 审批拒绝
             dailyReport.setStatus(0);
             // 审批拒绝后需要向 日报填报人 发送消息提醒 每个队伍暂时只有1人 随机取1人
             DeptDO dept = deptService.getDept(deptId);
@@ -875,113 +874,115 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
                     });
                 }
             }
-        }
-        // 审核同意 将生产异常情况 (npt 工程质量) 发送到拥有 生产异常通知 角色的人员
-        BigDecimal accidentTime = dailyReport.getAccidentTime();
-        if (ObjUtil.isNotEmpty(accidentTime) && accidentTime.compareTo(BigDecimal.ZERO) > 0) {
+        } else {
+            // 审核同意 将生产异常情况 (npt 工程质量) 发送到拥有 生产异常通知 角色的人员
+            BigDecimal accidentTime = dailyReport.getAccidentTime();
+            if (ObjUtil.isNotEmpty(accidentTime) && accidentTime.compareTo(BigDecimal.ZERO) > 0) {
+
+                String companyName = "瑞恒兴域";
+                BigDecimal day = accidentTime.divide(new BigDecimal("24"), 2, RoundingMode.HALF_UP);
+                String accidentDay = day + "T";
+                // 异常情况
+                String malfunction = StrUtil.blankToDefault(dailyReport.getMalfunction(), "无");
+                DeptDO dept = deptService.getDept(deptId);
+
+                List<String> projectDeptNames = new ArrayList<>();
+                // 查询瑞鹰 163l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                Set<Long> userIds = new HashSet<>();
+                Set<Long> deptIds = new HashSet<>();
+                DataPermissionUtils.executeIgnore(() -> {
+                    // 封装以上消息内容 发送到公司 角色 (生产异常通知)
+                    // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                    deptIds.add(157l);
+                    List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(companyUsers)) {
+                        companyUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    deptIds.clear();
+                    deptIds.add(156l);
+                    List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(groupUsers)) {
+                        groupUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    // 查询当前队伍的上级项目部 过滤掉数据权限
+                    DeptDO projectDept = deptService.getDept(dept.getParentId());
+                    if (ObjUtil.isNotEmpty(projectDept)) {
+                        projectDeptNames.add(projectDept.getName());
+                    }
+                });
 
-            String companyName = "瑞恒兴域";
-            BigDecimal day = accidentTime.divide(new BigDecimal("24"), 2, RoundingMode.HALF_UP);
-            String accidentDay = day + "T";
-            // 异常情况
-            String malfunction = StrUtil.blankToDefault(dailyReport.getMalfunction(), "无");
-            Long projectId = dailyReport.getProjectId();
-            DeptDO dept = deptService.getDept(deptId);
-            // 查询当前队伍的上级项目部
-            DeptDO projectDept = deptService.getDept(dept.getParentId());
-            // 队伍名称
-            String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
-            // 项目部名称
-            String projectDeptName = ObjUtil.isNotEmpty(projectDept) ? projectDept.getName() : StrUtil.EMPTY;
-            String contract = "无";
-            if (ObjUtil.isNotEmpty(projectId)) {
-                IotProjectInfoDO project = iotProjectInfoMapper.selectById(projectId);
-                if (ObjUtil.isNotEmpty(project)) {
-                    contract = project.getContractName();
-                }
-            }
-            String wellName = "无";
-            if (ObjUtil.isNotEmpty(taskId)) {
-                IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
-                if (ObjUtil.isNotEmpty(task)) {
-                    wellName = task.getWellName();
+                // 队伍名称
+                String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
+                // 项目部名称
+                String projectDeptName = CollUtil.isNotEmpty(projectDeptNames) ? projectDeptNames.get(0) : StrUtil.EMPTY;
+                String wellName = "无";
+                if (ObjUtil.isNotEmpty(taskId)) {
+                    IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
+                    if (ObjUtil.isNotEmpty(task)) {
+                        wellName = task.getWellName();
+                    }
                 }
-            }
-            // 当前处理进度 当日施工简报
-            String brief = StrUtil.blankToDefault(dailyReport.getProductionStatus(), "无");
-            // 下步计划
-            String nextPlan = StrUtil.blankToDefault(dailyReport.getNextPlan(), "无");
-            // 故障误工时间 accidentTime H
-            String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
-                    "[公司]:{}\n" +
-                    "[项目部]:{}\n" +
-                    "[队伍]:{}\n" +
-                    "[井号]:{}\n" +
-                    "[故障描述]:{}\n" +
-                    "[当前处理进度]:{}\n" +
-                    "[下步处理计划]:{}\n" +
-                    "[累计误工时间]:{}\n";
-
-            String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
-                    companyName, projectDeptName, deptName, wellName,
-                    malfunction, brief, nextPlan, accidentDay
-            );
-
-            // 封装以上消息内容 发送到公司 角色 (生产异常通知)
-            // 查询瑞恒 157l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
-            Set<Long> userIds = new HashSet<>();
-            Set<Long> deptIds = new HashSet<>();
-            deptIds.add(157l);
-            List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(companyUsers)) {
-                companyUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
-            deptIds.clear();
-            deptIds.add(156l);
-            List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(groupUsers)) {
-                groupUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
-            RoleDO role = roleService.getRoleByCode("生产异常通知");
-            if (ObjUtil.isNotEmpty(role)) {
-                Set<Long> roleIds = new HashSet<>();
-                roleIds.add(role.getId());
-                List<UserRoleDO> userRoles = userRoleMapper.selectListByRoleIds(roleIds);
-                if (CollUtil.isNotEmpty(userRoles)) {
-                    // 提取有审批角色的所有用户ID(去重+空值过滤)
-                    Set<Long> roleUserIds = userRoles.stream()
-                            .map(UserRoleDO::getUserId)
-                            .filter(Objects::nonNull) // 过滤空userId
-                            .collect(Collectors.toSet());
-                    // 计算两个集合的交集,得到最终目标用户ID
-                    Set<Long> targetUserIds = userIds.stream()
-                            .filter(roleUserIds::contains)
-                            .collect(Collectors.toSet());
-                    // 异步发送 站内信 钉钉消息
-                    if (CollUtil.isNotEmpty(targetUserIds)) {
-                        Map<Long, AdminUserRespDTO> users = adminUserApi.getUserMap(targetUserIds);
-                        // 给多个用户发送 相同 的 提醒消息
-                        if (CollUtil.isNotEmpty(users)) {
-                            // 生成消息提醒 标题内容
-                            CountDownLatch latch = new CountDownLatch(users.size());
-                            users.forEach((userId, user) -> {
-                                pmsThreadPoolTaskExecutor.execute(() -> {
-                                    try {
-                                        String mobile = user.getMobile();
-                                        // 没有手机号也发送站内信消息
-                                        if (StrUtil.isNotBlank(finalMsgTitle)) {
-                                            pmsMessage.sendMessage(dailyReport.getId(), finalMsgTitle, PmsConstants.PRODUCTION_EXCEPTION,
-                                                    userId, mobile);
+                // 当前处理进度 当日施工简报
+                String brief = StrUtil.blankToDefault(dailyReport.getProductionStatus(), "无");
+                // 下步计划
+                String nextPlan = StrUtil.blankToDefault(dailyReport.getNextPlan(), "无");
+                // 故障误工时间 accidentTime H
+                String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
+                        "[**公司**]:{}  \n" +
+                        "[**项目部**]:{}  \n" +
+                        "[**队伍**]:{}  \n" +
+                        "[**井号**]:{}  \n" +
+                        "[**故障描述**]:{}  \n" +
+                        "[**当前处理进度**]:{}  \n" +
+                        "[**下步处理计划**]:{}  \n" +
+                        "[**累计误工时间**]:{}  \n";
+
+                String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
+                        companyName, projectDeptName, deptName, wellName,
+                        malfunction, brief, nextPlan, accidentDay
+                );
+
+                RoleDO role = roleService.getRoleByCode("生产异常通知");
+                if (ObjUtil.isNotEmpty(role)) {
+                    Set<Long> roleIds = new HashSet<>();
+                    roleIds.add(role.getId());
+                    List<UserRoleDO> userRoles = userRoleMapper.selectListByRoleIds(roleIds);
+                    if (CollUtil.isNotEmpty(userRoles)) {
+                        // 提取有审批角色的所有用户ID(去重+空值过滤)
+                        Set<Long> roleUserIds = userRoles.stream()
+                                .map(UserRoleDO::getUserId)
+                                .filter(Objects::nonNull) // 过滤空userId
+                                .collect(Collectors.toSet());
+                        // 计算两个集合的交集,得到最终目标用户ID
+                        Set<Long> targetUserIds = userIds.stream()
+                                .filter(roleUserIds::contains)
+                                .collect(Collectors.toSet());
+                        // 异步发送 站内信 钉钉消息
+                        if (CollUtil.isNotEmpty(targetUserIds)) {
+                            Map<Long, AdminUserRespDTO> users = adminUserApi.getUserMap(targetUserIds);
+                            // 给多个用户发送 相同 的 提醒消息
+                            if (CollUtil.isNotEmpty(users)) {
+                                // 生成消息提醒 标题内容
+                                CountDownLatch latch = new CountDownLatch(users.size());
+                                users.forEach((userId, user) -> {
+                                    pmsThreadPoolTaskExecutor.execute(() -> {
+                                        try {
+                                            String mobile = user.getMobile();
+                                            // 没有手机号也发送站内信消息
+                                            if (StrUtil.isNotBlank(finalMsgTitle)) {
+                                                pmsMessage.sendMessage(dailyReport.getId(), finalMsgTitle, PmsConstants.PRODUCTION_EXCEPTION,
+                                                        userId, mobile);
+                                            }
+                                        } finally {
+                                            latch.countDown();
                                         }
-                                    } finally {
-                                        latch.countDown();
-                                    }
+                                    });
                                 });
-                            });
+                            }
                         }
                     }
                 }
@@ -1056,7 +1057,15 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         // 更新
         IotRhDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRhDailyReportDO.class);
         // 编辑后 直接设置 已经 审核通过
-        updateObj.setAuditStatus(FailureAuditStatusEnum.APPROVE.getStatus());
+        // updateObj.setAuditStatus(FailureAuditStatusEnum.APPROVE.getStatus());
+        // 重新查询 taskId 获取 任务 相关的合同信息
+        Long taskId = updateObj.getTaskId();
+        if (ObjUtil.isNotEmpty(taskId)) {
+            IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
+            if (ObjUtil.isNotEmpty(task)) {
+                updateObj.setProjectId(task.getProjectId());
+            }
+        }
         iotRhDailyReportMapper.updateById(updateObj);
     }
 

+ 104 - 95
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportServiceImpl.java

@@ -982,105 +982,114 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
                     });
                 }
             }
-        }
-        // 审核同意 将生产异常情况 (npt 工程质量) 发送到拥有 生产异常通知 角色的人员
-        BigDecimal accidentTime = dailyReport.getAccidentTime();
-        if (ObjUtil.isNotEmpty(accidentTime) && accidentTime.compareTo(BigDecimal.ZERO) > 0) {
+        } else {
+            // 审核同意 将生产异常情况 (npt 工程质量) 发送到拥有 生产异常通知 角色的人员
+            BigDecimal accidentTime = dailyReport.getAccidentTime();
+            if (ObjUtil.isNotEmpty(accidentTime) && accidentTime.compareTo(BigDecimal.ZERO) > 0) {
+
+                String companyName = "瑞鹰国际";
+                BigDecimal day = accidentTime.divide(new BigDecimal("24"), 2, RoundingMode.HALF_UP);
+                String accidentDay = day + "T";
+                // 异常情况
+                String malfunction = StrUtil.blankToDefault(dailyReport.getMalfunction(), "无");
+                DeptDO dept = deptService.getDept(deptId);
+                List<String> projectDeptNames = new ArrayList<>();
+
+                // 封装以上消息内容 发送到公司 角色 (生产异常通知)
+                // 查询瑞鹰 158l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
+                Set<Long> userIds = new HashSet<>();
+                Set<Long> deptIds = new HashSet<>();
+                DataPermissionUtils.executeIgnore(() -> {
+                    deptIds.add(158l);
+                    List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(companyUsers)) {
+                        companyUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    deptIds.clear();
+                    deptIds.add(156l);
+                    List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
+                    if (CollUtil.isNotEmpty(groupUsers)) {
+                        groupUsers.forEach(user -> {
+                            userIds.add(user.getId());
+                        });
+                    }
+                    // 查询当前队伍的上级项目部 过滤掉数据权限
+                    DeptDO projectDept = deptService.getDept(dept.getParentId());
+                    if (ObjUtil.isNotEmpty(projectDept)) {
+                        projectDeptNames.add(projectDept.getName());
+                    }
+                });
 
-            String companyName = "瑞鹰国际";
-            BigDecimal day = accidentTime.divide(new BigDecimal("24"), 2, RoundingMode.HALF_UP);
-            String accidentDay = day + "T";
-            // 异常情况
-            String malfunction = StrUtil.blankToDefault(dailyReport.getMalfunction(), "无");
-            DeptDO dept = deptService.getDept(deptId);
-            // 查询当前队伍的上级项目部
-            DeptDO projectDept = deptService.getDept(dept.getParentId());
-            // 队伍名称
-            String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
-            // 项目部名称
-            String projectDeptName = ObjUtil.isNotEmpty(projectDept) ? projectDept.getName() : StrUtil.EMPTY;
-            String wellName = "无";
-            if (ObjUtil.isNotEmpty(taskId)) {
-                IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
-                if (ObjUtil.isNotEmpty(task)) {
-                    wellName = task.getWellName();
+                // 队伍名称
+                String deptName = ObjUtil.isNotEmpty(dept) ? dept.getName() : StrUtil.EMPTY;
+                // 项目部名称
+                String projectDeptName = CollUtil.isNotEmpty(projectDeptNames) ? projectDeptNames.get(0) : StrUtil.EMPTY;
+                String wellName = "无";
+                if (ObjUtil.isNotEmpty(taskId)) {
+                    IotProjectTaskDO task = iotProjectTaskMapper.selectById(taskId);
+                    if (ObjUtil.isNotEmpty(task)) {
+                        wellName = task.getWellName();
+                    }
                 }
-            }
-            // 当前处理进度 当日施工简报
-            String brief = StrUtil.blankToDefault(dailyReport.getConstructionBrief(), "无");
-            // 下步计划
-            String nextPlan = StrUtil.blankToDefault(dailyReport.getNextPlan(), "无");
-            // 故障误工时间 accidentTime H
-            String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
-                    "[公司]:{}\n" +
-                    "[项目部]:{}\n" +
-                    "[队伍]:{}\n" +
-                    "[井号]:{}\n" +
-                    "[故障描述]:{}\n" +
-                    "[当前处理进度]:{}\n" +
-                    "[下步处理计划]:{}\n" +
-                    "[累计误工时间]:{}\n";
-
-            String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
-                    companyName, projectDeptName, deptName, wellName,
-                    malfunction, brief, nextPlan, accidentDay
-            );
-
-            // 封装以上消息内容 发送到公司 角色 (生产异常通知)
-            // 查询瑞鹰 158l 下具有以上角色的人员 查询集团(科瑞石油技术) 拥有以上角色的人员
-            Set<Long> userIds = new HashSet<>();
-            Set<Long> deptIds = new HashSet<>();
-            deptIds.add(158l);
-            List<AdminUserDO> companyUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(companyUsers)) {
-                companyUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
-            deptIds.clear();
-            deptIds.add(156l);
-            List<AdminUserDO> groupUsers = adminUserService.getUserListByDeptIds(deptIds);
-            if (CollUtil.isNotEmpty(groupUsers)) {
-                groupUsers.forEach(user -> {
-                    userIds.add(user.getId());
-                });
-            }
-            RoleDO role = roleService.getRoleByCode("生产异常通知");
-            if (ObjUtil.isNotEmpty(role)) {
-                Set<Long> roleIds = new HashSet<>();
-                roleIds.add(role.getId());
-                List<UserRoleDO> userRoles = userRoleMapper.selectListByRoleIds(roleIds);
-                if (CollUtil.isNotEmpty(userRoles)) {
-                    // 提取有审批角色的所有用户ID(去重+空值过滤)
-                    Set<Long> roleUserIds = userRoles.stream()
-                            .map(UserRoleDO::getUserId)
-                            .filter(Objects::nonNull) // 过滤空userId
-                            .collect(Collectors.toSet());
-                    // 计算两个集合的交集,得到最终目标用户ID
-                    Set<Long> targetUserIds = userIds.stream()
-                            .filter(roleUserIds::contains)
-                            .collect(Collectors.toSet());
-                    // 异步发送 站内信 钉钉消息
-                    if (CollUtil.isNotEmpty(targetUserIds)) {
-                        Map<Long, AdminUserRespDTO> users = adminUserApi.getUserMap(targetUserIds);
-                        // 给多个用户发送 相同 的 提醒消息
-                        if (CollUtil.isNotEmpty(users)) {
-                            // 生成消息提醒 标题内容
-                            CountDownLatch latch = new CountDownLatch(users.size());
-                            users.forEach((userId, user) -> {
-                                pmsThreadPoolTaskExecutor.execute(() -> {
-                                    try {
-                                        String mobile = user.getMobile();
-                                        // 没有手机号也发送站内信消息
-                                        if (StrUtil.isNotBlank(finalMsgTitle)) {
-                                            pmsMessage.sendMessage(dailyReport.getId(), finalMsgTitle, PmsConstants.PRODUCTION_EXCEPTION,
-                                                    userId, mobile);
+                // 当前处理进度 当日施工简报
+                String brief = StrUtil.blankToDefault(dailyReport.getConstructionBrief(), "无");
+                // 下步计划
+                String nextPlan = StrUtil.blankToDefault(dailyReport.getNextPlan(), "无");
+                // 故障误工时间 accidentTime H
+                String PRODUCTION_EXCEPTION_MSG_TEMPLATE =
+                        "[**公司**]:{}  \n" +
+                        "[**项目部**]:{}  \n" +
+                        "[**队伍**]:{}  \n" +
+                        "[**井号**]:{}  \n" +
+                        "[**故障描述**]:{}  \n" +
+                        "[**当前处理进度**]:{}  \n" +
+                        "[**下步处理计划**]:{}  \n" +
+                        "[**累计误工时间**]:{}  \n";
+
+                String finalMsgTitle = StrUtil.format(PRODUCTION_EXCEPTION_MSG_TEMPLATE,
+                        companyName, projectDeptName, deptName, wellName,
+                        malfunction, brief, nextPlan, accidentDay
+                );
+
+                RoleDO role = roleService.getRoleByCode("生产异常通知");
+                if (ObjUtil.isNotEmpty(role)) {
+                    Set<Long> roleIds = new HashSet<>();
+                    roleIds.add(role.getId());
+                    List<UserRoleDO> userRoles = userRoleMapper.selectListByRoleIds(roleIds);
+                    if (CollUtil.isNotEmpty(userRoles)) {
+                        // 提取有审批角色的所有用户ID(去重+空值过滤)
+                        Set<Long> roleUserIds = userRoles.stream()
+                                .map(UserRoleDO::getUserId)
+                                .filter(Objects::nonNull) // 过滤空userId
+                                .collect(Collectors.toSet());
+                        // 计算两个集合的交集,得到最终目标用户ID
+                        Set<Long> targetUserIds = userIds.stream()
+                                .filter(roleUserIds::contains)
+                                .collect(Collectors.toSet());
+                        // 异步发送 站内信 钉钉消息
+                        if (CollUtil.isNotEmpty(targetUserIds)) {
+                            Map<Long, AdminUserRespDTO> users = adminUserApi.getUserMap(targetUserIds);
+                            // 给多个用户发送 相同 的 提醒消息
+                            if (CollUtil.isNotEmpty(users)) {
+                                // 生成消息提醒 标题内容
+                                CountDownLatch latch = new CountDownLatch(users.size());
+                                users.forEach((userId, user) -> {
+                                    pmsThreadPoolTaskExecutor.execute(() -> {
+                                        try {
+                                            String mobile = user.getMobile();
+                                            // 没有手机号也发送站内信消息
+                                            if (StrUtil.isNotBlank(finalMsgTitle)) {
+                                                pmsMessage.sendMessage(dailyReport.getId(), finalMsgTitle, PmsConstants.PRODUCTION_EXCEPTION,
+                                                        userId, mobile);
+                                            }
+                                        } finally {
+                                            latch.countDown();
                                         }
-                                    } finally {
-                                        latch.countDown();
-                                    }
+                                    });
                                 });
-                            });
+                            }
                         }
                     }
                 }