Procházet zdrojové kódy

删除无用代码 恢复需要代码

xueyiming před 5 měsíci
rodič
revize
33a13d3928

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

@@ -323,22 +323,22 @@ public class MatchVideoServiceImpl {
     }
 
     private String getRootContentId(String contentId) {
-//        ProducePlanExeRecordExample example = new ProducePlanExeRecordExample();
-//        example.createCriteria().andPlanExeIdEqualTo(contentId);
-//        List<ProducePlanExeRecord> producePlanExeRecords = producePlanExeRecordMapper.selectByExample(example);
-//        if (!CollectionUtils.isEmpty(producePlanExeRecords)) {
-//            String channelContentId = producePlanExeRecords.get(0).getChannelContentId();
-//            if (channelContentId == null) {
-//                return null;
-//            }
-//            PromotionSourceExample promotionSourceExample = new PromotionSourceExample();
-//            promotionSourceExample.createCriteria().andChannelContentIdEqualTo(channelContentId);
-//            List<PromotionSource> promotionSources = promotionSourceMapper.selectByExample(promotionSourceExample);
-//            if (CollectionUtils.isEmpty(promotionSources)) {
-//                return null;
-//            }
-//            return promotionSources.get(0).getRootProduceContentId();
-//        }
+        ProducePlanExeRecordExample example = new ProducePlanExeRecordExample();
+        example.createCriteria().andPlanExeIdEqualTo(contentId);
+        List<ProducePlanExeRecord> producePlanExeRecords = producePlanExeRecordMapper.selectByExample(example);
+        if (!CollectionUtils.isEmpty(producePlanExeRecords)) {
+            String channelContentId = producePlanExeRecords.get(0).getChannelContentId();
+            if (channelContentId == null) {
+                return null;
+            }
+            PromotionSourceExample promotionSourceExample = new PromotionSourceExample();
+            promotionSourceExample.createCriteria().andChannelContentIdEqualTo(channelContentId);
+            List<PromotionSource> promotionSources = promotionSourceMapper.selectByExample(promotionSourceExample);
+            if (CollectionUtils.isEmpty(promotionSources)) {
+                return null;
+            }
+            return promotionSources.get(0).getRootProduceContentId();
+        }
         return null;
     }
 

+ 0 - 85
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/GetContentUtil.java

