瀏覽代碼

增加小程序发布

xueyiming 5 月之前
父節點
當前提交
b248a964f6

+ 2 - 2
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/common/enums/ContentStatusEnum.java

@@ -1,8 +1,8 @@
 package com.tzld.piaoquan.longarticle.common.enums;
 
 public enum ContentStatusEnum {
-    SUCCESS_3(3, "成功"),
-    SUCCESS_4(4, "成功"),
+    SUCCESS_3(3, "下载成功"),
+    SUCCESS_4(4, "发布成功"),
     ERROR_95(95, "KIMI识别文章风险不处理"),
     ERROR_96(96, "文章品类处于账号的负向品类中"),
     ERROR_97(97, "文章晋级或者退场"),

+ 23 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/common/enums/PublicFlagEnum.java

@@ -0,0 +1,23 @@
+package com.tzld.piaoquan.longarticle.common.enums;
+
+public enum PublicFlagEnum {
+
+    PUBLIC(1, "发布"),
+    NOT_PUBLIC(2, "不发布");
+
+    private final int statusCode;
+    private final String message;
+
+    PublicFlagEnum(int statusCode, String message) {
+        this.statusCode = statusCode;
+        this.message = message;
+    }
+
+    public int getStatusCode() {
+        return statusCode;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+}

+ 30 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/dao/mapper/longarticle/TitleAuditMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.longarticle.dao.mapper.longarticle;
+
+import com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit;
+import com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAuditExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface TitleAuditMapper {
+    long countByExample(TitleAuditExample example);
+
+    int deleteByExample(TitleAuditExample example);
+
+    int deleteByPrimaryKey(String contentId);
+
+    int insert(TitleAudit record);
+
+    int insertSelective(TitleAudit record);
+
+    List<TitleAudit> selectByExample(TitleAuditExample example);
+
+    TitleAudit selectByPrimaryKey(String contentId);
+
+    int updateByExampleSelective(@Param("record") TitleAudit record, @Param("example") TitleAuditExample example);
+
+    int updateByExample(@Param("record") TitleAudit record, @Param("example") TitleAuditExample example);
+
+    int updateByPrimaryKeySelective(TitleAudit record);
+
+    int updateByPrimaryKey(TitleAudit record);
+}

+ 11 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/job/MatchVideoJob.java

@@ -37,4 +37,15 @@ public class MatchVideoJob {
         }
         return ReturnT.SUCCESS;
     }
+
+    @XxlJob("publishCrawlerVideo")
+    public ReturnT<String> publishCrawlerVideoJob(String param) {
+        try {
+            matchVideoService.publishCrawlerVideo();
+        } catch (Exception e) {
+            LarkRobotUtil.sendMessage("publishCrawlerVideoJob异常,请及时查看,@薛一鸣");
+            log.error("publishCrawlerVideoJob error", e);
+        }
+        return ReturnT.SUCCESS;
+    }
 }

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

