package com.doumee.job;
|
|
import com.doumee.service.business.YwElectricalBizService;
|
import com.doumee.service.business.YwElectricalService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
@Slf4j
|
@Component
|
public class ElectricalScheduleJob {
|
|
@Autowired
|
private YwElectricalService ywElectricalService;
|
@Autowired
|
private YwElectricalBizService ywElectricalBizService;
|
|
/** 每5分钟同步采集器在线状态 */
|
@Scheduled(cron = "0 */5 * * * ?")
|
public void syncElectricalStatus() {
|
try {
|
ywElectricalService.getElectricalStatus();
|
} catch (Exception e) {
|
log.error("syncElectricalStatus failed", e);
|
}
|
}
|
|
/** 每小时0分30秒批量抄表 */
|
@Scheduled(cron = "30 0 * * * ?")
|
public void syncMeterData() {
|
try {
|
ywElectricalBizService.syncMeterDataScheduled();
|
} catch (Exception e) {
|
log.error("syncMeterData failed", e);
|
}
|
}
|
|
/** 每日清理3个月前的接口日志 */
|
@Scheduled(cron = "0 30 2 * * ?")
|
public void cleanElectricalLog() {
|
try {
|
ywElectricalBizService.cleanLogBeforeThreeMonths();
|
} catch (Exception e) {
|
log.error("cleanElectricalLog failed", e);
|
}
|
}
|
}
|