This commit is contained in:
cc
2025-01-09 17:54:50 +08:00
parent a31feca107
commit e9d21c41a6

View File

@@ -230,26 +230,19 @@ public class JDUtils {
continue;
}
LocalDateTime now = LocalDateTime.now();
logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
//logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
LocalDateTime lastHour = now.truncatedTo(ChronoUnit.HOURS);
LocalDateTime startDate = lastHour.minusMonths(3).truncatedTo(ChronoUnit.HOURS);
LocalDateTime startDate = lastHour.minusMonths(3);
logger.info("{} - {}" ,startDate,lastHour);
while (!startDate.isEqual(lastHour)) {
Integer pageIndex = 1;
boolean hasMore = true;
while (hasMore) {
try {
// 30-60 天 ,非实时,非分钟
test(startDate, false, pageIndex, false,appKey,secretKey);
test(startDate, appKey);
logger.info("test {}",startDate);
} catch (Exception e) {
hasMore = false; // Optionally break out of the while loop if required
}
if (hasMore) pageIndex++;
}
startDate = startDate.plusHours(1);
}
}
@@ -579,11 +572,11 @@ public class JDUtils {
}
public void test(LocalDateTime startTime, boolean isRealTime, Integer page, boolean isMinutes,String appKey,String secretKey){
public synchronized void test(LocalDateTime startTime,String appKey){
String oldTimeTag = JD_REFRESH_TAG + startTime.format(DATE_TIME_FORMATTER);
String newTimeTag = JD_REFRESH_TAG +appKey +":"+ startTime.format(DATE_TIME_FORMATTER);
StringRedisTemplate redisTemplate = new StringRedisTemplate();
HashOperations<String, String, String> hashOps = redisTemplate.opsForHash();
// get all entries from the old hash