瀏覽代碼

pms 瑞恒日报 任务计划进度 实际进度

zhangcl 3 周之前
父節點
當前提交
e6afd65851

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

@@ -103,6 +103,15 @@ public class IotRhDailyReportController {
         // return success(new PageResult<>(rhDailyReports, pageResult.getTotal()));
     }
 
+    @GetMapping("/taskActualProgress")
+    @Operation(summary = "查询日报所属任务的实际进度")
+    @PreAuthorize("@ss.hasPermission('pms:iot-rh-daily-report:query')")
+    public CommonResult<List<IotRhDailyReportRespVO>> taskActualProgress(@Valid IotRhDailyReportPageReqVO pageReqVO) {
+        List<IotRhDailyReportDO> taskProgresses = iotRhDailyReportService.taskActualProgress(pageReqVO);
+
+        return success(BeanUtils.toBean(taskProgresses, IotRhDailyReportRespVO.class));
+    }
+
     /**
      * 瑞恒日报分布 设置关联查询信息
      * @param reports

+ 37 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrhdailyreport/IotRhDailyReportMapper.java

@@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.List;
 
 /**
  * 瑞恒日报 Mapper
@@ -51,6 +53,41 @@ public interface IotRhDailyReportMapper extends BaseMapperX<IotRhDailyReportDO>
                 .orderByDesc(IotRhDailyReportDO::getId));
     }
 
+    /* default List<IotRhDailyReportDO> selectList(IotRhDailyReportPageReqVO reqVO) {
+        return selectList(new LambdaQueryWrapperX<IotRhDailyReportDO>()
+                .eqIfPresent(IotRhDailyReportDO::getDeptId, reqVO.getDeptId())
+                .eqIfPresent(IotRhDailyReportDO::getProjectId, reqVO.getProjectId())
+                .eqIfPresent(IotRhDailyReportDO::getTaskId, reqVO.getTaskId())
+                .eqIfPresent(IotRhDailyReportDO::getProjectClassification, reqVO.getProjectClassification())
+                .eqIfPresent(IotRhDailyReportDO::getRelocationDays, reqVO.getRelocationDays())
+                .betweenIfPresent(IotRhDailyReportDO::getTransitTime, reqVO.getTransitTime())
+                .eqIfPresent(IotRhDailyReportDO::getDailyGasInjection, reqVO.getDailyGasInjection())
+                .eqIfPresent(IotRhDailyReportDO::getDailyWaterInjection, reqVO.getDailyWaterInjection())
+                .betweenIfPresent(IotRhDailyReportDO::getDailyInjectGasTime, reqVO.getDailyInjectGasTime())
+                .betweenIfPresent(IotRhDailyReportDO::getDailyInjectWaterTime, reqVO.getDailyInjectWaterTime())
+                .betweenIfPresent(IotRhDailyReportDO::getNonProductionTime, reqVO.getNonProductionTime())
+                .eqIfPresent(IotRhDailyReportDO::getNptReason, reqVO.getNptReason())
+                .betweenIfPresent(IotRhDailyReportDO::getConstructionStartDate, reqVO.getConstructionStartDate())
+                .betweenIfPresent(IotRhDailyReportDO::getConstructionEndDate, reqVO.getConstructionEndDate())
+                .eqIfPresent(IotRhDailyReportDO::getProductionStatus, reqVO.getProductionStatus())
+                .eqIfPresent(IotRhDailyReportDO::getNextPlan, reqVO.getNextPlan())
+                .eqIfPresent(IotRhDailyReportDO::getConstructionStatus, reqVO.getConstructionStatus())
+                .eqIfPresent(IotRhDailyReportDO::getPersonnel, reqVO.getPersonnel())
+                .eqIfPresent(IotRhDailyReportDO::getTotalGasInjection, reqVO.getTotalGasInjection())
+                .eqIfPresent(IotRhDailyReportDO::getTotalWaterInjection, reqVO.getTotalWaterInjection())
+                .eqIfPresent(IotRhDailyReportDO::getCumulativeCompletion, reqVO.getCumulativeCompletion())
+                .eqIfPresent(IotRhDailyReportDO::getExtProperty, reqVO.getExtProperty())
+                .eqIfPresent(IotRhDailyReportDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotRhDailyReportDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotRhDailyReportDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotRhDailyReportDO::getProcessInstanceId, reqVO.getProcessInstanceId())
+                .eqIfPresent(IotRhDailyReportDO::getAuditStatus, reqVO.getAuditStatus())
+                .betweenIfPresent(IotRhDailyReportDO::getCreateTime, reqVO.getCreateTime()));
+    } */
+
+    // 修改selectList方法,使用XML实现
+    List<IotRhDailyReportDO> selectListGrouped(@Param("reqVO") IotRhDailyReportPageReqVO reqVO);
+
     /**
      * 根据条件查询单个OTA升级记录
      *

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportService.java

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDai
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * 瑞恒日报 Service 接口
@@ -52,4 +53,11 @@ public interface IotRhDailyReportService {
      */
     PageResult<IotRhDailyReportDO> getIotRhDailyReportPage(IotRhDailyReportPageReqVO pageReqVO);
 
