This commit is contained in:
wangjinlei
2024-05-16 13:54:42 +08:00
parent 1b3803074d
commit 7beb2b2b2c
6 changed files with 24 additions and 22 deletions

10
pom.xml
View File

@@ -135,11 +135,11 @@
<version>3.12.5</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.5.6</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.bytedeco</groupId>-->
<!-- <artifactId>javacv-platform</artifactId>-->
<!-- <version>1.5.6</version>-->
<!-- </dependency>-->
<!--阿里短信服务-->
<dependency>
<groupId>com.aliyun</groupId>

View File

@@ -21,8 +21,8 @@ public class AsyncService {
int i = p.getBody().getVideoMeta().getDuration().intValue();
courseCatalogueChapterVideoEntity.setDuration(i);
}else{
Integer mp4Duration = SpdbUtil.getMp4Duration("https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" + courseCatalogueChapterVideoEntity.getVideo());
courseCatalogueChapterVideoEntity.setDuration(mp4Duration);
// Integer mp4Duration = SpdbUtil.getMp4Duration("https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" + courseCatalogueChapterVideoEntity.getVideo());
// courseCatalogueChapterVideoEntity.setDuration(mp4Duration);
}
courseCatalogueChapterVideoDao.updateById(courseCatalogueChapterVideoEntity);
}

View File

@@ -5,24 +5,24 @@ import com.aliyun.teautil.models.RuntimeOptions;
import com.aliyun.vod20170321.Client;
import com.aliyun.vod20170321.models.GetVideoPlayAuthRequest;
import com.aliyun.vod20170321.models.GetVideoPlayAuthResponse;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FrameGrabber;
//import org.bytedeco.javacv.FFmpegFrameGrabber;
//import org.bytedeco.javacv.FrameGrabber;
import java.util.HashMap;
public class SpdbUtil {
public static Integer getMp4Duration(String url){
double duration = 0;
try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(url)) {
frameGrabber.start();
duration = frameGrabber.getLengthInTime()/1000000;
frameGrabber.stop();
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
return (int)duration;
};
// public static Integer getMp4Duration(String url){
// double duration = 0;
// try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(url)) {
// frameGrabber.start();
// duration = frameGrabber.getLengthInTime()/1000000;
// frameGrabber.stop();
// } catch (FrameGrabber.Exception e) {
// e.printStackTrace();
// }
// return (int)duration;
// };
public static GetVideoPlayAuthResponse getPlayAuth(String vid) throws Exception {
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()

View File

@@ -39,7 +39,7 @@ public class ShopProductController {
if (StringUtils.isNotEmpty(params.get("productName").toString())) {
wrapper.like(ShopProduct::getProductName, params.get("productName"));
}
wrapper.eq(StringUtils.isNotBlank(params.get("goodsType").toString())&&params.get("goodsType").toString()!="00",ShopProduct::getGoodsType,params.get("goodsType").toString());
wrapper.eq((StringUtils.isNotBlank(params.get("goodsType").toString())&&!params.get("goodsType").toString().equals("00")),ShopProduct::getGoodsType,params.get("goodsType").toString());
wrapper.orderByAsc(ShopProduct::getSort);
wrapper.orderByAsc(ShopProduct::getCreateTime);
Page<ShopProduct> res = shopProductService.page(new Page<>(

View File

@@ -48,7 +48,7 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
public CourseCatalogueChapterVideoEntity checkVideo(CourseCatalogueChapterVideoEntity videoEntity) throws Exception {
CourseCatalogueChapterVideoEntity video = this.getById(videoEntity.getId());
if (video.getDuration() == 0) {
asyncService.pushDurationToVideo(video.getId());
asyncService.pushDurationToVideo(video.getId());//获取mp4总时长
}
CourseCatalogueChapterEntity courseCatalogueChapterEntity = courseCatalogueChapterDao.selectById(video.getChapterId());
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(courseCatalogueChapterEntity.getCatalogueId());

View File

@@ -56,6 +56,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToSociologyEntity::getSociologyId,param.getId());
wrapper.orderByAsc(CourseToSociologyEntity::getSort);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()),CourseEntity.class, wrapper);
return courseEntityPage;
}
@@ -78,6 +79,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToMarketEntity.class,CourseToMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMarketEntity::getMarketId,param.getId());
wrapper.orderByAsc(CourseToSociologyEntity::getSort);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;
}