From 450083f7d9d5b687c732acddefb56632f7b3d5ad Mon Sep 17 00:00:00 2001
From: shikeying <shikeying@163.com>
Date: 星期一, 14 十一月 2022 12:53:39 +0800
Subject: [PATCH] 添加文本推荐API接口

---
 recommend-text/pom.xml                                                                   |   34 ++-
 recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java      |   29 +-
 deploy-jar-template/src/main/resources/application-test.yml                              |    5 
 recommend-common/pom.xml                                                                 |    7 
 deploy-jar-template/src/main/resources/application-dev.yml                               |    4 
 recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java    |    1 
 recommend-text/src/main/java/com/iplatform/rectext/pojo/UploadText.java                  |   44 +++++
 recommend-video/src/main/java/com/iplatform/recvideo/api/ShowResultApi.java              |    2 
 recommend-text/src/main/java/com/iplatform/rectext/pojo/TextSimilar.java                 |   40 +++++
 deploy-jar-template/pom.xml                                                              |    8 
 recommend-common/src/main/java/com/iplatform/reccommon/ResponseValue.java                |    2 
 recommend-text/src/main/java/com/iplatform/rectext/api/TextResultApi.java                |  211 ++++++++++++++++++++++++++
 recommend-common/src/main/java/com/iplatform/reccommon/config/RecommendConfig.java       |   29 +++
 recommend-text/src/main/java/com/iplatform/rectext/pojo/SearchRequest.java               |   27 +++
 recommend-common/src/main/java/com/iplatform/reccommon/config/TextSimilarProperties.java |   17 ++
 15 files changed, 426 insertions(+), 34 deletions(-)

diff --git a/deploy-jar-template/pom.xml b/deploy-jar-template/pom.xml
index 3f41e8c..571569a 100644
--- a/deploy-jar-template/pom.xml
+++ b/deploy-jar-template/pom.xml
@@ -18,10 +18,10 @@
 
     <dependencies>
 
-<!--        <dependency>-->
-<!--            <groupId>com.iplatform</groupId>-->
-<!--            <artifactId>recommend-text</artifactId>-->
-<!--        </dependency>-->
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>recommend-text</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>com.iplatform</groupId>
diff --git a/deploy-jar-template/src/main/resources/application-dev.yml b/deploy-jar-template/src/main/resources/application-dev.yml
index 50db6ae..5d3d644 100644
--- a/deploy-jar-template/src/main/resources/application-dev.yml
+++ b/deploy-jar-template/src/main/resources/application-dev.yml
@@ -109,6 +109,10 @@
     business-datasource-authentication: root
     business-datasource-certification: Bjjmy_2020
 
+  text:
+    # 鏂囨湰鐩镐技搴︽湇鍔RL
+    ai-service: http://116.198.39.83:54321
+
 #sftp:
 #  host: 124.70.39.177
 #  port: 22
diff --git a/deploy-jar-template/src/main/resources/application-test.yml b/deploy-jar-template/src/main/resources/application-test.yml
index 4e9ba89..a426d44 100644
--- a/deploy-jar-template/src/main/resources/application-test.yml
+++ b/deploy-jar-template/src/main/resources/application-test.yml
@@ -109,6 +109,11 @@
     business-datasource-authentication: root
     business-datasource-certification: Bjjmy_2020
 
+  text:
+    # 鏂囨湰鐩镐技搴︽湇鍔RL
+#    ai-service: http://116.198.39.83:54321
+    ai-service: http://127.0.0.1:54321
+
 #sftp:
 #  host: 116.198.40.76
 #  port: 22
diff --git a/recommend-common/pom.xml b/recommend-common/pom.xml
index 1bb2165..c8b2ee8 100644
--- a/recommend-common/pom.xml
+++ b/recommend-common/pom.xml
@@ -45,6 +45,13 @@
             <artifactId>iplatform-gather</artifactId>
         </dependency>
 
