Browse Source

运行记录优化0929-判断计划内是否所有队伍都是非施工状态且为瑞恒,满足条件直接插入日报

yuanchao 1 week ago
parent
commit
0ac1723022

+ 43 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/IotOperationPlanJob.java

@@ -131,6 +131,10 @@ public class IotOperationPlanJob implements JobHandler {
                 orderList.add(fillDO);
             }
             deal(planDO, date,devIdList,orderList);
+        }else{
+            //判断计划内是否所有队伍都是非施工状态且为瑞恒
+            //满足条件直接插入日报
+            unNormalTeamInPlan(planDO);
         }
     }
 
@@ -233,6 +237,45 @@ public class IotOperationPlanJob implements JobHandler {
         });
     }
 
+    private void unNormalTeamInPlan(IotOperationPlanDO planDO) {
+        Set<Long> rhIdList = new HashSet<>();
+        rhIdList =  deptService.getChildDeptIdListFromCache(157L);
+        rhIdList.add(157L);
+        boolean a = rhIdList.contains(planDO.getDeptId());
+        if(a){
+            Set<Long> deptIdList = new HashSet<>();
+            deptIdList =  deptService.getChildDeptIdListFromCache(planDO.getDeptId());
+            if(deptIdList.size()>0){
+                for (Long vir:deptIdList) {
+                    IotRhDailyReportSaveReqVO saveReqVO = new IotRhDailyReportSaveReqVO();
+                    //查询队伍增压机状态
+                    IotDeviceDO virDev = new IotDeviceDO();
+                    virDev.setDeptId(vir);
+                    IotDeviceDO devStatus = iotOpeationFillMapper.devStatus(virDev);
+                    //不为空则为日报赋值
+                    if(devStatus!=null){
+                        saveReqVO.setConstructionStatus(devStatus.getDeviceStatus());
+                    }
+                    //当日注气量
+                    saveReqVO.setDailyGasInjection(BigDecimal.valueOf(0.00));
+                    //当日注水量
+                    saveReqVO.setDailyWaterInjection(BigDecimal.valueOf(0.00));
+                    //当日注气时间
+                    saveReqVO.setDailyInjectGasTime(BigDecimal.valueOf(0.00));
+                    //当日注水时间
+                    saveReqVO.setDailyInjectWaterTime(BigDecimal.valueOf(0.00));
+                    //当日用电量
+                    saveReqVO.setDailyPowerUsage(BigDecimal.valueOf(0.00));
+                    //非生产时间
+                    saveReqVO.setNonProductionTime(BigDecimal.valueOf(0.00));
+                    saveReqVO.setDeptId(vir);
+                    saveReqVO.setFillOrderCreateTime(LocalDateTime.now());
+                    iotRhDailyReportService.createIotRhDailyReport(saveReqVO);
+                }
+            }
+        }
+    }
+
     private void rhReportInsert(IotOperationPlanDO plan, List<IotOpeationFillOrderDO> orderList1, boolean rhContain) {
         if(rhContain){