فهرست منبع

pms 瑞鹰看板 钻井 修井 统计

zhangcl 6 روز پیش
والد
کامیت
9f748ff45c

+ 9 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/IotRyDailyReportController.java

@@ -220,14 +220,22 @@ public class IotRyDailyReportController {
                     latestWellDoneTimePair.put(time.getDeptId(), time.getConstructionStartDate());
                 });
             }
-            // 按施工队伍统计 施工井数 完工井数
+            // 按施工队伍统计 钻井日报 施工井数 完工井数
             List<IotRyDailyReportTaskCountVO> deptTasks = iotRyDailyReportService.countTasksByDept();
+            // 修井日报 不存在既填写钻井日报 又填写修井日报的队伍
+            List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportService.countRepairTasksByDept();
             if (CollUtil.isNotEmpty(deptTasks)) {
                 deptTasks.forEach(task -> {
                     totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
                     completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
                 });
             }
+            if (CollUtil.isNotEmpty(repairDeptTasks)) {
+                repairDeptTasks.forEach(task -> {
+                    totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
+                    completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
+                });
+            }
         });
         // 2. 拼接数据
         return BeanUtils.toBean(reports, IotRyDailyReportRespVO.class, (reportVO) -> {

+ 23 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportTaskCountVO.java

@@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Schema(description = "管理后台 - 瑞鹰日报 统计施工井数 完工井数 Response VO")
 @Data
 @ExcelIgnoreUnannotated
@@ -18,4 +20,25 @@ public class IotRyDailyReportTaskCountVO {
     @Schema(description = "完工井数", example = "23")
     private Integer completedTaskCount;
 
+    @Schema(description = "月施工井数", example = "15")
+    private Integer monthTotalTaskCount;
+
+    @Schema(description = "月完工井数", example = "23")
+    private Integer monthCompletedTaskCount;
+
+    @Schema(description = "年施工井数", example = "15")
+    private Integer yearTotalTaskCount;
+
+    @Schema(description = "年完工井数", example = "23")
+    private Integer yearCompletedTaskCount;
+
+    @Schema(description = "日进尺", example = "23")
+    private BigDecimal dailyFootage;
+
+    @Schema(description = "月累计进尺", example = "15")
+    private BigDecimal monthlyFootage;
+
+    @Schema(description = "年累计进尺", example = "23")
+    private BigDecimal annualFootage;
+
 }

+ 190 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotStaticController.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.controller.admin.stat;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
 import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@@ -19,6 +20,8 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotmainworkorder.vo.IotMainW
 import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotoutbound.vo.IotOutboundPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.IotRyDailyReportPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.IotRyDailyReportTaskCountVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.YearTotalGas;
@@ -47,14 +50,17 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorder.IotMainWorkOrderMa
 import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotrydailyreport.IotRyDailyReportMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotsapstock.IotSapStockMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
 import cn.iocoder.yudao.module.pms.service.DeviceServiceImpl;
 import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
+import cn.iocoder.yudao.module.pms.service.iotrydailyreport.IotRyDailyReportService;
 import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
 import cn.iocoder.yudao.module.system.service.dept.DeptService;
 import cn.iocoder.yudao.module.system.service.dict.DictDataService;
@@ -138,6 +144,10 @@ public class IotStaticController {
     private IotInspectPlanMapper iotInspectPlanMapper;
     @Autowired
     private IotRhDailyReportMapper iotRhDailyReportMapper;
+    @Autowired
+    private IotRyDailyReportService iotRyDailyReportService;
+    @Autowired
+    private IotRyDailyReportMapper iotRyDailyReportMapper;
 
     @GetMapping("/main/day")
     public CommonResult<Map<String, Object>> getMaintainDay() {
@@ -1145,5 +1155,185 @@ public class IotStaticController {
 
         return success(ImmutableMap.of("瑞恒", rhcount.get(),"瑞都",rdcount.get(),"瑞鹰",rycount.get()));
     }
+
+    /**
+     * 统计 瑞鹰 158 的 钻井 修井工作量
+     * @param type drill钻井  repair修井
+     * @return
+     */
+    @GetMapping("/ry/dailyReport/{type}")
+    @PermitAll
+    public CommonResult<Map<String, Object>> getRyDailyReportStat(@PathVariable("type") String type) {
+        if (StrUtil.isBlank(type)) {
+            return success(new HashMap<>());
+        }
+        // 查询瑞鹰所有 队伍 项目部
+        Set<Long> rdChildDeptIds = deptService.getChildDeptIdListFromCache(158l);
+        List<DeptDO> depts =deptService.getDeptList(rdChildDeptIds);
+        // key队伍id      value队伍所属项目部id      包含队伍的项目部
+        Map<Long, Long> teamProjectPair = new HashMap<>();
+        // 项目部id集合
+        Set<Long> projectDeptIds = new HashSet<>();
+        // key项目部id     value项目部名称
+        Map<Long, String> projectDeptPair = new HashMap<>();
+        if (CollUtil.isNotEmpty(depts)) {
+            depts.forEach(dept -> {
+                if (dept.getName().contains("项目部")) {
+                    projectDeptIds.add(dept.getId());
+                    projectDeptPair.put(dept.getId(), dept.getName());
+                } else {
+                    teamProjectPair.put(dept.getId(), dept.getParentId());
+                }
+            });
+        }
+        IotRyDailyReportPageReqVO reqVO = new IotRyDailyReportPageReqVO();
+        List<IotRyDailyReportTaskCountVO> repairTaskCounts = new ArrayList<>();
+        if ("repair".equals(type)) {
+            // 修井
+            reqVO.setProjectClassification("2");
+            // 修井日报统计 月完井数 年完井数
+            List<IotRyDailyReportTaskCountVO> repairReports = iotRyDailyReportService.countDateRepairTasksByDept();
+            Map<String, Integer> projectDeptMonthCountPair = new HashMap<>();
+            Map<String, Integer> projectDeptYearCountPair = new HashMap<>();
+            // 遍历 集合 repairReports 找到队伍对应的项目部
+            if (CollUtil.isNotEmpty(repairReports)) {
+                repairReports.forEach(report -> {
+                    if (teamProjectPair.containsKey(report.getDeptId())) {
+                        Long projectDeptId = teamProjectPair.get(report.getDeptId());
+                        if (projectDeptPair.containsKey(projectDeptId)) {
+                            // 项目部id 对应的项目部名称
+                            String projectDeptName = projectDeptPair.get(projectDeptId);
+                            // 设置月完井数
+                            if (projectDeptMonthCountPair.containsKey(projectDeptName)) {
+                                Integer tempCount = projectDeptMonthCountPair.get(projectDeptName);
+                                Integer monthCompletedTaskCount = report.getMonthCompletedTaskCount();
+                                projectDeptMonthCountPair.put(projectDeptName, tempCount+monthCompletedTaskCount);
+                            } else {
+                                Integer monthCompletedTaskCount = report.getMonthCompletedTaskCount();
+                                projectDeptMonthCountPair.put(projectDeptName, monthCompletedTaskCount);
+                            }
+                            // 设置年完井数
+                            if (projectDeptYearCountPair.containsKey(projectDeptName)) {
+                                Integer tempCount = projectDeptYearCountPair.get(projectDeptName);
+                                Integer yearCompletedTaskCount = report.getYearCompletedTaskCount();
+                                projectDeptYearCountPair.put(projectDeptName, tempCount+yearCompletedTaskCount);
+                            } else {
+                                Integer yearCompletedTaskCount = report.getYearCompletedTaskCount();
+                                projectDeptYearCountPair.put(projectDeptName, yearCompletedTaskCount);
+                            }
+                        }
+                    }
+                });
+            }
+            // 遍历所有项目部 没有产生运行数据的项目部 赋值 0
+            projectDeptPair.forEach((projectDeptId, projectDeptName) -> {
+                if (!projectDeptMonthCountPair.containsKey(projectDeptName)) {
+                    projectDeptMonthCountPair.put(projectDeptName, 0);
+                }
+                if (!projectDeptYearCountPair.containsKey(projectDeptName)) {
+                    projectDeptYearCountPair.put(projectDeptName, 0);
+                }
+            });
+
+            LinkedList<Object> xAxis = new LinkedList<>();
+            LinkedList<Object> monthData = new LinkedList<>();
+            LinkedList<Object> yearData = new LinkedList<>();
+
+            projectDeptMonthCountPair.forEach( (k,v)->{
+                xAxis.add(k);
+                monthData.add(v);
+                if (projectDeptYearCountPair.containsKey(k)) {
+                    Integer yearCount = projectDeptYearCountPair.get(k);
+                    yearData.add(yearCount);
+                }
+            });
+            ImmutableMap<String, Serializable> monthResult = ImmutableMap.of("name", "月完井数~~en**monthWell", "data", monthData);
+            ImmutableMap<String, Serializable> yearResult = ImmutableMap.of("name", "年完井数~~en**YearWell", "data", yearData);
+            return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(monthResult, yearResult)));
+        } else {
+            // 钻井
+            reqVO.setProjectClassification("1");
+            // 查询钻井的日报统计 日进尺 月累计进尺 年累计进尺
+            List<IotRyDailyReportTaskCountVO> repairReports = iotRyDailyReportService.countDateDrillTasksByDept();
+            Map<String, BigDecimal> projectDeptDailyFootagePair = new HashMap<>();
+            Map<String, BigDecimal> projectDeptMonthFootagePair = new HashMap<>();
+            Map<String, BigDecimal> projectDeptYearFootagePair = new HashMap<>();
+            if (CollUtil.isNotEmpty(repairReports)) {
+                repairReports.forEach(report -> {
+                    if (teamProjectPair.containsKey(report.getDeptId())) {
+                        Long projectDeptId = teamProjectPair.get(report.getDeptId());
+                        if (projectDeptPair.containsKey(projectDeptId)) {
+                            // 项目部id 对应的项目部名称
+                            String projectDeptName = projectDeptPair.get(projectDeptId);
+                            // 设置日进尺
+                            if (projectDeptDailyFootagePair.containsKey(projectDeptName)) {
+                                BigDecimal tempFootage = projectDeptDailyFootagePair.get(projectDeptName);
+                                BigDecimal existFootage = report.getDailyFootage();
+                                projectDeptDailyFootagePair.put(projectDeptName, tempFootage.add(existFootage));
+                            } else {
+                                BigDecimal tempFootage = report.getDailyFootage();
+                                projectDeptDailyFootagePair.put(projectDeptName, tempFootage);
+                            }
+                            // 设置月累计进尺
+                            if (projectDeptMonthFootagePair.containsKey(projectDeptName)) {
+                                BigDecimal tempFootage = projectDeptMonthFootagePair.get(projectDeptName);
+                                BigDecimal existFootage = report.getMonthlyFootage();
+                                projectDeptMonthFootagePair.put(projectDeptName, tempFootage.add(existFootage));
+                            } else {
+                                BigDecimal tempFootage = report.getMonthlyFootage();
+                                projectDeptMonthFootagePair.put(projectDeptName, tempFootage);
+                            }
+                            // 设置年累计进尺
+                            if (projectDeptYearFootagePair.containsKey(projectDeptName)) {
+                                BigDecimal tempFootage = projectDeptYearFootagePair.get(projectDeptName);
+                                BigDecimal existFootage = report.getAnnualFootage();
+                                projectDeptYearFootagePair.put(projectDeptName, tempFootage.add(existFootage));
+                            } else {
+                                BigDecimal tempFootage = report.getAnnualFootage();
+                                projectDeptYearFootagePair.put(projectDeptName, tempFootage);
+                            }
+                        }
+                    }
+                });
+            }
+            // 遍历所有项目部 没有产生运行数据的项目部 进尺 赋值 0
+            projectDeptPair.forEach((projectDeptId, projectDeptName) -> {
+                if (!projectDeptDailyFootagePair.containsKey(projectDeptName)) {
+                    projectDeptDailyFootagePair.put(projectDeptName, BigDecimal.ZERO);
+                }
+                if (!projectDeptMonthFootagePair.containsKey(projectDeptName)) {
+                    projectDeptMonthFootagePair.put(projectDeptName, BigDecimal.ZERO);
+                }
+                if (!projectDeptYearFootagePair.containsKey(projectDeptName)) {
+                    projectDeptYearFootagePair.put(projectDeptName, BigDecimal.ZERO);
+                }
+            });
+
+            LinkedList<Object> xAxis = new LinkedList<>();
+            LinkedList<Object> dailyData = new LinkedList<>();
+            LinkedList<Object> monthData = new LinkedList<>();
+            LinkedList<Object> yearData = new LinkedList<>();
+
+            projectDeptDailyFootagePair.forEach( (k,v)->{
+                xAxis.add(k);
+                dailyData.add(v);
+                if (projectDeptMonthFootagePair.containsKey(k)) {
+                    BigDecimal monthlyFootage = projectDeptMonthFootagePair.get(k);
+                    monthData.add(monthlyFootage);
+                }
+                if (projectDeptYearFootagePair.containsKey(k)) {
+                    BigDecimal annualFootage = projectDeptYearFootagePair.get(k);
+                    yearData.add(annualFootage);
+                }
+            });
+
+            ImmutableMap<String, Serializable> dailyResult = ImmutableMap.of("name", "日进尺~~en**dailyFootage", "data", dailyData);
+            ImmutableMap<String, Serializable> monthResult = ImmutableMap.of("name", "月累进尺~~en**monthlyFootage", "data", monthData);
+            ImmutableMap<String, Serializable> yearResult = ImmutableMap.of("name", "年累进尺~~en**annualFootage", "data", yearData);
+            return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(dailyResult, monthResult, yearResult)));
+        }
+
+
+    }
 }
 