+        <!-- RestTemplate渚濊禆锛�2022/09/23 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/ResponseValue.java b/recommend-common/src/main/java/com/iplatform/reccommon/ResponseValue.java
similarity index 98%
rename from recommend-video/src/main/java/com/iplatform/recvideo/ResponseValue.java
rename to recommend-common/src/main/java/com/iplatform/reccommon/ResponseValue.java
index e46d3ed..4c41e53 100644
--- a/recommend-video/src/main/java/com/iplatform/recvideo/ResponseValue.java
+++ b/recommend-common/src/main/java/com/iplatform/reccommon/ResponseValue.java
@@ -1,4 +1,4 @@
-package com.iplatform.recvideo;
+package com.iplatform.reccommon;
 
 import java.io.Serializable;
 import java.util.List;
diff --git a/recommend-common/src/main/java/com/iplatform/reccommon/config/RecommendConfig.java b/recommend-common/src/main/java/com/iplatform/reccommon/config/RecommendConfig.java
new file mode 100644
index 0000000..9e16bf2
--- /dev/null
+++ b/recommend-common/src/main/java/com/iplatform/reccommon/config/RecommendConfig.java
@@ -0,0 +1,29 @@
+package com.iplatform.reccommon.config;
+
+import com.iplatform.core.PlatformConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RecommendConfig extends PlatformConfiguration {
+
+    /**
+     * 鍒涘缓杩滅▼璋冪敤瀵硅薄锛屼复鏃朵娇鐢ㄥ唴缃瓾ttp閰嶇疆锛屽悗缁細鍗曠嫭鍙戝竷妯″潡鏀寔 okHttp
+     * @return
+     * @date 2022-09-23
+     */
+    @Bean
+    public RestTemplate restTemplate(){
+        SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
+        clientHttpRequestFactory.setConnectTimeout(10 * 1000);
+        clientHttpRequestFactory.setReadTimeout(1200 * 1000);
+        return new RestTemplate(clientHttpRequestFactory);
+    }
+
+    @Bean
+    public TextSimilarProperties textSimilarProperties(){
+        return new TextSimilarProperties();
+    }
+}
diff --git a/recommend-common/src/main/java/com/iplatform/reccommon/config/TextSimilarProperties.java b/recommend-common/src/main/java/com/iplatform/reccommon/config/TextSimilarProperties.java
new file mode 100644
index 0000000..278ccc5
--- /dev/null
+++ b/recommend-common/src/main/java/com/iplatform/reccommon/config/TextSimilarProperties.java
@@ -0,0 +1,17 @@
+package com.iplatform.reccommon.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties(prefix = "recommend.text")
+public class TextSimilarProperties {
+
+    private String aiService;
+
+    public String getAiService() {
+        return aiService;
+    }
+
+    public void setAiService(String aiService) {
+        this.aiService = aiService;
+    }
+}
diff --git a/recommend-text/pom.xml b/recommend-text/pom.xml
index 4d4c10d..65aef23 100644
--- a/recommend-text/pom.xml
+++ b/recommend-text/pom.xml
@@ -24,21 +24,27 @@
         </dependency>
 
         <!-- 骞冲彴妯″潡锛氭枃鏈浉浼煎害鐩镐技搴︼紝2022/09/08 -->
-        <dependency>
-            <groupId>com.iplatform</groupId>
-            <artifactId>iplatform-ml-similarity</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.logging.log4j</groupId>
-                    <artifactId>log4j-slf4j-impl</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>com.iplatform</groupId>-->
+<!--            <artifactId>iplatform-ml-similarity</artifactId>-->
+<!--            <exclusions>-->
+<!--                <exclusion>-->
+<!--                    <groupId>org.slf4j</groupId>-->
+<!--                    <artifactId>slf4j-api</artifactId>-->
+<!--                </exclusion>-->
+<!--                <exclusion>-->
+<!--                    <groupId>org.apache.logging.log4j</groupId>-->
+<!--                    <artifactId>log4j-slf4j-impl</artifactId>-->
+<!--                </exclusion>-->
+<!--            </exclusions>-->
+<!--        </dependency>-->
 
