|
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
|
import cn.iocoder.yudao.module.pms.constant.PmsConstants;
|
|
import cn.iocoder.yudao.module.pms.constant.PmsConstants;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectPlanDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectPlanDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;
|
|
@@ -16,6 +17,7 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillOrde
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplan.IotOperationPlanMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplan.IotOperationPlanMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplandev.IotOperationPlanDevMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplandev.IotOperationPlanDevMapper;
|
|
import cn.iocoder.yudao.module.pms.message.PmsMessage;
|
|
import cn.iocoder.yudao.module.pms.message.PmsMessage;
|
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -55,6 +57,8 @@ public class IotOperationPlanJob implements JobHandler {
|
|
private IotOperationPlanMapper planMapper;
|
|
private IotOperationPlanMapper planMapper;
|
|
@Resource
|
|
@Resource
|
|
private IotOperationPlanDevMapper planDevMapper;
|
|
private IotOperationPlanDevMapper planDevMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private DeptService deptService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 1、查询开启状态运行计划
|
|
* 1、查询开启状态运行计划
|
|
@@ -88,11 +92,16 @@ public class IotOperationPlanJob implements JobHandler {
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
- List<Long> planIds= new ArrayList<>();
|
|
|
|
- planIds.add(planDO.getId());
|
|
|
|
|
|
+ Set<Long> idList = new HashSet<>();
|
|
|
|
+ if(Objects.nonNull(planDO.getDeptId())){
|
|
|
|
+ idList = deptService.getChildDeptIdListFromCache(planDO.getDeptId());
|
|
|
|
+ idList.add(planDO.getDeptId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
//2、根据计划获取设备ID
|
|
//2、根据计划获取设备ID
|
|
- List<IotOperationPlanDevDO> devList = planDevMapper.devIdList(planIds);
|
|
|
|
- List<Long> devIdList= devList.stream().map(IotOperationPlanDevDO::getId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<IotDeviceRespVO> devList = iotOpeationFillMapper.getFillDevices2(idList);
|
|
|
|
+ List<Long> devIdList= devList.stream().map(IotDeviceRespVO::getId).collect(Collectors.toList());
|
|
//3、根据设备ID生成主表数据
|
|
//3、根据设备ID生成主表数据
|
|
List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
|
|
List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
|
|
List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
|
|
List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
|
|
@@ -122,11 +131,18 @@ public class IotOperationPlanJob implements JobHandler {
|
|
.toInstant() // 转为 Instant(时间戳)
|
|
.toInstant() // 转为 Instant(时间戳)
|
|
);
|
|
);
|
|
|
|
|
|
- List<Long> planIds= new ArrayList<>();
|
|
|
|
- planIds.add(planDO.getId());
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Set<Long> idList = new HashSet<>();
|
|
|
|
+ if(Objects.nonNull(planDO.getDeptId())){
|
|
|
|
+ idList = deptService.getChildDeptIdListFromCache(planDO.getDeptId());
|
|
|
|
+ idList.add(planDO.getDeptId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
//2、根据计划获取设备ID
|
|
//2、根据计划获取设备ID
|
|
- List<IotOperationPlanDevDO> devList = planDevMapper.devIdList(planIds);
|
|
|
|
- List<Long> devIdList= devList.stream().map(IotOperationPlanDevDO::getId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<IotDeviceRespVO> devList = iotOpeationFillMapper.getFillDevices2(idList);
|
|
|
|
+ List<Long> devIdList= devList.stream().map(IotDeviceRespVO::getId).collect(Collectors.toList());
|
|
//3、根据设备ID生成主表数据
|
|
//3、根据设备ID生成主表数据
|
|
List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
|
|
List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
|
|
List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
|
|
List<IotOpeationFillDO> pdList = iotOpeationFillMapper.pdList(devIdList);
|
|
@@ -205,7 +221,7 @@ public class IotOperationPlanJob implements JobHandler {
|
|
iotOpeationFillOrderMapper.insertBatch(orderList1);
|
|
iotOpeationFillOrderMapper.insertBatch(orderList1);
|
|
|
|
|
|
|
|
|
|
- /*//发送钉钉通知
|
|
|
|
|
|
+ //发送钉钉通知
|
|
pmsThreadPoolTaskExecutor.execute(()->{
|
|
pmsThreadPoolTaskExecutor.execute(()->{
|
|
try{
|
|
try{
|
|
for (IotOpeationFillOrderDO order:orderList1) {
|
|
for (IotOpeationFillOrderDO order:orderList1) {
|
|
@@ -214,7 +230,7 @@ public class IotOperationPlanJob implements JobHandler {
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- });*/
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
for (IotOpeationFillDO device:deviceList) {
|
|
for (IotOpeationFillDO device:deviceList) {
|