+ 124 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrydailyreport/IotRyDailyReportMapper.java

@@ -68,6 +68,66 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
                 .orderByAsc(IotRyDailyReportDO::getId));
     } */
 
+    default List<IotRyDailyReportDO> dailyReports(IotRyDailyReportPageReqVO reqVO) {
+        // 获取查询参数中的 projectClassification 值
+        String projectClassification = reqVO.getProjectClassification();
+        LambdaQueryWrapperX<IotRyDailyReportDO> queryWrapper = new LambdaQueryWrapperX<IotRyDailyReportDO>();
+        // 创建查询包装器
+        queryWrapper
+                // .eqIfPresent(IotRyDailyReportDO::getDeptId, reqVO.getDeptId())
+                .inIfPresent(IotRyDailyReportDO::getDeptId, reqVO.getDeptIds())
+                .eqIfPresent(IotRyDailyReportDO::getProjectId, reqVO.getProjectId())
+                .inIfPresent(IotRyDailyReportDO::getProjectId, reqVO.getProjectIds())
+                .eqIfPresent(IotRyDailyReportDO::getTaskId, reqVO.getTaskId())
+                .inIfPresent(IotRyDailyReportDO::getTaskId, reqVO.getTaskIds())
+                .eqIfPresent(IotRyDailyReportDO::getRelocationDays, reqVO.getRelocationDays())
+                .betweenIfPresent(IotRyDailyReportDO::getLatestWellDoneTime, reqVO.getLatestWellDoneTime())
+                .eqIfPresent(IotRyDailyReportDO::getCurrentDepth, reqVO.getCurrentDepth())
+                .eqIfPresent(IotRyDailyReportDO::getDailyFootage, reqVO.getDailyFootage())
+                .eqIfPresent(IotRyDailyReportDO::getMonthlyFootage, reqVO.getMonthlyFootage())
+                .eqIfPresent(IotRyDailyReportDO::getAnnualFootage, reqVO.getAnnualFootage())
+                .eqIfPresent(IotRyDailyReportDO::getDailyPowerUsage, reqVO.getDailyPowerUsage())
+                .eqIfPresent(IotRyDailyReportDO::getMonthlyPowerUsage, reqVO.getMonthlyPowerUsage())
+                .eqIfPresent(IotRyDailyReportDO::getDailyFuel, reqVO.getDailyFuel())
+                .eqIfPresent(IotRyDailyReportDO::getMonthlyFuel, reqVO.getMonthlyFuel())
+                .betweenIfPresent(IotRyDailyReportDO::getNonProductionTime, reqVO.getNonProductionTime())
+                .eqIfPresent(IotRyDailyReportDO::getRyNptReason, reqVO.getRyNptReason())
+                .betweenIfPresent(IotRyDailyReportDO::getConstructionStartDate, reqVO.getConstructionStartDate())
+                .betweenIfPresent(IotRyDailyReportDO::getConstructionEndDate, reqVO.getConstructionEndDate())
+                .eqIfPresent(IotRyDailyReportDO::getProductionStatus, reqVO.getProductionStatus())
+                .eqIfPresent(IotRyDailyReportDO::getNextPlan, reqVO.getNextPlan())
+                .eqIfPresent(IotRyDailyReportDO::getRigStatus, reqVO.getRigStatus())
+                .eqIfPresent(IotRyDailyReportDO::getPersonnel, reqVO.getPersonnel())
+                .eqIfPresent(IotRyDailyReportDO::getMudDensity, reqVO.getMudDensity())
+                .eqIfPresent(IotRyDailyReportDO::getMudViscosity, reqVO.getMudViscosity())
+                .eqIfPresent(IotRyDailyReportDO::getLateralLength, reqVO.getLateralLength())
+                .eqIfPresent(IotRyDailyReportDO::getWellInclination, reqVO.getWellInclination())
+                .eqIfPresent(IotRyDailyReportDO::getAzimuth, reqVO.getAzimuth())
+                .eqIfPresent(IotRyDailyReportDO::getExtProperty, reqVO.getExtProperty())
+                .eqIfPresent(IotRyDailyReportDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotRyDailyReportDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotRyDailyReportDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotRyDailyReportDO::getProcessInstanceId, reqVO.getProcessInstanceId())
+                .eqIfPresent(IotRyDailyReportDO::getAuditStatus, reqVO.getAuditStatus())
+                .betweenIfPresent(IotRyDailyReportDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotRyDailyReportDO::getCreateTime)
+                .orderByAsc(IotRyDailyReportDO::getId);
+
+        // 单独处理 projectClassification 条件
+        if ("1".equals(projectClassification)) {
+            // 当值为 "1" 时,查询 project_classification 为 "1" 或空字符串的记录
+            queryWrapper.and(wrapper -> wrapper
+                    .eq(IotRyDailyReportDO::getProjectClassification, "1")
+                    .or().eq(IotRyDailyReportDO::getProjectClassification, "")
+            );
+        } else {
+            // 其他情况:有值则精确匹配,无值则不添加条件(保持原逻辑)
+            queryWrapper.eqIfPresent(IotRyDailyReportDO::getProjectClassification, projectClassification);
+        }
+
+        return selectList(queryWrapper);
+    }
+
     default PageResult<IotRyDailyReportDO> selectPage(IotRyDailyReportPageReqVO reqVO) {
         // 获取查询参数中的 projectClassification 值
         String projectClassification = reqVO.getProjectClassification();
@@ -282,15 +342,77 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
     }
 
     /**
-     * 按部门统计任务数量
+     * 按部门统计 钻井 任务数量 完工任务数量
      * @return 部门任务统计列表
      */
     @Select("SELECT " +
             "dept_id as deptId, " +
             "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL THEN task_id END) as totalTaskCount, " +
-            "COUNT(DISTINCT CASE WHEN rig_status = 12 AND task_id IS NOT NULL THEN task_id END) as completedTaskCount " +
+            "COUNT(DISTINCT CASE WHEN rig_status = 'wg' AND task_id IS NOT NULL THEN task_id END) as completedTaskCount " +
             "FROM rq_iot_ry_daily_report " +
             "WHERE deleted = 0 " +
+            "AND (project_classification = 1 OR project_classification = '') " +
             "GROUP BY dept_id")
     List<IotRyDailyReportTaskCountVO> countTasksByDept();
