Selaa lähdekoodia

抓获取一点通 语音和图片

小么熊🐻 1 vuosi sitten
vanhempi
commit
e64ab06a9e

+ 51 - 2
zzjs-admin/src/test/java/com/miaxis/test/YdtTest.java

@@ -3,6 +3,7 @@ package com.miaxis.test;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.miaxis.ZzjsApplication;
+import com.miaxis.common.utils.StringUtils;
 import com.miaxis.feign.dto.Ydt;
 import com.miaxis.feign.service.IYdtService;
 import com.miaxis.question.domain.QuestionInfoGet;
@@ -263,8 +264,56 @@ public class YdtTest {
 
 
     @Test
-    public void getShortVideo() throws IOException {
+    public void getVoice() throws IOException {
+
+        List<WebNoteAll> list = webNoteAllService.selectWebNoteAllList(null);
+        System.out.println(list.size());
+        for (int i = 0; i < list.size(); i++) {
+            WebNoteAll webNoteAll = list.get(i);
+            if(!StringUtils.isEmpty(webNoteAll.getMediaUrl())) {
+                String savePath = "G:\\中正\\题库\\20230809\\media";
+                int index = webNoteAll.getMediaUrl().lastIndexOf("/");
+                int index2 = webNoteAll.getMediaUrl().lastIndexOf(".");
+                String lastName = webNoteAll.getMediaUrl().substring(index2);
+                String fileName = webNoteAll.getMediaUrl().substring(index+1,index2);
+                System.out.println(lastName);
+                System.out.println(fileName);
+                System.out.println(fileName+lastName);
+                String allName = fileName+lastName;
+                downLoadFromUrl(webNoteAll.getMediaUrl(),allName,savePath);
+            }
+
+            if(!StringUtils.isEmpty(webNoteAll.getQuestionAudio())) {
+                String savePath = "G:\\中正\\题库\\20230809\\question_audio";
+                int index = webNoteAll.getQuestionAudio().lastIndexOf("/");
+                int index2 = webNoteAll.getQuestionAudio().lastIndexOf(".");
+                String lastName = webNoteAll.getQuestionAudio().substring(index2);
+                String fileName = webNoteAll.getQuestionAudio().substring(index+1,index2);
+                System.out.println(lastName);
+                System.out.println(fileName);
+                System.out.println(fileName+lastName);
+                String allName = fileName+lastName;
+                downLoadFromUrl(webNoteAll.getQuestionAudio(),allName,savePath);
+            }
 
+            if(!StringUtils.isEmpty(webNoteAll.getAnswerAudio())) {
+                String savePath = "G:\\中正\\题库\\20230809\\answer_audio";
+                int index = webNoteAll.getAnswerAudio().lastIndexOf("/");
+                int index2 = webNoteAll.getAnswerAudio().lastIndexOf(".");
+                String lastName = webNoteAll.getAnswerAudio().substring(index2);
+                String fileName = webNoteAll.getAnswerAudio().substring(index+1,index2);
+                System.out.println(lastName);
+                System.out.println(fileName);
+                System.out.println(fileName+lastName);
+                String allName = fileName+lastName;
+                downLoadFromUrl(webNoteAll.getAnswerAudio(),allName,savePath);
+            }
+
+        }
+    }
+
+    @Test
+    public void getShortVideo() throws IOException {
         String savePath = "G:\\中正\\一点通\\题库短视频";
         List<QuestionYdtJs> list = questionYdtJsService.selectQuestionYdtJsList2(null);
 
@@ -280,9 +329,9 @@ public class YdtTest {
 
         }
 
-
     }
 
+
     public static void downLoadFromUrl(String urlStr, String fileName, String savePath) throws IOException {
         URL url = new URL(urlStr);
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();

+ 30 - 0
zzjs-service/src/main/java/com/miaxis/question/domain/WebNoteAll.java

@@ -216,6 +216,33 @@ public class WebNoteAll extends BaseBusinessEntity{
     @ApiModelProperty(value = "best_explain_new")
     private String bestExplainNew;
 
+
+    @Excel(name = "question_audio")
+    @TableField("question_audio")
+    @ApiModelProperty(value = "question_audio")
+    private String questionAudio;
+
+    @Excel(name = "answer_audio")
+    @TableField("answer_audio")
+    @ApiModelProperty(value = "answer_audio")
+    private String answerAudio;
+
+    @Excel(name = "order_id")
+    @TableField("order_id")
+    @ApiModelProperty(value = "order_id")
+    private Integer orderId;
+
+    @Excel(name = "red_question")
+    @TableField("red_question")
+    @ApiModelProperty(value = "red_question")
+    private String redQuestion;
+
+
+    @Excel(name = "category")
+    @TableField("category")
+    @ApiModelProperty(value = "category")
+    private Integer category;
+
     public void setId(Long id){
         this.id = id;
     }
@@ -441,6 +468,9 @@ public class WebNoteAll extends BaseBusinessEntity{
         return bestExplainNew;
     }
 
+
+
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)