소스 검색

pms 瑞鹰汇总统计 已填报 未填报 数量统计 已完成率 功能优化

zhangcl 4 일 전
부모
커밋
b4f0729526

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

@@ -248,8 +248,13 @@ public class IotRhDailyReportController {
             long completeRyCount = 0;
             IotRyDailyReportPageReqVO ryReqVO = new IotRyDailyReportPageReqVO();
             ryReqVO.setCreateTime(pageReqVO.getCreateTime());
-            ryReqVO.setProjectClassification("2");  // 暂时先统计修井
+            // 修井
+            ryReqVO.setProjectClassification("2");
             List<IotRyDailyReportStatisticsVO> ryReports = iotRyDailyReportService.ryDailyReportStatistics(ryReqVO);
+            // 钻井
+            ryReqVO.setProjectClassification("1");
+            List<IotRyDailyReportStatisticsVO> ryZjReports = iotRyDailyReportService.ryDailyReportStatistics(ryReqVO);
+            // 钻井 修井 日报 总数 已填报 数 累加示平均值
             if (CollUtil.isNotEmpty(ryReports)) {
                 for (IotRyDailyReportStatisticsVO ryReport : ryReports) {
                     if ("总数".equals(ryReport.getGroupName())) {
@@ -259,13 +264,23 @@ public class IotRhDailyReportController {
                         completeRyCount = ryReport.getCount();
                     }
                 }
-                if (totalRhCount != 0l) {
-                    BigDecimal filled = BigDecimal.valueOf(completeRyCount);
-                    BigDecimal total = BigDecimal.valueOf(totalRyCount);
-                    BigDecimal rate = filled.divide(total, 2, RoundingMode.HALF_UP);
-                    ryRate.put("rate", rate);
+            }
+            if (CollUtil.isNotEmpty(ryZjReports)) {
+                for (IotRyDailyReportStatisticsVO zjReport : ryZjReports) {
+                    if ("总数".equals(zjReport.getGroupName())) {
+                        totalRyCount = totalRyCount + zjReport.getCount();
+                    }
+                    if ("已填报".equals(zjReport.getGroupName())) {
+                        completeRyCount = completeRyCount + zjReport.getCount();
+                    }
                 }
             }
+            if (totalRyCount != 0l) {
+                BigDecimal filled = BigDecimal.valueOf(completeRyCount);
+                BigDecimal total = BigDecimal.valueOf(totalRyCount);
+                BigDecimal rate = filled.divide(total, 2, RoundingMode.HALF_UP);
+                ryRate.put("rate", rate);
+            }
             result.add(ryRate);
         });
         return success(result);

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotopeationfill/IotOpeationFillMapper.java

@@ -101,6 +101,10 @@ public interface IotOpeationFillMapper extends BaseMapperX<IotOpeationFillDO> {
 
     @TenantIgnore
     List<IotOpeationFillOrderDO> selectListByCreateTime(IotOpeationFillPageReqVO reqVO);
+
+    @TenantIgnore
+    List<IotOpeationFillDO> countFills(IotOpeationFillPageReqVO reqVO);
+
     @TenantIgnore
     List<IotOpeationFillDO> getFillDevices(@Param("deviceIds")List<Long> deviceIds);
 

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

@@ -12,16 +12,19 @@ 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.depttype.vo.IotDeptTypePageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceProperty;
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.*;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.depttype.IotDeptTypeDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotrydailyreport.IotRyDailyReportDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.depttype.IotDeptTypeMapper;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotrydailyreport.IotRyDailyReportMapper;
 import cn.iocoder.yudao.module.pms.message.PmsMessage;
@@ -97,6 +100,9 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
     private ThreadPoolTaskExecutor pmsThreadPoolTaskExecutor;
     @Resource
     private PmsMessage pmsMessage;
+    @Resource
+    private IotOpeationFillMapper iotOpeationFillMapper;
+
 
     @Override
     public Long createIotRyDailyReport(IotRyDailyReportSaveReqVO createReqVO) {
@@ -481,6 +487,7 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
         // 查询 瑞鹰158l 所有存在设备的队伍
         // 查询瑞鹰下所有部门
         List<IotDeviceDO> devices = devices();
+
         // 所有需要填报日报的 瑞鹰 队伍集合
         Set<Long> deptIds = new HashSet<>();
         if (CollUtil.isNotEmpty(devices)){
@@ -501,23 +508,50 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
                 });
             }
 
+            // 以运行记录表中 指定 时间范围内的 名称中包含 ‘生产日报’ 工单的部门为基数
+            // 瑞鹰钻井 rq_iot_opeation_fill rq_iot_opeation_fill_order 关联查询
+            // 瑞鹰修井 需要结合 挂靠队伍 日报
+            IotOpeationFillPageReqVO fillReqVO = new IotOpeationFillPageReqVO();
+            fillReqVO.setCreateTime(pageReqVO.getCreateTime());
+            fillReqVO.setDeptIds(zjOrXjDeptIds);
+            List<IotOpeationFillDO> fills = iotOpeationFillMapper.countFills(fillReqVO);
+            // 钻修井日报总数
+            Integer zxjTotalCount = 0;
+            // 钻修井已填报完成日报总数
+            AtomicReference<Integer> zxjFinishedCount = new AtomicReference<>(0);
+            // 钻修井未填报完成日报总数
+            AtomicReference<Integer> zxjUnfinishedCount = new AtomicReference<>(0);
+            if (CollUtil.isNotEmpty(fills)) {
+                zxjTotalCount = fills.size();
+                fills.forEach(fill -> {
+                    // 找出所有已经填报完成的队伍
+                    if (1 == fill.getIsFill()) {
+                        // 填报完成
+                        zxjFinishedCount.set(zxjFinishedCount.get() + 1);
+                    } else {
+                        // 填报中属于未填报完成
+                        zxjUnfinishedCount.set(zxjUnfinishedCount.get() + 1);
+                    }
+                });
+            }
+
             devices.forEach(device -> {
                 deptIds.add(device.getDeptId());
             });
             // 根据部门id集合查询所有部门信息
             // 查询所有部门信息
-            Map<Long, DeptDO> allDepts = deptService.getDeptMap(deptIds);
+            // Map<Long, DeptDO> allDepts = deptService.getDeptMap(deptIds);
             // 过滤后的所有部门信息
             Map<Long, DeptDO> filteredDepts = new HashMap<>();
             // 过滤掉部门中的 ‘项目部’...
-            if (CollUtil.isNotEmpty(allDepts)) {
+            /* if (CollUtil.isNotEmpty(allDepts)) {
                 allDepts.forEach((deptId, dept) -> {
                     // 将不属于 队伍 的组织部门过滤掉
                     if ("3".equals(dept.getType()) && zjOrXjDeptIds.contains(deptId)) {
                         filteredDepts.put(deptId, dept);
                     }
                 });
-            }
+            } */
 
             // 比如有20个队伍 某个时间区间D内 必须有20*D份日报 时间区间最好是1天
             // 查询出指定时间区间内 已经填写的日报数量
@@ -540,13 +574,13 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
             long notReportedCount = totalRequiredReports - totalReportedReports;
             IotRyDailyReportStatisticsVO allReports = new IotRyDailyReportStatisticsVO();
             allReports.setGroupName("总数");
-            allReports.setCount(totalRequiredReports);
+            allReports.setCount(zxjTotalCount);
             IotRyDailyReportStatisticsVO haveReported = new IotRyDailyReportStatisticsVO();
             haveReported.setGroupName("已填报");
-            haveReported.setCount(totalReportedReports);
+            haveReported.setCount(zxjFinishedCount.get());
             IotRyDailyReportStatisticsVO notReported = new IotRyDailyReportStatisticsVO();
             notReported.setGroupName("未填报");
-            notReported.setCount(notReportedCount);
+            notReported.setCount(zxjUnfinishedCount.get());
             results.add(allReports);
             results.add(haveReported);
             results.add(notReported);
@@ -563,134 +597,164 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
             throw exception(IOT_DAILY_REPORT_TIME_NOT_EXISTS);
         }
         List<IotRyDailyReportStatisticsVO> results = new ArrayList<>();
-        List<IotDeviceDO> devices = devices();
+        // List<IotDeviceDO> devices = devices();
         // 所有需要填报日报的 瑞鹰 队伍集合
         Set<Long> deptIds = new HashSet<>();
         List<String> reportDates = new ArrayList<>();
-        if (CollUtil.isNotEmpty(devices)){
-            // 1钻井  2修井
-            String projectClassification = pageReqVO.getProjectClassification();
-            // 查询钻井部门 修井 部门
-            IotDeptTypePageReqVO reqVO = new IotDeptTypePageReqVO();
-            if ("1".equals(projectClassification)) {
-                reqVO.setType("zj");
-            } else {
-                reqVO.setType("xj");
-            }
-            List<IotDeptTypeDO> deptTypes = iotDeptTypeMapper.selectList(reqVO);
-            List<Long> zjOrXjDeptIds = new ArrayList<>();
-            if (CollUtil.isNotEmpty(deptTypes)) {
-                deptTypes.forEach(dept -> {
-                    zjOrXjDeptIds.add(dept.getDeptId());
-                });
-            }
+        // 1钻井  2修井
+        String projectClassification = pageReqVO.getProjectClassification();
+        // 查询钻井部门 修井 部门
+        IotDeptTypePageReqVO reqVO = new IotDeptTypePageReqVO();
+        if ("1".equals(projectClassification)) {
+            reqVO.setType("zj");
+        } else {
+            reqVO.setType("xj");
+        }
+        List<IotDeptTypeDO> deptTypes = iotDeptTypeMapper.selectList(reqVO);
+        List<Long> zjOrXjDeptIds = new ArrayList<>();
+        if (CollUtil.isNotEmpty(deptTypes)) {
+            deptTypes.forEach(dept -> {
+                zjOrXjDeptIds.add(dept.getDeptId());
+            });
+        }
 
-            devices.forEach(device -> {
-                deptIds.add(device.getDeptId());
+        /* devices.forEach(device -> {
+            deptIds.add(device.getDeptId());
+        }); */
+
+        // 以运行记录表中 指定 时间范围内的 名称中包含 ‘生产日报’ 工单的部门为基数
+        // 瑞鹰钻井 rq_iot_opeation_fill rq_iot_opeation_fill_order 关联查询
+        // 瑞鹰修井 需要结合 挂靠队伍 日报
+        IotOpeationFillPageReqVO fillReqVO = new IotOpeationFillPageReqVO();
+        fillReqVO.setCreateTime(pageReqVO.getCreateTime());
+        fillReqVO.setDeptIds(zjOrXjDeptIds);
+        List<IotOpeationFillDO> fills = iotOpeationFillMapper.countFills(fillReqVO);
+
+        // 根据指定的时间区间 计算出天数
+        LocalDateTime[] createTimes = pageReqVO.getCreateTime();
+        // 获取开始时间和结束时间
+        LocalDateTime startTime = createTimes[0];
+        LocalDateTime endTime = createTimes[1];
+        // 截断到日期(忽略时分秒)
+        LocalDate startDate = startTime.toLocalDate();
+        LocalDate endDate = endTime.toLocalDate();
+        // 将时间区间拆分成具体的每天 计算每天未填报日报的队伍明细
+        Set<LocalDate> dateSet = new HashSet<>();
+        LocalDate currentDate = startDate;
+        // 循环添加从开始日期到结束日期的所有日期(包含两端)
+        while (!currentDate.isAfter(endDate)) {
+            dateSet.add(currentDate);
+            currentDate = currentDate.plusDays(1); // 日期加1天
+        }
+        // 转换为字符串格式的日期集合(如:2025-10-06)
+        reportDates = dateSet.stream()
+                .map(date -> date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
+                .collect(Collectors.toList());
+        // 比如有20个队伍 某个时间区间D内 必须有20*D份日报 时间区间最好是1天
+        // 查询出指定时间区间内 已经填写的日报数量
+        List<IotRyDailyReportDO> dailyReports = iotRyDailyReportMapper.dailyReports(pageReqVO);
+        // key日期   value对应日期已经填报的队伍名称集合
+        Map<String, List<String>> reportedDeptNames = new HashMap<>();
+        // key日期    value对应日期未填报完成的队伍名称集合
+        Map<String, List<String>> unReportedDeptNames = new HashMap<>();
+        // 查询所有部门信息
+        Map<Long, DeptDO> allDepts = deptService.getDeptMap(zjOrXjDeptIds);
+        // 过滤后的所有部门信息
+        Map<Long, DeptDO> filteredDepts = new HashMap<>();
+        // 过滤掉部门中的 ‘项目部’
+        /* if (CollUtil.isNotEmpty(allDepts)) {
+            allDepts.forEach((deptId, dept) -> {
+                if ("3".equals(dept.getType()) && zjOrXjDeptIds.contains(deptId)) {
+                    filteredDepts.put(deptId, dept);
+                }
             });
-            // 根据指定的时间区间 计算出天数
-            LocalDateTime[] createTimes = pageReqVO.getCreateTime();
-            // 获取开始时间和结束时间
-            LocalDateTime startTime = createTimes[0];
-            LocalDateTime endTime = createTimes[1];
-            // 截断到日期(忽略时分秒)
-            LocalDate startDate = startTime.toLocalDate();
-            LocalDate endDate = endTime.toLocalDate();
-            // 将时间区间拆分成具体的每天 计算每天未填报日报的队伍明细
-            Set<LocalDate> dateSet = new HashSet<>();
-            LocalDate currentDate = startDate;
-            // 循环添加从开始日期到结束日期的所有日期(包含两端)
-            while (!currentDate.isAfter(endDate)) {
-                dateSet.add(currentDate);
-                currentDate = currentDate.plusDays(1); // 日期加1天
-            }
-            // 转换为字符串格式的日期集合(如:2025-10-06)
-            reportDates = dateSet.stream()
-                    .map(date -> date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
-                    .collect(Collectors.toList());
-            // 比如有20个队伍 某个时间区间D内 必须有20*D份日报 时间区间最好是1天
-            // 查询出指定时间区间内 已经填写的日报数量
-            List<IotRyDailyReportDO> dailyReports = iotRyDailyReportMapper.dailyReports(pageReqVO);
-            // 已经填报的队伍名称集合
-            Map<String, List<String>> reportedDeptNames = new HashMap<>();
-            // 未填报的队伍名称集合
-            Map<String, List<String>> unReportedDeptNames = new HashMap<>();
-            // 查询所有部门信息
-            Map<Long, DeptDO> allDepts = deptService.getDeptMap(deptIds);
-            // 过滤后的所有部门信息
-            Map<Long, DeptDO> filteredDepts = new HashMap<>();
-            // 过滤掉部门中的 ‘项目部’
-            if (CollUtil.isNotEmpty(allDepts)) {
-                allDepts.forEach((deptId, dept) -> {
-                    if ("3".equals(dept.getType()) && zjOrXjDeptIds.contains(deptId)) {
-                        filteredDepts.put(deptId, dept);
-                    }
-                });
-            }
-            if (CollUtil.isNotEmpty(dailyReports)) {
-                // 组装每天填写的日报集合 从而统计出每天未填写日报的队伍
-                dailyReports.forEach(report -> {
-                    Long tempDeptId = report.getDeptId();
-                    if (filteredDepts.containsKey(tempDeptId)) {
-                        String deptName = filteredDepts.get(tempDeptId).getName();
-                        LocalDateTime createTime = report.getCreateTime();
-                        LocalDate tempDate = createTime.toLocalDate();
-                        String tempReportDate = tempDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                        if (reportedDeptNames.containsKey(tempReportDate)) {
-                            List<String> tempDeptNames = reportedDeptNames.get(tempReportDate);
-                            tempDeptNames.add(deptName);
-                            reportedDeptNames.put(tempReportDate, tempDeptNames);
-                        } else {
-                            List<String> tempDeptNames = new ArrayList<>();
-                            tempDeptNames.add(deptName);
-                            reportedDeptNames.put(tempReportDate, tempDeptNames);
-                        }
+        } */
+        /* if (CollUtil.isNotEmpty(dailyReports)) {
+            // 组装每天填写的日报集合 从而统计出每天未填写日报的队伍
+            dailyReports.forEach(report -> {
+                Long tempDeptId = report.getDeptId();
+                if (filteredDepts.containsKey(tempDeptId)) {
+                    String deptName = filteredDepts.get(tempDeptId).getName();
+                    LocalDateTime createTime = report.getCreateTime();
+                    LocalDate tempDate = createTime.toLocalDate();
+                    String tempReportDate = tempDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                    if (reportedDeptNames.containsKey(tempReportDate)) {
+                        List<String> tempDeptNames = reportedDeptNames.get(tempReportDate);
+                        tempDeptNames.add(deptName);
+                        reportedDeptNames.put(tempReportDate, tempDeptNames);
+                    } else {
+                        List<String> tempDeptNames = new ArrayList<>();
+                        tempDeptNames.add(deptName);
+                        reportedDeptNames.put(tempReportDate, tempDeptNames);
                     }
-                });
-            }
-            // 遍历所有时间区间的日期 组装每个日期中 未填写日报的队伍名称集合
-            if (CollUtil.isNotEmpty(reportDates)) {
-                reportDates.forEach(dateStr -> {
-                    // 对时间区间内每个日期 都经过已经填报日报的过滤
-                    if (reportedDeptNames.containsKey(dateStr)) {
-                        List<String> tempReportedDeptNames = reportedDeptNames.get(dateStr);
-                        filteredDepts.forEach((deptId, dept) -> {
-                            if (!tempReportedDeptNames.contains(dept.getName())) {
-                                if (unReportedDeptNames.containsKey(dateStr)) {
-                                    List<String> tempDeptNames = unReportedDeptNames.get(dateStr);
-                                    tempDeptNames.add(dept.getName());
-                                    unReportedDeptNames.put(dateStr, tempDeptNames);
-                                } else {
-                                    List<String> tempDeptNames = new ArrayList<>();
-                                    tempDeptNames.add(dept.getName());
-                                    unReportedDeptNames.put(dateStr, tempDeptNames);
-                                }
+                }
+            });
+        } */
+        // 遍历所有时间区间的日期 组装每个日期中 未填写日报的队伍名称集合
+        /* if (CollUtil.isNotEmpty(reportDates)) {
+            reportDates.forEach(dateStr -> {
+                // 对时间区间内每个日期 都经过已经填报日报的过滤
+                if (reportedDeptNames.containsKey(dateStr)) {
+                    List<String> tempReportedDeptNames = reportedDeptNames.get(dateStr);
+                    filteredDepts.forEach((deptId, dept) -> {
+                        if (!tempReportedDeptNames.contains(dept.getName())) {
+                            if (unReportedDeptNames.containsKey(dateStr)) {
+                                List<String> tempDeptNames = unReportedDeptNames.get(dateStr);
+                                tempDeptNames.add(dept.getName());
+                                unReportedDeptNames.put(dateStr, tempDeptNames);
+                            } else {
+                                List<String> tempDeptNames = new ArrayList<>();
+                                tempDeptNames.add(dept.getName());
+                                unReportedDeptNames.put(dateStr, tempDeptNames);
                             }
-                        });
-                    } else {
-                        // 当天没有任何队伍填写日报
-                        filteredDepts.forEach((deptId, dept) -> {
+                        }
+                    });
+                } else {
+                    // 当天没有任何队伍填写日报
+                    filteredDepts.forEach((deptId, dept) -> {
+                        List<String> tempDeptNames = new ArrayList<>();
+                        tempDeptNames.add(dept.getName());
+                        unReportedDeptNames.put(dateStr, tempDeptNames);
+                    });
+                }
+            });
+        } */
+
+        if (CollUtil.isNotEmpty(fills)) {
+            fills.forEach(fill -> {
+                if (0 == fill.getIsFill()) {
+                    // 未完成填报
+                    LocalDate tempDate = fill.getCreateTime().toLocalDate();
+                    String tempDateStr = tempDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                    if (allDepts.containsKey(fill.getDeptId())) {
+                        DeptDO dept = allDepts.get(fill.getDeptId());
+                        if (unReportedDeptNames.containsKey(tempDateStr)) {
+                            List<String> tempDeptNames = unReportedDeptNames.get(tempDateStr);
+                            tempDeptNames.add(dept.getName());
+                            unReportedDeptNames.put(tempDateStr, tempDeptNames);
+                        } else {
                             List<String> tempDeptNames = new ArrayList<>();
                             tempDeptNames.add(dept.getName());
-                            unReportedDeptNames.put(dateStr, tempDeptNames);
-                        });
+                            unReportedDeptNames.put(tempDateStr, tempDeptNames);
+                        }
                     }
-                });
-            }
-            // 将集合中的未填报日报的队伍集合转换成 逗号 分隔的字符串
-            if (CollUtil.isNotEmpty(unReportedDeptNames)) {
-                unReportedDeptNames.forEach((reportDate, deptList) -> {
-                    IotRyDailyReportStatisticsVO dailyReportVO = new IotRyDailyReportStatisticsVO();
-                    dailyReportVO.setReportDate(reportDate);
-                    dailyReportVO.setDeptNames(deptList.stream().collect(Collectors.joining(",")));
-                    dailyReportVO.setCount(deptList.size());
-                    results.add(dailyReportVO);
-                });
-                // 使用Comparator进行排序
-                results.sort(Comparator
-                        .comparing(IotRyDailyReportStatisticsVO::getReportDate,
-                                Comparator.nullsLast(Comparator.reverseOrder())));
-            }
+                }
+            });
+        }
+
+        // 将集合中的未填报日报的队伍集合转换成 逗号 分隔的字符串
+        if (CollUtil.isNotEmpty(unReportedDeptNames)) {
+            unReportedDeptNames.forEach((reportDate, deptList) -> {
+                IotRyDailyReportStatisticsVO dailyReportVO = new IotRyDailyReportStatisticsVO();
+                dailyReportVO.setReportDate(reportDate);
+                dailyReportVO.setDeptNames(deptList.stream().collect(Collectors.joining(",")));
+                dailyReportVO.setCount(deptList.size());
+                results.add(dailyReportVO);
+            });
+            // 使用Comparator进行排序
+            results.sort(Comparator
+                    .comparing(IotRyDailyReportStatisticsVO::getReportDate,
+                            Comparator.nullsLast(Comparator.reverseOrder())));
         }
         return results;
     }

+ 16 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotOpeationFillMapper.xml

@@ -517,6 +517,22 @@
         </if>
     </select>
 
+    <select id="countFills" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO"
+            resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
+        SELECT a.*
+        FROM rq_iot_opeation_fill a
+        WHERE a.deleted = 0
+        AND a.device_name = '生产日报'
+        AND a.create_time BETWEEN #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
+            AND #{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
+        <if test="deptIds != null and deptIds.size &gt; 0">
+            AND a.dept_id IN
+            <foreach collection="deptIds" index="index" item="key" open="(" separator="," close=")">
+                #{key}
+            </foreach>
+        </if>
+    </select>
+
     <select id="rhList"
             resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
         SELECT au.id, au.name, au.parent_id