|
@@ -1,6 +1,8 @@
|
|
|
package com.miaxis.test;
|
|
|
|
|
|
|
|
|
+import com.miaxis.question.domain.WebNoteAll;
|
|
|
+import com.miaxis.question.service.IWebNoteAllService;
|
|
|
import org.junit.Test;
|
|
|
import com.miaxis.ZzjsApplication;
|
|
|
import com.miaxis.common.utils.StringUtils;
|
|
@@ -26,36 +28,69 @@ public class KTDownload {
|
|
|
@Autowired
|
|
|
private IQuestionInfoKtGetService questionInfoGetService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IWebNoteAllService webNoteAllService;
|
|
|
+
|
|
|
@Test
|
|
|
public void testExcel() throws Exception {
|
|
|
|
|
|
//explain_gif
|
|
|
- List<QuestionInfoKtGet> explainGifList = questionInfoGetService.selectQuestionInfoKtGetExplainGifList(); //要修改
|
|
|
- downLoadList(explainGifList, "explainGifList");
|
|
|
+// List<QuestionInfoKtGet> explainGifList = questionInfoGetService.selectQuestionInfoKtGetExplainGifList(); //要修改
|
|
|
+// downLoadList(explainGifList, "explainGifList");
|
|
|
+//
|
|
|
+// //explain_mp3
|
|
|
+// List<QuestionInfoKtGet> explainMp3List = questionInfoGetService.selectQuestionInfoKtGetExplainMp3List(); //要修改
|
|
|
+// downLoadList(explainMp3List, "explainMp3List");
|
|
|
+//
|
|
|
+// //image
|
|
|
+// List<QuestionInfoKtGet> imageList = questionInfoGetService.selectQuestionInfoKtGetImageList(); //要修改
|
|
|
+// downLoadList(imageList, "imageList");
|
|
|
+
|
|
|
+ //image_ydt
|
|
|
+// List<QuestionInfoKtGet> imageYdtList = questionInfoGetService.selectQuestionInfoKtGetImageYdtList(); //要修改
|
|
|
+// downLoadList(imageYdtList, "imageYdtList");
|
|
|
|
|
|
- //explain_mp3
|
|
|
- List<QuestionInfoKtGet> explainMp3List = questionInfoGetService.selectQuestionInfoKtGetExplainMp3List(); //要修改
|
|
|
- downLoadList(explainMp3List, "explainMp3List");
|
|
|
+ //issuemp3
|
|
|
+// List<QuestionInfoKtGet> issuemp3List = questionInfoGetService.selectQuestionInfoKtGetIssuemp3List(); //要修改
|
|
|
+// downLoadList(issuemp3List, "issuemp3List");
|
|
|
+//
|
|
|
+//
|
|
|
+// //answermp3
|
|
|
+// List<QuestionInfoKtGet> answermp3List = questionInfoGetService.selectQuestionInfoKtGetAnswermp3List(); //要修改
|
|
|
+// downLoadList(answermp3List, "answermp3List");
|
|
|
+//
|
|
|
+// //explainjsmp3
|
|
|
+// List<QuestionInfoKtGet> explainjsmp3List = questionInfoGetService.selectQuestionInfoKtGetExplainjsmp3List(); //要修改
|
|
|
+// downLoadList(explainjsmp3List, "explainjsmp3List");
|
|
|
+
|
|
|
+
|
|
|
+ List<WebNoteAll> webNoteAllList = webNoteAllService.selectWebNoteAllMediaUrlList();
|
|
|
+ downLoadList2(webNoteAllList, "webNoteAllList");
|
|
|
|
|
|
- //image
|
|
|
- List<QuestionInfoKtGet> imageList = questionInfoGetService.selectQuestionInfoKtGetImageList(); //要修改
|
|
|
- downLoadList(imageList, "imageList");
|
|
|
+ }
|
|
|
|
|
|
- //issuemp3
|
|
|
- List<QuestionInfoKtGet> issuemp3List = questionInfoGetService.selectQuestionInfoKtGetIssuemp3List(); //要修改
|
|
|
- downLoadList(issuemp3List, "issuemp3List");
|
|
|
|
|
|
+ public static void downLoadList2(List<WebNoteAll> list, String listType) {
|
|
|
|
|
|
- //answermp3
|
|
|
- List<QuestionInfoKtGet> answermp3List = questionInfoGetService.selectQuestionInfoKtGetAnswermp3List(); //要修改
|
|
|
- downLoadList(answermp3List, "answermp3List");
|
|
|
+ if ("webNoteAllList".equals(listType)) {
|
|
|
|
|
|
- //explainjsmp3
|
|
|
- List<QuestionInfoKtGet> explainjsmp3List = questionInfoGetService.selectQuestionInfoKtGetExplainjsmp3List(); //要修改
|
|
|
- downLoadList(explainjsmp3List, "explainjsmp3List");
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ WebNoteAll WebNoteAll = list.get(i);
|
|
|
+ String mediaUrl = WebNoteAll.getMediaUrl(); //要修改
|
|
|
|
|
|
+ int index = mediaUrl.lastIndexOf("/");
|
|
|
+ String fileName = mediaUrl.substring(index + 1);
|
|
|
+ System.out.println(mediaUrl + "," + fileName);
|
|
|
+ try {
|
|
|
+ downLoadFromUrl(mediaUrl, fileName, "G:\\中正\\题库图\\kt20230223\\media_ydt"); //要修改
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public static void downLoadList(List<QuestionInfoKtGet> list, String listType) {
|
|
|
|
|
|
if ("explainGifList".equals(listType)) {
|
|
@@ -105,9 +140,21 @@ public class KTDownload {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ } else if("imageYdtList".equals(listType)){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ QuestionInfoKtGet questionInfoKtGet = list.get(i);
|
|
|
+ String mediaUrl = questionInfoKtGet.getImageYdt(); //要修改
|
|
|
|
|
|
-
|
|
|
- } else if ("issuemp3List".equals(listType)) {
|
|
|
+ int index = mediaUrl.lastIndexOf("/");
|
|
|
+ String fileName = mediaUrl.substring(index + 1);
|
|
|
+ System.out.println(mediaUrl + "," + fileName);
|
|
|
+ try {
|
|
|
+ downLoadFromUrl(mediaUrl, fileName, "G:\\中正\\题库图\\kt20230223\\image_ydt"); //要修改
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ("issuemp3List".equals(listType)) {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
QuestionInfoKtGet questionInfoKtGet = list.get(i);
|
|
|
String mediaUrl = questionInfoKtGet.getIssuemp3(); //要修改
|