|  | @@ -13,6 +13,7 @@ import com.tzld.longarticle.recommend.server.common.enums.FieshuTableColumnDataT
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.aigc.ChannelEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.aigc.MiniprogramUseTypeEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.aigc.ProduceContentAuditStatusEnum;
 | 
	
		
			
				|  |  | +import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
 | 
	
	
		
			
				|  | @@ -128,6 +129,8 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |      private AIGCWaitingPublishContentService aigcWaitingPublishContentService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private PublishContentGzhWaitingRepository publishContentGzhWaitingRepository;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private LongArticleTitleAuditRepository titleAuditRepository;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      ExecutorService thread = new CommonThreadPoolExecutor(
 | 
	
		
			
				|  |  |              5,
 | 
	
	
		
			
				|  | @@ -988,6 +991,15 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |          List<PublishPlanAccountDTO> accountList = publishContentMapper.getPublishPlanAccounts(planIds);
 | 
	
		
			
				|  |  |          Collections.shuffle(accountList);
 | 
	
		
			
				|  |  |          CountDownLatch cdl = new CountDownLatch(accountList.size());
 | 
	
		
			
				|  |  | +        // 获取最近3天审核通过内容
 | 
	
		
			
				|  |  | +        List<LongArticleTitleAudit> newAuditList = titleAuditRepository.getByStatusAndAuditTimestampBetween(
 | 
	
		
			
				|  |  | +                ArticleVideoAuditStatusEnum.PASS.getCode(), now - (86400000 * 3), now);
 | 
	
		
			
				|  |  | +        List<String> newAuditIds = newAuditList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        // 获取已存在数
 | 
	
		
			
				|  |  | +        List<PublishPlanAccountDTO> existAccountList = publishContentMapper.getGroupPublishPlanAccounts();
 | 
	
		
			
				|  |  | +        Map<String, Map<String, Integer>> existAccountMap = existAccountList.stream().collect(
 | 
	
		
			
				|  |  | +                Collectors.groupingBy(PublishPlanAccountDTO::getPlanId,
 | 
	
		
			
				|  |  | +                        Collectors.toMap(PublishPlanAccountDTO::getAccountId, PublishPlanAccountDTO::getCnt)));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          ExecutorService thread = new CommonThreadPoolExecutor(
 | 
	
		
			
				|  |  |                  syncPublishContentThreadPoolSize, syncPublishContentThreadPoolSize, 0L, TimeUnit.SECONDS,
 | 
	
	
		
			
				|  | @@ -997,7 +1009,13 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |          for (PublishPlanAccountDTO account : accountList) {
 | 
	
		
			
				|  |  |              thread.submit(() -> {
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  | -                    List<Content> contentList = aigcWaitingPublishContentService.getAllContent(account.getPlanId(), account.getAccountId());
 | 
	
		
			
				|  |  | +                    // 首次同步所有待发布内容,后续增量同步最近三天审核通过内容
 | 
	
		
			
				|  |  | +                    Integer cnt = 0;
 | 
	
		
			
				|  |  | +                    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);
 | 
	
		
			
				|  |  |                  } finally {
 | 
	
		
			
				|  |  |                      cdl.countDown();
 | 
	
	
		
			
				|  | @@ -1037,7 +1055,7 @@ public class XxlJobService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<String> contentIds = contentList.stream().map(Content::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  |          // 不存在状态置0
 | 
	
		
			
				|  |  | -        longArticleBaseMapper.updatePublishContentGzhWaitingStatus(planId, accountId, contentIds, 0, now);
 | 
	
		
			
				|  |  | +//        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(
 |