@@ -0,0 +1,68 @@
+package com.tzld.piaoquan.longarticle.model.po.longarticle;
+
+public class TitleAudit {
+    private String contentId;
+
+    private Integer status;
+
+    private Long createTimestamp;
+
+    private String auditAccount;
+
+    private Long auditTimestamp;
+
+    public String getContentId() {
+        return contentId;
+    }
+
+    public void setContentId(String contentId) {
+        this.contentId = contentId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    public String getAuditAccount() {
+        return auditAccount;
+    }
+
+    public void setAuditAccount(String auditAccount) {
+        this.auditAccount = auditAccount;
+    }
+
+    public Long getAuditTimestamp() {
+        return auditTimestamp;
+    }
+
+    public void setAuditTimestamp(Long auditTimestamp) {
+        this.auditTimestamp = auditTimestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", contentId=").append(contentId);
+        sb.append(", status=").append(status);
+        sb.append(", createTimestamp=").append(createTimestamp);
+        sb.append(", auditAccount=").append(auditAccount);
+        sb.append(", auditTimestamp=").append(auditTimestamp);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -0,0 +1,531 @@
+package com.tzld.piaoquan.longarticle.model.po.longarticle;
+
+import com.tzld.piaoquan.longarticle.utils.page.Page;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TitleAuditExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public TitleAuditExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andContentIdIsNull() {
+            addCriterion("content_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdIsNotNull() {
+            addCriterion("content_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdEqualTo(String value) {
+            addCriterion("content_id =", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdNotEqualTo(String value) {
+            addCriterion("content_id <>", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdGreaterThan(String value) {
+            addCriterion("content_id >", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdGreaterThanOrEqualTo(String value) {
+            addCriterion("content_id >=", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdLessThan(String value) {
+            addCriterion("content_id <", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdLessThanOrEqualTo(String value) {
+            addCriterion("content_id <=", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdLike(String value) {
+            addCriterion("content_id like", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdNotLike(String value) {
+            addCriterion("content_id not like", value, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdIn(List<String> values) {
+            addCriterion("content_id in", values, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdNotIn(List<String> values) {
+            addCriterion("content_id not in", values, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdBetween(String value1, String value2) {
+            addCriterion("content_id between", value1, value2, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIdNotBetween(String value1, String value2) {
+            addCriterion("content_id not between", value1, value2, "contentId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNull() {
+            addCriterion("`status` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNotNull() {
+            addCriterion("`status` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusEqualTo(Integer value) {
+            addCriterion("`status` =", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotEqualTo(Integer value) {
+            addCriterion("`status` <>", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThan(Integer value) {
+            addCriterion("`status` >", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
+            addCriterion("`status` >=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThan(Integer value) {
+            addCriterion("`status` <", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThanOrEqualTo(Integer value) {
+            addCriterion("`status` <=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIn(List<Integer> values) {
+            addCriterion("`status` in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotIn(List<Integer> values) {
+            addCriterion("`status` not in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusBetween(Integer value1, Integer value2) {
+            addCriterion("`status` between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotBetween(Integer value1, Integer value2) {
+            addCriterion("`status` not between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNull() {
+            addCriterion("create_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNotNull() {
+            addCriterion("create_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampEqualTo(Long value) {
+            addCriterion("create_timestamp =", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotEqualTo(Long value) {
+            addCriterion("create_timestamp <>", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThan(Long value) {
+            addCriterion("create_timestamp >", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp >=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThan(Long value) {
+            addCriterion("create_timestamp <", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp <=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIn(List<Long> values) {
+            addCriterion("create_timestamp in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotIn(List<Long> values) {
+            addCriterion("create_timestamp not in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp not between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountIsNull() {
+            addCriterion("audit_account is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountIsNotNull() {
+            addCriterion("audit_account is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountEqualTo(String value) {
+            addCriterion("audit_account =", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountNotEqualTo(String value) {
+            addCriterion("audit_account <>", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountGreaterThan(String value) {
+            addCriterion("audit_account >", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountGreaterThanOrEqualTo(String value) {
+            addCriterion("audit_account >=", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountLessThan(String value) {
+            addCriterion("audit_account <", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountLessThanOrEqualTo(String value) {
+            addCriterion("audit_account <=", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountLike(String value) {
+            addCriterion("audit_account like", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountNotLike(String value) {
+            addCriterion("audit_account not like", value, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountIn(List<String> values) {
+            addCriterion("audit_account in", values, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountNotIn(List<String> values) {
+            addCriterion("audit_account not in", values, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountBetween(String value1, String value2) {
+            addCriterion("audit_account between", value1, value2, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditAccountNotBetween(String value1, String value2) {
+            addCriterion("audit_account not between", value1, value2, "auditAccount");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampIsNull() {
+            addCriterion("audit_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampIsNotNull() {
+            addCriterion("audit_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampEqualTo(Long value) {
+            addCriterion("audit_timestamp =", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampNotEqualTo(Long value) {
+            addCriterion("audit_timestamp <>", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampGreaterThan(Long value) {
+            addCriterion("audit_timestamp >", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("audit_timestamp >=", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampLessThan(Long value) {
+            addCriterion("audit_timestamp <", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("audit_timestamp <=", value, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampIn(List<Long> values) {
+            addCriterion("audit_timestamp in", values, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampNotIn(List<Long> values) {
+            addCriterion("audit_timestamp not in", values, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampBetween(Long value1, Long value2) {
+            addCriterion("audit_timestamp between", value1, value2, "auditTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andAuditTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("audit_timestamp not between", value1, value2, "auditTimestamp");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

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

@@ -3,6 +3,8 @@ package com.tzld.piaoquan.longarticle.service.local.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
+import com.tzld.piaoquan.longarticle.common.enums.ContentStatusEnum;
+import com.tzld.piaoquan.longarticle.common.enums.PublicFlagEnum;
 import com.tzld.piaoquan.longarticle.common.enums.PublishGzhPushTypeEnum;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.CrawlerVideoMapper;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.MatchVideoMapper;
@@ -104,8 +106,8 @@ public class ContentServiceImpl implements ContentService {
             String traceId = matchVideo.getTraceId();
             MatchVideo updateMatchVideo = new MatchVideo();
             updateMatchVideo.setId(matchVideo.getId());
-            updateMatchVideo.setContentStatus(4);
-            updateMatchVideo.setPublishFlag(2);
+            updateMatchVideo.setContentStatus(ContentStatusEnum.SUCCESS_4.getStatusCode());
+            updateMatchVideo.setPublishFlag(PublicFlagEnum.NOT_PUBLIC.getStatusCode());
             updateMatchVideo.setResponse(jsonArray.toJSONString());
             matchVideoMapper.updateByPrimaryKeySelective(updateMatchVideo);
             publicContentService.updatePublishContentTraceId(traceId, publishContent.getId());
@@ -215,17 +217,17 @@ public class ContentServiceImpl implements ContentService {
         return data.getRank_list();
     }
 
-    public List<VideoDetail> getPublishVideoDetail(PublishContent publishContent, PlanAccount planAccount, MatchVideo matchVideo) {
-        List<CrawlerVideo> contentMiniVideos = getContentMiniVideo(publishContent, planAccount);
+    public List<VideoDetail> getPublishVideoDetail(MatchVideo matchVideo, Integer publicFlag) {
+        List<CrawlerVideo> contentMiniVideos = getContentMiniVideo(matchVideo.getContentId(), publicFlag);
         log.info("getPublishVideoDetail contentMiniVideos={}", contentMiniVideos);
         if (CollectionUtils.isEmpty(contentMiniVideos)) {
-            LarkRobotUtil.sendMessage("文章获取小程序为空 publishContent.getSourceId=" + publishContent.getSourceId());
+            LarkRobotUtil.sendMessage("文章获取小程序为空 matchVideo.getContentId" + matchVideo.getContentId());
             return new ArrayList<>();
         }
         List<VideoDetail> videoDetails = publishVideo(contentMiniVideos, matchVideo);
         log.info("getPublishVideoDetail videoDetails={}", videoDetails);
         if (CollectionUtils.isEmpty(videoDetails)) {
-            LarkRobotUtil.sendMessage("发布后小程序为空 publishContent.getSourceId=" + publishContent.getSourceId());
+            LarkRobotUtil.sendMessage("发布后小程序为空 matchVideo.getContentId" + matchVideo.getContentId());
             return new ArrayList<>();
         }
         return videoDetails;
@@ -283,14 +285,16 @@ public class ContentServiceImpl implements ContentService {
     }
 
 
-    public List<CrawlerVideo> getContentMiniVideo(PublishContent publishContent, PlanAccount planAccount) {
+    public List<CrawlerVideo> getContentMiniVideo(String contentId, Integer publicFlag) {
         try {
             CrawlerVideoExample example = new CrawlerVideoExample();
             example.setOrderByClause("score desc");
-            example.createCriteria().andDownloadStatusEqualTo(2)
-                    .andContentIdEqualTo(publishContent.getSourceId())
-                    .andStatusEqualTo(1)
-                    .andIsIllegalEqualTo(0);
+            CrawlerVideoExample.Criteria criteria = example.createCriteria().andDownloadStatusEqualTo(2)
+                    .andContentIdEqualTo(contentId);
+            //不发布需要审核后才能使用
+            if (PublicFlagEnum.NOT_PUBLIC.getStatusCode() == publicFlag) {
+                criteria.andStatusEqualTo(1).andIsIllegalEqualTo(0);
+            }
             List<CrawlerVideo> crawlerVideoList = crawlerVideoMapper.selectByExample(example);
             List<CrawlerVideo> videoList = new ArrayList<>();
             if (!CollectionUtils.isEmpty(crawlerVideoList)) {

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

@@ -1007,7 +1007,7 @@ public class CoreServiceImpl implements CoreService {
                                 request.setStrategy("strategy_v2");
                                 request.setArticleId(matchContent.getSourceId());
                                 request.setFlowPoolLevelTag(matchContent.getFlowPoolLevelTag());
-                                request.setPublishFlag(2);
+                                request.setPublishFlag(PublicFlagEnum.NOT_PUBLIC.getStatusCode());
                                 Integer status = matchService.matchMiniprogramVideo(request);
                                 if (status == MatchRequestStatusEnum.NOT_CONTENT.getStatusCode()) {
                                     MatchMiniprogramStatusParam statusParam = new MatchMiniprogramStatusParam();
@@ -1283,7 +1283,8 @@ public class CoreServiceImpl implements CoreService {
                         if (matchVideo == null) {
                             continue;
                         }
-                        List<VideoDetail> videoDetails = contentService.getPublishVideoDetail(publishContent, planAccount, matchVideo);
+                        List<VideoDetail> videoDetails = contentService.
+                                getPublishVideoDetail(matchVideo, PublicFlagEnum.NOT_PUBLIC.getStatusCode());
                         log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
                         if (CollectionUtils.isEmpty(videoDetails)) {
                             continue;

+ 27 - 5
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CrawlerVideoServiceImpl.java

@@ -3,9 +3,11 @@ package com.tzld.piaoquan.longarticle.service.local.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.CrawlerVideoMapper;
+import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.TitleAuditMapper;
 import com.tzld.piaoquan.longarticle.model.po.longarticle.CrawlerVideo;
 import com.tzld.piaoquan.longarticle.model.po.longarticle.CrawlerVideoExample;
 import com.tzld.piaoquan.longarticle.model.po.longarticle.LongArticlesText;
+import com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit;
 import com.tzld.piaoquan.longarticle.utils.other.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -19,6 +21,7 @@ import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Random;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -28,6 +31,9 @@ public class CrawlerVideoServiceImpl {
     @Autowired
     private CrawlerVideoMapper crawlerVideoMapper;
 
+    @Autowired
+    private TitleAuditMapper titleAuditMapper;
+
     private static final String default_user_id = "69637498";
 
     private static final Double NLP_SIMILARITY_THRESHOLD = 0.45;
@@ -87,7 +93,23 @@ public class CrawlerVideoServiceImpl {
                 crawlerVideoMapper.insertSelective(crawlerVideo);
             }
         }
-        return pushOss(contentId);
+        boolean pushRes = pushOss(contentId);
+        if (pushRes) {
+            try {
+                Random random = new Random();
+                int randomInt = random.nextInt(10) + 97;
+                // 将随机整数转换为字符
+                char auditAccount = (char) randomInt;
+                TitleAudit titleAudit = new TitleAudit();
+                titleAudit.setContentId(contentId);
+                titleAudit.setAuditAccount(String.valueOf(auditAccount));
+                titleAudit.setCreateTimestamp(System.currentTimeMillis());
+                titleAuditMapper.insertSelective(titleAudit);
+            } catch (Exception e) {
+                log.error("addCrawlerVideo add titleAudit error", e);
+            }
+        }
+        return pushRes;
     }
 
     public boolean existCrawlerVideo(String contentId) {
@@ -100,16 +122,16 @@ public class CrawlerVideoServiceImpl {
 
     public List<CrawlerVideo> searchVideosFromWeb(LongArticlesText longArticlesText) {
         String articleSummary;
-        if(longArticlesText.getKimiSummary().length() > 15){
+        if (longArticlesText.getKimiSummary().length() > 15) {
             articleSummary = longArticlesText.getKimiSummary().substring(0, 15);
-        }else {
+        } else {
             articleSummary = longArticlesText.getKimiSummary();
         }
 
         String oriTitle;
-        if(longArticlesText.getKimiTitle().length() > 15){
+        if (longArticlesText.getKimiTitle().length() > 15) {
             oriTitle = longArticlesText.getKimiTitle().substring(0, 15);
-        }else {
+        } else {
             oriTitle = longArticlesText.getKimiTitle();
         }
         String kimiKeys = longArticlesText.getKimiKeys();

+ 103 - 38
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/MatchVideoServiceImpl.java

@@ -1,12 +1,16 @@
 package com.tzld.piaoquan.longarticle.service.local.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.longarticle.common.enums.ContentStatusEnum;
+import com.tzld.piaoquan.longarticle.common.enums.PublicFlagEnum;
 import com.tzld.piaoquan.longarticle.component.RedisLock;
 import com.tzld.piaoquan.longarticle.dao.mapper.aigc.ProducePlanExeRecordMapper;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.LongArticlesTextMapper;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.MatchVideoMapper;
 import com.tzld.piaoquan.longarticle.dao.mapper.longarticle.PromotionSourceMapper;
 import com.tzld.piaoquan.longarticle.model.bo.MatchContent;
+import com.tzld.piaoquan.longarticle.model.bo.VideoDetail;
 import com.tzld.piaoquan.longarticle.model.po.aigc.ProducePlanExeRecord;
 import com.tzld.piaoquan.longarticle.model.po.aigc.ProducePlanExeRecordExample;
 import com.tzld.piaoquan.longarticle.model.po.longarticle.*;
@@ -60,6 +64,9 @@ public class MatchVideoServiceImpl {
     @Autowired
     private PromotionSourceMapper promotionSourceMapper;
 
+    @Autowired
+    private ContentServiceImpl contentService;
+
 
     // 定义一个阻塞队列
     private static final ArrayBlockingQueue<MatchVideo> matchKimiVideoQueue = new ArrayBlockingQueue<>(100000);
@@ -141,8 +148,8 @@ public class MatchVideoServiceImpl {
             do {
                 Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
                 if (id == null) {
-                    redisTemplate.opsForValue().set("last_match_video_id", 0);
-                    id = 0;
+                    redisTemplate.opsForValue().set("last_match_video_id", 12864912);
+                    id = 12864912;
                 }
                 MatchVideoExample example = new MatchVideoExample();
                 example.createCriteria().andIdGreaterThan(id);
@@ -158,6 +165,10 @@ public class MatchVideoServiceImpl {
                         flag = false;
                         break;
                     }
+                    //需要发布的状态需要到4才能结束
+                    if (matchVideo.getContentStatus() == ContentStatusEnum.SUCCESS_3.getStatusCode() && matchVideo.getPublishFlag() == 1) {
+                        break;
+                    }
                 }
                 if (flag) {
                     Integer lastId = matchVideos.get(matchVideos.size() - 1).getId();
@@ -167,24 +178,24 @@ public class MatchVideoServiceImpl {
                 }
             } while (!CollectionUtils.isEmpty(matchVideos));
 
-            int pageNum = 1;
-            do {
-                Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
-                if (id == null) {
-                    break;
-                }
-                int pageSize = 5000;
-                MatchVideoExample example = new MatchVideoExample();
-                example.createCriteria().andIdGreaterThan(id).andContentStatusEqualTo(0);
-                example.setOrderByClause("id asc");
-                Page<Object> page = new Page<>();
-                page.setCurrentPage(pageNum);
-                page.setPageSize(pageSize);
-                example.setPage(page);
-                matchVideos = matchVideoMapper.selectByExample(example);
-                matchKimiVideoQueue.addAll(matchVideos);
-                pageNum++;
-            } while (!CollectionUtils.isEmpty(matchVideos));
+            Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
+            if (id != null) {
+                do {
+                    MatchVideoExample example = new MatchVideoExample();
+                    example.createCriteria().andIdGreaterThan(id).andContentStatusEqualTo(0);
+                    example.setOrderByClause("id asc");
+                    Page<Object> page = new Page<>();
+                    page.setCurrentPage(1);
+                    page.setPageSize(5000);
+                    example.setPage(page);
+                    matchVideos = matchVideoMapper.selectByExample(example);
+                    if (CollectionUtils.isEmpty(matchVideos)) {
+                        break;
+                    }
+                    id = matchVideos.get(matchVideos.size() - 1).getId();
+                    matchKimiVideoQueue.addAll(matchVideos);
+                } while (!CollectionUtils.isEmpty(matchVideos));
+            }
             countDownLatch.await();
         }
     }
@@ -243,26 +254,26 @@ public class MatchVideoServiceImpl {
                     countDownLatch.countDown();
                 }));
             }
-            int pageNum = 1;
             List<MatchVideo> matchVideos;
             List<Integer> status = Arrays.asList(1, 2);
-            do {
-                Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
-                if (id == null) {
-                    break;
-                }
-                int pageSize = 5000;
-                MatchVideoExample example = new MatchVideoExample();
-                example.createCriteria().andIdGreaterThan(id).andContentStatusIn(status);
-                example.setOrderByClause("id asc");
-                Page<Object> page = new Page<>();
-                page.setCurrentPage(pageNum);
-                page.setPageSize(pageSize);
-                example.setPage(page);
-                matchVideos = matchVideoMapper.selectByExample(example);
-                matchCrawlerVideoQueue.addAll(matchVideos);
-                pageNum++;
-            } while (!CollectionUtils.isEmpty(matchVideos));
+            Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
+            if (id != null) {
+                do {
+                    MatchVideoExample example = new MatchVideoExample();
+                    example.createCriteria().andIdGreaterThan(id).andContentStatusIn(status);
+                    example.setOrderByClause("id asc");
+                    Page<Object> page = new Page<>();
+                    page.setCurrentPage(1);
+                    page.setPageSize(5000);
+                    example.setPage(page);
+                    matchVideos = matchVideoMapper.selectByExample(example);
+                    if (CollectionUtils.isEmpty(matchVideos)) {
+                        break;
+                    }
+                    id = matchVideos.get(matchVideos.size() - 1).getId();
+                    matchCrawlerVideoQueue.addAll(matchVideos);
+                } while (!CollectionUtils.isEmpty(matchVideos));
+            }
             countDownLatch.await();
         }
     }
@@ -342,6 +353,60 @@ public class MatchVideoServiceImpl {
         return null;
     }
 
+    public void publishCrawlerVideo() {
+        List<MatchVideo> matchVideos;
+        Integer id = (Integer) redisTemplate.opsForValue().get("last_match_video_id");
+        if (id != null) {
+            do {
+                MatchVideoExample example = new MatchVideoExample();
+                example.createCriteria().andIdGreaterThan(id)
+                        .andContentStatusEqualTo(ContentStatusEnum.SUCCESS_3.getStatusCode())
+                        .andPublishFlagEqualTo(1);
+                example.setOrderByClause("id asc");
+                Page<Object> page = new Page<>();
+                page.setCurrentPage(1);
+                page.setPageSize(5000);
+                example.setPage(page);
+                matchVideos = matchVideoMapper.selectByExample(example);
+                if (CollectionUtils.isEmpty(matchVideos)) {
+                    break;
+                }
+                id = matchVideos.get(matchVideos.size() - 1).getId();
+                for (MatchVideo matchVideo : matchVideos) {
+                    processPublishCrawlerVideo(matchVideo);
+                }
+            } while (!CollectionUtils.isEmpty(matchVideos));
+        }
+    }
+
+    public void processPublishCrawlerVideo(MatchVideo matchVideo) {
+        List<VideoDetail> videoDetails = contentService.getPublishVideoDetail(matchVideo, PublicFlagEnum.PUBLIC.getStatusCode());
+        if (CollectionUtils.isEmpty(videoDetails)) {
+            return;
+        }
+        JSONArray response = getResponse(videoDetails);
+        matchVideo.setContentStatus(ContentStatusEnum.SUCCESS_4.getStatusCode());
+        matchVideo.setResponse(response.toJSONString());
+        matchVideoMapper.updateByPrimaryKeySelective(matchVideo);
+    }
+
+    private JSONArray getResponse(List<VideoDetail> videoDetails) {
+        JSONArray jsonArray = new JSONArray();
+        for (VideoDetail videoDetail : videoDetails) {
+            //生成match表json数据
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("uid", videoDetail.getUid());
+            jsonObject.put("source", videoDetail.getSource());
+            jsonObject.put("kimiTitle", videoDetail.getKimiTitle());
+            jsonObject.put("videoId", videoDetail.getVideoId());
+            jsonObject.put("videoCover", videoDetail.getShareImgPath());
+            jsonObject.put("videoPath", videoDetail.getVideoPath());
+            jsonObject.put("videoOss", videoDetail.getVideoOss());
+            jsonArray.add(jsonObject);
+        }
+        return jsonArray;
+    }
+
     private void updateStatus(Integer id, Integer status) {
         MatchVideo matchVideo = new MatchVideo();
         matchVideo.setId(id);

+ 214 - 0
long-article-server/src/main/resources/mapper/longarticle/TitleAuditMapper.xml

@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.longarticle.dao.mapper.longarticle.TitleAuditMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit">
+    <id column="content_id" jdbcType="VARCHAR" property="contentId" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
+    <result column="audit_account" jdbcType="VARCHAR" property="auditAccount" />
+    <result column="audit_timestamp" jdbcType="BIGINT" property="auditTimestamp" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    content_id, `status`, create_timestamp, audit_account, audit_timestamp
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAuditExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from long_articles_title_audit
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from long_articles_title_audit
+    where content_id = #{contentId,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from long_articles_title_audit
+    where content_id = #{contentId,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAuditExample">
+    delete from long_articles_title_audit
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit">
+    insert into long_articles_title_audit (content_id, `status`, create_timestamp, 
+      audit_account, audit_timestamp)
+    values (#{contentId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTimestamp,jdbcType=BIGINT}, 
+      #{auditAccount,jdbcType=VARCHAR}, #{auditTimestamp,jdbcType=BIGINT})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit">
+    insert into long_articles_title_audit
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="contentId != null">
+        content_id,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp,
+      </if>
+      <if test="auditAccount != null">
+        audit_account,
+      </if>
+      <if test="auditTimestamp != null">
+        audit_timestamp,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="contentId != null">
+        #{contentId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        #{createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="auditAccount != null">
+        #{auditAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="auditTimestamp != null">
+        #{auditTimestamp,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAuditExample" resultType="java.lang.Long">
+    select count(*) from long_articles_title_audit
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update long_articles_title_audit
+    <set>
+      <if test="record.contentId != null">
+        content_id = #{record.contentId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.status != null">
+        `status` = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTimestamp != null">
+        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="record.auditAccount != null">
+        audit_account = #{record.auditAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="record.auditTimestamp != null">
+        audit_timestamp = #{record.auditTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update long_articles_title_audit
+    set content_id = #{record.contentId,jdbcType=VARCHAR},
+      `status` = #{record.status,jdbcType=INTEGER},
+      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      audit_account = #{record.auditAccount,jdbcType=VARCHAR},
+      audit_timestamp = #{record.auditTimestamp,jdbcType=BIGINT}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit">
+    update long_articles_title_audit
+    <set>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="auditAccount != null">
+        audit_account = #{auditAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="auditTimestamp != null">
+        audit_timestamp = #{auditTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    where content_id = #{contentId,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.longarticle.model.po.longarticle.TitleAudit">
+    update long_articles_title_audit
+    set `status` = #{status,jdbcType=INTEGER},
+      create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      audit_account = #{auditAccount,jdbcType=VARCHAR},
+      audit_timestamp = #{auditTimestamp,jdbcType=BIGINT}
+    where content_id = #{contentId,jdbcType=VARCHAR}
+  </update>
+</mapper>

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

@@ -60,7 +60,7 @@
 <!--            <columnOverride column="cover_url" javaType="java.lang.String" jdbcType="LONGVARCHAR" />-->
 <!--        </table>-->
 <!--        <table tableName="long_articles_root_source_id" domainObjectName="RootSource" alias=""/>-->
-        <table tableName="article_pool_promotion_source" domainObjectName="PromotionSource" alias=""/>
+        <table tableName="long_articles_title_audit" domainObjectName="TitleAudit" alias=""/>
 <!--            <table tableName="long_articles_plan" domainObjectName="Plan" alias=""/>-->
 
 <!--                <table tableName="long_articles_publish_content" domainObjectName="PublishContent" alias=""/>-->