+    /**
+     * 查询任务的实际进度
+     *
+     * @param reqVO taskId
+     * @return 从日报中提取任务的实际进度
+     */
+    List<IotRhDailyReportDO> taskActualProgress(IotRhDailyReportPageReqVO reqVO);
 }

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

@@ -38,6 +38,7 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_PROJECT_TASK_NOT_EXISTS;
 import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_RH_DAILY_REPORT_NOT_EXISTS;
 
 /**
@@ -231,4 +232,19 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         return iotRhDailyReportMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public List<IotRhDailyReportDO> taskActualProgress(IotRhDailyReportPageReqVO reqVO) {
+        if (ObjUtil.isEmpty(reqVO.getTaskId())) {
+            throw exception(IOT_PROJECT_TASK_NOT_EXISTS);
+        }
+        // 根据 taskId 任务提取日报中的施工状态进度节点信息
+        IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
+        reportReqVO.setTaskId(reqVO.getTaskId());
+        List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO);
+        if (CollUtil.isNotEmpty(dailyReports)) {
+
+        }
+        return dailyReports;
+    }
+
 }

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

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper">
+
+
+    <!-- 基础结果映射 -->
+    <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO">
+        <!-- 根据实际字段配置 -->
+        <id column="id" property="id" />
+        <result column="dept_id" property="deptId" />
+        <result column="project_id" property="projectId" />
+        <result column="task_id" property="taskId" />
+        <result column="construction_status" property="constructionStatus" />
+        <result column="construction_start_date" property="constructionStartDate" />
+        <result column="construction_end_date" property="constructionEndDate" />
+        <!-- 其他字段映射 -->
+    </resultMap>
+
+    <!-- 使用窗口函数实现分组查询 -->
+    <select id="selectListGrouped" resultMap="BaseResultMap"
+            parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO">
+        WITH rq_iot_rh_daily_report AS (
+            SELECT
+            *,
+            ROW_NUMBER() OVER (
+                PARTITION BY construction_status
+                ORDER BY construction_start_date
+            ) as row_num,
+            MIN(construction_start_date) OVER (
+                PARTITION BY construction_status
+            ) as min_start_date
+            FROM rq_iot_rh_daily_report
+            <where>
+                <if test="reqVO.deptId != null">
+                    AND dept_id = #{reqVO.deptId}
+                </if>
+                <if test="reqVO.projectId != null">
+                    AND project_id = #{reqVO.projectId}
+                </if>
+                <if test="reqVO.taskId != null">
+                    AND task_id = #{reqVO.taskId}
+                </if>
+            </where>
+        )
+        SELECT *
+        FROM rq_iot_rh_daily_report
+        WHERE row_num = 1
+        ORDER BY min_start_date ASC
+    </select>
+
+</mapper>