| 
					
				 | 
			
			
				@@ -1,8 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.tzld.piaoquan.longarticle.service.local.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.longarticle.common.constants.TimeConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.longarticle.common.enums.ContentStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.longarticle.common.enums.PublishGzhPushTypeEnum; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -400,10 +398,10 @@ public class CoreServiceImpl implements CoreService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //文章处理  小程序查询和发布 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<LongArticleSystemPushContentParam> pushContentList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<PushContentParam> pushContentList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Long> sendIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (PublishArticleData publishArticleData : rankList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LongArticleSystemPushContentParam contentParam = new LongArticleSystemPushContentParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PushContentParam contentParam = new PushContentParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PublishContent publishContent = publicContentService.getPublishContent(planAccount, publishArticleData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (publishContent == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     continue; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -435,88 +433,88 @@ public class CoreServiceImpl implements CoreService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     contentService.updateMatchContent(publishContent, planAccount, publishMiniprogramBoList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<PublishMiniprogramParam> publishCardList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (PublishMiniprogram publishMiniprogram : publishMiniprogramList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    PublishMiniprogramParam param = new PublishMiniprogramParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setProgramId(publishMiniprogram.getAppId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setProgramName(publishMiniprogram.getAppName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setProgramAvatar(publishMiniprogram.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setMini_id(publishMiniprogram.getMiniId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setMiniprogramUseType(publishMiniprogram.getMiniProgramType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String videoTitle = publishMiniprogram.getVideoTitle(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (org.springframework.util.StringUtils.hasText(videoTitle)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        videoTitle = videoTitle.replace("\"", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (videoTitle.length() > 32) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            videoTitle = videoTitle.substring(0, 32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        param.setProductionName(videoTitle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String wxUrl = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (StringUtils.isNotEmpty(publishMiniprogram.getWxUrl())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        wxUrl = publishMiniprogram.getWxUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        aigcService.pushCover(publishMiniprogram.getVideoCover(), publishMiniprogram.getPublishContentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (StringUtils.isEmpty(wxUrl)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setProductionCover(wxUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setProductionPath(publishMiniprogram.getProductionPath()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setRootShareId(publishMiniprogram.getRootShareId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setSource(publishMiniprogram.getSource()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setVideoUrl(publishMiniprogram.getVideoPath()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setParagraphPosition(BigDecimal.valueOf(publishMiniprogram.getIndex() * 0.25)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (publishMiniprogram.getIndex() == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        param.setParagraphPosition(BigDecimal.valueOf(0.01)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    param.setTraceId(publishMiniprogram.getTraceId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    publishCardList.add(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (publishCardList.size() < 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    publicContentService.delPublishContent(publishContent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<PublishMiniprogramParam> publishCardList = getPublishCardList(publishMiniprogramList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 contentParam.setPublishContentId(publishContent.getPublishContentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 contentParam.setMiniprogramCardList(publishCardList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 pushContentList.add(contentParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            LongArticleSystemCreatePushTaskParam gzhPushParam = new LongArticleSystemCreatePushTaskParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            gzhPushParam.setPlanId(planAccount.getPlanId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            gzhPushParam.setAccountId(planAccount.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            gzhPushParam.setPushType(planAccount.getPushType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            gzhPushParam.setPushScheduleTimestamp(System.currentTimeMillis()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (StringUtils.isNotEmpty(planAccount.getPublishPushTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String dateTimeStr = TimeZoneUtil.todayYMD(TimeZoneUtil.Timezone.china) + " " + planAccount.getPublishPushTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                gzhPushParam.setPushScheduleTimestamp(TimeZoneUtil.getDateStrTimestamp(dateTimeStr, "yyyy-MM-dd HH:mm:ss", TimeZoneUtil.Timezone.china)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                gzhPushParam.setPushScheduleTimestamp(System.currentTimeMillis()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (CollectionUtils.isEmpty(pushContentList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_group_publish.getVal()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    && pushContentList.size() < planAccount.getPublishPreMinNum()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CreatePushTaskParam gzhPushParam = getCreatePushTaskParam(planAccount, pushContentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (gzhPushParam == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            gzhPushParam.setPushContentList(pushContentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.info("gzhPushParam={}", gzhPushParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String pushId = aigcService.createPushTask(gzhPushParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.info("pushId = {}", pushId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(pushId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (Long id : sendIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    PublishContent publishContent = publishContentMapper.selectByPrimaryKey(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (publishContent == null || publishContent.getStatus() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    PublishContent update = new PublishContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    update.setId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    update.setPushId(pushId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    update.setStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    publishContentMapper.updateByPrimaryKeySelective(update); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                publicContentService.updatePublishContentPushId(sendIds, pushId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private CreatePushTaskParam getCreatePushTaskParam(PlanAccount planAccount, List<PushContentParam> pushContentList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CreatePushTaskParam gzhPushParam = new CreatePushTaskParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gzhPushParam.setPlanId(planAccount.getPlanId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gzhPushParam.setAccountId(planAccount.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gzhPushParam.setPushType(planAccount.getPushType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gzhPushParam.setPushScheduleTimestamp(System.currentTimeMillis()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(planAccount.getPublishPushTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String dateTimeStr = TimeZoneUtil.todayYMD(TimeZoneUtil.Timezone.china) + " " + planAccount.getPublishPushTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            gzhPushParam.setPushScheduleTimestamp(TimeZoneUtil.getDateStrTimestamp(dateTimeStr, "yyyy-MM-dd HH:mm:ss", TimeZoneUtil.Timezone.china)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            gzhPushParam.setPushScheduleTimestamp(System.currentTimeMillis()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //文章列表为空直接返回 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(pushContentList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //自动群发少于最少数量不发送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_group_publish.getVal()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && pushContentList.size() < planAccount.getPublishPreMinNum()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gzhPushParam.setPushContentList(pushContentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return gzhPushParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<PublishMiniprogramParam> getPublishCardList(List<PublishMiniprogram> publishMiniprogramList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PublishMiniprogramParam> publishCardList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (PublishMiniprogram publishMiniprogram : publishMiniprogramList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PublishMiniprogramParam param = new PublishMiniprogramParam(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setProgramId(publishMiniprogram.getAppId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setProgramName(publishMiniprogram.getAppName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setProgramAvatar(publishMiniprogram.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setMini_id(publishMiniprogram.getMiniId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setMiniprogramUseType(publishMiniprogram.getMiniProgramType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String videoTitle = publishMiniprogram.getVideoTitle(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (org.springframework.util.StringUtils.hasText(videoTitle)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                videoTitle = videoTitle.replace("\"", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (videoTitle.length() > 32) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    videoTitle = videoTitle.substring(0, 32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                param.setProductionName(videoTitle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String wxUrl = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotEmpty(publishMiniprogram.getWxUrl())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                wxUrl = publishMiniprogram.getWxUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                aigcService.pushCover(publishMiniprogram.getVideoCover(), publishMiniprogram.getPublishContentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isEmpty(wxUrl)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setProductionCover(wxUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setProductionPath(publishMiniprogram.getProductionPath()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setRootShareId(publishMiniprogram.getRootShareId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setSource(publishMiniprogram.getSource()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setVideoUrl(publishMiniprogram.getVideoPath()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setParagraphPosition(BigDecimal.valueOf(publishMiniprogram.getIndex() * 0.25)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (publishMiniprogram.getIndex() == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                param.setParagraphPosition(BigDecimal.valueOf(0.01)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setTraceId(publishMiniprogram.getTraceId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            publishCardList.add(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return publishCardList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 |