Commit c3efd540 authored by m1991's avatar m1991

资讯模块数据——视频功能修复

parent 08137cef
......@@ -52,17 +52,11 @@ public class UploadServiceImpl implements UploadService {
@Override
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>();
/**
* 生成当前时间戳
*/
BigInteger zxDate= BigInteger.valueOf(System.currentTimeMillis());
/**
* http://路径
*/
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/upload/video/";
Long time = new Date().getTime();
String fileName = file.getOriginalFilename();//文件原始名称
......@@ -82,19 +76,24 @@ public class UploadServiceImpl implements UploadService {
//将内存中的数据写入磁盘
file.transferTo(newFile);
//视频上传保存url
String zxUrl = basePath + newFileName;
String videoUrl = basePath + newFileName;
//视频封面图处理
String newImgName = time+".jpg";
String framefile = rootPath + newImgName;
String imgUrlSave = basePath+newImgName;//图片最终位置路径
//视频截取封面图
String imgUrl=FrameGrabberKit.getVedioImg(zxUrl, framefile, imgUrlSave);
String imgUrl=FrameGrabberKit.getVedioImg(videoUrl, framefile, imgUrlSave);
resultMap.put("zxUrl", zxUrl);
resultMap.put("videoUrl", videoUrl);
resultMap.put("imgUrl", imgUrl);
resultMap.put("returnCode", 0);
resultMap.put("returnCode", 200);
String zxUrl=videoUrl;
//System.out.println("上传的文件名为:"+fileName+",后缀名为:"+newFileName);
/**
* 生成当前时间戳
*/
BigInteger zxDate= BigInteger.valueOf(System.currentTimeMillis());
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, String.valueOf(zxDate));
return resultMap;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment