每日设备接入定时任务
This commit is contained in:
@@ -1,50 +1,50 @@
|
||||
//package com.njcn.access.runner;
|
||||
//
|
||||
//import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||
//import com.njcn.access.service.ICsTopicService;
|
||||
//import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
||||
//import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 类的介绍:防止设备掉线 系统未能调整,做一个定时任务,每天凌晨将所有设备重新接入
|
||||
// *
|
||||
// * @author xuyang
|
||||
// * @version 1.0.0
|
||||
// * @createTime 2023/8/28 14:21
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class AccessScheduledTask {
|
||||
//
|
||||
// @Resource
|
||||
// private CsDeviceServiceImpl csDeviceService;
|
||||
//
|
||||
// @Resource
|
||||
// private ICsTopicService csTopicService;
|
||||
//
|
||||
// @Resource
|
||||
// private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
//
|
||||
// /**
|
||||
// * {秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
|
||||
// */
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
// public void executeTask() {
|
||||
// log.info("每日凌晨定时任务执行");
|
||||
// List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||
// list.forEach(item->{
|
||||
// String version = csTopicService.getVersion(item.getNdid());
|
||||
// if (!Objects.isNull(version)){
|
||||
// csDeviceService.devAccess(item.getNdid(),version);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//}
|
||||
package com.njcn.access.runner;
|
||||
|
||||
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 类的介绍:防止设备掉线 系统未能调整,做一个定时任务,每天凌晨将所有设备重新接入
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/8/28 14:21
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AccessScheduledTask {
|
||||
|
||||
@Resource
|
||||
private CsDeviceServiceImpl csDeviceService;
|
||||
|
||||
@Resource
|
||||
private ICsTopicService csTopicService;
|
||||
|
||||
@Resource
|
||||
private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
/**
|
||||
* {秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void executeTask() {
|
||||
log.info("每日凌晨定时任务执行");
|
||||
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||
list.forEach(item->{
|
||||
String version = csTopicService.getVersion(item.getNdid());
|
||||
if (!Objects.isNull(version)){
|
||||
csDeviceService.devAccess(item.getNdid(),version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user