@@ -1,85 +0,0 @@
-package com.tzld.piaoquan.longarticle.utils.other;
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Objects;
-
-public class GetContentUtil {
-    public static void main(String[] args) {
-        String articleTitle = "中国宣布重大消息,韩国被吓,美国不服气,俄罗斯和朝鲜都笑了!";
-        String articleContent = "在当前国际政治舞台上,中朝关系、朝鲜半岛安全局势以及广泛的国际政治关系如同一副错综复杂的画卷,引人注目。\n" +
-                "近期,中国外交部副部长孙卫东带领的代表团访问平壤的消息,为这幅画卷添上了新的一笔,引发了外界对中朝关系未来走向的广泛关注。\n" +
-                "自1949年10月6日中华人民共和国与朝鲜民主主义人民共和国正式建交以来,两国之间的友好合作关系历经风雨,但总体上保持稳定发展。\n" +
-                "两国在多个领域展开了深入合作,包括文化、教育、科技、体育和民生等领域,这些合作不仅加深了两国人民之间的相互理解和友谊,也为地区乃至全球的和平与发展作出了贡献。\n" +
-                "在经济领域,作为朝鲜的重要贸易伙伴和物质援助国,中国对于朝鲜的经济发展起着至关重要的支持作用。中国提供的各种援助,帮助朝鲜在经济上保持稳定,助推其发展。\n" +
-                "而在政治领域,中国一直致力于推动实现半岛无核化,维护朝鲜半岛及地区的和平稳定。在这一过程中,中朝两国保持了密切的沟通与协调。\n" +
-                "\n" +
-                "然而,朝鲜半岛的局势一直是国际政治关系中的一个热点问题。近年来,美国、日本和韩国加强了对朝鲜的军事压力,通过扩大联合军演、部署战略武器等方式,不断提升在半岛的军事存在感,这无疑增加了地区的紧张气氛。对此,俄罗斯表达了对朝鲜的支持,批评美日韩的军事行动,认为这些行动加剧了地区的不稳定因素。\n" +
-                "在这个背景下,中国外交部副部长孙卫东此次访问朝鲜,显得尤为重要。此访旨在深化中朝传统友好,特别是在两国建交75周年之际,进一步加强经济合作,并就朝鲜半岛局势等共同关心的国际和地区问题交换意见。\n" +
-                "这次访问不仅是两国关系发展的一个里程碑,也是在当前复杂国际形势下,中国致力于维护地区和平稳定、推动构建人类命运共同体理念的一个重要体现。\n" +
-                "中朝双方的此次接触,无疑将为推动解决朝鲜半岛问题、维护地区和平稳定发挥积极作用。作为朝鲜半岛问题的直接相关方和重要的地区国家,中国一直倡导通过对话和协商解决问题,反对外部势力的军事干预和压力策略,这一立场在当前形势下显得尤为重要。\n" +
-                "\n" +
-                "未来,随着国际形势的不断变化,中朝之间的合作将更加多元化和深入。两国之间不仅在经济上互为支持,在维护地区和平稳定、推动构建更加公正合理的国际政治经济新秩序方面,也将发挥更加积极的作用。\n" +
-                "作为国际社会的一份子,希望所有国家都能本着相互尊重、平等互利的原则,共同努力,为实现地区乃至全球的和平、稳定与发展作出应有的贡献。\n" +
-                "在国际政治的大棋局中,中朝关系、朝鲜半岛的安全局势和国际政治关系的发展方向,始终是全球关注的焦点。本次中国外交部副部长孙卫东访问朝鲜,不仅是对两国传统友谊的再次肯定,更是在复杂的国际环境中,为维护地区和平稳定、推动构建人类命运共同体贡献中国的智慧和力量。\n" +
-                "让我们共同关注并支持这一重要的外交行动,期待它为地区乃至全球的和平与发展带来积极影响。转发此消息,让更多人了解国际局势的最新动向,共同为世界和平与稳定发声。";
-        String titleTxt = articleTitle + "\n" + promptGenerate("title");
-//        String kimiTitle = KimiAPI.chat(titleTxt);
-        String kimiTitle = "";
-        if (StringUtils.isEmpty(kimiTitle)) {
-            kimiTitle = GptAPI.chat(titleTxt);
-        }
-        if (StringUtils.isEmpty(kimiTitle)) {
-            //TODO 处理异常
-            System.out.println("error");
-        }
-        kimiTitle = kimiTitle.replaceAll("'", "").replaceAll("\"", "").replace("\\", "");
-        System.out.println(kimiTitle);
-        String contentTxt = promptGenerate("text") + "\n" + articleContent;
-//        String kimiContent = KimiAPI.chat(contentTxt);
-        String kimiContent = "";
-        if (StringUtils.isEmpty(kimiContent)) {
-            kimiContent = GptAPI.chat(contentTxt);
-        }
-        if (StringUtils.isEmpty(kimiContent)) {
-            //TODO 处理异常
-            System.out.println("error");
-        }
-        JSONObject jsonObject = JSONObject.parseObject(kimiContent);
-
-
-    }
-
-
-    public static String promptGenerate(String promptType) {
-        if (Objects.equals(promptType, "title")) {
-            return " 请将以上标题改写成适合小程序点击和传播的小程序标题,小程序标题的写作规范如下,请学习后进行小程序标题的编写。直接输出最终的小程序标题\n" +
-                    "                小程序标题写作规范:\n" +
-                    "                1.要点前置:将最重要的信息放在标题的最前面,以快速吸引读者的注意力。例如,“5月一辈子同学,三辈子亲,送给我的老同学,听哭无数人!”中的“5月”和“一辈子同学,三辈子亲”都是重要的信息点。\n" +
-                    "                2.激发情绪:使用能够触动人心的语言,激发读者的情感共鸣。如“只剩两人同学聚会,看后感动落泪。”使用“感动落泪”激发读者的同情和怀旧情绪。\n" +
-                    "                3.使用数字和特殊符号:数字可以提供具体性,而特殊符号如“\uD83D\uDD34”、“\uD83D\uDE04”、“\uD83D\uDD25”等可以吸引视觉注意力,增加点击率。\n" +
-                    "                4.悬念和好奇心:创建悬念或提出问题,激发读者的好奇心。例如,“太神奇了!长江水位下降,重庆出现惊奇一幕!”中的“惊奇一幕”就是一个悬念。\n" +
-                    "                5.名人效应:如果内容与知名人士相关,提及他们的名字可以增加标题的吸引力。\n" +
-                    "                6.社会价值观:触及读者的文化和社会价值观,如家庭、友情、国家荣誉等。\n" +
-                    "                7.标点符号的运用:使用感叹号、问号等标点来增强语气和情感表达。\n" +
-                    "                8.直接的语言:使用直白、口语化的语言,易于理解,如“狗屁股,笑死我了!”。\n" +
-                    "                9.热点人物或事件:提及当前的热点人物或事件,利用热点效应吸引读者。\n" +
-                    "                10.字数适中:保持标题在10-20个字之间,既不过长也不过短,确保信息的完整性和吸引力。\n" +
-                    "                11.适当的紧迫感:使用“最新”、“首次”、“紧急”等词汇,创造一种紧迫感,促使读者立即行动。\n" +
-                    "                12.情感或价值诉求:使用如“感动”、“泪目”、“经典”等词汇,直接与读者的情感或价值观产生共鸣。\n" +
-                    "                避免误导:确保标题准确反映内容,避免夸大或误导读者。";
-
-        } else if (Objects.equals(promptType, "text")) {
-            return "请从我给你的文章中挖掘出以下信息并且返回如下结果。\n" +
-                    "                你返回的结果是一个 json, 格式如下:\n" +
-                    "                {\n" +
-                    "                    \"content_keys\": [] # 同时提供三个与文章内容高度相关的关键词,这些关键词将用于网络上搜索相关视频内容,\n" +
-                    "                    \"content_title\": 一个总结性的标题,该标题应简洁并能够反映文章的主要内容\n" +
-                    "                }\n" +
-                    "                你需要处理的文本是:";
-        } else {
-            return "用中文帮我回答以下问题";
-        }
-    }
-}