+
+    /**
+     * 按部门统计 修井 任务数量 完工任务数量
+     * @return 部门任务统计列表
+     */
+    @Select("SELECT " +
+            "dept_id as deptId, " +
+            "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL THEN task_id END) as totalTaskCount, " +
+            "COUNT(DISTINCT CASE WHEN repair_status = 'wg' AND task_id IS NOT NULL THEN task_id END) as completedTaskCount " +
+            "FROM rq_iot_ry_daily_report " +
+            "WHERE deleted = 0 " +
+            "AND project_classification = 2 " +
+            "GROUP BY dept_id")
+    List<IotRyDailyReportTaskCountVO> countRepairTasksByDept();
+
+    /**
+     * 按部门统计 修井 任务数量 完工任务数量 当前日期所属的月 年
+     * @return 部门任务统计列表
+     */
+    @Select("SELECT " +
+            "dept_id as deptId, " +
+            "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) AND MONTH(create_time) = MONTH(CURDATE()) THEN task_id END) as monthTotalTaskCount," +
+            "COUNT(DISTINCT CASE WHEN repair_status = 'wg' AND task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) AND MONTH(create_time) = MONTH(CURDATE()) THEN task_id END) as monthCompletedTaskCount," +
+            "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) THEN task_id END) as yearTotalTaskCount," +
+            "COUNT(DISTINCT CASE WHEN repair_status = 'wg' AND task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) THEN task_id END) as yearCompletedTaskCount " +
+            "FROM rq_iot_ry_daily_report " +
+            "WHERE deleted = 0 " +
+            "AND project_classification = 2 " +
+            "GROUP BY dept_id")
+    List<IotRyDailyReportTaskCountVO> countDateRepairTasksByDept();
+
+    /**
+     * 按部门统计 钻井 任务数量 完工任务数量 当前日期所属的月 年
+     * @return 部门任务统计列表
+     */
+    @Select("SELECT " +
+            "dept_id as deptId, " +
+            "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) AND MONTH(create_time) = MONTH(CURDATE()) THEN task_id END) as monthTotalTaskCount," +
+            "COUNT(DISTINCT CASE WHEN rig_status = 'wg' AND task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) AND MONTH(create_time) = MONTH(CURDATE()) THEN task_id END) as monthCompletedTaskCount," +
+            "COUNT(DISTINCT CASE WHEN task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) THEN task_id END) as yearTotalTaskCount," +
+            "COUNT(DISTINCT CASE WHEN rig_status = 'wg' AND task_id IS NOT NULL AND YEAR(create_time) = YEAR(CURDATE()) THEN task_id END) as yearCompletedTaskCount " +
+            "FROM rq_iot_ry_daily_report " +
+            "WHERE deleted = 0 " +
+            "AND (project_classification = 1 OR project_classification = '') " +
+            "GROUP BY dept_id")
+    List<IotRyDailyReportTaskCountVO> countDateRigTasksByDept();
+
+    /**
+     * 统计钻井 日进尺 月累计进尺 年累计进尺
+     * @return
+     */
+    @Select("SELECT " +
+            "dept_id as deptId, " +
+            "SUM(IF(DATE(construction_start_date) = CURDATE(), daily_footage, 0)) as dailyFootage," +
+            "SUM(IF(YEAR(construction_start_date) = YEAR(CURDATE()) AND MONTH(construction_start_date) = MONTH(CURDATE()), daily_footage, 0)) as monthlyFootage," +
+            "SUM(IF(YEAR(construction_start_date) = YEAR(CURDATE()), daily_footage, 0)) as annualFootage " +
+            "FROM rq_iot_ry_daily_report " +
+            "WHERE deleted = 0 " +
+            "AND (project_classification = 1 OR project_classification = '')  " +
+            "GROUP BY dept_id")
+    List<IotRyDailyReportTaskCountVO> countDateDrillTasksByDept();
 }

