|  | @@ -7,14 +7,12 @@ import com.tzld.piaoquan.api.common.enums.contentplatform.ContentPlatformGzhPlan
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.common.enums.contentplatform.PublishStageEnum;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.common.enums.contentplatform.QwPlanTypeEnum;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.common.exception.CommonException;
 | 
	
		
			
				|  |  | -import com.tzld.piaoquan.api.component.AdApiService;
 | 
	
		
			
				|  |  | -import com.tzld.piaoquan.api.component.AigcApiService;
 | 
	
		
			
				|  |  | -import com.tzld.piaoquan.api.component.ManagerApiService;
 | 
	
		
			
				|  |  | -import com.tzld.piaoquan.api.component.VlogApiService;
 | 
	
		
			
				|  |  | +import com.tzld.piaoquan.api.component.*;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.model.bo.AdPutFlowRecordTencent;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.model.bo.BucketDataParam;
 | 
	
		
			
				|  |  | +import com.tzld.piaoquan.api.model.bo.SmallPageUrlDetail;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.model.config.LoginUserContext;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.model.param.contentplatform.*;
 | 
	
		
			
				|  |  |  import com.tzld.piaoquan.api.model.po.contentplatform.*;
 | 
	
	
		
			
				|  | @@ -85,6 +83,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |      private AdApiService adApiService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private CgiReplyService cgiReplyService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TouLiuHttpClient touLiuHttpClient;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value("${vlog.share.appType:11}")
 | 
	
	
		
			
				|  | @@ -93,6 +93,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |      @Value("${video.min.score:0.6}")
 | 
	
		
			
				|  |  |      private Double videoMinScore;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Value("${small_page_url}")
 | 
	
		
			
				|  |  | +    private String GET_SMALL_PAGE_URL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param) {
 | 
	
		
			
				|  |  |          ContentPlatformAccount loginAccount = LoginUserContext.getUser();
 | 
	
	
		
			
				|  | @@ -251,11 +254,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |          gzhPlan.setPublishStage(param.getPublishStage());
 | 
	
		
			
				|  |  |          gzhPlan.setSelectVideoType(param.getSelectVideoType());
 | 
	
		
			
				|  |  |          gzhPlan.setUpdateTimestamp(now);
 | 
	
		
			
				|  |  | -        // 更新gh_detail
 | 
	
		
			
				|  |  |          List<Long> videoIds = param.getVideoList().stream().map(GzhPlanVideoContentItemParam::getVideoId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -        updateGhDetail(account, param.getSelectVideoType(), videoIds);
 | 
	
		
			
				|  |  | -        // 更新cgi_reply_bucket_data
 | 
	
		
			
				|  |  | -        updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
 | 
	
		
			
				|  |  | +        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
 | 
	
		
			
				|  |  | +            // 更新gh_detail
 | 
	
		
			
				|  |  | +            updateGhDetail(account, param.getSelectVideoType(), videoIds);
 | 
	
		
			
				|  |  | +            // 更新cgi_reply_bucket_data
 | 
	
		
			
				|  |  | +            updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (Objects.isNull(param.getId())) {
 | 
	
		
			
				|  |  |              // 调用aigc创建发布计划
 | 
	
		
			
				|  |  |              if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
 | 
	
	
		
			
				|  | @@ -287,14 +292,16 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |              gzhPlanMapper.updateByPrimaryKeySelective(gzhPlan);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 保存视频内容
 | 
	
		
			
				|  |  | -        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), loginAccount);
 | 
	
		
			
				|  |  | +        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), account, loginAccount);
 | 
	
		
			
				|  |  |          // 调用aigc重新拉取视频
 | 
	
		
			
				|  |  | -        if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
 | 
	
		
			
				|  |  | -            aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            BucketDataParam bucketDataParam = new BucketDataParam();
 | 
	
		
			
				|  |  | -            bucketDataParam.setGhId(account.getGhId());
 | 
	
		
			
				|  |  | -            cgiReplyService.getRgiReplyData(bucketDataParam);
 | 
	
		
			
				|  |  | +        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
 | 
	
		
			
				|  |  | +            if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
 | 
	
		
			
				|  |  | +                aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                BucketDataParam bucketDataParam = new BucketDataParam();
 | 
	
		
			
				|  |  | +                bucketDataParam.setGhId(account.getGhId());
 | 
	
		
			
				|  |  | +                cgiReplyService.getRgiReplyData(bucketDataParam);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -314,7 +321,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id, ContentPlatformAccount loginAccount) {
 | 
	
		
			
				|  |  | +    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id,
 | 
	
		
			
				|  |  | +                                  ContentPlatformGzhAccount account, ContentPlatformAccount loginAccount) {
 | 
	
		
			
				|  |  |          List<ContentPlatformGzhPlanVideo> existsVideo = getGzhVideoByPlanId(id);
 | 
	
		
			
				|  |  |          List<Long> existsVideoIds = existsVideo.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
 | 
	
		
			
				|  |  |          Map<Long, ContentPlatformGzhPlanVideo> existsVideoMap = existsVideo.stream()
 | 
	
	
		
			
				|  | @@ -343,6 +351,12 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 | 
	
		
			
				|  |  |                  item.setCustomCover(vo.getCustomCover());
 | 
	
		
			
				|  |  |                  item.setCustomCoverType(vo.getCustomCoverType());
 | 
	
		
			
				|  |  |                  item.setVideo(vo.getVideo());
 | 
	
		
			
				|  |  | +                if (param.getType() == ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal()) {
 | 
	
		
			
				|  |  | +                    String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "fwhdyy",
 | 
	
		
			
				|  |  | +                            loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "文字和小程序", account.getGhId());
 | 
	
		
			
				|  |  | +                    SmallPageUrlDetail smallPageUrlDetail = JSONObject.parseObject(response, SmallPageUrlDetail.class);
 | 
	
		
			
				|  |  | +                    item.setPageUrl(smallPageUrlDetail.getUrl());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  item.setCreateAccountId(loginAccount.getId());
 | 
	
		
			
				|  |  |                  item.setCreateTimestamp(System.currentTimeMillis());
 | 
	
		
			
				|  |  |                  gzhPlanVideoMapper.insertSelective(item);
 |