+ 0 - 92
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/HttpClientUtil.java

@@ -1,92 +0,0 @@
-package com.tzld.piaoquan.longarticle.utils.other;
-
-import com.tzld.piaoquan.longarticle.utils.HttpPoolClientUtil;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * http util
- *
- * @author xueyiming
- */
-public class HttpClientUtil {
-
-    private static final String DEFAULT_SHARED_KEY = "DEFAULT_SHARED_KEY";
-
-    /**
-     * 链接建立的超时时间 ms
-     */
-    private static final int DEFAULT_CONNECTION_TIMEOUT = 3000;
-    /**
-     * 响应超时时间 ms
-     */
-    private static final int DEFAULT_SOCKET_TIMEOUT = 3000;
-
-    /**
-     * 每个路由的最大连接数
-     */
-    private static final int DEFAULT_DEFAULT_MAX_PER_ROUTE = 50;
-
-    /**
-     * 最大连接数
-     */
-    private static final int DEFAULT_DEFAULT_MAX_TOTAL = 200;
-
-    /**
-     * 重试次数,默认0
-     */
-    private static final int DEFAULT_RETRY_COUNT = 5;
-
-    /**
-     * 从connection pool中获得一个connection的超时时间 ms
-     */
-    private static final int DEFAULT_CONNECTION_WAIT_TIMEOUT = 300;
-
-    private static final Map<String, HttpPoolClientUtil> CREATED_HTTP_CLIENTS = new HashMap<>();
-
-    private static final Lock LOCK = new ReentrantLock();
-
-    private HttpClientUtil() {
-    }
-
-    public static HttpPoolClientUtil useDefault() {
-        return createCached(DEFAULT_SHARED_KEY);
-    }
-
-
-    public static HttpPoolClientUtil createCached(String cachedKey) {
-        HttpPoolClientUtil httpPoolClientUtil = CREATED_HTTP_CLIENTS.get(cachedKey);
-        if (httpPoolClientUtil != null) {
-            return httpPoolClientUtil;
-        }
-        LOCK.lock();
-        try {
-            httpPoolClientUtil = CREATED_HTTP_CLIENTS.get(cachedKey);
-            if (httpPoolClientUtil == null) {
-                httpPoolClientUtil = create(DEFAULT_CONNECTION_TIMEOUT, DEFAULT_SOCKET_TIMEOUT, DEFAULT_DEFAULT_MAX_PER_ROUTE, DEFAULT_DEFAULT_MAX_TOTAL, DEFAULT_RETRY_COUNT, DEFAULT_CONNECTION_WAIT_TIMEOUT);
-                CREATED_HTTP_CLIENTS.put(cachedKey, httpPoolClientUtil);
-            }
-        } finally {
-            LOCK.unlock();
-        }
-        return httpPoolClientUtil;
-    }
-
-    /**
-     * 创建httpclient
-     *
-     * @param connectTimeout        连接超时时间 ms
-     * @param socketTimeout         读超时时间(等待数据超时时间)ms
-     * @param maxPerRoute           每个路由的最大连接数
-     * @param maxTotal              最大连接数
-     * @param retryCount            重试次数
-     * @param connectionWaitTimeout 连接等待超市时间 ms
-     * @return httpclient instance
-     */
-    public static HttpPoolClientUtil create(int connectTimeout, int socketTimeout, int maxPerRoute, int maxTotal, int retryCount, int connectionWaitTimeout) {
-        return HttpPoolClientUtil.create(connectTimeout, socketTimeout, maxPerRoute, maxTotal, retryCount, connectionWaitTimeout);
-    }
-}