+ 29 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportService.java

@@ -72,9 +72,37 @@ public interface IotRyDailyReportService {
     List<IotRyDailyReportDO> latestWellDoneTimes(IotRyDailyReportPageReqVO reqVO);
 
     /**
-     * 按部门统计任务数量
+     * 按部门统计 钻井 任务数量
      *
      * @return 按部门统计任务数量
      */
     List<IotRyDailyReportTaskCountVO> countTasksByDept();
+
+    /**
+     * 按部门统计 修井 任务数量
+     *
+     * @return 按部门统计任务数量
+     */
+    List<IotRyDailyReportTaskCountVO> countRepairTasksByDept();
+
+    /**
+     * 按部门统计 修井 月累计 年累计 任务数量
+     *
+     * @return 按部门统计任务数量
+     */
+    List<IotRyDailyReportTaskCountVO> countDateRepairTasksByDept();
+
+    /**
+     * 按部门统计 修井 月累计 年累计 任务数量
+     *
+     * @return 按部门统计任务数量
+     */
+    List<IotRyDailyReportTaskCountVO> countDateRigTasksByDept();
+
+    /**
+     * 统计钻井 日进尺 月累计进尺 年累计进尺
+     *
+     * @return 按部门统计任务数量
+     */
+    List<IotRyDailyReportTaskCountVO> countDateDrillTasksByDept();
 }

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

@@ -263,4 +263,24 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
         return iotRyDailyReportMapper.countTasksByDept();
     }
 
+    @Override
+    public List<IotRyDailyReportTaskCountVO> countRepairTasksByDept() {
+        return iotRyDailyReportMapper.countRepairTasksByDept();
+    }
+
+    @Override
+    public List<IotRyDailyReportTaskCountVO> countDateRepairTasksByDept() {
+        return iotRyDailyReportMapper.countDateRepairTasksByDept();
+    }
+
+    @Override
+    public List<IotRyDailyReportTaskCountVO> countDateRigTasksByDept() {
+        return iotRyDailyReportMapper.countDateRigTasksByDept();
+    }
+
+    @Override
+    public List<IotRyDailyReportTaskCountVO> countDateDrillTasksByDept() {
+        return iotRyDailyReportMapper.countDateDrillTasksByDept();
+    }
+
 }