|
|
|
@ -5,6 +5,7 @@ import com.shxy.xymanager_common.util.DateUtil;
|
|
|
|
|
import com.shxy.xymanager_service.service.MntnDayStatService;
|
|
|
|
|
import com.shxy.xymanager_service.service.NewCacheService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -22,24 +23,29 @@ public class MntnDayStatTask {
|
|
|
|
|
@Resource
|
|
|
|
|
NewCacheService newCacheService;
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 10 * * ?")
|
|
|
|
|
private void storeAll() {
|
|
|
|
|
try {
|
|
|
|
|
long total = dayStatService.countTotal();
|
|
|
|
|
int days = 3;
|
|
|
|
|
if (total <= 0) {
|
|
|
|
|
days = 365;
|
|
|
|
|
}
|
|
|
|
|
Date today = DateUtil.getTodayZero();
|
|
|
|
|
@Value("${maintain.check}")
|
|
|
|
|
private boolean needCheck;
|
|
|
|
|
|
|
|
|
|
Map<Integer, Terminals> terminalMap = newCacheService.getTerminalMap();
|
|
|
|
|
Iterator<Integer> it = terminalMap.keySet().iterator();
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
Integer termId = it.next();
|
|
|
|
|
this.storeOne(termId, today, days);
|
|
|
|
|
@Scheduled(cron = "0 0 12 * * ?")
|
|
|
|
|
private void storeAll() {
|
|
|
|
|
if (needCheck) {
|
|
|
|
|
try {
|
|
|
|
|
long total = dayStatService.countTotal();
|
|
|
|
|
int days = 3;
|
|
|
|
|
if (total <= 0) {
|
|
|
|
|
days = 365;
|
|
|
|
|
}
|
|
|
|
|
Date today = DateUtil.getTodayZero();
|
|
|
|
|
|
|
|
|
|
Map<Integer, Terminals> terminalMap = newCacheService.getTerminalMap();
|
|
|
|
|
Iterator<Integer> it = terminalMap.keySet().iterator();
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
Integer termId = it.next();
|
|
|
|
|
this.storeOne(termId, today, days);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("MntnDayStatTask.storeAll error.", e);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("MntnDayStatTask.storeAll error.", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|