2024年5月9日 修改直播画面抓取保存路径

This commit is contained in:
bai 2024-05-09 22:22:21 +08:00
parent 0ce3754021
commit af23f1cb89
1 changed files with 11 additions and 7 deletions

View File

@ -76,8 +76,10 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
@Override
public void videoScreenshotAll() {
DateTime starTime = DateTime.now();
String nowStr = starTime.toString("yyyy-MM-dd");
DateTime now = DateTime.now();
String nowStr = now.toString("yyyy-MM-dd");
String yearMonthStr = now.toString("yyyy-MM");
//新版查询当前是否有课
// KcZhihuijiaoshi jiaoshi = new KcZhihuijiaoshi();
@ -134,11 +136,12 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
zhihuijiaoshiList.forEach(x -> {
KcKetangbiao ketangbiao = KcKetangbiaoMap.get(x.getJsbh());
String rwbh = ketangbiao.getRwbh();
String fileName;
File uploadpathFile = new File(uploadpath);
String uploadpathFilePath = uploadpathFile.getPath();
File file = new File(uploadpathFilePath + File.separator + "videoScreenshot" + File.separator + DateUtils.getTradeNo() + File.separator);
File file = new File(uploadpathFilePath + File.separator + "videoScreenshot" + File.separator + ketangbiao.getXnxq() + File.separator + yearMonthStr + File.separator + x.getJsbh() + File.separator);
String orgName = x.getPullUrl();// 获取文件名
orgName = CommonUtil.getFileName(orgName);
if(orgName.lastIndexOf(".")!=-1){
@ -146,11 +149,12 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
orgName = URLEncoder.DEFAULT.encode(orgName);
//原名是m3u8不是图片改成jpeg
// fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + DateUtils.getTradeNo() + orgName.substring(orgName.lastIndexOf("."));
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + DateUtils.getTradeNo() + ".jpeg";
fileName = DateUtils.getTradeNo() + "_" + orgName.substring(0, orgName.lastIndexOf(".")) + ".jpeg";
}else{
// fileName = x.getRw"_" + orgName+ "_" + DateUtils.getTradeNo();
fileName = orgName+ "_" + DateUtils.getTradeNo();
fileName = DateUtils.getTradeNo() + "_" + orgName;
}
fileName = rwbh + "_" + fileName;
//qn更改-- 修复特殊字符上传后无法下载的问题修复多个.名称错乱的问题END
// String savePath = file.getPath() + File.separator + fileName;
// File savefile = new File(savePath);
@ -159,7 +163,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
//截图
String outImagePath = file.getPath() + File.separator + fileName;
FileUtil.touch(outImagePath);
String miniOutImagePath = StringUtils.replace(outImagePath, uploadpathFilePath, "");
String miniOutImagePath = StringUtils.replace(outImagePath, uploadpathFilePath + File.separator, "");
miniOutImagePath = StringUtils.replace(miniOutImagePath,"\\","/");
boolean isSuccess = _FFmpegTools.videoScreenshot(x.getPullUrl(), outImagePath);
//查找主表
@ -194,7 +198,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
detectionDetailed.setXnxq(ketangbiao.getXnxq());
detectionDetailed.setDetectionUrl(x.getPullUrl());
detectionDetailed.setDetectionOutImgUrl(miniOutImagePath);
detectionDetailed.setDetectionOutImgRes("{\"res\":\"无法截取图片!\"}");
detectionDetailed.setDetectionOutImgRes("{\"log_id\": \"没有图片,无法查询\", \"person_num\": 0}");//
detectionDetailed.setDetectionNum(detectionNum);//截图序列号
detectionDetailed.setNum(0);