limin преди 7 години
родител
ревизия
94452316af

+ 20 - 0
src/main/java/com/goafanti/admin/bo/AdminVideoBo.java

@@ -0,0 +1,20 @@
+package com.goafanti.admin.bo;
+
+import com.goafanti.common.model.JtVideo;
+
+
+public class AdminVideoBo extends JtVideo {
+	
+	private String ownerName;
+
+	public String getOwnerName() {
+		return ownerName;
+	}
+
+	public void setOwnerName(String ownerName) {
+		this.ownerName = ownerName;
+	}
+	
+	
+	
+}

+ 349 - 0
src/main/java/com/goafanti/admin/controller/AdminVideoApiController.java

@@ -0,0 +1,349 @@
+package com.goafanti.admin.controller;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Base64;
+import java.util.Calendar;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+
+import net.bramp.ffmpeg.FFmpeg;
+import net.bramp.ffmpeg.FFmpegExecutor;
+import net.bramp.ffmpeg.FFmpegUtils;
+import net.bramp.ffmpeg.FFprobe;
+import net.bramp.ffmpeg.builder.FFmpegBuilder;
+import net.bramp.ffmpeg.job.FFmpegJob;
+import net.bramp.ffmpeg.probe.FFmpegProbeResult;
+import net.bramp.ffmpeg.progress.Progress;
+import net.bramp.ffmpeg.progress.ProgressListener;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.goafanti.admin.service.AdminVideoService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.enums.VideoFields;
+import com.goafanti.common.model.JtVideo;
+import com.goafanti.common.utils.FtpUtils;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+
+@Controller
+@RequestMapping(value = "/api/admin/video")
+public class AdminVideoApiController extends CertifyApiController {
+
+	@Resource
+	private AdminVideoService adminVideoService;
+
+	@Value(value = "${ffmpeg.path}")
+	public String ffmpegPath = null;
+	@Value(value = "${ffprobe.path}")
+	public String ffprobePath = null;
+
+	// 上传视频只做MP4格式的
+	@RequestMapping(value = "/upload", method = RequestMethod.POST)
+	@ResponseBody
+	public Result uploadPicture(HttpServletRequest req, String sign) {
+		Result res = new Result();
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+		if (attachmentType == AttachmentType.VIDEO) {
+			// 先将视频存在本地文件中
+			String filename = handleVideoFiles(res, req);
+			res.setData(filename);
+		} else if (attachmentType == AttachmentType.VIDEO_COVER) {
+			String picturebase = req.getParameter("picturebase");
+			String filename = req.getParameter("filename");
+			byte[] bs = Base64.getDecoder().decode(picturebase);
+			filename = System.nanoTime()
+					+ filename.substring(filename.indexOf("."));
+			res.setData(handleBaseFiles(res, "/video_cover/", false, bs, sign,
+					TokenManager.getUserId(), filename));
+
+		} else {
+			res.getError().add(
+					buildError(ErrorConstants.PARAM_ERROR, "", "文件标示"));
+		}
+		return res;
+	}
+
+	private String createFileName() {
+		// 年月日
+		Calendar now = Calendar.getInstance();
+		int year = now.get(Calendar.YEAR);
+		int month = now.get(Calendar.MONTH) + 1;
+		int day = now.get(Calendar.DAY_OF_MONTH);
+		String dir = "/" + year + "/" + month + "/" + day;
+		return dir;
+	}
+
+	// 查看所有视频信息
+	@RequestMapping(value = "/getVideoList", method = RequestMethod.GET)
+	@ResponseBody
+	public Result getVideoList(JtVideo video, Integer pageNo, Integer pageSize) {
+		Result result = new Result();
+		result.setData(adminVideoService.getVideoList(video, pageNo, pageSize,1));
+		return result;
+	}
+
+	// 查看单个信息
+	@RequestMapping(value = "/getVideoById", method = RequestMethod.GET)
+	@ResponseBody
+	public Result getVideoById(String id) {
+		Result result = new Result();
+		result.setData(adminVideoService.getVideoById(id));
+		return result;
+	}
+
+	// 新增视频信息
+	@RequestMapping(value = "/insertVideo", method = RequestMethod.POST)
+	@ResponseBody
+	public Result insertVideo(@Valid JtVideo video , BindingResult bindingResult) throws IOException,
+			InterruptedException, ExecutionException {
+		// 数据限制
+		Result result = new Result();
+		if (bindingResult.hasErrors()) {
+			result.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					VideoFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return result;
+		}
+		
+		String filename = video.getUrl();
+		// 生成保存到数据库的url
+		String output = System.nanoTime() + ".mp4";
+		video.setUrl(createFileName() + "/" + output);
+		video.setTranscoding(1);
+		// 保存到数据库
+		result.setData(adminVideoService.insertVideo(video));
+
+		// 压缩视频并将视频
+		videoChange(filename, output, video.getUrl());
+
+		return result;
+	}
+
+	// 修改视频
+	@RequestMapping(value = "/updateVideo", method = RequestMethod.POST)
+	@ResponseBody
+	public Result updateVideo(@Valid JtVideo video , BindingResult bindingResult) throws IOException,
+			InterruptedException, ExecutionException {
+		Result result = new Result();
+		if (bindingResult.hasErrors()) {
+			result.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					VideoFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return result;
+		}
+		JtVideo oldVideo = adminVideoService.getVideoById(video.getId());
+		if (StringUtils.isBlank(video.getId())) {
+			result.getError().add(
+					buildError(ErrorConstants.PARAM_ERROR, "", "视频id不能为空"));
+			return result;
+		} else if (null == oldVideo) {
+			result.getError().add(
+					buildError(ErrorConstants.PARAM_ERROR, "", "视频id不存在"));
+			return result;
+		}
+		if (StringUtils.isNotBlank(video.getUrl())) { // 如果修改了视频
+			video.setTranscoding(1);
+			// 压缩视频并将视频
+			String filename = video.getUrl();
+			String output = System.nanoTime() + ".mp4";
+			video.setUrl(createFileName() + "/" + output);
+			videoChange(filename, output, video.getUrl());
+		}
+
+		result.setData(adminVideoService.updateVideo(video));
+		return result;
+	}
+	
+	
+
+	// 将文件转码
+	private String videoChange(String input, String output, String url) throws IOException,
+			InterruptedException, ExecutionException {
+
+		FFmpeg ffmpeg = new FFmpeg(ffmpegPath);
+		FFprobe ffprobe = new FFprobe(ffprobePath);
+
+		FFmpegProbeResult in = ffprobe.probe(input);
+
+		FFmpegBuilder builder = new FFmpegBuilder();
+		builder.setInput(in) // 输入文件
+				.overrideOutputFiles(true) // 覆盖重复文件
+				.addOutput(output) // 输出文件
+				.setFormat("mp4") // 设置格式
+				.setTargetSize(250_000) // 目标大小
+				.disableSubtitle() // 没有子标题
+				.setAudioChannels(1) // 声道
+				.setAudioSampleRate(48_000) // 音频采样率
+				.setAudioBitRate(32768) // 音频传输率
+				.setVideoCodec("libx264") // 视频编解码器
+				.setVideoFrameRate(24, 1) // 视频帧速率
+				.setVideoResolution(640, 480) // 视频分辨率
+				.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // 严格形式
+				.done();
+
+		FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
+		ExecutorService service = Executors.newCachedThreadPool();
+		// 3.直接new一个FutureTask
+		SubTask subTask = new SubTask(executor, builder, in, url, input, output);
+		FutureTask<Boolean> result = new FutureTask<Boolean>(subTask);
+		// 4.提交任务
+		service.submit(result);
+		// 5.关闭线程池
+		service.shutdown();
+		// LOGGER.info("=============返回给前端=============");
+		return "SUCESS";
+	}
+
+	private void updateSql(String url, String filename) {
+		// 修改数据
+		File file = new File(filename);
+		JtVideo video = new JtVideo();
+		video.setMd5(FileMD5(file));
+		video.setTranscoding(2);
+		video.setUrl(url);
+		int c = adminVideoService.updateByUrl(video);
+		if (c > 0){
+			url = url.substring(0,url.lastIndexOf("/"));
+			videoChange(url, filename);// 上传到远程
+		}
+	}
+
+	private void videoChange(String url, String filename) {
+		
+		File f2 = new File(filename);// 临时压缩后的文件
+		if (f2.exists()) {
+			// 传到远程服务器
+			FtpUtils ftp = new FtpUtils();
+			ftp.uploadFile(url, filename, filename);
+			// 删除视频
+			f2.delete();
+		}
+	}
+
+	// 获得文件md5
+	private String FileMD5(File file) {
+		try {
+			FileInputStream fis = new FileInputStream(file);
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			byte[] buffer = new byte[1024];
+			int length = -1;
+			while ((length = fis.read(buffer, 0, 1024)) != -1) {
+				md.update(buffer, 0, length);
+			}
+			BigInteger bigInt = new BigInteger(1, md.digest());
+			return bigInt.toString(16);
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	class SubTask implements Callable<Boolean> {
+		private Boolean state = false;
+		private FFmpegExecutor executor;
+		private FFmpegBuilder builder;
+		private FFmpegProbeResult probeResult;
+		private String url;
+		private String input;
+		private String output;
+
+		public SubTask(FFmpegExecutor executor, FFmpegBuilder builder,
+				FFmpegProbeResult probeResult, String url, String input,
+				String output) {
+			this.executor = executor;
+			this.builder = builder;
+			this.probeResult = probeResult;
+			this.url = url;
+			this.input = input;
+			this.output = output;
+		}
+
+		public FFmpegExecutor getExecutor() {
+			return executor;
+		}
+
+		public FFmpegBuilder getBuilder() {
+			return builder;
+		}
+
+		public String getUrl() {
+			return url;
+		}
+
+		public String getInput() {
+			return input;
+		}
+
+		public String getOutput() {
+			return output;
+		}
+
+		public Boolean getState() {
+			return state;
+		}
+
+		@Override
+		public Boolean call() throws Exception {
+			final double duration_ns = probeResult.getFormat().duration
+					* TimeUnit.SECONDS.toNanos(1);
+			try {
+				FFmpegJob job = executor.createJob(builder,
+						new ProgressListener() {
+							@Override
+							public void progress(Progress progress) {
+								double percentage = progress.out_time_ns
+										/ duration_ns;
+								System.out.println(String
+										.format("[%.0f%%] status:%s frame:%d time:%s ms fps:%.0f speed:%.2fx",
+												percentage * 100,
+												progress.status,
+												progress.frame,
+												FFmpegUtils.toTimecode(
+														progress.out_time_ns,
+														TimeUnit.NANOSECONDS),
+												progress.fps.doubleValue(),
+												progress.speed));
+							}
+						});
+				job.run();
+				// 6.阻塞 call
+				// System.out.println("设置 sate");
+				// latch.wait();
+				state = true;
+				updateSql(url, output);
+				// 删除未压缩的视频
+				File f1 = new File(input);
+				f1.delete();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+			return state;
+		}
+	}
+
+}

+ 18 - 0
src/main/java/com/goafanti/admin/service/AdminVideoService.java

@@ -0,0 +1,18 @@
+package com.goafanti.admin.service;
+
+import com.goafanti.admin.bo.AdminVideoBo;
+import com.goafanti.common.model.JtVideo;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface AdminVideoService {
+	Pagination<AdminVideoBo> getVideoList(JtVideo video, Integer pageNo, Integer pageSize,Integer ob);
+	
+	AdminVideoBo getVideoById(String id);
+	
+	int insertVideo(JtVideo jtVideo);
+	
+	int updateVideo(JtVideo jtVideo);
+	
+	int updateByUrl(JtVideo jtVideo);
+	
+}

+ 70 - 0
src/main/java/com/goafanti/admin/service/impl/AdminVideoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.goafanti.admin.service.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.admin.bo.AdminVideoBo;
+import com.goafanti.admin.service.AdminVideoService;
+import com.goafanti.common.dao.JtVideoMapper;
+import com.goafanti.common.model.JtVideo;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+
+@Service
+public class AdminVideoServiceImpl extends BaseMybatisDao<JtVideoMapper> implements AdminVideoService {
+
+	@Autowired
+	private JtVideoMapper jtVideoMapper;
+	
+	@Override
+	public Pagination<AdminVideoBo> getVideoList(JtVideo video, Integer pageNo,
+			Integer pageSize, Integer ob) {
+		Map<String,Object> params = new HashMap<String, Object>();
+		if(null != video) params.put("v", video);
+		params.put("ob", ob);//按创建时间排序
+		@SuppressWarnings("unchecked")
+		Pagination<AdminVideoBo> videos = (Pagination<AdminVideoBo>) findPage("getVideoListBySome","getVideoCountBySome",params,pageNo,pageSize);
+		return videos;
+	}
+
+	@Override
+	public AdminVideoBo getVideoById(String id) {
+		return jtVideoMapper.selectById(id);
+	}
+
+	@Override
+	public int insertVideo(JtVideo jtVideo) {
+		//生成id
+		jtVideo.setId(UUID.randomUUID().toString());
+		//默认状态
+		if(null == jtVideo.getStatus()) jtVideo.setStatus(0);
+		//创建时间
+		jtVideo.setCreateTime(new Date());
+		//创建人
+		jtVideo.setOwner(TokenManager.getUserId());
+		return jtVideoMapper.insertSelective(jtVideo);
+	}
+
+	@Override
+	public int updateVideo(JtVideo jtVideo) {
+		//如果状态更改成已经发布需要修改发布时间
+		if(jtVideo.getStatus() == 1){
+			jtVideo.setReleaseTime(new Date());
+		}
+		return jtVideoMapper.updateByPrimaryKeySelective(jtVideo);
+	}
+
+	@Override
+	public int updateByUrl(JtVideo jtVideo) {
+		return jtVideoMapper.updateByUrl(jtVideo);
+	}
+
+	
+
+}

+ 20 - 0
src/main/java/com/goafanti/common/controller/BaseApiController.java

@@ -257,4 +257,24 @@ public class BaseApiController extends BaseController {
 		}
 		return fileName;
 	}
+	
+	protected String handleVideoFiles(Result res, HttpServletRequest req) {
+		List<MultipartFile> files = getFiles(req);
+		MultipartFile mf = files.get(0);
+		String fileName = mf.getName() + System.nanoTime() + ".mp4" ;
+		if (!files.isEmpty()) {
+			try {
+				mf.transferTo(new File(fileName));
+				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
+			} catch (IllegalStateException | IOException e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+				return "";
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+			return "";
+		}
+		return fileName;
+	}
 }

+ 24 - 0
src/main/java/com/goafanti/common/controller/PortalController.java

@@ -6,17 +6,23 @@ import java.util.Random;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.view.RedirectView;
+
 import com.goafanti.achievement.bo.AchievementPartnerListBo;
 import com.goafanti.achievement.service.AchievementService;
+import com.goafanti.admin.service.AdminVideoService;
 import com.goafanti.business.bo.JtBusinessProjectResult;
 import com.goafanti.business.service.JtBusinessService;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.enums.AchievementMaturity;
 import com.goafanti.common.model.JtBusinessProject;
+import com.goafanti.common.model.JtVideo;
 import com.goafanti.common.model.UserInterest;
 import com.goafanti.common.service.DistrictGlossoryService;
 import com.goafanti.common.service.FieldGlossoryService;
@@ -59,6 +65,9 @@ public class PortalController extends BaseController {
 	private JtBusinessService	jtBusinessService;
 	@Resource
 	private VoucherService	voucherService;
+	
+	@Resource
+	private AdminVideoService adminVideoService;
 
 	@RequestMapping(value = "/index", method = RequestMethod.GET)
 	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {
@@ -213,4 +222,19 @@ public class PortalController extends BaseController {
 		
 		return modelAndView;
 	}
+	
+	@RequestMapping(value="/portal/video",method = RequestMethod.GET)
+	public ModelAndView video(ModelAndView modelAndView){
+		modelAndView.setViewName("/portal/video/video");
+		return modelAndView;
+	}
+	
+	//获得所有视频数据
+	@RequestMapping(value="/portal/getVideoList", method = RequestMethod.GET)
+	@ResponseBody
+	public Result getVideoList(JtVideo video, Integer pageNo, Integer pageSize){
+		Result result = new Result();
+		result.setData(adminVideoService.getVideoList(video, pageNo, pageSize,2));
+		return result;
+	}
 }

+ 84 - 0
src/main/java/com/goafanti/common/dao/JtVideoMapper.java

@@ -0,0 +1,84 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.goafanti.admin.bo.AdminVideoBo;
+import com.goafanti.common.model.JtVideo;
+import com.goafanti.common.model.JtVideoExample;
+
+public interface JtVideoMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int countByExample(JtVideoExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int deleteByExample(JtVideoExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int insert(JtVideo record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int insertSelective(JtVideo record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	List<JtVideo> selectByExample(JtVideoExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	JtVideo selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") JtVideo record,
+			@Param("example") JtVideoExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int updateByExample(@Param("record") JtVideo record,
+			@Param("example") JtVideoExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int updateByPrimaryKeySelective(JtVideo record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jt_video
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	int updateByPrimaryKey(JtVideo record);
+
+	AdminVideoBo selectById(String id);
+	
+	int updateByUrl(JtVideo video);
+}

+ 4 - 1
src/main/java/com/goafanti/common/enums/AttachmentType.java

@@ -17,7 +17,10 @@ public enum AttachmentType {
 	JT_BUSINESS_PICTURE("jt_business_picture","技淘品类图片"),
 	JT_PROJECT_PICTURE("jt_project_picture","技淘服务项目图片"),
 	USER_PICTURE("user_picture","用户图片"),
-	HONOR_PICTURE("honor_picture","荣誉图片");
+	HONOR_PICTURE("honor_picture","荣誉图片"),
+	VIDEO("video","视频"),
+	VIDEO_COVER("video_cover","视频封面图片");
+	
 	private AttachmentType(String code, String desc) {
 		this.code = code;
 		this.desc = desc;

+ 55 - 0
src/main/java/com/goafanti/common/enums/VideoFields.java

@@ -0,0 +1,55 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum VideoFields {
+	NAME("name", "视频名称"),
+	URL("url", "视频地址"),
+	TYPE("type", "视频类型"),
+	COVERURL("coverUrl", "封面"),
+	SUMMARY("summary", "简介"),
+	STATUS("status", "状态"),
+	OTHER("", "未知参数");
+
+	private VideoFields(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<String, VideoFields> status = new HashMap<String, VideoFields>();
+
+	static {
+		for (VideoFields value : VideoFields.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static VideoFields getField(String code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static String getFieldDesc(String code) {
+		return getField(code).getDesc();
+	}
+
+	public static boolean containsType(String code) {
+		return status.containsKey(code);
+	}
+
+	private String	code;
+	private String	desc;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+
+}

+ 509 - 0
src/main/java/com/goafanti/common/mapper/JtVideoMapper.xml

@@ -0,0 +1,509 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.JtVideoMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtVideo">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="url" jdbcType="VARCHAR" property="url" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="owner" jdbcType="VARCHAR" property="owner" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="summary" jdbcType="VARCHAR" property="summary" />
+    <result column="cover_url" jdbcType="VARCHAR" property="coverUrl" />
+    <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
+    <result column="transcoding" jdbcType="INTEGER" property="transcoding" />
+    <result column="md5" jdbcType="VARCHAR" property="md5" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    id, name, url, type, owner, create_time, status, summary, cover_url, release_time, 
+    transcoding, md5
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.JtVideoExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from jt_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from jt_video
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    delete from jt_video
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtVideoExample">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    delete from jt_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.JtVideo">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    insert into jt_video (id, name, url, 
+      type, owner, create_time, 
+      status, summary, cover_url, 
+      release_time, transcoding, md5
+      )
+    values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
+      #{type,jdbcType=INTEGER}, #{owner,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{status,jdbcType=INTEGER}, #{summary,jdbcType=VARCHAR}, #{coverUrl,jdbcType=VARCHAR}, 
+      #{releaseTime,jdbcType=TIMESTAMP}, #{transcoding,jdbcType=INTEGER}, #{md5,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.JtVideo">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    insert into jt_video
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="name != null">
+        name,
+      </if>
+      <if test="url != null">
+        url,
+      </if>
+      <if test="type != null">
+        type,
+      </if>
+      <if test="owner != null">
+        owner,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="summary != null">
+        summary,
+      </if>
+      <if test="coverUrl != null">
+        cover_url,
+      </if>
+      <if test="releaseTime != null">
+        release_time,
+      </if>
+      <if test="transcoding != null">
+        transcoding,
+      </if>
+      <if test="md5 != null">
+        md5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="owner != null">
+        #{owner,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="summary != null">
+        #{summary,jdbcType=VARCHAR},
+      </if>
+      <if test="coverUrl != null">
+        #{coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="releaseTime != null">
+        #{releaseTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="transcoding != null">
+        #{transcoding,jdbcType=INTEGER},
+      </if>
+      <if test="md5 != null">
+        #{md5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.JtVideoExample" resultType="java.lang.Integer">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    select count(*) from jt_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    update jt_video
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.name != null">
+        name = #{record.name,jdbcType=VARCHAR},
+      </if>
+      <if test="record.url != null">
+        url = #{record.url,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null">
+        type = #{record.type,jdbcType=INTEGER},
+      </if>
+      <if test="record.owner != null">
+        owner = #{record.owner,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.status != null">
+        status = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.summary != null">
+        summary = #{record.summary,jdbcType=VARCHAR},
+      </if>
+      <if test="record.coverUrl != null">
+        cover_url = #{record.coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="record.releaseTime != null">
+        release_time = #{record.releaseTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.transcoding != null">
+        transcoding = #{record.transcoding,jdbcType=INTEGER},
+      </if>
+      <if test="record.md5 != null">
+        md5 = #{record.md5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    update jt_video
+    set id = #{record.id,jdbcType=VARCHAR},
+      name = #{record.name,jdbcType=VARCHAR},
+      url = #{record.url,jdbcType=VARCHAR},
+      type = #{record.type,jdbcType=INTEGER},
+      owner = #{record.owner,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      status = #{record.status,jdbcType=INTEGER},
+      summary = #{record.summary,jdbcType=VARCHAR},
+      cover_url = #{record.coverUrl,jdbcType=VARCHAR},
+      release_time = #{record.releaseTime,jdbcType=TIMESTAMP},
+      transcoding = #{record.transcoding,jdbcType=INTEGER},
+      md5 = #{record.md5,jdbcType=VARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtVideo">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    update jt_video
+    <set>
+      <if test="name != null">
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        url = #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        type = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="owner != null">
+        owner = #{owner,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="summary != null">
+        summary = #{summary,jdbcType=VARCHAR},
+      </if>
+      <if test="coverUrl != null">
+        cover_url = #{coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="releaseTime != null">
+        release_time = #{releaseTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="transcoding != null">
+        transcoding = #{transcoding,jdbcType=INTEGER},
+      </if>
+      <if test="md5 != null">
+        md5 = #{md5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtVideo">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 30 20:16:39 CST 2018.
+    -->
+    update jt_video
+    set name = #{name,jdbcType=VARCHAR},
+      url = #{url,jdbcType=VARCHAR},
+      type = #{type,jdbcType=INTEGER},
+      owner = #{owner,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      status = #{status,jdbcType=INTEGER},
+      summary = #{summary,jdbcType=VARCHAR},
+      cover_url = #{coverUrl,jdbcType=VARCHAR},
+      release_time = #{releaseTime,jdbcType=TIMESTAMP},
+      transcoding = #{transcoding,jdbcType=INTEGER},
+      md5 = #{md5,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <!-- 查看视频列表 -->
+  <select id="getVideoListBySome" parameterType="java.util.Map" resultType="com.goafanti.admin.bo.AdminVideoBo">
+  	select  
+  	v.id, v.name, url, type, owner, v.create_time as createTime, v.status, summary, cover_url as coverUrl, 
+  	release_time as releaseTime, transcoding, md5, a.name as ownerName  
+  	from jt_video v
+	left join admin a on v.owner = a.id
+  	where 1=1
+  	<if test='v.name != null and v.name != ""'>
+  	<bind name="n" value="'%' + v.name + '%' " />
+	and v.name like #{n,jdbcType=VARCHAR}
+  	</if>
+  	<if test="v.type != null">
+	and type = #{v.type,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.status != null">
+	and v.status = #{v.status,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.status == null">
+	and v.status &lt; 3
+  	</if>
+  	<if test="v.transcoding != null">
+	and v.transcoding = #{v.transcoding,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.owner != null">
+	and owner = #{v.owner,jdbcType=VARCHAR}
+  	</if>
+  	<if test="ob == 1">
+	order by v.create_time desc
+  	</if>
+  	<if test="ob == 2">
+	order by v.release_time desc
+  	</if>
+	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+   </select>
+   <!-- 查看视频列表数量 -->
+   <select id="getVideoCountBySome" parameterType="java.util.Map" resultType="java.lang.Integer">
+   select  
+  	count(*)
+  	from jt_video v
+	left join admin a on v.owner = a.id
+  	where 1=1
+  	<if test='v.name != null and v.name != ""'>
+  	<bind name="n" value="'%' + v.name + '%' " />
+	and v.name like #{n,jdbcType=VARCHAR}
+  	</if>
+  	<if test="v.type != null">
+	and v.type = #{v.type,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.status != null">
+	and v.status = #{v.status,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.status == null">
+	and v.status &lt; 3
+  	</if>
+  	<if test="v.transcoding != null">
+	and v.transcoding = #{v.transcoding,jdbcType=INTEGER}
+  	</if>
+  	<if test="v.owner != null">
+	and v.owner = #{v.owner,jdbcType=VARCHAR}
+  	</if>
+	<if test="ob == 1">
+	order by v.create_time desc
+  	</if>
+  	<if test="ob == 2">
+	order by v.release_time desc
+  	</if>
+   </select>
+   <!-- 查看单个信息 -->
+   <select id="selectById" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminVideoBo">
+    select 
+    v.id, v.name, url, type, owner, v.create_time as createTime, v.status, summary, cover_url as coverUrl, 
+    release_time as releaseTime, transcoding, md5, a.name as ownerName  
+  	from jt_video v
+	left join admin a on v.owner = a.id
+    where v.id = #{id,jdbcType=VARCHAR}
+  </select>
+  <!-- 根据url 修改数据 -->
+  <update id="updateByUrl" parameterType="com.goafanti.common.model.JtVideo">
+  	update jt_video
+    <set>
+      <if test="name != null">
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        type = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="owner != null">
+        owner = #{owner,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="summary != null">
+        summary = #{summary,jdbcType=VARCHAR},
+      </if>
+      <if test="coverUrl != null">
+        cover_url = #{coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="transcoding != null">
+        transcoding = #{transcoding,jdbcType=INTEGER},
+      </if>
+      <if test="md5 != null">
+        md5 = #{md5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where url = #{url,jdbcType=VARCHAR}
+  </update>
+</mapper>

+ 302 - 0
src/main/java/com/goafanti/common/model/JtVideo.java

@@ -0,0 +1,302 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class JtVideo {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.id
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.name
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 16, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String name;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 64, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String url;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.type
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Max(value = 3, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer type;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.owner
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String owner;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.create_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	private Date createTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.status
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Max(value = 3, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer status;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.summary
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 512, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String summary;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.cover_url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 64, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String coverUrl;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.release_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	private Date releaseTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.transcoding
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Max(value = 2, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer transcoding;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jt_video.md5
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	@Size(min = 0, max = 32, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String md5;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.id
+	 * @return  the value of jt_video.id
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.id
+	 * @param id  the value for jt_video.id
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.name
+	 * @return  the value of jt_video.name
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.name
+	 * @param name  the value for jt_video.name
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.url
+	 * @return  the value of jt_video.url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getUrl() {
+		return url;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.url
+	 * @param url  the value for jt_video.url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.type
+	 * @return  the value of jt_video.type
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public Integer getType() {
+		return type;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.type
+	 * @param type  the value for jt_video.type
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.owner
+	 * @return  the value of jt_video.owner
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getOwner() {
+		return owner;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.owner
+	 * @param owner  the value for jt_video.owner
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setOwner(String owner) {
+		this.owner = owner;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.create_time
+	 * @return  the value of jt_video.create_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.create_time
+	 * @param createTime  the value for jt_video.create_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.status
+	 * @return  the value of jt_video.status
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public Integer getStatus() {
+		return status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.status
+	 * @param status  the value for jt_video.status
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.summary
+	 * @return  the value of jt_video.summary
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getSummary() {
+		return summary;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.summary
+	 * @param summary  the value for jt_video.summary
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setSummary(String summary) {
+		this.summary = summary;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.cover_url
+	 * @return  the value of jt_video.cover_url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getCoverUrl() {
+		return coverUrl;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.cover_url
+	 * @param coverUrl  the value for jt_video.cover_url
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setCoverUrl(String coverUrl) {
+		this.coverUrl = coverUrl;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.release_time
+	 * @return  the value of jt_video.release_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public Date getReleaseTime() {
+		return releaseTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.release_time
+	 * @param releaseTime  the value for jt_video.release_time
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setReleaseTime(Date releaseTime) {
+		this.releaseTime = releaseTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.transcoding
+	 * @return  the value of jt_video.transcoding
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public Integer getTranscoding() {
+		return transcoding;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.transcoding
+	 * @param transcoding  the value for jt_video.transcoding
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setTranscoding(Integer transcoding) {
+		this.transcoding = transcoding;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jt_video.md5
+	 * @return  the value of jt_video.md5
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public String getMd5() {
+		return md5;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jt_video.md5
+	 * @param md5  the value for jt_video.md5
+	 * @mbggenerated  Tue Oct 30 20:16:39 CST 2018
+	 */
+	public void setMd5(String md5) {
+		this.md5 = md5;
+	}
+}

Файловите разлики са ограничени, защото са твърде много
+ 1060 - 0
src/main/java/com/goafanti/common/model/JtVideoExample.java


+ 1 - 1
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -98,7 +98,7 @@ public class FileUtils {
 		boolean uniq = false;
 		if (sign.indexOf("demand_picture") != -1|| sign.indexOf("achievement_picture") != -1 || sign.indexOf("user_picture")!=-1
 				|| sign.indexOf("jt_project_picture")!=-1 || sign.indexOf("jt_business_picture")!=-1 || sign.indexOf("honor_picture")!=-1
-				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1) {
+				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1 || sign.indexOf("video")!=-1 ) {
 			uniq = true;
 		}
 		String fileName = "";

+ 302 - 0
src/main/java/com/goafanti/common/utils/FtpUtils.java

@@ -0,0 +1,302 @@
+package com.goafanti.common.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+
+public class FtpUtils {
+	//ftp服务器地址
+    public static final String HOSTNAME = "118.190.205.7";
+    //ftp服务器端口号默认为21
+    public static final Integer PORT = 21 ;
+    //ftp登录账号
+    public static final String USERNAME = "video";
+    //ftp登录密码
+    public static final String PASSWORD = "aft2018";
+    
+    public FTPClient ftpClient = null;
+    /**
+     * 初始化ftp服务器
+     */
+    public void initFtpClient() {
+        ftpClient = new FTPClient();
+        ftpClient.setControlEncoding("utf-8");
+        try {
+            System.out.println("connecting...ftp服务器:"+ HOSTNAME+":"+ PORT); 
+            ftpClient.connect(HOSTNAME, PORT); //连接ftp服务器
+            ftpClient.login(USERNAME, PASSWORD); //登录ftp服务器
+            int replyCode = ftpClient.getReplyCode(); //是否成功登录服务器
+            if(!FTPReply.isPositiveCompletion(replyCode)){
+                System.out.println("connect failed...ftp服务器:"+ HOSTNAME+":"+ PORT); 
+            }
+            System.out.println("connect successfu...ftp服务器:"+ HOSTNAME+":"+ PORT); 
+        }catch (MalformedURLException e) { 
+           e.printStackTrace(); 
+        }catch (IOException e) { 
+           e.printStackTrace(); 
+        } 
+    }
+    
+    /**
+     * 上传文件
+     * @param pathname ftp服务保存地址
+     * @param fileName 上传到ftp的文件名
+     *  @param originfilename 待上传文件的名称(绝对地址) * 
+     * @return
+     */
+     public boolean uploadFile( String pathname, String fileName,String originfilename){
+         boolean flag = false;
+         InputStream inputStream = null;
+         try{
+             System.out.println("开始上传文件");
+             inputStream = new FileInputStream(new File(originfilename));
+             initFtpClient();
+             ftpClient.setFileType(ftpClient.BINARY_FILE_TYPE);
+             CreateDirecroty(pathname);
+             ftpClient.makeDirectory(pathname);
+             ftpClient.changeWorkingDirectory(pathname);
+             ftpClient.storeFile(fileName, inputStream);
+             inputStream.close();
+             ftpClient.logout();
+             flag = true;
+             System.out.println("上传文件成功");
+         }catch (Exception e) {
+             System.out.println("上传文件失败");
+             e.printStackTrace();
+         }finally{
+             if(ftpClient.isConnected()){ 
+                 try{
+                     ftpClient.disconnect();
+                 }catch(IOException e){
+                     e.printStackTrace();
+                 }
+             } 
+             if(null != inputStream){
+                 try {
+                     inputStream.close();
+                 } catch (IOException e) {
+                     e.printStackTrace();
+                 } 
+             } 
+         }
+         return true;
+     }
+     /**
+      * 上传文件
+      * @param pathname ftp服务保存地址
+      * @param fileName 上传到ftp的文件名
+      * @param inputStream 输入文件流 
+      * @return
+      */
+     public boolean uploadFile( String pathname, String fileName,InputStream inputStream){
+         boolean flag = false;
+         try{
+             System.out.println("开始上传文件");
+             initFtpClient();
+             ftpClient.setFileType(ftpClient.BINARY_FILE_TYPE);
+             CreateDirecroty(pathname);
+             ftpClient.makeDirectory(pathname);
+             ftpClient.changeWorkingDirectory(pathname);
+             ftpClient.storeFile(fileName, inputStream);
+             inputStream.close();
+             ftpClient.logout();
+             flag = true;
+             System.out.println("上传文件成功");
+         }catch (Exception e) {
+             System.out.println("上传文件失败");
+             e.printStackTrace();
+         }finally{
+             if(ftpClient.isConnected()){ 
+                 try{
+                     ftpClient.disconnect();
+                 }catch(IOException e){
+                     e.printStackTrace();
+                 }
+             } 
+             if(null != inputStream){
+                 try {
+                     inputStream.close();
+                 } catch (IOException e) {
+                     e.printStackTrace();
+                 } 
+             } 
+         }
+         return true;
+     }
+     //改变目录路径
+      public boolean changeWorkingDirectory(String directory) {
+             boolean flag = true;
+             try {
+                 flag = ftpClient.changeWorkingDirectory(directory);
+                 if (flag) {
+                   System.out.println("进入文件夹" + directory + " 成功!");
+
+                 } else {
+                     System.out.println("进入文件夹" + directory + " 失败!开始创建文件夹");
+                 }
+             } catch (IOException ioe) {
+                 ioe.printStackTrace();
+             }
+             return flag;
+         }
+
+     //创建多层目录文件,如果有ftp服务器已存在该文件,则不创建,如果无,则创建
+     public boolean CreateDirecroty(String remote) throws IOException {
+         boolean success = true;
+         String directory = remote + "/";
+         // 如果远程目录不存在,则递归创建远程服务器目录
+         if (!directory.equalsIgnoreCase("/") && !changeWorkingDirectory(new String(directory))) {
+             int start = 0;
+             int end = 0;
+             if (directory.startsWith("/")) {
+                 start = 1;
+             } else {
+                 start = 0;
+             }
+             end = directory.indexOf("/", start);
+             String path = "";
+             String paths = "";
+             while (true) {
+                 String subDirectory = new String(remote.substring(start, end).getBytes("GBK"), "iso-8859-1");
+                 path = path + "/" + subDirectory;
+                 if (!existFile(path)) {
+                     if (makeDirectory(subDirectory)) {
+                         changeWorkingDirectory(subDirectory);
+                     } else {
+                         System.out.println("创建目录[" + subDirectory + "]失败");
+                         changeWorkingDirectory(subDirectory);
+                     }
+                 } else {
+                     changeWorkingDirectory(subDirectory);
+                 }
+
+                 paths = paths + "/" + subDirectory;
+                 start = end + 1;
+                 end = directory.indexOf("/", start);
+                 // 检查所有目录是否创建完毕
+                 if (end <= start) {
+                     break;
+                 }
+             }
+         }
+         return success;
+     }
+
+   //判断ftp服务器文件是否存在    
+     public boolean existFile(String path) throws IOException {
+             boolean flag = false;
+             FTPFile[] ftpFileArr = ftpClient.listFiles(path);
+             if (ftpFileArr.length > 0) {
+                 flag = true;
+             }
+             return flag;
+         }
+     //创建目录
+     public boolean makeDirectory(String dir) {
+         boolean flag = true;
+         try {
+             flag = ftpClient.makeDirectory(dir);
+             if (flag) {
+                 System.out.println("创建文件夹" + dir + " 成功!");
+
+             } else {
+                 System.out.println("创建文件夹" + dir + " 失败!");
+             }
+         } catch (Exception e) {
+             e.printStackTrace();
+         }
+         return flag;
+     }
+     
+     /** * 下载文件 * 
+     * @param pathname FTP服务器文件目录 * 
+     * @param filename 文件名称 * 
+     * @param localpath 下载后的文件路径 * 
+     * @return */
+     public  boolean downloadFile(String pathname, String filename, String localpath){ 
+         boolean flag = false; 
+         OutputStream os=null;
+         try { 
+             System.out.println("开始下载文件");
+             initFtpClient();
+             //切换FTP目录 
+             ftpClient.changeWorkingDirectory(pathname); 
+             FTPFile[] ftpFiles = ftpClient.listFiles(); 
+             for(FTPFile file : ftpFiles){ 
+                 if(filename.equalsIgnoreCase(file.getName())){ 
+                     File localFile = new File(localpath + "/" + file.getName()); 
+                     os = new FileOutputStream(localFile); 
+                     ftpClient.retrieveFile(file.getName(), os); 
+                     os.close(); 
+                 } 
+             } 
+             ftpClient.logout(); 
+             flag = true; 
+             System.out.println("下载文件成功");
+         } catch (Exception e) { 
+             System.out.println("下载文件失败");
+             e.printStackTrace(); 
+         } finally{ 
+             if(ftpClient.isConnected()){ 
+                 try{
+                     ftpClient.disconnect();
+                 }catch(IOException e){
+                     e.printStackTrace();
+                 }
+             } 
+             if(null != os){
+                 try {
+                     os.close();
+                 } catch (IOException e) {
+                     e.printStackTrace();
+                 } 
+             } 
+         } 
+         return flag; 
+     }
+     
+     /** * 删除文件 * 
+     * @param pathname FTP服务器保存目录 * 
+     * @param filename 要删除的文件名称 * 
+     * @return */ 
+     public boolean deleteFile(String pathname, String filename){ 
+         boolean flag = false; 
+         try { 
+             System.out.println("开始删除文件");
+             initFtpClient();
+             //切换FTP目录 
+             ftpClient.changeWorkingDirectory(pathname); 
+             ftpClient.dele(filename); 
+             ftpClient.logout();
+             flag = true; 
+             System.out.println("删除文件成功");
+         } catch (Exception e) { 
+             System.out.println("删除文件失败");
+             e.printStackTrace(); 
+         } finally {
+             if(ftpClient.isConnected()){ 
+                 try{
+                     ftpClient.disconnect();
+                 }catch(IOException e){
+                     e.printStackTrace();
+                 }
+             } 
+         }
+         return flag; 
+     }
+     
+     public static void main(String[] args) {
+         FtpUtils ftp =new FtpUtils(); 
+         ftp.uploadFile("ftpFile/data", "aaa.avi", "F:\\BaiduNetdiskDownload\\day63_project_OA_day12_JBPM04\\video\\aaa.avi");
+         System.out.println("ok");
+     }
+    
+}

+ 3 - 0
src/main/resources/props/config_local.properties

@@ -82,4 +82,7 @@ jiguang.appKey=dbcea43366e038073452a04e
 jiguang.masterSecret=59792298288e4f635c737def
 jiguang.pushUrl=https://api.jpush.cn/v3/push
 
+ffmpeg.path=E\:\\mytools\\ffmpeg-20181028-bdfd2e3-win64-static\\bin\\ffmpeg.exe
+ffprobe.path=E\:\\mytools\\ffmpeg-20181028-bdfd2e3-win64-static\\bin\\ffprobe.exe
+
 collect_flag=true

+ 4 - 0
src/main/resources/props/config_test.properties

@@ -81,4 +81,8 @@ jiguang.appKey=dbcea43366e038073452a04e
 jiguang.masterSecret=59792298288e4f635c737def
 jiguang.pushUrl=https://api.jpush.cn/v3/push
 
+ffmpeg.path=E:/mytools/ffmpeg-20181028-bdfd2e3-win64-static/bin/ffmpeg.exe
+ffprobe.path=E:/mytools/ffmpeg-20181028-bdfd2e3-win64-static/bin/ffprobe.exe
+
+
 collect_flag=true

+ 1 - 1
src/main/resources/spring/spring-mvc.xml

@@ -111,7 +111,7 @@
 	<bean id="multipartResolver"
 		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
 		<property name="defaultEncoding" value="UTF-8" />
-		<property name="maxUploadSize" value="10485760" />
+		<property name="maxUploadSize" value="104857600" />
 	</bean>
 
 	<bean

+ 1 - 1
src/main/webapp/WEB-INF/views/common.html

@@ -12,7 +12,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <th:block th:replace="${link}" />
-  <title></title>
+<!--   <title></title> -->
 </head>
 
 

+ 77 - 0
src/main/webapp/WEB-INF/views/portal/video/video.html

@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head th:replace="common::header(~{::title},~{::link})">
+	<meta charset="UTF-8">
+	<title>技淘视频</title>
+	<link th:href="${portalHost+'/dll/dll.css'}"  rel="stylesheet">
+	<link th:href="${portalHost+'/vendors.css'}" rel="stylesheet">
+	<link th:href="${portalHost+'/newMenu/video.css'}" rel="stylesheet">
+</head>
+	<body>
+		<div th:replace="common::nav('','video')"></div>  
+		<!-- 上面是公共头部 -->
+		<div class="indexSearch">
+			<div class="search-inp">
+				<div class="input-group">
+					<input type="text" class="form-control demandSearch" placeholder="请输入关键字">
+					<span class="input-group-btn">
+						<button class="btn btn-default searchBtn" type="button">
+							<img th:src="${portalHost+'/img/newMenu/search-icon.jpg'}" alt=""> 搜索
+						</button>
+					</span>
+				</div>
+			</div>
+		</div>
+	    <div class="title">
+	    	视频专区
+	    </div>
+		<div class="contImg">
+			<ul>
+				
+			</ul>
+		</div>
+		<div class="pagination_box">
+            <nav aria-label="Page navigation" class="clearfix">
+                <ul class="pagination">
+                    <li class="pagePre">
+                        <a href="#" aria-label="Previous">
+                            <span aria-hidden="true">首页</span>
+                        </a>
+                    </li>
+                    <li class="pageNumber"><a href="#" value="1">1</a></li>
+                    <li class="pageNext">
+                        <a href="#" aria-label="Next">
+                            <span aria-hidden="true">末页</span>
+                        </a>
+                    </li>
+                </ul>
+                <div class="inp">
+                    <input type="text" class=""><button class="btn btn-default">跳转</button>
+                </div>
+                <span class="totalCount">共0条数据</span>
+            </nav>
+		</div>
+		<div class="videoPlay">
+			<div class="videoTopM">
+				<span class="glyphicon glyphicon-remove"></span>	
+				<span class="videoPre">播放上一个</span>
+				<span class="videoNext">播放下一个</span>
+				<div class="videoList">
+					<video id="videoAt" controls="true" controlslist="nodownload">
+						<source src="" type="video/mp4">
+					</video>
+				</div>
+			</div>
+		</div>	
+		<!-- 下面是公共底部 -->	
+		<footer>
+        <div th:replace="common::copyright"></div>
+		<div th:replace="common::login"></div>
+    </footer>
+    <div th:replace="common::footer(~{::script})">
+    	<script type="text/javascript" th:src="${portalHost + '/dll/dll.js'}"></script>
+    	<script type="text/javascript" th:src="${portalHost + '/vendors.js'}"></script>
+		<script type="text/javascript" th:src="${portalHost+'/newMenu/video.js'}"></script>
+	</div>
+	</body>
+</html>