Commit 6a52265b by liyaoting

增加版本

1 parent 15ede663
...@@ -46,7 +46,7 @@ import java.util.stream.Collectors; ...@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
import static cn.bxe.updatevideo.util.VersionUtil.*; import static cn.bxe.updatevideo.util.VersionUtil.*;
/** /**
* @deprecated 用于更新知识点精讲视频(其实是新增 一般不修改旧的) * 用于更新知识点精讲视频(其实是新增 一般不修改旧的)
* 1.一般来说操作流程是: 获取新书籍->获取新章节->获取新模块->获取新视频->下载视频封面->更新数据库视频封面链接 * 1.一般来说操作流程是: 获取新书籍->获取新章节->获取新模块->获取新视频->下载视频封面->更新数据库视频封面链接
* 2.如果只是某本版本更新了内容,并没有新增书籍,也可以单独更新章节/模块/视频 * 2.如果只是某本版本更新了内容,并没有新增书籍,也可以单独更新章节/模块/视频
* 3.他们存储有几个域名,其中有一个oss.5rs.com得域名,这个域名下的视频封面不可以直接访问的,所以需要特殊处理来下载 * 3.他们存储有几个域名,其中有一个oss.5rs.com得域名,这个域名下的视频封面不可以直接访问的,所以需要特殊处理来下载
...@@ -633,6 +633,12 @@ public class UpdateVideoApplication { ...@@ -633,6 +633,12 @@ public class UpdateVideoApplication {
AtomicInteger counter = new AtomicInteger(); AtomicInteger counter = new AtomicInteger();
for (TbxXrVideo video : list) { for (TbxXrVideo video : list) {
pool.execute(() -> { pool.execute(() -> {
//检测封面是否存在本地
String fileName = "xrv_" + video.getVideoId() + ".jpg";
String filePath = "D:\\video\\" + fileName;
if (!new File(filePath).exists()) {
return;
}
video.setCoverUrl("https://pics-cos.banxiaoer.net/tbx/xrv/covers_images/xrv_" + video.getVideoId() + ".jpg"); video.setCoverUrl("https://pics-cos.banxiaoer.net/tbx/xrv/covers_images/xrv_" + video.getVideoId() + ".jpg");
video.updateById(); video.updateById();
int count = counter.addAndGet(1); int count = counter.addAndGet(1);
...@@ -654,9 +660,7 @@ public class UpdateVideoApplication { ...@@ -654,9 +660,7 @@ public class UpdateVideoApplication {
List<TbxXrModule> list1 = moduleService.list(moduleQW); List<TbxXrModule> list1 = moduleService.list(moduleQW);
LambdaQueryWrapper<TbxXrVideo> videoQW = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TbxXrVideo> videoQW = new LambdaQueryWrapper<>();
list1.forEach(obj -> { list1.forEach(obj -> videoQW.or().eq(TbxXrVideo::getChapterId, obj.getChapterId()).eq(TbxXrVideo::getModuleId, obj.getModuleId()));
videoQW.or().eq(TbxXrVideo::getChapterId, obj.getChapterId()).eq(TbxXrVideo::getModuleId, obj.getModuleId());
});
List<TbxXrVideo> list2 = videoService.list(videoQW); List<TbxXrVideo> list2 = videoService.list(videoQW);
System.out.println(v + "," + list2.size()); System.out.println(v + "," + list2.size());
} }
...@@ -666,10 +670,8 @@ public class UpdateVideoApplication { ...@@ -666,10 +670,8 @@ public class UpdateVideoApplication {
/** /**
* 获取oss.5rs.me的视频封面 * 获取oss.5rs.me的视频封面
* *
* @throws IOException
* @throws InterruptedException
*/ */
private static void getOss5rsmeCover() throws IOException, InterruptedException { private static void getOss5rsmeCover() throws IOException {
LambdaQueryWrapper<TbxXrVideo> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TbxXrVideo> qw = new LambdaQueryWrapper<>();
qw.like(TbxXrVideo::getUrl, "https://oss.5rs.me"); qw.like(TbxXrVideo::getUrl, "https://oss.5rs.me");
qw.isNull(TbxXrVideo::getCoverUrl); qw.isNull(TbxXrVideo::getCoverUrl);
......
...@@ -33,8 +33,26 @@ public class VersionUtil { ...@@ -33,8 +33,26 @@ public class VersionUtil {
GRADE_MAP.put("GRADE_ONE","7"); GRADE_MAP.put("GRADE_ONE","7");
GRADE_MAP.put("GRADE_TWO","8"); GRADE_MAP.put("GRADE_TWO","8");
GRADE_MAP.put("GRADE_THREE","9"); GRADE_MAP.put("GRADE_THREE","9");
GRADE_MAP.put("SENIOR_ONE","10"); GRADE_MAP.put("SENIOR_ONE","10");
//必修 一般高一
GRADE_MAP.put("REQUIRED_ONE","10");
GRADE_MAP.put("REQUIRED_TWO","10");
GRADE_MAP.put("REQUIRED_THREE","10");
//选修
GRADE_MAP.put("TAKE_ONE","11");
//选择性必修 一般高二
//选择性必修1
GRADE_MAP.put("TAKE_REQUIRED_ONE","11");
//选择性必修二
GRADE_MAP.put("TAKE_REQUIRED_TWO","11");
//选择性必修三
GRADE_MAP.put("TAKE_REQUIRED_THREE","11");
//书籍版本 //书籍版本
VERSION_MAP.put("CHINA","zhongtu"); VERSION_MAP.put("CHINA","zhongtu");
VERSION_MAP.put("LUKE","luke"); VERSION_MAP.put("LUKE","luke");
...@@ -61,9 +79,12 @@ public class VersionUtil { ...@@ -61,9 +79,12 @@ public class VersionUtil {
VERSION_MAP.put("PEP_B","pep_b"); VERSION_MAP.put("PEP_B","pep_b");
VERSION_MAP.put("QINGDAO","QINGDAO"); VERSION_MAP.put("QINGDAO","QINGDAO");
//学年 //学期
//全一册
SCHOOL_YEAR_MAP.put("ALL_BOOKS",5); SCHOOL_YEAR_MAP.put("ALL_BOOKS",5);
//上学期
SCHOOL_YEAR_MAP.put("LAST_SEMESTER",1); SCHOOL_YEAR_MAP.put("LAST_SEMESTER",1);
//下学期
SCHOOL_YEAR_MAP.put("NEXT_SEMESTER",2); SCHOOL_YEAR_MAP.put("NEXT_SEMESTER",2);
} }
} }
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!