Jelajahi Sumber

增加记录 修改报警

xueyiming 7 bulan lalu
induk
melakukan
dafbe75f7d
16 mengubah file dengan 485 tambahan dan 71 penghapusan
  1. 6 4
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/bo/PublishMiniprogramBo.java
  2. 2 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/bo/VideoDetail.java
  3. 11 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishContent.java
  4. 70 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishContentExample.java
  5. 33 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishMiniprogram.java
  6. 200 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishMiniprogramExample.java
  7. 4 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/PlanAccountService.java
  8. 3 2
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CardServiceImpl.java
  9. 16 1
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/ContentServiceImpl.java
  10. 51 52
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java
  11. 12 0
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/PlanAccountServiceImpl.java
  12. 1 1
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/VideoService.java
  13. 3 2
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/impl/VideoServiceImpl.java
  14. 20 3
      long-article-server/src/main/resources/mapper/PublishContentMapper.xml
  15. 51 4
      long-article-server/src/main/resources/mapper/PublishMiniprogramMapper.xml
  16. 2 2
      long-article-server/src/main/resources/mybatis-generator-config.xml

+ 6 - 4
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/bo/PublishMiniprogramBo.java

@@ -37,8 +37,6 @@ public class PublishMiniprogramBo {
 
     private String videoPath;
 
-    private String videoOss;
-
     private String productionPath;
 
     private String rootSourceId;
@@ -47,12 +45,16 @@ public class PublishMiniprogramBo {
 
     private Integer index;
 
-    private String uid;
-
     private String traceId;
 
     private String wxUrl;
 
+    private Integer crawlerVideoId;
+
+    private String videoOssPath;
+
+    private String userId;
+
     private Integer isDelete;
 
     private Date createTime;

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/bo/VideoDetail.java

@@ -5,6 +5,8 @@ import lombok.Data;
 @Data
 public class VideoDetail {
 
+    private Integer crawlerVideoId;
+
     private String uid;
 
     private String source;

+ 11 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishContent.java

@@ -21,6 +21,8 @@ public class PublishContent {
 
     private String reason;
 
+    private String traceId;
+
     private Date createTime;
 
     private Date updateTime;
@@ -97,6 +99,14 @@ public class PublishContent {
         this.reason = reason;
     }
 
+    public String getTraceId() {
+        return traceId;
+    }
+
+    public void setTraceId(String traceId) {
+        this.traceId = traceId;
+    }
+
     public Date getCreateTime() {
         return createTime;
     }
@@ -128,6 +138,7 @@ public class PublishContent {
         sb.append(", status=").append(status);
         sb.append(", pushId=").append(pushId);
         sb.append(", reason=").append(reason);
+        sb.append(", traceId=").append(traceId);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);
         sb.append("]");

+ 70 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishContentExample.java

@@ -706,6 +706,76 @@ public class PublishContentExample {
             return (Criteria) this;
         }
 
+        public Criteria andTraceIdIsNull() {
+            addCriterion("trace_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdIsNotNull() {
+            addCriterion("trace_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdEqualTo(String value) {
+            addCriterion("trace_id =", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdNotEqualTo(String value) {
+            addCriterion("trace_id <>", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdGreaterThan(String value) {
+            addCriterion("trace_id >", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdGreaterThanOrEqualTo(String value) {
+            addCriterion("trace_id >=", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdLessThan(String value) {
+            addCriterion("trace_id <", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdLessThanOrEqualTo(String value) {
+            addCriterion("trace_id <=", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdLike(String value) {
+            addCriterion("trace_id like", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdNotLike(String value) {
+            addCriterion("trace_id not like", value, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdIn(List<String> values) {
+            addCriterion("trace_id in", values, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdNotIn(List<String> values) {
+            addCriterion("trace_id not in", values, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdBetween(String value1, String value2) {
+            addCriterion("trace_id between", value1, value2, "traceId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTraceIdNotBetween(String value1, String value2) {
+            addCriterion("trace_id not between", value1, value2, "traceId");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateTimeIsNull() {
             addCriterion("create_time is null");
             return (Criteria) this;

+ 33 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishMiniprogram.java

@@ -43,6 +43,12 @@ public class PublishMiniprogram {
 
     private String wxUrl;
 
+    private Integer crawlerVideoId;
+
+    private String videoOssPath;
+
+    private String userId;
+
     private Integer isDelete;
 
     private Date createTime;
@@ -209,6 +215,30 @@ public class PublishMiniprogram {
         this.wxUrl = wxUrl;
     }
 
+    public Integer getCrawlerVideoId() {
+        return crawlerVideoId;
+    }
+
+    public void setCrawlerVideoId(Integer crawlerVideoId) {
+        this.crawlerVideoId = crawlerVideoId;
+    }
+
+    public String getVideoOssPath() {
+        return videoOssPath;
+    }
+
+    public void setVideoOssPath(String videoOssPath) {
+        this.videoOssPath = videoOssPath;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
     public Integer getIsDelete() {
         return isDelete;
     }
@@ -259,6 +289,9 @@ public class PublishMiniprogram {
         sb.append(", index=").append(index);
         sb.append(", traceId=").append(traceId);
         sb.append(", wxUrl=").append(wxUrl);
+        sb.append(", crawlerVideoId=").append(crawlerVideoId);
+        sb.append(", videoOssPath=").append(videoOssPath);
+        sb.append(", userId=").append(userId);
         sb.append(", isDelete=").append(isDelete);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);

+ 200 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/po/PublishMiniprogramExample.java

@@ -1446,6 +1446,206 @@ public class PublishMiniprogramExample {
             return (Criteria) this;
         }
 
+        public Criteria andCrawlerVideoIdIsNull() {
+            addCriterion("crawler_video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdIsNotNull() {
+            addCriterion("crawler_video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdEqualTo(Integer value) {
+            addCriterion("crawler_video_id =", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdNotEqualTo(Integer value) {
+            addCriterion("crawler_video_id <>", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdGreaterThan(Integer value) {
+            addCriterion("crawler_video_id >", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("crawler_video_id >=", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdLessThan(Integer value) {
+            addCriterion("crawler_video_id <", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdLessThanOrEqualTo(Integer value) {
+            addCriterion("crawler_video_id <=", value, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdIn(List<Integer> values) {
+            addCriterion("crawler_video_id in", values, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdNotIn(List<Integer> values) {
+            addCriterion("crawler_video_id not in", values, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdBetween(Integer value1, Integer value2) {
+            addCriterion("crawler_video_id between", value1, value2, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCrawlerVideoIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("crawler_video_id not between", value1, value2, "crawlerVideoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathIsNull() {
+            addCriterion("video_oss_path is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathIsNotNull() {
+            addCriterion("video_oss_path is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathEqualTo(String value) {
+            addCriterion("video_oss_path =", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathNotEqualTo(String value) {
+            addCriterion("video_oss_path <>", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathGreaterThan(String value) {
+            addCriterion("video_oss_path >", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathGreaterThanOrEqualTo(String value) {
+            addCriterion("video_oss_path >=", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathLessThan(String value) {
+            addCriterion("video_oss_path <", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathLessThanOrEqualTo(String value) {
+            addCriterion("video_oss_path <=", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathLike(String value) {
+            addCriterion("video_oss_path like", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathNotLike(String value) {
+            addCriterion("video_oss_path not like", value, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathIn(List<String> values) {
+            addCriterion("video_oss_path in", values, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathNotIn(List<String> values) {
+            addCriterion("video_oss_path not in", values, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathBetween(String value1, String value2) {
+            addCriterion("video_oss_path between", value1, value2, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoOssPathNotBetween(String value1, String value2) {
+            addCriterion("video_oss_path not between", value1, value2, "videoOssPath");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNull() {
+            addCriterion("user_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNotNull() {
+            addCriterion("user_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdEqualTo(String value) {
+            addCriterion("user_id =", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotEqualTo(String value) {
+            addCriterion("user_id <>", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThan(String value) {
+            addCriterion("user_id >", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThanOrEqualTo(String value) {
+            addCriterion("user_id >=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThan(String value) {
+            addCriterion("user_id <", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThanOrEqualTo(String value) {
+            addCriterion("user_id <=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLike(String value) {
+            addCriterion("user_id like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotLike(String value) {
+            addCriterion("user_id not like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIn(List<String> values) {
+            addCriterion("user_id in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotIn(List<String> values) {
+            addCriterion("user_id not in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdBetween(String value1, String value2) {
+            addCriterion("user_id between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotBetween(String value1, String value2) {
+            addCriterion("user_id not between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
         public Criteria andIsDeleteIsNull() {
             addCriterion("is_delete is null");
             return (Criteria) this;

+ 4 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/PlanAccountService.java

@@ -22,4 +22,8 @@ public interface PlanAccountService {
     void updateMatchStatus(Integer status, Long id);
 
     void updateStatus(Integer status, Long id);
+
+    PlanAccount getPlanAccountById(Long id);
+
+    void updateRetry(PlanAccount planAccount);
 }

+ 3 - 2
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CardServiceImpl.java

@@ -97,13 +97,14 @@ public class CardServiceImpl implements CardService {
         publishMiniprogramBo.setVideoTitle(videoDetail.getKimiTitle());
         publishMiniprogramBo.setVideoCover(videoDetail.getVideoCover());
         publishMiniprogramBo.setVideoPath(videoDetail.getVideoPath());
-        publishMiniprogramBo.setVideoOss(videoDetail.getVideoOss());
         publishMiniprogramBo.setProductionPath(jsonObject.getString("productionPath"));
         publishMiniprogramBo.setRootSourceId(jsonObject.getString("rootSourceId"));
         publishMiniprogramBo.setRootShareId(jsonObject.getString("rootShareId"));
         publishMiniprogramBo.setIndex(index);
-        publishMiniprogramBo.setUid(videoDetail.getUid());
         publishMiniprogramBo.setTraceId(videoDetail.getTraceId());
+        publishMiniprogramBo.setCrawlerVideoId(videoDetail.getCrawlerVideoId());
+        publishMiniprogramBo.setVideoOssPath(videoDetail.getVideoOss());
+        publishMiniprogramBo.setUserId(videoDetail.getUid());
         return publishMiniprogramBo;
     }
 

+ 16 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/ContentServiceImpl.java

@@ -38,7 +38,7 @@ public class ContentServiceImpl implements ContentService {
     private PublishMiniprogramMapper publishMiniprogramMapper;
 
     @Autowired
-    private RedisTemplate<String, Object> redisTemplate;
+    private PublishContentMapper publishContentMapper;
 
     public MatchVideo getContent(String contentId, String ghId) {
         MatchVideoExample matchVideoExample = new MatchVideoExample();
@@ -76,6 +76,21 @@ public class ContentServiceImpl implements ContentService {
         return matchVideo.getTraceId();
     }
 
+    public void updatePublishContentTraceId(String traceId, Long publishContentId) {
+        PublishContent publishContent = new PublishContent();
+        publishContent.setTraceId(traceId);
+        publishContent.setId(publishContentId);
+        publishContentMapper.updateByPrimaryKeySelective(publishContent);
+    }
+
+    public void updatePublishContentStatus(Integer status, Long publishContentId, String reason) {
+        PublishContent publishContent = new PublishContent();
+        publishContent.setStatus(status);
+        publishContent.setId(publishContentId);
+        publishContent.setReason(reason);
+        publishContentMapper.updateByPrimaryKeySelective(publishContent);
+    }
+
 
     public List<CrawlerVideo> getContentMiniVideo(PublishArticleData publishArticleData, PlanAccount planAccount) {
         CrawlerVideoExample example = new CrawlerVideoExample();

+ 51 - 52
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -473,6 +473,7 @@ public class CoreServiceImpl implements CoreService {
                     List<VideoDetail> videoDetails = new ArrayList<>();
                     //发布小程序
                     for (CrawlerVideo crawlerVideo : contentVideos) {
+                        Integer crawlerVideoId = crawlerVideo.getId();
                         String videoOssPath = crawlerVideo.getVideoOssPath();
                         String platform = crawlerVideo.getPlatform();
                         String userId = crawlerVideo.getUserId();
@@ -484,7 +485,7 @@ public class CoreServiceImpl implements CoreService {
                         } else {
                             kimiTitle = crawlerVideo.getVideoTitle();
                         }
-                        VideoDetail publish = videoService.publish(videoOssPath, userId, kimiTitle, platform, traceId);
+                        VideoDetail publish = videoService.publish(crawlerVideoId, videoOssPath, userId, kimiTitle, platform, traceId);
                         if (publish == null) {
                             continue;
                         }
@@ -524,13 +525,13 @@ public class CoreServiceImpl implements CoreService {
                         rootSourceService.addRootSource(publishMiniprogramBo, planAccount, publishArticleData);
 
                         JSONObject jsonObject = new JSONObject();
-                        jsonObject.put("uid", publishMiniprogramBo.getUid());
+                        jsonObject.put("uid", publishMiniprogramBo.getUserId());
                         jsonObject.put("source", publishMiniprogramBo.getSource());
                         jsonObject.put("kimiTitle", publishMiniprogramBo.getVideoTitle());
                         jsonObject.put("videoId", publishMiniprogramBo.getVideoId());
                         jsonObject.put("videoCover", publishMiniprogramBo.getVideoCover());
                         jsonObject.put("videoPath", publishMiniprogramBo.getVideoPath());
-                        jsonObject.put("videoOss", publishMiniprogramBo.getVideoOss());
+                        jsonObject.put("videoOss", publishMiniprogramBo.getVideoOssPath());
                         jsonObject.put("rootSourceId", publishMiniprogramBo.getRootSourceId());
                         jsonArray.add(jsonObject);
 
@@ -540,7 +541,7 @@ public class CoreServiceImpl implements CoreService {
                         publishMiniprogramList.add(publishMiniprogram);
                     }
                     String traceId = contentService.updateMatchContent(publishArticleData.getSourceId(), planAccount.getGhId(), jsonArray);
-                    videoService.miniProgramVideoOff(traceId);
+                    contentService.updatePublishContentTraceId(traceId, publishContent.getId());
                 }
 
                 List<PublishMiniprogramParam> publishCardList = new ArrayList<>();
@@ -638,8 +639,12 @@ public class CoreServiceImpl implements CoreService {
         PublishContentExample example = new PublishContentExample();
         example.createCriteria().andStatusEqualTo(1).andPushIdIsNotNull();
         List<PublishContent> publishContents = publishContentMapper.selectByExample(example);
-        Set<String> collect = publishContents.stream().map(PublishContent::getPushId).collect(Collectors.toSet());
-        for (String pushId : collect) {
+        Map<String, List<PublishContent>> groupedByPushId = publishContents.stream()
+                .filter(content -> content.getPushId() != null) // 过滤掉 pushId 为空的情况
+                .collect(Collectors.groupingBy(PublishContent::getPushId));
+
+        for (Map.Entry<String, List<PublishContent>> entry : groupedByPushId.entrySet()) {
+            String pushId = entry.getKey();
             PushStatusParam param = new PushStatusParam();
             param.setPushId(pushId);
             PushStatusVO pushStatusVO = aigcService.queryPushStatus(param);
@@ -647,24 +652,8 @@ public class CoreServiceImpl implements CoreService {
             if (pushStatusVO == null) {
                 continue;
             }
-            if (StringUtils.isNotEmpty(pushStatusVO.getErrorMsg())) {
-                String accountName = "";
-                PublishContentExample publishContentExample = new PublishContentExample();
-                publishContentExample.createCriteria().andPushIdEqualTo(pushId);
-                List<PublishContent> failPublishContents = publishContentMapper.selectByExample(publishContentExample);
-                if (!CollectionUtils.isEmpty(failPublishContents)) {
-                    Long planAccountId = failPublishContents.get(0).getPlanAccountId();
-                    PlanAccount planAccount = planAccountMapper.selectByPrimaryKey(planAccountId);
-                    if (planAccount != null && StringUtils.isNotEmpty(planAccount.getAccountName())) {
-                        accountName = planAccount.getAccountName();
-                    }
-                }
-                log.error("push error pushId={} msg={}", pushId, pushStatusVO.getErrorMsg());
-                LarkRobotUtil.sendMessage("发布失败,请查看,pushId=" + pushId + "失败信息"
-                        + pushStatusVO.getErrorMsg() + "账号名称:" + accountName);
-            }
             int updateStatus = 0;
-            //推送失败  重新推送
+            //推送失败  失败
             if (pushStatusVO.getPushStatus() == 3) {
                 updateStatus = 3;
             }
@@ -686,8 +675,30 @@ public class CoreServiceImpl implements CoreService {
                     updateStatus = 2;
                 }
             }
-            //更新状态  2成功  3失败
-            if (updateStatus != 0) {
+
+
+            Long planAccountId = entry.getValue().get(0).getPlanAccountId();
+            if (planAccountId == null) {
+                continue;
+            }
+            PlanAccount planAccount = planAccountService.getPlanAccountById(planAccountId);
+            if (updateStatus == 2) {
+                for (PublishContent publishContent : entry.getValue()) {
+                    contentService.updatePublishContentStatus(updateStatus, publishContent.getId(), pushStatusVO.getErrorMsg());
+                    if (StringUtils.isNotEmpty(publishContent.getTraceId())) {
+                        videoService.miniProgramVideoOff(publishContent.getTraceId());
+                    } else {
+                        LarkRobotUtil.sendMessage("publishContent traceId is null publishContent id=" + publishContent.getId());
+                    }
+                }
+                if (planAccount == null) {
+                    continue;
+                }
+                if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_group_publish.getVal())) {
+                    planAccountService.updateStatus(2, planAccountId);
+                }
+            }
+            if (updateStatus == 3) {
                 PublishContentExample publishContentExample = new PublishContentExample();
                 publishContentExample.createCriteria().andPushIdEqualTo(pushId);
                 PublishContent update = new PublishContent();
@@ -696,37 +707,25 @@ public class CoreServiceImpl implements CoreService {
                 }
                 update.setStatus(updateStatus);
                 publishContentMapper.updateByExampleSelective(update, publishContentExample);
-
-                List<PublishContent> publishContentList = publishContentMapper.selectByExample(publishContentExample);
-                if (!CollectionUtils.isEmpty(publishContentList)) {
-                    Long planAccountId = publishContentList.get(0).getPlanAccountId();
-                    if (planAccountId == null) {
-                        continue;
-                    }
-                    PlanAccount planAccount = planAccountMapper.selectByPrimaryKey(planAccountId);
-                    if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_group_publish.getVal())) {
-                        if (updateStatus == 2) {
-                            planAccount.setStatus(2);
-                            planAccountMapper.updateByPrimaryKeySelective(planAccount);
-                        }
-                        if (updateStatus == 3) {
-                            if (StringUtils.isNotEmpty(pushStatusVO.getErrorMsg())) {
-                                //群发配额用完  不再重试
-                                if (pushStatusVO.getErrorMsg().contains("45028")) {
-                                    planAccount.setStatus(3);
-                                }
-                            }
-                            planAccount.setRetryCount(planAccount.getRetryCount() + 1);
-                            planAccountMapper.updateByPrimaryKeySelective(planAccount);
+                if (planAccount == null) {
+                    continue;
+                }
+                planAccountService.updateRetry(planAccount);
+                if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_group_publish.getVal())) {
+                    if (StringUtils.isNotEmpty(pushStatusVO.getErrorMsg())) {
+                        //群发配额用完  不再重试
+                        if (pushStatusVO.getErrorMsg().contains("45028")) {
+                            planAccountService.updateStatus(3, planAccountId);
                         }
                     }
                 }
+                if (StringUtils.isNotEmpty(pushStatusVO.getErrorMsg()) && !pushStatusVO.getErrorMsg().contains("45028")) {
+                    log.error("push error pushId={} msg={}", pushId, pushStatusVO.getErrorMsg());
+                    String message = String.format("发布失败,请查看,pushId=%s 失败信息:%s 账号名称:%s 计划名称:%s",
+                            pushId, pushStatusVO.getErrorMsg(), planAccount.getAccountName(), planAccount.getPlanName());
+                    LarkRobotUtil.sendMessage(message);
+                }
             }
         }
     }
-
-    public static void main(String[] args) {
-        String error = "45028,has no masssend quota rid: 673fcc03-762b3ce0-0bfa729b";
-        System.out.println(error.contains("45028"));
-    }
 }

+ 12 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/PlanAccountServiceImpl.java

@@ -107,4 +107,16 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         planAccountMapper.updateByPrimaryKey(updatePlanAccount);
     }
 
+    public PlanAccount getPlanAccountById(Long id) {
+        return planAccountMapper.selectByPrimaryKey(id);
+    }
+
+    public void updateRetry(PlanAccount planAccount) {
+        PlanAccount updatePlanAccount = new PlanAccount();
+        updatePlanAccount.setId(planAccount.getId());
+        updatePlanAccount.setRetryCount(planAccount.getRetryCount() + 1);
+        planAccountMapper.updateByPrimaryKeySelective(updatePlanAccount);
+    }
+
+
 }

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/VideoService.java

@@ -4,7 +4,7 @@ import com.tzld.piaoquan.longarticle.model.bo.VideoDetail;
 
 public interface VideoService {
 
-    VideoDetail publish(String ossPath, String uid, String title, String platform, String traceId);
+    VideoDetail publish(Integer crawlerVideoId, String ossPath, String uid, String title, String platform, String traceId);
 
     void miniProgramVideoOff(String traceId);
 }

+ 3 - 2
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/impl/VideoServiceImpl.java

@@ -30,12 +30,13 @@ public class VideoServiceImpl implements VideoService {
     private static final String PUBLISH_URL = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send";
     private static final String VIDEO_DETAIL_URL = "https://longvideoapi.piaoquantv.com/longvideoapi/openapi/video/batchSelectVideoInfo";
 
-    public VideoDetail publish(String ossPath, String uid, String title, String platform, String traceId) {
+    public VideoDetail publish(Integer crawlerVideoId, String ossPath, String uid, String title, String platform, String traceId) {
         String videoId = publishToPQ(ossPath, uid, title);
         if (videoId == null) {
             return null;
         }
         VideoDetail videoDetail = getPQVideoDetail(videoId);
+        videoDetail.setCrawlerVideoId(crawlerVideoId);
         videoDetail.setKimiTitle(title);
         videoDetail.setUid(uid);
         videoDetail.setVideoOss(ossPath);
@@ -113,7 +114,7 @@ public class VideoServiceImpl implements VideoService {
             System.out.println(post);
             JSONObject jsonObject = JSONUtil.parseObj(post);
             String status = jsonObject.getStr("status");
-            if(!Objects.equals(status, "success")){
+            if (!Objects.equals(status, "success")) {
                 LarkRobotUtil.sendMessage("get_off_videos失败  traceId=" + traceId);
             }
         } catch (Exception e) {

+ 20 - 3
long-article-server/src/main/resources/mapper/PublishContentMapper.xml

@@ -11,6 +11,7 @@
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="push_id" jdbcType="VARCHAR" property="pushId" />
     <result column="reason" jdbcType="VARCHAR" property="reason" />
+    <result column="trace_id" jdbcType="VARCHAR" property="traceId" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
   </resultMap>
@@ -74,7 +75,7 @@
   </sql>
   <sql id="Base_Column_List">
     id, plan_account_id, publish_content_id, source_id, score, content_pool_type, `status`, 
-    push_id, reason, create_time, update_time
+    push_id, reason, trace_id, create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.longarticle.model.po.PublishContentExample" resultMap="BaseResultMap">
     select
@@ -113,11 +114,13 @@
     insert into long_articles_publish_content (id, plan_account_id, publish_content_id, 
       source_id, score, content_pool_type, 
       `status`, push_id, reason, 
-      create_time, update_time)
+      trace_id, create_time, update_time
+      )
     values (#{id,jdbcType=BIGINT}, #{planAccountId,jdbcType=BIGINT}, #{publishContentId,jdbcType=VARCHAR}, 
       #{sourceId,jdbcType=VARCHAR}, #{score,jdbcType=DOUBLE}, #{contentPoolType,jdbcType=VARCHAR}, 
       #{status,jdbcType=INTEGER}, #{pushId,jdbcType=VARCHAR}, #{reason,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+      #{traceId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.longarticle.model.po.PublishContent" useGeneratedKeys="true" keyProperty="id">
     insert into long_articles_publish_content
@@ -149,6 +152,9 @@
       <if test="reason != null">
         reason,
       </if>
+      <if test="traceId != null">
+        trace_id,
+      </if>
       <if test="createTime != null">
         create_time,
       </if>
@@ -184,6 +190,9 @@
       <if test="reason != null">
         #{reason,jdbcType=VARCHAR},
       </if>
+      <if test="traceId != null">
+        #{traceId,jdbcType=VARCHAR},
+      </if>
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
@@ -231,6 +240,9 @@
       <if test="record.reason != null">
         reason = #{record.reason,jdbcType=VARCHAR},
       </if>
+      <if test="record.traceId != null">
+        trace_id = #{record.traceId,jdbcType=VARCHAR},
+      </if>
       <if test="record.createTime != null">
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
       </if>
@@ -253,6 +265,7 @@
       `status` = #{record.status,jdbcType=INTEGER},
       push_id = #{record.pushId,jdbcType=VARCHAR},
       reason = #{record.reason,jdbcType=VARCHAR},
+      trace_id = #{record.traceId,jdbcType=VARCHAR},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
       update_time = #{record.updateTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
@@ -286,6 +299,9 @@
       <if test="reason != null">
         reason = #{reason,jdbcType=VARCHAR},
       </if>
+      <if test="traceId != null">
+        trace_id = #{traceId,jdbcType=VARCHAR},
+      </if>
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
@@ -305,6 +321,7 @@
       `status` = #{status,jdbcType=INTEGER},
       push_id = #{pushId,jdbcType=VARCHAR},
       reason = #{reason,jdbcType=VARCHAR},
+      trace_id = #{traceId,jdbcType=VARCHAR},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_time = #{updateTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}

+ 51 - 4
long-article-server/src/main/resources/mapper/PublishMiniprogramMapper.xml

@@ -22,6 +22,9 @@
     <result column="index" jdbcType="INTEGER" property="index" />
     <result column="trace_id" jdbcType="VARCHAR" property="traceId" />
     <result column="wx_url" jdbcType="VARCHAR" property="wxUrl" />
+    <result column="crawler_video_id" jdbcType="INTEGER" property="crawlerVideoId" />
+    <result column="video_oss_path" jdbcType="VARCHAR" property="videoOssPath" />
+    <result column="user_id" jdbcType="VARCHAR" property="userId" />
     <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@@ -87,8 +90,8 @@
   <sql id="Base_Column_List">
     id, content_id, plan_account_id, publish_content_id, app_id, app_name, avatar, mini_id, 
     mini_program_type, video_id, `source`, video_title, video_cover, video_path, production_path, 
-    root_source_id, root_share_id, `index`, trace_id, wx_url, is_delete, create_time, 
-    update_time
+    root_source_id, root_share_id, `index`, trace_id, wx_url, crawler_video_id, video_oss_path, 
+    user_id, is_delete, create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.longarticle.model.po.PublishMiniprogramExample" resultMap="BaseResultMap">
     select
@@ -130,7 +133,8 @@
       video_id, `source`, video_title, 
       video_cover, video_path, production_path, 
       root_source_id, root_share_id, `index`, 
-      trace_id, wx_url, is_delete, 
+      trace_id, wx_url, crawler_video_id, 
+      video_oss_path, user_id, is_delete, 
       create_time, update_time)
     values (#{id,jdbcType=BIGINT}, #{contentId,jdbcType=BIGINT}, #{planAccountId,jdbcType=BIGINT}, 
       #{publishContentId,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, 
@@ -138,7 +142,8 @@
       #{videoId,jdbcType=BIGINT}, #{source,jdbcType=VARCHAR}, #{videoTitle,jdbcType=VARCHAR}, 
       #{videoCover,jdbcType=VARCHAR}, #{videoPath,jdbcType=VARCHAR}, #{productionPath,jdbcType=VARCHAR}, 
       #{rootSourceId,jdbcType=VARCHAR}, #{rootShareId,jdbcType=VARCHAR}, #{index,jdbcType=INTEGER}, 
-      #{traceId,jdbcType=VARCHAR}, #{wxUrl,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, 
+      #{traceId,jdbcType=VARCHAR}, #{wxUrl,jdbcType=VARCHAR}, #{crawlerVideoId,jdbcType=INTEGER}, 
+      #{videoOssPath,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.longarticle.model.po.PublishMiniprogram">
@@ -204,6 +209,15 @@
       <if test="wxUrl != null">
         wx_url,
       </if>
+      <if test="crawlerVideoId != null">
+        crawler_video_id,
+      </if>
+      <if test="videoOssPath != null">
+        video_oss_path,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
       <if test="isDelete != null">
         is_delete,
       </if>
@@ -275,6 +289,15 @@
       <if test="wxUrl != null">
         #{wxUrl,jdbcType=VARCHAR},
       </if>
+      <if test="crawlerVideoId != null">
+        #{crawlerVideoId,jdbcType=INTEGER},
+      </if>
+      <if test="videoOssPath != null">
+        #{videoOssPath,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=VARCHAR},
+      </if>
       <if test="isDelete != null">
         #{isDelete,jdbcType=INTEGER},
       </if>
@@ -355,6 +378,15 @@
       <if test="record.wxUrl != null">
         wx_url = #{record.wxUrl,jdbcType=VARCHAR},
       </if>
+      <if test="record.crawlerVideoId != null">
+        crawler_video_id = #{record.crawlerVideoId,jdbcType=INTEGER},
+      </if>
+      <if test="record.videoOssPath != null">
+        video_oss_path = #{record.videoOssPath,jdbcType=VARCHAR},
+      </if>
+      <if test="record.userId != null">
+        user_id = #{record.userId,jdbcType=VARCHAR},
+      </if>
       <if test="record.isDelete != null">
         is_delete = #{record.isDelete,jdbcType=INTEGER},
       </if>
@@ -391,6 +423,9 @@
       `index` = #{record.index,jdbcType=INTEGER},
       trace_id = #{record.traceId,jdbcType=VARCHAR},
       wx_url = #{record.wxUrl,jdbcType=VARCHAR},
+      crawler_video_id = #{record.crawlerVideoId,jdbcType=INTEGER},
+      video_oss_path = #{record.videoOssPath,jdbcType=VARCHAR},
+      user_id = #{record.userId,jdbcType=VARCHAR},
       is_delete = #{record.isDelete,jdbcType=INTEGER},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
       update_time = #{record.updateTime,jdbcType=TIMESTAMP}
@@ -458,6 +493,15 @@
       <if test="wxUrl != null">
         wx_url = #{wxUrl,jdbcType=VARCHAR},
       </if>
+      <if test="crawlerVideoId != null">
+        crawler_video_id = #{crawlerVideoId,jdbcType=INTEGER},
+      </if>
+      <if test="videoOssPath != null">
+        video_oss_path = #{videoOssPath,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=VARCHAR},
+      </if>
       <if test="isDelete != null">
         is_delete = #{isDelete,jdbcType=INTEGER},
       </if>
@@ -491,6 +535,9 @@
       `index` = #{index,jdbcType=INTEGER},
       trace_id = #{traceId,jdbcType=VARCHAR},
       wx_url = #{wxUrl,jdbcType=VARCHAR},
+      crawler_video_id = #{crawlerVideoId,jdbcType=INTEGER},
+      video_oss_path = #{videoOssPath,jdbcType=VARCHAR},
+      user_id = #{userId,jdbcType=VARCHAR},
       is_delete = #{isDelete,jdbcType=INTEGER},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_time = #{updateTime,jdbcType=TIMESTAMP}

+ 2 - 2
long-article-server/src/main/resources/mybatis-generator-config.xml

@@ -60,10 +60,10 @@
 <!--            <columnOverride column="cover_url" javaType="java.lang.String" jdbcType="LONGVARCHAR" />-->
 <!--        </table>-->
 <!--        <table tableName="long_articles_root_source_id" domainObjectName="RootSource" alias=""/>-->
-        <table tableName="long_articles_plan_account" domainObjectName="PlanAccount" alias=""/>
+<!--        <table tableName="long_articles_plan_account" domainObjectName="PlanAccount" alias=""/>-->
 <!--            <table tableName="long_articles_plan" domainObjectName="Plan" alias=""/>-->
 
-<!--                <table tableName="long_articles_publish_content" domainObjectName="PublishContent" alias=""/>-->
+                <table tableName="long_articles_publish_content" domainObjectName="PublishContent" alias=""/>
 <!--                <table tableName="long_articles_publish_miniprogram" domainObjectName="PublishMiniprogram" alias=""/>-->
 
     </context>