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