From d87613ba3ee0652fe96285ac687e0b537b42df88 Mon Sep 17 00:00:00 2001
From: shikeying <shikeying@163.com>
Date: 星期四, 22 九月 2022 17:32:48 +0800
Subject: [PATCH] 运行测试

---
 recommend-text/pom.xml                                                                |   22 +++++
 deploy-jar-template/src/main/java/com/iplatform/RecommendApplication.java             |   12 +++
 deploy-jar-template/pom.xml                                                           |   17 ++++
 recommend-common/pom.xml                                                              |   28 +++++++
 deploy-jar-template/src/main/resources/application-dev.yml                            |   80 ++++++++++++++++++++
 recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java |   44 +++++++++++
 recommend-text/src/main/java/com/iplatform/rectext/Test.java                          |    4 +
 deploy-jar-template/src/main/resources/application.yml                                |    3 
 8 files changed, 210 insertions(+), 0 deletions(-)

diff --git a/deploy-jar-template/pom.xml b/deploy-jar-template/pom.xml
index c34bf61..ed20e5d 100644
--- a/deploy-jar-template/pom.xml
+++ b/deploy-jar-template/pom.xml
@@ -17,6 +17,23 @@
     </properties>
 
     <dependencies>
+
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>recommend-text</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>recommend-video</artifactId>
+        </dependency>
+
+        <!-- 涓烘祴璇曪細鍚姩web鎺ュ彛 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/deploy-jar-template/src/main/java/com/iplatform/RecommendApplication.java b/deploy-jar-template/src/main/java/com/iplatform/RecommendApplication.java
new file mode 100644
index 0000000..1735144
--- /dev/null
+++ b/deploy-jar-template/src/main/java/com/iplatform/RecommendApplication.java
@@ -0,0 +1,12 @@
+package com.iplatform;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = {"com.walker","com.iplatform"})
+public class RecommendApplication {
+
+    public static void main(String[] args) throws Exception {
+        SpringApplication.run(RecommendApplication.class, args);
+    }
+}
diff --git a/deploy-jar-template/src/main/resources/application-dev.yml b/deploy-jar-template/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..a11d24f
--- /dev/null
+++ b/deploy-jar-template/src/main/resources/application-dev.yml
@@ -0,0 +1,80 @@
+spring:
+  application:
+    name: train_recommend
+  datasource:
+    # 鏄惁鏄剧ずdao涓墦鍗扮殑SQL璇彞
+    show-sql: true
+    username: root
+#    password: Bjjmy_63661766
+    password: Bjjmy_2020
+#    driver-class-name: sunje.goldilocks.jdbc.GoldilocksDriver
+    url: jdbc:mysql://124.70.39.177:3306/train_recommend?useUnicode=true&characterEncoding=UTF-8&useSSL=false
+    type: com.walker.jdbc.ds.DefaultDataSource
+    hikari:
+      minimum-idle: 5
+      idle-timeout: 5000
+      pool-name: databasePool_walker
+      connection-timeout: 10000
+      connection-test-query: select 1
+#    username: root
+#    password: SearunMaster@2019
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+#    url: jdbc:mysql://193.193.193.236:3306/cpmsxc?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&failOverReadOnly=false
+
+#    username: GQCG
+#    password: GQCG
+#    driver-class-name: oracle.jdbc.OracleDriver
+#    url: jdbc:oracle:thin:@61.163.210.202:6021/orcl
+server:
+  port: 8082
+  servlet:
+    context-path: /
+    session:
+      timeout: 30m
+
+logging:
+  level:
+    root: info
+    org:
+      springframework: error
+    com:
+      walker: info
+#  file: # logging.file.path 鍜� logging.file.name锛屽彧浼氭湁涓�涓敓鏁堬紝閰嶄簡path涓嶈閰峮ame锛岄厤浜唍ame涓嶈閰峱ath锛屽彧閰峱ath鏃秐ame榛樿涓簊pring.log锛屾兂璺緞鍜屾枃浠跺悕鍚屾椂鐢熸晥鍙厤缃甽ogging.file.name=d:/logs/mylog.log
+#    name: ${spring.application.name}.log #鏃ュ織鏂囦欢鍚�
+#    path: logs  #鏃ュ織瀛樺偍璺緞
+#    max-history: 30 #淇濈暀澶氬皯澶╃殑鏃ュ織
+#    max-size: 10MB
+#  pattern:
+#    rolling-file-name: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz
+  logback:
+    rollingpolicy:
+      file-name-pattern: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz
+      max-history: 1
+      max-file-size: 2
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 骞冲彴閰嶇疆鏀寔鍔熻兘
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+iplatform:
+
+  # 骞冲彴缂撳瓨锛屾槸鍚﹀惎鐢╮edis缂撳瓨锛岄粯璁や娇鐢ㄥ熀浜庡唴瀛樼紦瀛�.
+  # 娉ㄦ剰锛氬鏋滃紑鍚痳edis缂撳瓨锛屼笟鍔″伐绋嬪繀椤讳緷璧�(walker-support-redis)
+  cache:
+    redis-enabled: false
+
+  # 鐩镐技搴﹀垎鏋愭ā鍧椾娇鐢�
+  similarity:
+    # 鏄惁鍚敤鐩镐技搴︽ā鍧楋紝濡傛灉绂佺敤鍒欒纭繚娉ㄥ叆鏃舵敮鎸佷负绌�
+    enabled: true
+    milvus-host: 172.16.60.65
+    milvus-port: 19530
+    word-file: d:/dev_tools/ai/w2v_sogou_dim300_vocab.txt
+    embedding-file: d:/dev_tools/ai/w2v_sogou_dim300.npy
+
+  # 璋冨害鍣ㄦā鍧楋紝鏄惁鍚敤
+  scheduler:
+    enabled: true
+
+  # 鏁版嵁閲囬泦妯″潡
+  gather:
+    enabled: true
\ No newline at end of file
diff --git a/deploy-jar-template/src/main/resources/application.yml b/deploy-jar-template/src/main/resources/application.yml
new file mode 100644
index 0000000..3d7808a
--- /dev/null
+++ b/deploy-jar-template/src/main/resources/application.yml
@@ -0,0 +1,3 @@
+spring:
+  profiles:
+    active: dev
diff --git a/recommend-common/pom.xml b/recommend-common/pom.xml
index a5e5b0a..1bb2165 100644
--- a/recommend-common/pom.xml
+++ b/recommend-common/pom.xml
@@ -17,6 +17,34 @@
     </properties>
 
     <dependencies>
+
+<!--        &lt;!&ndash; 骞冲彴鍩虹妯″潡锛�2022/09-22 &ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>com.iplatform</groupId>-->
+<!--            <artifactId>iplatform-base</artifactId>-->
+<!--        </dependency>-->
+
+<!--        &lt;!&ndash; 骞冲彴妯″潡锛氳皟搴︿换鍔★紝2022/09/08 &ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>com.iplatform</groupId>-->
+<!--            <artifactId>iplatform-scheduler</artifactId>-->
+<!--            <exclusions>-->
+<!--                <exclusion>-->
+<!--                    <groupId>org.springframework.boot</groupId>-->
+<!--                    <artifactId>spring-boot-autoconfigure</artifactId>-->
+<!--                </exclusion>-->
+<!--            </exclusions>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>iplatform-base</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>iplatform-gather</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/recommend-text/pom.xml b/recommend-text/pom.xml
index 7807239..4d4c10d 100644
--- a/recommend-text/pom.xml
+++ b/recommend-text/pom.xml
@@ -17,6 +17,28 @@
     </properties>
 
     <dependencies>
+
+        <dependency>
+            <groupId>com.iplatform</groupId>
+            <artifactId>recommend-common</artifactId>
+        </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>
+
     </dependencies>
 
 </project>
diff --git a/recommend-text/src/main/java/com/iplatform/rectext/Test.java b/recommend-text/src/main/java/com/iplatform/rectext/Test.java
new file mode 100644
index 0000000..73c1853
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/Test.java
@@ -0,0 +1,4 @@
+package com.iplatform.rectext;
+
+public class Test {
+}
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
new file mode 100644
index 0000000..9727922
--- /dev/null
+++ b/recommend-text/src/main/java/com/iplatform/rectext/scheduler/WriteCourseToMilvus.java
@@ -0,0 +1,44 @@
+package com.iplatform.rectext.scheduler;
+
+import com.iplatform.gather.GatherScheduler;
+import com.walker.store.AbstractStore;
+import com.walker.store.support.EmptyDatabaseStore;
+import com.walker.store.task.GatherTask;
+
+/**
+ * 鎸佺画鍐欏叆璇剧▼鏂囨湰鎻忚堪鍒扮浉浼兼暟鎹簱涓紝鍦ㄦ暟鎹簱涓畾涔変换鍔℃椂闂村懆鏈熴��
+ * <pre>
+ *     1锛夎浠诲姟涓嶄細鍋滄锛屾瘡闂撮殧2灏忔椂鎵ц涓�娆�;
+ *     2锛夊閲忔媺鍙栨暟鎹紝鏁版嵁鍏堢粍缁囧ソ鍐欏叆涓棿琛紝鐒跺悗璋冪敤sdk鍐欏叆milvus
+ * </pre>
+ */
+public class WriteCourseToMilvus extends GatherScheduler {
+
+    private GatherTask gatherTask;
+
+    public WriteCourseToMilvus(int id, String name){
+        super(id, name, new EmptyDatabaseStore());
+    }
+
+    @Override
+    protected GatherTask providerTask(AbstractStore store) {
+        return null;
+    }
+
+    @Override
+    protected void terminateGatherScheduler(int schedulerId) {
+
+    }
+
+    @Override
+    protected Object onProcess(Object[] inputParams) throws Exception {
+        if(this.gatherTask == null){
+            this.gatherTask = this.providerTask(this.getStore());
+            if(this.gatherTask == null){
+                throw new IllegalArgumentException("鏈彁渚涗换鍔″璞★紝璋冨害鏃犳硶鎵ц锛�" + this.getName());
+            }
+        }
+        // srcName, createTableSQL, parameter, params[]
+        return this.gatherTask.run((String)inputParams[0], (String)inputParams[1], inputParams[2], (Object[])inputParams[3]);
+    }
+}

--
Gitblit v1.9.1