Commit c3efd540 authored by m1991's avatar m1991

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

parent 08137cef
...@@ -52,17 +52,11 @@ public class UploadServiceImpl implements UploadService { ...@@ -52,17 +52,11 @@ public class UploadServiceImpl implements UploadService {
@Override @Override
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception { 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>(); Map<String, Object> resultMap=new HashMap<String, Object>();
/**
* 生成当前时间戳
*/
BigInteger zxDate= BigInteger.valueOf(System.currentTimeMillis());
/** /**
* http://路径 * http://路径
*/ */
String basePath = request.getScheme() + "://" + request.getServerName() String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/upload/video/"; + ":" + request.getServerPort()+"/upload/video/";
Long time = new Date().getTime(); Long time = new Date().getTime();
String fileName = file.getOriginalFilename();//文件原始名称 String fileName = file.getOriginalFilename();//文件原始名称
...@@ -82,19 +76,24 @@ public class UploadServiceImpl implements UploadService { ...@@ -82,19 +76,24 @@ public class UploadServiceImpl implements UploadService {
//将内存中的数据写入磁盘 //将内存中的数据写入磁盘
file.transferTo(newFile); file.transferTo(newFile);
//视频上传保存url //视频上传保存url
String zxUrl = basePath + newFileName; String videoUrl = basePath + newFileName;
//视频封面图处理 //视频封面图处理
String newImgName = time+".jpg"; String newImgName = time+".jpg";
String framefile = rootPath + newImgName; String framefile = rootPath + newImgName;
String imgUrlSave = basePath+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("imgUrl", imgUrl);
resultMap.put("returnCode", 0); resultMap.put("returnCode", 200);
String zxUrl=videoUrl;
//System.out.println("上传的文件名为:"+fileName+",后缀名为:"+newFileName); //System.out.println("上传的文件名为:"+fileName+",后缀名为:"+newFileName);
/**
* 生成当前时间戳
*/
BigInteger zxDate= BigInteger.valueOf(System.currentTimeMillis());
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, String.valueOf(zxDate)); shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, String.valueOf(zxDate));
return resultMap; 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