+ 0 - 193
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/HttpPoolClientUtil.java

@@ -1,193 +0,0 @@
-package com.tzld.piaoquan.longarticle.utils.other;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.concurrent.BasicThreadFactory;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.*;
-import org.apache.http.config.Registry;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.conn.HttpClientConnectionManager;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.NoopHostnameVerifier;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.ssl.SSLContexts;
-import org.apache.http.util.EntityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-import javax.net.ssl.SSLContext;
-import java.io.File;
-import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.nio.charset.StandardCharsets;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * http client
- *
- * @author xueyiming
- */
-public class HttpPoolClientUtil {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(HttpPoolClientUtil.class);
-
-    private static final ScheduledExecutorService SCHEDULED_CLOSED_EXECUTOR = new ScheduledThreadPoolExecutor(1,
-            new BasicThreadFactory.Builder().namingPattern("http conn-closed-thread-%s").priority(Thread.NORM_PRIORITY).daemon(false).build(), (r, e) -> LOGGER.error(" monitor push reject task error={}", e.toString()));
-
-    private static final List<HttpClientConnectionManager> HTTP_CLIENT_CONNECTION_MANAGERS = Lists.newArrayList();
-
-    static {
-        SCHEDULED_CLOSED_EXECUTOR.schedule(() -> HTTP_CLIENT_CONNECTION_MANAGERS.forEach(HttpClientConnectionManager::closeExpiredConnections), 5, TimeUnit.SECONDS);
-    }
-
-    private CloseableHttpClient closeableHttpClient;
-
-    private HttpPoolClientUtil(CloseableHttpClient closeableHttpClient) {
-        this.closeableHttpClient = closeableHttpClient;
-    }
-
-    private static HttpRequestInterceptor getInterceptor() {
-        HttpRequestInterceptor requestInterceptor = (request, context) -> {
-            try {
-                String missSpanId = MDC.get("missSpanId");
-                String missTraceId = MDC.get("request-id");
-                if (missTraceId != null && !"".equals(missTraceId.trim())) {
-                    request.setHeader("request-id", missTraceId);
-                }
-                if (missSpanId != null && !"".equals(missSpanId.trim())) {
-                    request.setHeader("missSpanId", missSpanId);
-                }
-            } catch (Exception e) {
-                LOGGER.error(e.getMessage(), e);
-            }
-        };
-        return requestInterceptor;
-    }
-
-
-    public String get(String url) throws IOException {
-        HttpGet httpGet = new HttpGet(url);
-        return request(httpGet);
-    }
-
-    public String post(String url) throws IOException {
-        HttpPost httpPost = new HttpPost(url);
-        return request(httpPost);
-    }
-
-
-    public String post(String url, String json) throws IOException {
-        HttpPost httpPost = new HttpPost(url);
-        if (StringUtils.isBlank(json)) {
-            return request(httpPost);
-        }
-        StringEntity entity = new StringEntity(json, StandardCharsets.UTF_8);
-        entity.setContentEncoding("UTF-8");
-        entity.setContentType("application/json");
-        httpPost.setEntity(entity);
-        return request(httpPost);
-    }
-
-    public String post(String url, File file) throws IOException {
-        HttpPost uploadFile = new HttpPost(url);
-        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
-        builder.addBinaryBody("media", file);
-        uploadFile.setEntity(builder.build());
-        return request(uploadFile);
-    }
-
-    public String request(HttpRequestBase request) throws IOException {
-
-        if (LOGGER.isDebugEnabled()) {
-            String path = request.getURI().toString();
-            LOGGER.debug("http request url = {} ", path);
-        }
-        HttpEntity entity = null;
-        CloseableHttpResponse response = request((HttpUriRequest) request);
-        if (response == null) {
-            throw new RuntimeException("call api exception no response");
-        }
-        entity = response.getEntity();
-        String content = null;
-        if (entity != null) {
-            content = EntityUtils.toString(entity, "UTF-8");
-        }
-        int httpStatus = response.getStatusLine().getStatusCode();
-        if (httpStatus == HttpStatus.SC_OK) {
-            return content;
-        }
-        String path = request.getURI().toString();
-        LOGGER.error("http call api {} fail response status {} content {}", path, httpStatus, content);
-//            throw new HttpServiceException(httpStatus, content);
-        return null;
-    }
-
-
-    public CloseableHttpResponse request(HttpUriRequest request) {
-        try {
-            CloseableHttpResponse execute = closeableHttpClient.execute(request);
-            return execute;
-        } catch (Exception e) {
-            String path = request.getURI().toString();
-            if (e instanceof SocketTimeoutException) {
-                LOGGER.error(String.format("http timeout request url = %s .", path));
-//                throw new TimeoutException();
-            } else {
-            }
-            throw new RuntimeException(String.format("http exception request url = %s ", path), e);
-        }
-    }
-
-    /**
-     * @param connectTimeout 连接超时时间 ms
-     * @param socketTimeout  读超时时间(等待数据超时时间)ms
-     * @param maxPerRoute    每个路由的最大连接数
-     * @param maxTotal       最大连接数
-     * @param retryCount     重试次数
-     * @return httpclient instance
-     */
-    protected static HttpPoolClientUtil create(int connectTimeout, int socketTimeout, int maxPerRoute, int maxTotal, int retryCount, int connectionWaitTimeout) {
-        try {
-            RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(connectTimeout).setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionWaitTimeout).build();
-            CloseableHttpClient client = HttpClientBuilder.create()
-                    .setDefaultRequestConfig(requestConfig)
-                    .setConnectionManager(createConnectionManager(maxPerRoute, maxTotal))
-                    .setRetryHandler(new DefaultHttpRequestRetryHandler(retryCount, false)).addInterceptorFirst(getInterceptor()).build();
-            return new HttpPoolClientUtil(client);
-        } catch (Throwable e) {
-            LOGGER.error("create HttpPoolClient exception", e);
-            throw new RuntimeException("create HttpPoolClient exception");
-        }
-    }
-
-    private static PoolingHttpClientConnectionManager createConnectionManager(int maxPerRoute, int maxTotal) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
-        SSLContext sslContext = SSLContexts.custom().loadTrustMaterial((chain, authType) -> true).build();
-        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
-                .register("http", PlainConnectionSocketFactory.getSocketFactory())
-                .register("https", new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)).build();
-        PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
-        cm.setDefaultMaxPerRoute(maxPerRoute);
-        cm.setMaxTotal(maxTotal);
-        HTTP_CLIENT_CONNECTION_MANAGERS.add(cm);
-        return cm;
-    }
-
-}