+        <!-- RestTemplate渚濊禆锛�2022/09/23 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/api/TextResultApi.java b/recommend-text/src/main/java/com/iplatform/rectext/api/TextResultApi.java
new file mode 100644
index 0000000..f3fcf2b
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/api/TextResultApi.java
@@ -0,0 +1,211 @@
+package com.iplatform.rectext.api;
+
+import com.iplatform.reccommon.ResponseValue;
+import com.iplatform.reccommon.config.TextSimilarProperties;
+import com.iplatform.rectext.pojo.SearchRequest;
+import com.iplatform.rectext.pojo.TextSimilar;
+import com.iplatform.rectext.pojo.UploadText;
+import com.walker.infrastructure.utils.JsonUtils;
+import com.walker.infrastructure.utils.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/api/text")
+public class TextResultApi {
+
+    private final transient Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    private RestTemplate restTemplate = null;
+
+    private TextSimilarProperties textSimilarProperties = null;
+
+    @Autowired
+    public TextResultApi(RestTemplate restTemplate, TextSimilarProperties textSimilarProperties){
+        this.restTemplate = restTemplate;
+        this.textSimilarProperties = textSimilarProperties;
+    }
+
+    /**
+     * 涓氬姟涓婁紶璇剧▼鏂囨湰鍒嗘瀽鏁版嵁銆�<p></p>
+     * 1.璇锋眰鍙傛暟鏍煎紡:<br>
+     * <pre>
+     *     {
+     *      "type":"kecheng",                           // 鏂囨湰鍒嗙被锛屼笟鍔¤缃爣璇嗗瓧绗︿覆
+     *      "title":["10","20","30"],                   // title涓鸿绋婭D
+     *      "text":["璇剧▼鎻忚堪1","璇剧▼鎻忚堪2","璇剧▼鎻忚堪3"]    // text涓鸿绋嬫弿杩扮瓑涓�涓瓧绗︿覆
+     *     }
+     * </pre>
+     * 2.鍝嶅簲鏍煎紡:<br>
+     * <pre>
+     *     {"state":true, "code":1, "msg":"success"}    // 1 鎴愬姛锛屽叾浠栧け璐�
+     * </pre>
+     * @param json
+     * @return
+     * @author 鏃跺厠鑻�
+     * @date 2022-11-03
+     */
+    @RequestMapping("/upload")
+    public ResponseValue uploadText(@RequestBody String json){
+        if(StringUtils.isEmpty(json)){
+            return ResponseValue.error("涓婁紶鐨勮绋嬪垎鏋愭暟鎹负绌�");
+        }
+        String url = this.textSimilarProperties.getAiService();
+        logger.info("upload text url = " + url);
+        try {
+            UploadText uploadText = JsonUtils.jsonStringToObject(json, UploadText.class);
+            String error = this.postUploadText(url, uploadText);
+            if(error != null){
+                return ResponseValue.error(error);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return ResponseValue.success();
+    }
+
+    /**
+     * 缁欏畾涓�鍙ヨ瘽(鎴栨爣绛炬枃鏈唴瀹�)妫�绱㈠嚭鐩镐技鐨勮绋嬪垪琛紝鏈�澶�40涓��<br>
+     * 闇�瑕佷笟鍔℃牴鎹瘎鍒嗘帓搴忎娇鐢紝鍙缃竴涓槇鍊硷紝鍒嗘暟楂樼殑鎺掑墠闈€��<p></p>
+     * 1.璇锋眰鍙傛暟鏍煎紡:<br>
+     * <pre>
+     *     {"query":"浠栨槸涓�涓細璁″笀", "type":"kecheng"}
+     * </pre>
+     *
+     * 2.鍝嶅簲鏍煎紡:<br>
+     * <pre>
+     *     {
+     *     "state": true,
+     *     "code": 1,
+     *     "msg": "success",
+     *     "data": [
+     *         {
+     *         "dis": 0.3613262176513672,
+     *         "id": "9",
+     *         "text": "浼氳鍩硅_浼氳鍏ㄧ鐝姤鍚嶅璐癸紝闆朵細璁″熀纭�鐭ヨ瘑锛屾鍏ㄩ潰瀛︿範浼氳涓撲笟鎶�鑳斤紝杈惧埌涓�鑸紒涓氱殑鐔熺粌浼氳姘村钩",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.3019663691520691,
+     *         "id": "2",
+     *         "text": "鍒濈骇浼氳甯堣�冭瘯鍖呭惈鍝嚑闂ㄥ憿?鍒濈骇浼氳甯堣�冭瘯涓�鐩存槸鑰冭瘯涓ら棬锛屽垎鍒负銆婂垵绾т細璁″疄鍔°�嬪拰銆婄粡娴庢硶鍩虹銆嬨�傚弬鍔犲垵绾ц祫鏍艰�冭瘯鐨勪汉鍛橈紝鍦ㄤ竴涓�冭瘯骞村害鍐呴�氳繃鍏ㄩ儴绉戠洰鐨勮�冭瘯锛屾墠鍙幏寰楀垵绾ц祫鏍艰瘉涔︺��",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.29971787333488464,
+     *         "id": "8",
+     *         "text": "婀栧窞甯傛窐瀹濈編宸ュ煿璁� 娣樺疂鐢靛晢鍩硅鎶ュ悕鐑嚎锛�2022骞存箹宸炲競鏄ュ崕鑱屼笟鍩硅瀛︽牎寮�璁剧數鑴戠郴鍒楄绋嬶細鍔炲叕銆佸钩闈€�佺編宸ャ�佽璁°�佸埗鐗堛�佹窐瀹濈瓑锛涗細璁¤绋嬶細鍩虹浼氳锛屽垵涓骇浼氳鑰冭瘉锛屼細璁″疄鍔★紝浼氳鍏ㄧ鐝瓑锛屾垚浜哄湪鑱屼笓绉戞湰绉戝鍘嗚繘淇紝娣樺疂缇庡伐鐖卞ソ鑰呫�佹窐瀹濆簵閾虹粡钀ヨ�呫�佸钩闈㈣璁$埍濂借�呫�傛帉鎻$綉搴椾富椤电編宸ヨ璁°�佹捣鎶ャ�佺劍鐐瑰浘銆佸疂璐濊鎯呴〉鐨勭編宸ヨ璁★紝鍥剧墖绌洪棿锛岀綉绔欎唬鐮侊紝瀹炵幇瑙嗚钀ラ攢",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.23417186737060547,
+     *         "id": "7",
+     *         "text": "2022骞村彴宸炵帀鐜幙鎴愪汉鏁欒偛瀛﹀巻杩涗慨鎶ュ悕锛屽涔犲舰寮忔湁鑷�冿紝鍑芥巿涓庤繙绋嬫暀鑲诧紝瀛﹀埗鐭紝鏂囧嚟鐢靛瓙娉ㄥ唽锛屽浗瀹舵暀鑲查儴鎵胯锛岄珮鍗囨湰璁剧疆涓撲笟锛氫細璁★紝涓撳崌鏈缃笓涓氾細浼氳锛屾満鐢典竴浣撳寲锛屽伐鍟嗙鐞�",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.22891874611377716,
+     *         "id": "10",
+     *         "text": "闇�瑕佹帉鎻¤储鍔$煡璇嗙殑浼佷笟绠$悊浜哄憳涔熷彲瀛︿範璇ヨ绋嬨�傚弬鍔犺�冭瘯鎴愮哗鍚堟牸棰佸彂ATEP鍏ㄥ浗浼氳瀹炲姟璧勬牸鍒濈骇璇佷功鍙婁細璁′粠涓氳祫鏍艰瘉涔�",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.11250658333301544,
+     *         "id": "11",
+     *         "text": "娴峰畞甯傛垚浜哄嚱鎺堝ぇ瀛︿細璁′笓绉戙�佹湰绉戝鍘嗘嫑鐢燂紝涓滃寳鍐滀笟澶у缃戠粶鏁欒偛瀛﹂櫌鍒涘缓浜�2000骞�7鏈堬紝鏄叏鍥介鎵逛笁鍗佷竴鎵�杩滅▼鏁欒偛璇曠偣瀛︽牎涔嬩竴锛屼篃鏄叏鍥界涓�鎵�杩涜鐜颁唬杩滅▼鏁欒偛璇曠偣鐨勯珮绛夊啘涓氶櫌鏍�",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.10873384773731232,
+     *         "id": "13",
+     *         "text": "瀹佹尝鏉窞婀炬窐瀹濆煿璁� 鐢靛晢杩愯惀鎺ㄥ箍鐝姤鍚嶅璐癸紝鏄ュ崕娣樺疂寮�搴楀煿璁彮鎷涙敹闆跺熀纭�瀛﹀憳銆佹窐瀹濆紑搴楀垱涓氳�呫�佸叏鑱屽濡堛�佹墦宸ヤ粩銆佹窐瀹濇柊鎵嬪崠瀹讹紝瀵规湁蹇椾簬缃戠粶閿�鍞紝娣樺疂寮�搴楃瓑鐨勭ぞ浼氬悇鐣屼汉澹紝瀵圭綉缁滈浂鍞拰鐢靛瓙鍟嗗姟鏈夋洿娣卞叆鐨勭悊瑙o紝瀛︿範缃戝簵鐨勫缓璁撅紱瀵圭綉搴楃殑娴佺▼鍚勬柟闈㈤兘姣旇緝浜嗚В锛岃兘澶熺嫭绔嬭繍钀ョ綉搴楋紝娣樺疂浼氬憳娉ㄥ唽銆佹敮浠樺疂瀹炲悕璁よ瘉銆佺綉涓婅喘鐗╂祦绋嬨�佹窐瀹濆簵閾烘敞鍐�",
+     *         "type": "kecheng"
+     *         },
+     *         {
+     *         "dis": 0.07954521477222443,
+     *         "id": "3",
+     *         "text": "涓�銆佷簩绾ф秷闃插笀鑰冭瘯鏈�鏂版暀锛�2022骞寸増鏁欐潗鏄庣‘涓轰竴銆佷簩绾ф敞鍐屾秷闃插伐绋嬪笀鍏辩敤锛屽悓鏃舵寜鐓ц�冭瘯澶х翰鍙婅�冩煡鑼冨洿瀵逛竴绾ф敞鍐屾秷闃插伐绋嬪笀鍜屼簩绾ф敞鍐屾秷闃插伐绋嬪笀瀛︿範",
+     *         "type": "kecheng"
+     *         }
+     *     ],
+     *     "total": 8
+     * }
+     * </pre>
+     * @param json
+     * @return
+     */
+    @RequestMapping("/search")
+    public ResponseValue searchTextList(@RequestBody String json){
+        if(StringUtils.isEmpty(json)){
+            return ResponseValue.error("缂哄皯鏌ヨ鏉′欢:{'query':'demo'}");
+        }
+        String url = this.textSimilarProperties.getAiService();
+        logger.info("upload text url = " + url);
+        try {
+            SearchRequest request = JsonUtils.jsonStringToObject(json, SearchRequest.class);
+            List<TextSimilar> list = this.getSearchResultList(url, request);
+            if(list == null){
+                return ResponseValue.error("鎺ㄨ崘绯荤粺鏈繑鍥炰换浣曠浉浼兼枃鏈泦鍚�");
+            }
+            return ResponseValue.success(list);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private List<TextSimilar> getSearchResultList(String url, SearchRequest request){
+        ResponseEntity<String> entity = restTemplate.postForEntity(url + "/ai/text/search", request, String.class);
+        if(entity == null){
+            return null;
+        }
+        String jsonData = entity.getBody();
+        try {
+            List<TextSimilar> list = JsonUtils.jsonStringToObject(jsonData, List.class);
+            if(StringUtils.isEmptyList(list)){
+                logger.error("\"python杩斿洖鏂囨湰鐩镐技闆嗗悎缁撴灉涓虹┖!\"");
+                return null;
+            }
+            return list;
+
+        } catch (Exception e) {
+            logger.error("瑙f瀽json缁撴灉閿欒:" + jsonData, e);
+            return null;
+        }
+    }
+
+    private String postUploadText(String url, UploadText request){
+        ResponseEntity<String> entity = restTemplate.postForEntity(url + "/ai/text/upload", request, String.class);
+        if(entity == null){
+            return null;
+        }
+        String jsonData = entity.getBody();
+        try {
+            Map<String, Object> map = JsonUtils.jsonStringToObject(jsonData, Map.class);
+            if(map == null || !map.containsKey("code")){
+                logger.error("python杩斿洖缁撴灉涓虹┖锛屾垨鑰呮病鏈塩ode鏍囧織锛屾棤娉曞垽鏂皟鐢ㄥ姞杞借棰戞垚鍔�!");
+                return "python杩斿洖缁撴灉涓虹┖锛屾垨鑰呮病鏈塩ode鏍囧織锛屾棤娉曞垽鏂皟鐢ㄥ姞杞借棰戞垚鍔�!";
+            }
+            String code = map.get("code").toString();
+            if(code.equals("0")){
+                logger.info("python upload_text_to_server() 澶勭悊鎴愬姛! ");
+                return null;
+            }
+//            logger.warn("python notify_gather_once() 鍔犺浇瑙嗛澶勭悊澶辫触, batchId = " + batchId);
+            return map.get("msg") == null? "閿欒": map.get("msg").toString();
+
+        } catch (Exception e) {
+            logger.error("瑙f瀽json缁撴灉閿欒:" + jsonData, e);
+            return e.getMessage();
+        }
+    }
+}
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/pojo/SearchRequest.java b/recommend-text/src/main/java/com/iplatform/rectext/pojo/SearchRequest.java
new file mode 100644
index 0000000..5ed282d
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/pojo/SearchRequest.java
@@ -0,0 +1,27 @@
+package com.iplatform.rectext.pojo;
+
+import java.io.Serializable;
+
+public class SearchRequest implements Serializable {
+
+    private String query = null;
+
+    private String type = null;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getQuery() {
+        return query;
+    }
+
+    public void setQuery(String query) {
+        this.query = query;
+    }
+
+}
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/pojo/TextSimilar.java b/recommend-text/src/main/java/com/iplatform/rectext/pojo/TextSimilar.java
new file mode 100644
index 0000000..ac77f0b
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/pojo/TextSimilar.java
@@ -0,0 +1,40 @@
+package com.iplatform.rectext.pojo;
+
+import java.io.Serializable;
+
+/**
+ * 鏂囨湰鐩镐技鎼滅储缁撴灉瀵硅薄銆�
+ * @date 2022-11-03
+ */
+public class TextSimilar implements Serializable {
+
+    private String id;
+    private double dis = 0;
+
+    private String text;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public double getDis() {
+        return dis;
+    }
+
+    public void setDis(double dis) {
+        this.dis = dis;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+}
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/pojo/UploadText.java b/recommend-text/src/main/java/com/iplatform/rectext/pojo/UploadText.java
new file mode 100644
index 0000000..e94f283
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/pojo/UploadText.java
@@ -0,0 +1,44 @@
+package com.iplatform.rectext.pojo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 涓氬姟涓婁紶鐨勬枃鏈垎鏋愭暟鎹紝涓昏鏄绋媔d涓庤绋嬫弿杩般��
+ * @author 鏃跺厠鑻�
+ * @date 2022-11-03
+ */
+public class UploadText implements Serializable {
+
+    private List<String> title = new ArrayList<>();
+
+    private List<String> text = new ArrayList<>();
+
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public List<String> getTitle() {
+        return title;
+    }
+
+    public void setTitle(List<String> title) {
+        this.title = title;
+    }
+
+    public List<String> getText() {
+        return text;
+    }
+
+    public void setText(List<String> text) {
+        this.text = text;
+    }
+
+}
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java b/recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java
index 9727922..36b6580 100644
--- a/recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java
+++ b/recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java
@@ -12,6 +12,7 @@
  *     2锛夊閲忔媺鍙栨暟鎹紝鏁版嵁鍏堢粍缁囧ソ鍐欏叆涓棿琛紝鐒跺悗璋冪敤sdk鍐欏叆milvus
  * </pre>
  */
+@Deprecated
 public class WriteCourseToMilvus extends GatherScheduler {
 
     private GatherTask gatherTask;
diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/api/ShowResultApi.java b/recommend-video/src/main/java/com/iplatform/recvideo/api/ShowResultApi.java
index 4554988..10ec83f 100644
--- a/recommend-video/src/main/java/com/iplatform/recvideo/api/ShowResultApi.java
+++ b/recommend-video/src/main/java/com/iplatform/recvideo/api/ShowResultApi.java
@@ -1,7 +1,7 @@
 package com.iplatform.recvideo.api;
 
 import com.iplatform.model.po.Rc_video_user;
-import com.iplatform.recvideo.ResponseValue;
+import com.iplatform.reccommon.ResponseValue;
 import com.iplatform.recvideo.service.VideoShowServiceImpl;
 import com.walker.infrastructure.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java
index bf5eda8..c8e56d9 100644
--- a/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java
+++ b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java
@@ -3,8 +3,6 @@
 import com.iplatform.core.PlatformConfiguration;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
-import org.springframework.web.client.RestTemplate;
 
 @Configuration
 public class VideoSimilarConfig extends PlatformConfiguration {
@@ -14,16 +12,19 @@
         return new VideoSimilarProperties();
     }
 
-    /**
-     * 鍒涘缓杩滅▼璋冪敤瀵硅薄锛屼复鏃朵娇鐢ㄥ唴缃瓾ttp閰嶇疆锛屽悗缁細鍗曠嫭鍙戝竷妯″潡鏀寔 okHttp
-     * @return
-     * @date 2022-09-23
-     */
-    @Bean
-    public RestTemplate restTemplate(){
-        SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
-        clientHttpRequestFactory.setConnectTimeout(10 * 1000);
-        clientHttpRequestFactory.setReadTimeout(1200 * 1000);
-        return new RestTemplate(clientHttpRequestFactory);
-    }
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    //~ RestTemplate 绉诲埌common鍖呬腑锛�2022-11-03
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//    /**
+//     * 鍒涘缓杩滅▼璋冪敤瀵硅薄锛屼复鏃朵娇鐢ㄥ唴缃瓾ttp閰嶇疆锛屽悗缁細鍗曠嫭鍙戝竷妯″潡鏀寔 okHttp
+//     * @return
+//     * @date 2022-09-23
+//     */
+//    @Bean
+//    public RestTemplate restTemplate(){
+//        SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
+//        clientHttpRequestFactory.setConnectTimeout(10 * 1000);
+//        clientHttpRequestFactory.setReadTimeout(1200 * 1000);
+//        return new RestTemplate(clientHttpRequestFactory);
+//    }
 }

--
Gitblit v1.9.1