|
@@ -1000,6 +1000,7 @@ public class XxlJobService {
|
|
|
Map<String, Map<String, Integer>> existAccountMap = existAccountList.stream().collect(
|
|
|
Collectors.groupingBy(PublishPlanAccountDTO::getPlanId,
|
|
|
Collectors.toMap(PublishPlanAccountDTO::getAccountId, PublishPlanAccountDTO::getCnt)));
|
|
|
+ int hour = DateUtils.getHourByTimestamp(now / 1000);
|
|
|
|
|
|
ExecutorService thread = new CommonThreadPoolExecutor(
|
|
|
syncPublishContentThreadPoolSize, syncPublishContentThreadPoolSize, 0L, TimeUnit.SECONDS,
|
|
@@ -1014,9 +1015,16 @@ public class XxlJobService {
|
|
|
if (existAccountMap.containsKey(account.getPlanId())) {
|
|
|
cnt = existAccountMap.get(account.getPlanId()).getOrDefault(account.getAccountId(), 0);
|
|
|
}
|
|
|
- List<Content> contentList = aigcWaitingPublishContentService.getAllContent(account.getPlanId(),account.getAccountId()
|
|
|
- , cnt > 0 ? newAuditIds : null);
|
|
|
- savePublishContentCache(contentList, account.getPlanId(), account.getAccountId(), now);
|
|
|
+ List<Content> contentList;
|
|
|
+ // 每天晚上随机全量同步
|
|
|
+ boolean findAll = hour > 20 && Math.random() > 0.5;
|
|
|
+ if (findAll) {
|
|
|
+ contentList = aigcWaitingPublishContentService.getAllContent(account.getPlanId(), account.getAccountId(), null);
|
|
|
+ } else {
|
|
|
+ contentList = aigcWaitingPublishContentService.getAllContent(account.getPlanId(), account.getAccountId()
|
|
|
+ , cnt > 0 ? newAuditIds : null);
|
|
|
+ }
|
|
|
+ savePublishContentCache(contentList, account.getPlanId(), account.getAccountId(), findAll, now);
|
|
|
} finally {
|
|
|
cdl.countDown();
|
|
|
}
|
|
@@ -1049,13 +1057,15 @@ public class XxlJobService {
|
|
|
item.setUpdateTimestamp(updateTimestamp);
|
|
|
}
|
|
|
|
|
|
- public void savePublishContentCache(List<Content> contentList, String planId, String accountId, Long now) {
|
|
|
+ public void savePublishContentCache(List<Content> contentList, String planId, String accountId, Boolean findAll, Long now) {
|
|
|
if (CollectionUtil.isEmpty(contentList)) {
|
|
|
return;
|
|
|
}
|
|
|
List<String> contentIds = contentList.stream().map(Content::getId).collect(Collectors.toList());
|
|
|
// 不存在状态置0
|
|
|
-// longArticleBaseMapper.updatePublishContentGzhWaitingStatus(planId, accountId, contentIds, 0, now);
|
|
|
+ if (findAll) {
|
|
|
+ longArticleBaseMapper.updatePublishContentGzhWaitingStatus(planId, accountId, contentIds, 0, now);
|
|
|
+ }
|
|
|
List<PublishContentGzhWaiting> existList = publishContentGzhWaitingRepository.getByIdIn(contentIds);
|
|
|
List<String> existContentIds = existList.stream().map(PublishContentGzhWaiting::getId).collect(Collectors.toList());
|
|
|
Map<String, PublishContentGzhWaiting> existMap = existList.stream().collect(
|