|  | @@ -988,39 +988,7 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |              thread.submit(() -> {
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  |                      List<Content> contentList = aigcWaitingPublishContentService.getAllContent(account.getPlanId(), account.getAccountId());
 | 
	
		
			
				|  |  | -                    if (CollectionUtil.isEmpty(contentList)) {
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    List<String> contentIds = contentList.stream().map(Content::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -                    // 不存在状态置0
 | 
	
		
			
				|  |  | -                    longArticleBaseMapper.updatePublishContentGzhWaitingStatus(account.getPlanId(), account.getAccountId(), 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(
 | 
	
		
			
				|  |  | -                            Collectors.toMap(PublishContentGzhWaiting::getId, Function.identity()));
 | 
	
		
			
				|  |  | -                    List<PublishContentGzhWaiting> saveList = new ArrayList<>();
 | 
	
		
			
				|  |  | -                    for (Content content : contentList) {
 | 
	
		
			
				|  |  | -                        // 已存在更新
 | 
	
		
			
				|  |  | -                        if (existContentIds.contains(content.getId())) {
 | 
	
		
			
				|  |  | -                            PublishContentGzhWaiting existItem = existMap.get(content.getId());
 | 
	
		
			
				|  |  | -                            if (existItem.getStatus().equals(0)) {
 | 
	
		
			
				|  |  | -                                existItem.setStatus(1);
 | 
	
		
			
				|  |  | -                                existItem.setUpdateTimestamp(now);
 | 
	
		
			
				|  |  | -                                publishContentGzhWaitingRepository.save(existItem);
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -//                              setPublishContentValue(existItem, content, plan.getId(), account.getId(), now);
 | 
	
		
			
				|  |  | -//                              publishContentGzhWaitingRepository.save(existItem);
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        // 新增
 | 
	
		
			
				|  |  | -                        PublishContentGzhWaiting item = new PublishContentGzhWaiting();
 | 
	
		
			
				|  |  | -                        setPublishContentValue(item, content, account.getPlanId(), account.getAccountId(), now);
 | 
	
		
			
				|  |  | -                        saveList.add(item);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    if (CollectionUtil.isNotEmpty(saveList)) {
 | 
	
		
			
				|  |  | -                        longArticleBaseMapper.batchInsertPublishContentGzhWaiting(saveList);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    log.info("syncGzhWaitingPublishContent success planId: {} accountId: {}", account.getPlanId(), account.getAccountId());
 | 
	
		
			
				|  |  | +                    savePublishContentCache(contentList, account.getPlanId(), account.getAccountId(), now);
 | 
	
		
			
				|  |  |                  } finally {
 | 
	
		
			
				|  |  |                      cdl.countDown();
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -1053,4 +1021,40 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |          item.setUpdateTimestamp(updateTimestamp);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public void savePublishContentCache(List<Content> contentList, String planId, String accountId, 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);
 | 
	
		
			
				|  |  | +        List<PublishContentGzhWaiting> existList = publishContentGzhWaitingRepository.getByIdIn(contentIds);
 | 
	
		
			
				|  |  | +        List<String> existContentIds = existList.stream().map(PublishContentGzhWaiting::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        Map<String, PublishContentGzhWaiting> existMap = existList.stream().collect(
 | 
	
		
			
				|  |  | +                Collectors.toMap(PublishContentGzhWaiting::getId, Function.identity()));
 | 
	
		
			
				|  |  | +        List<PublishContentGzhWaiting> saveList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (Content content : contentList) {
 | 
	
		
			
				|  |  | +            // 已存在更新
 | 
	
		
			
				|  |  | +            if (existContentIds.contains(content.getId())) {
 | 
	
		
			
				|  |  | +                PublishContentGzhWaiting existItem = existMap.get(content.getId());
 | 
	
		
			
				|  |  | +                if (existItem.getStatus().equals(0)) {
 | 
	
		
			
				|  |  | +                    existItem.setStatus(1);
 | 
	
		
			
				|  |  | +                    existItem.setUpdateTimestamp(now);
 | 
	
		
			
				|  |  | +                    publishContentGzhWaitingRepository.save(existItem);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +//                setPublishContentValue(existItem, content, planId, accountId, now);
 | 
	
		
			
				|  |  | +//                publishContentGzhWaitingRepository.save(existItem);
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // 新增
 | 
	
		
			
				|  |  | +            PublishContentGzhWaiting item = new PublishContentGzhWaiting();
 | 
	
		
			
				|  |  | +            setPublishContentValue(item, content, planId, accountId, now);
 | 
	
		
			
				|  |  | +            saveList.add(item);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (CollectionUtil.isNotEmpty(saveList)) {
 | 
	
		
			
				|  |  | +            longArticleBaseMapper.batchInsertPublishContentGzhWaiting(saveList);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        log.info("syncGzhWaitingPublishContent success planId: {} accountId: {}", planId, accountId);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |