diff --git a/mindspore/pom.xml b/mindspore/pom.xml
index 4d46235..4af52e1 100644
--- a/mindspore/pom.xml
+++ b/mindspore/pom.xml
@@ -80,6 +80,12 @@
1.0-SNAPSHOT
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.3
+
+
diff --git a/mindspore/src/main/java/App.java b/mindspore/src/main/java/App.java
index 63af5f4..9d2c462 100644
--- a/mindspore/src/main/java/App.java
+++ b/mindspore/src/main/java/App.java
@@ -6,6 +6,12 @@
public class App {
private static final String TARGET = System.getenv("TARGET");
+ private static final String TARGET_PAPERS = System.getenv("TARGET") + "/papers";
+
+ private static final String TARGET_CASES = System.getenv("TARGET") + "/cases";
+
+ private static final String TARGET_COURSES = System.getenv("TARGET") + "/courses";
+
private static final String APPLICATION_PATH = System.getenv("APPLICATION_PATH");
private static final String MAPPING_PATH = System.getenv("MAPPING_PATH");
@@ -18,6 +24,7 @@ public static void main(String[] args) {
PublicClient.CreateClientFormConfig(APPLICATION_PATH);
PublicClient.makeIndex(INDEX_PREFIX + "_zh", MAPPING_PATH);
PublicClient.makeIndex(INDEX_PREFIX + "_en", MAPPING_PATH);
+ portalData();
fileDate();
} catch (Exception e) {
System.out.println(e.getMessage());
@@ -28,6 +35,67 @@ public static void main(String[] args) {
System.exit(0);
}
+ public static void portalData() throws Exception {
+ File indexPaperFile = new File(TARGET_PAPERS);
+ File indexCaseFile = new File(TARGET_CASES);
+ File indexCourseFile = new File(TARGET_COURSES);
+ if (!indexPaperFile.exists()) {
+ System.out.printf("%s folder does not exist%n", indexPaperFile.getPath());
+ return;
+ }
+ if (!indexCaseFile.exists()) {
+ System.out.printf("%s folder does not exist%n", indexCaseFile.getPath());
+ return;
+ }
+ if (!indexCourseFile.exists()) {
+ System.out.printf("%s folder does not exist%n", indexCourseFile.getPath());
+ }
+
+ System.out.println("begin to update portal data,开始更新");
+ Map hashMap = Map.of("paper", indexPaperFile, "case", indexCaseFile, "course", indexCourseFile);
+ hashMap.entrySet().forEach(entry -> {
+ try {
+ updatePortal(entry.getKey(), entry.getValue());
+ System.out.println(entry.getKey() + " data import success");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ }
+
+ public static void updatePortal(String category, File indexFile) throws Exception {
+ Collection listFiles = FileUtils.listFiles(indexFile, new String[]{"json"}, true);
+
+ for(File paresFile : listFiles) {
+ try {
+ List