package org.sxkj.gd.workorder.scheduler;
|
|
import lombok.AllArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
import org.sxkj.gd.workorder.service.IGdManageDeviceService;
|
|
/**
|
* 星图设备同步定时器
|
*/
|
@Component
|
@Slf4j
|
@AllArgsConstructor
|
public class GdXingtuDeviceScheduler {
|
|
private final IGdManageDeviceService gdManageDeviceService;
|
|
@Scheduled(cron = "0 0 0 * * ?") // 每天凌晨0点执行
|
// @Scheduled(cron = "*/10 * * * * ?")
|
public void syncXingtuDevice() {
|
try {
|
int total = gdManageDeviceService.syncXingtuDevice();
|
log.info("星图设备同步完成,共更新或新增 {} 条设备", total);
|
} catch (Exception e) {
|
log.error("星图设备同步任务执行失败", e);
|
}
|
}
|
}
|