+ 3 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/KimiAPI.java

@@ -3,12 +3,14 @@ package com.tzld.piaoquan.longarticle.utils.other;
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 public class KimiAPI {
 
     /**
@@ -49,7 +51,7 @@ public class KimiAPI {
             message = result.getJSONObject("message");
             return message.getString("content");
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("KimiAPI chat error", e);
         }
         return "";
     }

+ 3 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/OSSUploader.java

@@ -3,10 +3,12 @@ package com.tzld.piaoquan.longarticle.utils.other;
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
 import com.aliyun.oss.model.PutObjectRequest;
+import lombok.extern.slf4j.Slf4j;
 
 import java.io.File;
 import java.util.UUID;
 
+@Slf4j
 public class OSSUploader {
 
     private static final String ACCESS_KEY_ID = "LTAIP6x1l3DXfSxm"; // 填写您的 Access Key ID
@@ -27,7 +29,7 @@ public class OSSUploader {
             ossClient.putObject(putObjectRequest);
             return ossVideoKey;
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("OSSUploader uploadToOSS error", e);
             return null;
         } finally {
             // 关闭 OSSClient

+ 0 - 32
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/SearchUtils.java

@@ -1,32 +0,0 @@
-package com.tzld.piaoquan.longarticle.utils.other;
-
-import com.alibaba.fastjson.JSONObject;
-import org.springframework.util.CollectionUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SearchUtils {
-    public List<JSONObject> searchVideo(String keyword, List<String> words, String traceId) {
-        List<JSONObject> douyinSearch = DouyinSearch.douyinSearch(keyword, words, traceId);
-        if (!CollectionUtils.isEmpty(douyinSearch)) {
-            for (JSONObject jsonObject : douyinSearch) {
-                jsonObject.put("platform", "dy_search");
-            }
-            return douyinSearch;
-        }
-//        List<JSONObject> jsonObjects1 = HkspSearch.hkspSearch(keyword, words, traceId);
-//        if (CollectionUtils.isEmpty(jsonObjects1)) {
-//            return jsonObjects;
-//        }
-//        for (JSONObject jsonObject : jsonObjects1) {
-//            jsonObject.put("platform", "baidu_search");
-//        }
-//        if (CollectionUtils.isEmpty(jsonObjects)) {
-//            return jsonObjects1;
-//        }
-//        jsonObjects.addAll(jsonObjects1);
-//        return jsonObjects;
-        return null;
-    }
-}

+ 0 - 55
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/SortUtil.java

@@ -1,55 +0,0 @@
-package com.tzld.piaoquan.longarticle.utils.other;
-
-
-import cn.hutool.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class SortUtil {
-
-    private static double jcdTitleSimilarity(String oriTitle, String searchTitle) {
-        Set<Character> set1 = new HashSet<>();
-        for (char c : oriTitle.toCharArray()) {
-            set1.add(c);
-        }
-
-        Set<Character> set2 = new HashSet<>();
-        for (char c : searchTitle.toCharArray()) {
-            set2.add(c);
-        }
-
-        Set<Character> intersection = new HashSet<>(set1);
-        intersection.retainAll(set2);
-
-        Set<Character> union = new HashSet<>(set1);
-        union.addAll(set2);
-
-        return (double) intersection.size() / union.size();
-    }
-
-    public static List<JSONObject> titleSimilarityRank(String contentTitle, List<JSONObject> recallList) {
-        List<JSONObject> includeTitleList = new ArrayList<>();
-        for (JSONObject videoInfo : recallList) {
-            String platform = (String) videoInfo.get("platform");
-            String title = "";
-
-            if (platform.equals("dy_search") || platform.equals("baidu_search")) {
-                title = (String) videoInfo.get("title");
-            } else if (platform.equals("xg_search")) {
-                title = (String) videoInfo.get("video_title");
-            } else {
-                continue;
-            }
-
-            videoInfo.put("title", title);
-            videoInfo.put("score", jcdTitleSimilarity(contentTitle, title));
-            includeTitleList.add(videoInfo);
-        }
-
-        includeTitleList.sort((a, b) -> Double.compare((double) b.get("score"), (double) a.get("score")));
-        return includeTitleList;
-    }
-}