|
@@ -22,6 +22,8 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplandev.IotOperationPla
|
|
|
import cn.iocoder.yudao.module.pms.message.PmsMessage;
|
|
import cn.iocoder.yudao.module.pms.message.PmsMessage;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotopeationfill.IotOpeationFillService;
|
|
import cn.iocoder.yudao.module.pms.service.iotopeationfill.IotOpeationFillService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotrhdailyreport.IotRhDailyReportService;
|
|
import cn.iocoder.yudao.module.pms.service.iotrhdailyreport.IotRhDailyReportService;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -143,10 +145,6 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
orderList.add(fillDO);
|
|
orderList.add(fillDO);
|
|
|
}
|
|
}
|
|
|
deal(planDO, date,devIdList,orderList);
|
|
deal(planDO, date,devIdList,orderList);
|
|
|
- }else{
|
|
|
|
|
- //判断计划内是否所有队伍都是非施工状态且为瑞恒
|
|
|
|
|
- //满足条件直接插入日报
|
|
|
|
|
- unNormalTeamInPlan(planDO);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -174,6 +172,10 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
|
|
|
|
|
|
|
|
|
|
private void extracted(List<Long> devIdList, List<IotOpeationFillOrderDO> orderList,IotOperationPlanDO plan) {
|
|
private void extracted(List<Long> devIdList, List<IotOpeationFillOrderDO> orderList,IotOperationPlanDO plan) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//瑞鹰日报计划为12小时执行一次
|
|
//瑞鹰日报计划为12小时执行一次
|
|
|
//判断计划周期是否为小时,如果是,则保存上次执行时间为当前时间最近的整点
|
|
//判断计划周期是否为小时,如果是,则保存上次执行时间为当前时间最近的整点
|
|
|
if ("hour".equals(plan.getPlanUnit())) {
|
|
if ("hour".equals(plan.getPlanUnit())) {
|
|
@@ -197,7 +199,10 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
}
|
|
}
|
|
|
planMapper.updateById(plan);
|
|
planMapper.updateById(plan);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //判断是否为瑞恒特殊计划
|
|
|
|
|
+ if(plan.getId()==153L){
|
|
|
|
|
+ unNormalTeamInPlan(plan);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//4、根据设备ID生成子表数据
|
|
//4、根据设备ID生成子表数据
|
|
|
List<IotOpeationFillDO> deviceList = iotOpeationFillMapper.getFillDevices(devIdList);
|
|
List<IotOpeationFillDO> deviceList = iotOpeationFillMapper.getFillDevices(devIdList);
|
|
@@ -314,55 +319,55 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private static final AtomicBoolean hasExecuted = new AtomicBoolean(false);
|
|
|
|
|
|
|
+
|
|
|
private void unNormalTeamInPlan(IotOperationPlanDO planDO) {
|
|
private void unNormalTeamInPlan(IotOperationPlanDO planDO) {
|
|
|
|
|
|
|
|
- if (!hasExecuted.compareAndSet(false, true)) {
|
|
|
|
|
- return; // 已经执行过
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- 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);
|
|
|
|
|
- IotDeviceRunLogDO cx = new IotDeviceRunLogDO();
|
|
|
|
|
- cx.setDeptId(vir);
|
|
|
|
|
- IotDeviceRunLogDO result = iotOpeationFillMapper.getUserId(cx);
|
|
|
|
|
- //不为空则为日报赋值
|
|
|
|
|
- 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());
|
|
|
|
|
- if(result!=null){
|
|
|
|
|
- saveReqVO.setCreator(String.valueOf(result.getDeviceId()));
|
|
|
|
|
- }
|
|
|
|
|
- iotRhDailyReportService.createIotRhDailyReport(saveReqVO);
|
|
|
|
|
|
|
+ Set<Long> allRhChildDeptIds = deptService.getChildDeptIdListFromCache(planDO.getDeptId());
|
|
|
|
|
+ DeptListReqVO reqVO = new DeptListReqVO();
|
|
|
|
|
+ reqVO.setDeptIds(allRhChildDeptIds);
|
|
|
|
|
+
|
|
|
|
|
+ List<DeptDO> depts = deptService.getDeptList(reqVO);
|
|
|
|
|
+
|
|
|
|
|
+ //筛选出所有小队
|
|
|
|
|
+ List<DeptDO> teams = depts.stream().filter(e->e.getType().equals("3")).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ //查询增压机状态为非施工的小队
|
|
|
|
|
+ List<IotDeviceDO> teamStatusL = iotOpeationFillMapper.selectDevStatusBatch(teams);
|
|
|
|
|
+
|
|
|
|
|
+ if(teamStatusL.size()>0){
|
|
|
|
|
+ for (IotDeviceDO vir:teamStatusL) {
|
|
|
|
|
+ IotRhDailyReportSaveReqVO saveReqVO = new IotRhDailyReportSaveReqVO();
|
|
|
|
|
+ //查询队伍增压机状态
|
|
|
|
|
+
|
|
|
|
|
+ IotDeviceRunLogDO cx = new IotDeviceRunLogDO();
|
|
|
|
|
+ cx.setDeptId(vir.getDeptId());
|
|
|
|
|
+ IotDeviceRunLogDO result = iotOpeationFillMapper.getUserId(cx);
|
|
|
|
|
+ //不为空则为日报赋值
|
|
|
|
|
+ if(vir.getDeviceStatus()!=null){
|
|
|
|
|
+ saveReqVO.setConstructionStatus(vir.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.getDeptId());
|
|
|
|
|
+ saveReqVO.setFillOrderCreateTime(LocalDateTime.now());
|
|
|
|
|
+ if(result!=null){
|
|
|
|
|
+ saveReqVO.setCreator(String.valueOf(result.getDeviceId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ iotRhDailyReportService.createIotRhDailyReport(saveReqVO);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|