Bläddra i källkod

Merge remote-tracking branch 'origin/master'

lipenghui 4 dagar sedan
förälder
incheckning
6f5fe63016

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

@@ -112,6 +112,8 @@ public class IotRdDailyReportSaveReqVO {
     @Schema(description = "其它非生产时间原因")
     @Schema(description = "其它非生产时间原因")
     private String otherNptReason;
     private String otherNptReason;
 
 
+    @Schema(description = "非生产时间时效")
+    private BigDecimal nptRate;
 
 
     @Schema(description = "施工开始日期")
     @Schema(description = "施工开始日期")
     private LocalDateTime constructionStartDate;
     private LocalDateTime constructionStartDate;

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

@@ -738,19 +738,39 @@ public class IotRhDailyReportController {
             // 2.1 拼接部门信息
             // 2.1 拼接部门信息
             findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
             findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
             // 队伍当年累计注气量
             // 队伍当年累计注气量
-            findAndThen(yearGasInjectionPair, reportVO.getDeptId(), gasInjection -> reportVO.setYearTotalGasInjection(gasInjection));
+            findAndThen(yearGasInjectionPair, reportVO.getDeptId(), gasInjection -> {
+                // 转换单位为 万方
+                BigDecimal gasInjectionWanFang = gasInjection
+                        .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
+                reportVO.setYearTotalGasInjection(gasInjectionWanFang);
+            });
             // 队伍当年累计注水量
             // 队伍当年累计注水量
             findAndThen(yearWaterInjectionPair, reportVO.getDeptId(), waterInjection -> reportVO.setYearTotalWaterInjection(waterInjection));
             findAndThen(yearWaterInjectionPair, reportVO.getDeptId(), waterInjection -> reportVO.setYearTotalWaterInjection(waterInjection));
             // 队伍当年累计用电量
             // 队伍当年累计用电量
-            findAndThen(yearPowerPair, reportVO.getDeptId(), power -> reportVO.setYearTotalPower(power));
+            findAndThen(yearPowerPair, reportVO.getDeptId(), power -> {
+                // 换算单位为 MWh
+                BigDecimal powerW = power
+                        .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
+                reportVO.setYearTotalPower(powerW);
+            });
             // 队伍当年累计油耗
             // 队伍当年累计油耗
             findAndThen(yearFuelPair, reportVO.getDeptId(), fuel -> reportVO.setYearTotalFuel(fuel));
             findAndThen(yearFuelPair, reportVO.getDeptId(), fuel -> reportVO.setYearTotalFuel(fuel));
             // 井当年累计注气量
             // 井当年累计注气量
-            findAndThen(wellGasInjectionPair, reportVO.getTaskId(), gasInjection -> reportVO.setWellTotalGasInjection(gasInjection));
+            findAndThen(wellGasInjectionPair, reportVO.getTaskId(), gasInjection -> {
+                // 转换单位为 万方
+                BigDecimal gasInjectionWanFang = gasInjection
+                        .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
+                reportVO.setWellTotalGasInjection(gasInjectionWanFang);
+            });
             // 井当年累计注水量
             // 井当年累计注水量
             findAndThen(wellWaterInjectionPair, reportVO.getTaskId(), waterInjection -> reportVO.setWellTotalWaterInjection(waterInjection));
             findAndThen(wellWaterInjectionPair, reportVO.getTaskId(), waterInjection -> reportVO.setWellTotalWaterInjection(waterInjection));
             // 井当年累计用电量
             // 井当年累计用电量
-            findAndThen(wellPowerPair, reportVO.getTaskId(), power -> reportVO.setWellTotalPower(power));
+            findAndThen(wellPowerPair, reportVO.getTaskId(), power -> {
+                // 换算单位为 MWh
+                BigDecimal powerW = power
+                        .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
+                reportVO.setWellTotalPower(powerW);
+            });
             // 井当年累计油耗
             // 井当年累计油耗
             findAndThen(wellFuelPair, reportVO.getTaskId(), fuel -> reportVO.setWellTotalFuel(fuel));
             findAndThen(wellFuelPair, reportVO.getTaskId(), fuel -> reportVO.setWellTotalFuel(fuel));
             // 2.2 日报关联的项目信息
             // 2.2 日报关联的项目信息
@@ -760,7 +780,13 @@ public class IotRhDailyReportController {
             // 2.4 设计注气量
             // 2.4 设计注气量
             findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
             findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
             // 2.5 搬迁安装天数
             // 2.5 搬迁安装天数
-            findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
+            findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> {
+                if (relocationDays.compareTo(BigDecimal.ZERO) < 0) {
+                    reportVO.setRelocationDays(BigDecimal.ZERO);
+                } else {
+                    reportVO.setRelocationDays(relocationDays);
+                }
+            });
             // 2.6 产能
             // 2.6 产能
             findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
             findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
             // 施工状态 数据字典
             // 施工状态 数据字典

+ 19 - 8
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/vo/IotRhDailyReportRespVO.java

@@ -195,22 +195,33 @@ public class IotRhDailyReportRespVO {
     @Schema(description = "日报关联的油耗记录")
     @Schema(description = "日报关联的油耗记录")
     private List<IotDailyReportFuelDO> reportFuels;
     private List<IotDailyReportFuelDO> reportFuels;
 
 
-    @Schema(description = "队伍当年累计注气量")
+    @Schema(description = "年累计注气量(万方)")
+    @ExcelProperty("年累计注气量(万方)")
     private BigDecimal yearTotalGasInjection;
     private BigDecimal yearTotalGasInjection;
-    @Schema(description = "队伍当年累计注水量")
+
+    @Schema(description = "年累计注水量(方)")
+    @ExcelProperty("年累计注水量(方)")
     private BigDecimal yearTotalWaterInjection;
     private BigDecimal yearTotalWaterInjection;
-    @Schema(description = "队伍当年累计用电量")
+
+    @Schema(description = "年累计用电量(MWh)")
+    @ExcelProperty("年累计用电量(MWh)")
     private BigDecimal yearTotalPower;
     private BigDecimal yearTotalPower;
-    @Schema(description = "队伍当年累计油耗")
+
+    @Schema(description = "年累计油耗(L)")
+    @ExcelProperty("年累计油耗(L)")
     private BigDecimal yearTotalFuel;
     private BigDecimal yearTotalFuel;
 
 
-    @Schema(description = "井累计注气量")
+    @Schema(description = "井累计注气量(万方)")
+    @ExcelProperty("井累计注气量(万方)")
     private BigDecimal wellTotalGasInjection;
     private BigDecimal wellTotalGasInjection;
-    @Schema(description = "井累计注水量")
+    @Schema(description = "井累计注水量(方)")
+    @ExcelProperty("井累计注水量(方)")
     private BigDecimal wellTotalWaterInjection;
     private BigDecimal wellTotalWaterInjection;
-    @Schema(description = "井累计用电量")
+    @Schema(description = "井累计用电量(MWh)")
+    @ExcelProperty("井累计用电量(MWh)")
     private BigDecimal wellTotalPower;
     private BigDecimal wellTotalPower;
-    @Schema(description = "井累计油耗")
+    @Schema(description = "井累计油耗(L)")
+    @ExcelProperty("井累计油耗(L)")
     private BigDecimal wellTotalFuel;
     private BigDecimal wellTotalFuel;
 
 
 
 

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotrddailyreport/IotRdDailyReportDO.java

@@ -183,6 +183,10 @@ public class IotRdDailyReportDO extends BaseDO {
      * 其它非生产时间
      * 其它非生产时间
      */
      */
     private BigDecimal otherNptTime;
     private BigDecimal otherNptTime;
+    /**
+     * 非生产时效
+     */
+    private BigDecimal nptRate;
     /**
     /**
      * 其它非生产时间原因
      * 其它非生产时间原因
      */
      */

+ 3 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotprojecttask/IotProjectTaskMapper.java

@@ -80,7 +80,9 @@ public interface IotProjectTaskMapper extends BaseMapperX<IotProjectTaskDO> {
 
 
         // 处理deptId特殊查询
         // 处理deptId特殊查询
         if (ObjUtil.isNotEmpty(reqVO.getDeptId())) {
         if (ObjUtil.isNotEmpty(reqVO.getDeptId())) {
-            wrapper.apply("FIND_IN_SET({0}, REPLACE(REPLACE(dept_ids,'[',''),']',''))", reqVO.getDeptId());
+            // wrapper.apply("FIND_IN_SET({0}, REPLACE(REPLACE(dept_ids,'[',''),']',''))", reqVO.getDeptId());
+            // wrapper.apply("JSON_CONTAINS(dept_ids, {0})", reqVO.getDeptId());
+            wrapper.apply("JSON_CONTAINS(CAST(dept_ids AS JSON), CAST({0} AS JSON))", reqVO.getDeptId());
         }
         }
 
 
         // 新增searchKey多字段模糊查询
         // 新增searchKey多字段模糊查询

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

@@ -171,6 +171,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         Set<Long> deviceIds = new HashSet<>();
         Set<Long> deviceIds = new HashSet<>();
         IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
         IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
         reqVO.setDeptId(createReqVO.getDeptId());
         reqVO.setDeptId(createReqVO.getDeptId());
+        // 只筛选未施工完成的任务
+        reqVO.setJobFlag("Y");
         // 查询包含当前日报施工队伍的任务
         // 查询包含当前日报施工队伍的任务
         List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
         List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
         // 日报对应的任务中的设备列表
         // 日报对应的任务中的设备列表
@@ -182,6 +184,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         // 井号
         // 井号
         String wellName;
         String wellName;
         if (CollUtil.isNotEmpty(tasks)) {
         if (CollUtil.isNotEmpty(tasks)) {
+            // 只查询 未施工完成 的任务 随机获取1个 最好是保持 1个施工队伍只存在于1个任务中
             IotProjectTaskDO task = tasks.get(0);
             IotProjectTaskDO task = tasks.get(0);
             // 暂时只考虑1个施工队伍只属于1个任务
             // 暂时只考虑1个施工队伍只属于1个任务
             iotRhDailyReport.setProjectId(task.getProjectId());
             iotRhDailyReport.setProjectId(task.getProjectId());

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

@@ -134,6 +134,8 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
         Set<Long> deviceIds = new HashSet<>();
         Set<Long> deviceIds = new HashSet<>();
         IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
         IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
         reqVO.setDeptId(createReqVO.getDeptId());
         reqVO.setDeptId(createReqVO.getDeptId());
+        // 只筛选未施工完成的任务
+        reqVO.setJobFlag("Y");
         // 查询包含当前日报施工队伍的任务
         // 查询包含当前日报施工队伍的任务
         List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
         List<IotProjectTaskDO> tasks = iotProjectTaskMapper.selectList(reqVO);
         // 井号
         // 井号
@@ -147,8 +149,15 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
             taskId = task.getId();
             taskId = task.getId();
             // 根据日报状态 查询 日报所属任务的状态 瑞鹰任务状态数据字典 rigStatus
             // 根据日报状态 查询 日报所属任务的状态 瑞鹰任务状态数据字典 rigStatus
             if (ObjUtil.isNotEmpty(createReqVO.getRigStatus())) {
             if (ObjUtil.isNotEmpty(createReqVO.getRigStatus())) {
-                // ry任务施工状态 需要与 任务施工状态 匹配
+                // ry任务施工状态 需要与 任务施工状态 匹配 钻井施工状态
                 task.setStatus(createReqVO.getRigStatus());
                 task.setStatus(createReqVO.getRigStatus());
+                task.setRigStatus(createReqVO.getRigStatus());
+                // 更新任务状态
+                iotProjectTaskMapper.updateById(task);
+            }
+            if (ObjUtil.isNotEmpty(createReqVO.getRepairStatus())) {
+                task.setStatus(createReqVO.getRepairStatus());
+                task.setRepairStatus(createReqVO.getRepairStatus());
                 // 更新任务状态
                 // 更新任务状态
                 iotProjectTaskMapper.updateById(task);
                 iotProjectTaskMapper.updateById(task);
             }
             }