增加视频文件生成关键帧图片的处理逻辑,以关键帧图片作为源文件生成特征文件。
This commit is contained in:
@@ -643,6 +643,8 @@ public final class Constants {
|
||||
public static final boolean SPEAKER_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("speaker_sample_proc_param_is_translation", false);
|
||||
public static final boolean LOGO_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("logo_sample_proc_param_is_translation", false);
|
||||
public static final boolean FACE_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("face_sample_proc_param_is_translation", false);
|
||||
//视频文件生成关键帧图片相关参数
|
||||
public static final String VEDIO_TO_PICTURE_PROC = Configurations.getStringProperty("video_to_picture_proc", "./video_to_picture_proc");
|
||||
|
||||
//HTTP自定义域相关参数
|
||||
public static String HTTP_HEADER_USER_REGION_KEY=Configurations.getStringProperty("http_header_user_region_key", "HTTP_HEADER");
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -11,13 +15,18 @@ import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.io.filefilter.IOFileFilter;
|
||||
import org.apache.tools.zip.ZipOutputStream;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
@@ -34,16 +43,21 @@ import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.exceptions.MultiPartNewException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.security.SystemAuthorizingRealm.Principal;
|
||||
|
||||
import it.sauronsoftware.jave.AudioInfo;
|
||||
import it.sauronsoftware.jave.Encoder;
|
||||
import it.sauronsoftware.jave.EncoderException;
|
||||
import it.sauronsoftware.jave.InputFormatException;
|
||||
import it.sauronsoftware.jave.MultimediaInfo;
|
||||
import it.sauronsoftware.jave.VideoInfo;
|
||||
|
||||
@@ -123,20 +137,53 @@ public class AvController extends BaseController {
|
||||
//保存文件样例配置
|
||||
@RequestMapping(value = {"/sample/saveFileSample"})
|
||||
public String saveFileSample(Model model,HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes,
|
||||
String ids,AvFileSampleCfg entity,MultipartFile srcFile,MultipartFile sampleFile){
|
||||
String ids,AvFileSampleCfg entity,MultipartFile srcFile,MultipartFile sampleFile,String picPath,String videoToPicture){
|
||||
try{
|
||||
// if(srcFile!=null && sampleFile!=null &&
|
||||
// srcFile.getSize()>0 && sampleFile.getSize()>0){
|
||||
String sep = System.getProperty("file.separator");
|
||||
String srcFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"srcFile";//源文件保存路径
|
||||
String sampleFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"sampleFile";//样例文件保存路径
|
||||
String resultFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"resultFile";//结果文件保存路径
|
||||
FileUtils.createDirectory(srcFilePath);
|
||||
FileUtils.createDirectory(sampleFilePath);
|
||||
String fileName = UUID.randomUUID()+"";
|
||||
|
||||
//视频样例生成并选中的图片压缩为zip文件
|
||||
if("true".equals(videoToPicture)){
|
||||
if(!StringUtils.isBlank(entity.getSrcPath())){
|
||||
String[] srcArray = entity.getSrcPath().split("\\|");//所选图片数组
|
||||
String srcFileAllPath = srcFilePath+sep+fileName+".zip";
|
||||
File zipFile = new File(srcFileAllPath);
|
||||
ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(zipFile));
|
||||
for(String s:srcArray){
|
||||
if(!"".equals(s)){
|
||||
String filePath = picPath+sep+s;
|
||||
File file = new File(filePath);
|
||||
//将文件添加至压缩文件
|
||||
FileUtils.zipFilesToZipFile(file.getParent(), file, zouts);
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
if(zouts!=null){
|
||||
zouts.close();
|
||||
}
|
||||
FileInputStream input = new FileInputStream(srcFileAllPath);
|
||||
srcFile = new MockMultipartFile(zipFile.getName(), input);
|
||||
if(input!=null){
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(srcFile!=null && srcFile.getSize()>0 && entity!=null){
|
||||
String sep = System.getProperty("file.separator");
|
||||
String srcFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"srcFile";//源文件保存路径
|
||||
String sampleFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"sampleFile";//样例文件保存路径
|
||||
String resultFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"resultFile";//结果文件保存路径
|
||||
FileUtils.createDirectory(srcFilePath);
|
||||
FileUtils.createDirectory(sampleFilePath);
|
||||
String srcFileAllPath = "";
|
||||
if(StringUtil.isBlank(srcFile.getOriginalFilename())){
|
||||
srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getName(), true);
|
||||
}else{
|
||||
srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);
|
||||
}
|
||||
|
||||
String fileName = UUID.randomUUID()+"";
|
||||
String srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);
|
||||
String sampleFileAllPath = sampleFilePath+sep+fileName+".sample";
|
||||
String resultFileAllPath = resultFilePath+sep+fileName+".result";
|
||||
entity.setSrcPath(srcFileAllPath);
|
||||
@@ -144,8 +191,9 @@ public class AvController extends BaseController {
|
||||
entity.setResultPath(resultFileAllPath);
|
||||
|
||||
File uploadSrcFile = new File(srcFileAllPath);
|
||||
// File uploadSampleFile = new File(sampleFileAllPath);
|
||||
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
|
||||
if(!uploadSrcFile.exists()){
|
||||
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
|
||||
}
|
||||
entity.setSrcUrl("");
|
||||
entity.setSampleUrl("");
|
||||
/*String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
|
||||
@@ -158,40 +206,33 @@ public class AvController extends BaseController {
|
||||
entity.setSrcUrl(srcUrl);
|
||||
entity.setSampleUrl(sampleUrl);*/
|
||||
|
||||
// File uploadSrcFile = new File(srcFilePath);
|
||||
// FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
|
||||
// String srcMd5 = FileUtils.getFileMD5(uploadSrcFile);
|
||||
// File uploadSampleFile = new File(sampleFilePath);
|
||||
// String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
|
||||
// File uploadSrcFile = new File(srcFilePath);
|
||||
// FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
|
||||
// String srcMd5 = FileUtils.getFileMD5(uploadSrcFile);
|
||||
// File uploadSampleFile = new File(sampleFilePath);
|
||||
// String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
|
||||
|
||||
// entity.setSrcMd5(srcMd5);
|
||||
// entity.setSampleMd5(sampleMd5);
|
||||
// entity.setSrcMd5(srcMd5);
|
||||
// entity.setSampleMd5(sampleMd5);
|
||||
|
||||
//音频、视频、VoIP、说话人(音频)、人脸识别(视频)样例需要验证时长
|
||||
if(entity.getCfgType().equals(Constants.AV_SAMPLE_AUDIO_REGION)
|
||||
|| entity.getCfgType().equals(Constants.AV_SAMPLE_VIDEO_REGION)
|
||||
|| entity.getCfgType().equals(Constants.AV_SAMPLE_VOIP_REGION)
|
||||
|| entity.getCfgType().equals(Constants.MM_SPEAKER_RECOGNIZATION_REGION)
|
||||
|| entity.getCfgType().equals(Constants.MM_FACE_RECOGNIZATION_REGION)){
|
||||
//验证音视频文件时长
|
||||
Encoder encoder = new Encoder();
|
||||
String length = "";
|
||||
MultimediaInfo m = encoder.getInfo(uploadSrcFile);
|
||||
long ls = m.getDuration()/1000;
|
||||
int hour = (int) (ls/3600);
|
||||
int minute = (int) (ls%3600)/60;
|
||||
int second = (int) (ls-hour*3600-minute*60);
|
||||
length = hour+"'"+minute+"''"+second+"'''";
|
||||
logger.info(uploadSrcFile.getName()+"时长:"+length);
|
||||
if(ls>0 && second>Constants.AV_DURATION_LIMIT){
|
||||
if(Constants.AUDIO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.VIDEO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.VOIP_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.SPEAKER_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.FACE_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
){
|
||||
if(!validateAvDuration(uploadSrcFile)){
|
||||
addMessage(redirectAttributes,"exceeds_duration_limit");
|
||||
logger.error("The duration of uploaded files exceeds the limit("+Constants.AV_DURATION_LIMIT+"s).");
|
||||
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
avCfgService.saveOrUpdateAvFileSample(entity, srcFile);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
|
||||
@@ -229,7 +270,7 @@ public class AvController extends BaseController {
|
||||
@RequestMapping(value = {"/sample/updateAvFileSampleValid"})
|
||||
public String updateAvFileSampleValid(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes){
|
||||
avCfgService.updateAvFileSampleValid(isAudit,isValid,ids);
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
addMessage(redirectAttributes,"delete_success");
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改文件样例配置审核状态
|
||||
@@ -466,4 +507,115 @@ public class AvController extends BaseController {
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证音视频时长
|
||||
* @throws EncoderException
|
||||
* @throws InputFormatException
|
||||
*/
|
||||
public boolean validateAvDuration(File file) throws InputFormatException, EncoderException{
|
||||
//验证音视频文件时长
|
||||
Encoder encoder = new Encoder();
|
||||
String length = "";
|
||||
MultimediaInfo m = encoder.getInfo(file);
|
||||
long ls = m.getDuration()/1000;
|
||||
int hour = (int) (ls/3600);
|
||||
int minute = (int) (ls%3600)/60;
|
||||
int second = (int) (ls-hour*3600-minute*60);
|
||||
length = hour+"'"+minute+"''"+second+"'''";
|
||||
logger.info(file.getName()+"时长:"+length);
|
||||
if(ls>0 && second>Constants.AV_DURATION_LIMIT){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 上传视频文件,调用脚本生成关键帧图片,返回图片保存路径
|
||||
* @param cfg
|
||||
* @param functionId
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/sample/videoToPicture"})
|
||||
public Map videoToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile srcFile){
|
||||
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID()+"";
|
||||
String srcFilePath = Constants.AV_FILE_PATH+"video"+sep+"srcFile";//视频源文件保存路径
|
||||
String picFilePath = StringUtils.getUserfilesBaseDir()+"video"+sep+"picFile";//视频生成的关键帧图片文件保存路径
|
||||
|
||||
FileUtils.createDirectory(srcFilePath);
|
||||
FileUtils.createDirectory(picFilePath);
|
||||
String srcFileAllPath = srcFilePath+sep+random+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);//新的文件名
|
||||
File uploadSrcFile = new File(srcFileAllPath);
|
||||
Map map = new HashMap();
|
||||
map.put("picFilePath", picFilePath);
|
||||
try {
|
||||
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
|
||||
if(validateAvDuration(uploadSrcFile)){
|
||||
String shellName = Constants.VEDIO_TO_PICTURE_PROC;
|
||||
// String params = srcFileAllPath+" "+picFilePath+" 0.95 90.0 0.5";
|
||||
String params = srcFileAllPath+" "+picFilePath;
|
||||
Map resultMap = avCfgService.execShell(shellName, params);
|
||||
if(resultMap.get("exitStatus").equals(0)){//调用外部程序成功
|
||||
//关键帧图片生成成功,删除原视频文件
|
||||
FileUtils.deleteFile(srcFileAllPath);
|
||||
map.put("status", 1);
|
||||
map.put("msg", "success");
|
||||
}
|
||||
}else{
|
||||
map.put("status", 0);
|
||||
map.put("msg", this.getMsgProp().get("exceeds_duration_limit"));
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
} catch (InputFormatException e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
} catch (EncoderException e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/sample/selectVedioPicture"})
|
||||
public String selectVedioPicture(Model model,HttpServletRequest request,String picFilePath,String srcPath){
|
||||
Collection<File> files = FileUtils.listFiles(new File(picFilePath), null, true);
|
||||
List<Map<String,String>> fileList = new ArrayList();
|
||||
String picUrl = picFilePath.substring(picFilePath.indexOf(Configurations.getStringProperty("userfiles.basedir", "upload")));
|
||||
String sep = System.getProperty("file.separator");
|
||||
String[] checkedPic = null;
|
||||
if(srcPath!=null){
|
||||
checkedPic = srcPath.split("\\|");
|
||||
}
|
||||
for(File f:files){
|
||||
Map map = new HashMap();
|
||||
map.put("picUrl", StringUtils.replace(picUrl+"/"+f.getName(), "\\", "/"));
|
||||
map.put("picName", f.getName());
|
||||
boolean checked = false;
|
||||
if(checkedPic!=null){
|
||||
for(String pic:checkedPic){
|
||||
if(f.getName().equals(pic)){
|
||||
checked = true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
checked = true;//默认全选
|
||||
}
|
||||
|
||||
map.put("checked", checked);
|
||||
fileList.add(map);
|
||||
}
|
||||
model.addAttribute("fileList", fileList);
|
||||
model.addAttribute("picFilePath",picFilePath);
|
||||
return "/cfg/av/videoPictureList";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1263,4 +1263,5 @@ the_same_port_pattern=Client port and server port must in the same port pattern
|
||||
ip_range_in_c=Start IP and end IP in a IP range must with in C subnet
|
||||
ip_range_bit_field=Start IP and end IP in a IP range has the same network number bit field
|
||||
ip_range_smaller=Start IP in a IP range should smaller than end IP
|
||||
alternative_values= Alternative values can be %s
|
||||
alternative_values= Alternative values can be %s
|
||||
keyframe_pic_required=No keyframe pictures have been selected.
|
||||
@@ -1283,4 +1283,5 @@ the_same_port_pattern=Client port and server port must in the same port pattern
|
||||
ip_range_in_c=Start IP and end IP in a IP range must with in C subnet
|
||||
ip_range_bit_field=Start IP and end IP in a IP range has the same network number bit field
|
||||
ip_range_smaller=Start IP in a IP range should smaller than end IP
|
||||
alternative_values= Alternative values can be %s
|
||||
alternative_values= Alternative values can be %s
|
||||
keyframe_pic_required=No keyframe pictures have been selected.
|
||||
@@ -1257,4 +1257,5 @@ the_same_port_pattern=\u6E90\u7AEF\u53E3\u4E0E\u76EE\u7684\u7AEF\u53E3\u7AEF\u53
|
||||
ip_range_in_c=IP\u8303\u56F4\u7684\u8D77\u59CBIP\u4E0E\u7EC8\u6B62IP\u5FC5\u987B\u5728C\u7F51\u6BB5
|
||||
ip_range_bit_field=IP\u8303\u56F4\u7684\u8D77\u59CBIP\u4E0E\u7EC8\u6B62IP\u7F51\u7EDC\u5730\u5740\u5FC5\u987B\u76F8\u540C
|
||||
ip_range_smaller=IP\u8303\u56F4\u7684\u8D77\u59CBIP\u5FC5\u987B\u5C0F\u4E8E\u7EC8\u6B62IP
|
||||
alternative_values=\u53EF\u9009\u62E9\u7684\u503C\u6709%s
|
||||
alternative_values=\u53EF\u9009\u62E9\u7684\u503C\u6709%s
|
||||
keyframe_pic_required=\u5C1A\u672A\u9009\u62E9\u5173\u952E\u5E27\u56FE\u7247
|
||||
@@ -530,4 +530,5 @@ isp_tag=isp
|
||||
mmFileDigestLog=mmFileDigestLogs
|
||||
ntcStreamMediaLog=ntcStreamMediaLogs
|
||||
#音视频样例限制时长,单位秒
|
||||
av_duration_limit=120
|
||||
av_duration_limit=120
|
||||
video_to_picture_proc=/root/code/shot_detect/shot_detect
|
||||
@@ -28,8 +28,49 @@ $(function(){
|
||||
$("#uploadSrc,#srcFileInfo").on('click',function(){
|
||||
$("#srcFile").trigger("click");
|
||||
});
|
||||
|
||||
$("#srcFile").on('change',function(){
|
||||
$("#srcFileInfo").val($("#srcFile").val());
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
if(videoToPicture=="true"){
|
||||
|
||||
var fd = new FormData($('#cfgFrom')[0]);
|
||||
$.ajax({
|
||||
url: "${ctx}/ntc/av/sample/videoToPicture",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: fd,
|
||||
async: true,
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
loading('onloading...');
|
||||
},
|
||||
success: function(data) {
|
||||
top.$.jBox.closeTip();
|
||||
if(data.status==1){
|
||||
$("#picPath").val(data.picFilePath);
|
||||
$("#showPicture").removeClass("hidden");
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||
$.jBox("iframe:"+url, {
|
||||
title: "",
|
||||
width: 1350,
|
||||
height:800,
|
||||
dragLimit: true,
|
||||
buttons: { 'close': true,"ok":"ok" }
|
||||
});
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error:function(jqXHR, textStatus, errorThrown){
|
||||
top.$.jBox.closeTip();
|
||||
alert(errorThrown);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/* $("#uploadSample,#sampleFileInfo").on('click',function(){
|
||||
$("#sampleFile").trigger("click");
|
||||
@@ -64,17 +105,27 @@ $(function(){
|
||||
var srcFile = $("#srcFile").val();
|
||||
//var sampleFile = $("#sampleFile").val();
|
||||
var srcUrl = $("#srcUrl").val();
|
||||
var srcPath = $("#srcPath").val();
|
||||
//var sampleUrl = $("#sampleUrl").val();
|
||||
if((srcUrl==null||srcUrl=="") && (srcFile==null || srcFile=="")){
|
||||
$("div[for='srcFile']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='required'></spring:message></label>");
|
||||
return false;
|
||||
}/* else if((sampleUrl==null || sampleUrl=="") && (sampleFile==null || sampleFile=="")){
|
||||
$("div[for='sampleFile']").append("<label id='level-error' class='error' for='sampleFile'><spring:message code='required'></spring:message></label>");
|
||||
return false;
|
||||
} */else{
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
if(videoToPicture=="true"){
|
||||
if((srcUrl==null||srcUrl=="") && (srcPath==null || srcPath=="")){//srcUrl判断修改时未重新上传文件,srcPath判断修改时重新上传文件但未选择关键帧图片
|
||||
$("div[for='srcFileInfo']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='keyframe_pic_required'></spring:message></label>");
|
||||
return false;
|
||||
}else if(srcFile!=null && srcFile!=""){//选择视频文件
|
||||
if(srcPath==null || srcPath==""){//单位选择关键帧图片
|
||||
$("div[for='srcFileInfo']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='keyframe_pic_required'></spring:message></label>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if((srcUrl==null||srcUrl=="") && (srcFile==null || srcFile=="")){
|
||||
$("div[for='srcFileInfo']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='required'></spring:message></label>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
@@ -82,6 +133,17 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
});
|
||||
$("#showPicture").on('click',function(){
|
||||
var srcPath = $("#srcPath").val()
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent($("#picPath").val())+"&srcPath="+encodeURIComponent(srcPath);
|
||||
$.jBox("iframe:"+url, {
|
||||
title: "",
|
||||
width: 1350,
|
||||
height:800,
|
||||
dragLimit: true,
|
||||
buttons: { 'close': true,"ok":"ok" }
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
function hiddenlevel(){
|
||||
@@ -123,8 +185,9 @@ function hiddenlevel(){
|
||||
<form id="cfgFrom" action="${ctx}/ntc/av/sample/saveFileSample" enctype="multipart/form-data" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="functionId" id="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" name="picPath" id="picPath" value="">
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
@@ -176,18 +239,42 @@ function hiddenlevel(){
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_file"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }"> --%>
|
||||
<input id="srcFile" name="srcFile" type="file" style="width: 330px;display:none" />
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
placeholder="<spring:message code="select_file"/>" class="required form-control" style=" background-color:transparent"
|
||||
aria-required="true" type="text" value="${_cfg.srcUrl }">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<a id="uploadSrc" class="btn btn-default btn-search" href="javascript:" style=""><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<%-- <span id="srcFileInfo" style="margin-top:20px;margin-left:10px;">${_cfg.srcUrl }</span> --%>
|
||||
</div>
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" />
|
||||
<c:set var="videoToPicture" value="${fns:getDictLabel('VIDEO_TO_PICTURE', _cfg.functionId, 'false')}" />
|
||||
<input type="hidden" name="videoToPicture" id="videoToPicture" value="${videoToPicture }">
|
||||
<c:choose>
|
||||
|
||||
<c:when test="${videoToPicture}">
|
||||
<input id="srcPath" name="srcPath" type="hidden" style="width: 330px;" />
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
placeholder="<spring:message code="select_file"/>" class="required form-control" style=" background-color:transparent"
|
||||
aria-required="true" type="text" value="${_cfg.srcUrl }">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<a id="uploadSrc" class="btn btn-default btn-search " href="javascript:" style=""><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
<button type="button" id="showPicture" class="btn btn-warning hidden ">
|
||||
<i class="fa btn-search"></i>
|
||||
<spring:message code="show"></spring:message></button>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
placeholder="<spring:message code="select_file"/>" class="required form-control" style=" background-color:transparent"
|
||||
aria-required="true" type="text" value="${_cfg.srcUrl }">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<a id="uploadSrc" class="btn btn-default btn-search" href="javascript:" style=""><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<%-- <span id="srcFileInfo" style="margin-top:20px;margin-left:10px;">${_cfg.srcUrl }</span> --%>
|
||||
</div>
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
<div for="srcFileInfo"></div>
|
||||
</div>
|
||||
|
||||
156
src/main/webapp/WEB-INF/views/cfg/av/videoPictureList.jsp
Normal file
156
src/main/webapp/WEB-INF/views/cfg/av/videoPictureList.jsp
Normal file
@@ -0,0 +1,156 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#submitButton").on('click',function(){
|
||||
var selectPic = "";
|
||||
$("div[name='checkPic']").each(function(){
|
||||
if($(this).attr("ischecked")=="true")
|
||||
{
|
||||
selectPic += $(this).attr("value")+"|";
|
||||
}
|
||||
});
|
||||
if(selectPic==""){
|
||||
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
return false;
|
||||
}else{
|
||||
$("#srcPath",parent.document).val(selectPic);
|
||||
//关闭此窗口
|
||||
window.parent.window.jBox.close();
|
||||
}
|
||||
|
||||
});
|
||||
$("div[name='checkPic']").on('click',function(){
|
||||
if($(this).attr("ischecked")=="true"){
|
||||
$(this).attr("ischecked","false");
|
||||
$(this).find(".icon-check").css("display","none");
|
||||
}else{
|
||||
$(this).attr("ischecked","true");
|
||||
$(this).find(".icon-check").css("display","block");
|
||||
}
|
||||
});
|
||||
$(".checkAll").on('click',function(){
|
||||
if($(this).hasClass("checkAll-cancel")){
|
||||
$(this).addClass("checkAll-check");
|
||||
$(this).removeClass("checkAll-cancel");
|
||||
$("div[name='checkPic']").attr("ischecked","true");
|
||||
$("div[name='checkPic']").find(".icon-check").css("display","block");
|
||||
}else{
|
||||
$(this).addClass("checkAll-cancel");
|
||||
$(this).removeClass("checkAll-check");
|
||||
$("div[name='checkPic']").attr("ischecked","false");
|
||||
$("div[name='checkPic']").find(".icon-check").css("display","none");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.selectImgDiv .item{width:150px;height:150px;border:solid thin #aaa;float:left;margin:10px;cursor:pointer;overflow:hidden}
|
||||
.selectImgDiv .item:hover{border:solid thin #09f}.selectImgDiv .item .img_show{width:100%;height:100%;overflow:hidden}
|
||||
.selectImgDiv .item .img_show img{width:100%;height:100%}
|
||||
.selectImgDiv .item:hover .img_show img{transform:scale(1.3);transition:all 1s ease 0s;-webkit-transform:scale(1.3);-webkit-transform:all 1s ease 0s}
|
||||
.selectImgDiv .item .img_title{height:30px;text-align:center;font-size:16px;line-height:30px;background-color:rgba(102,102,102,.6);position:relative;color:#fff;font-weight:700}
|
||||
.selectImgDiv .item:hover .img_title{top:-30px}
|
||||
.selectImgDiv .item .img_isCheck{position:relative;top:-168px;text-align:right}
|
||||
.selectImgDiv .item .img_isCheck i{font-size:30px;display:none;color:#fdfdfd;padding-top:3px;}
|
||||
.checkAll{font-size:30px;display:none;color:#6f3}
|
||||
/* @font-face{
|
||||
font-family:iconfont;
|
||||
src:url(../font/iconfont.eot?t=1495283771116);
|
||||
src:url(../font/iconfont.eot?t=1495283771116#iefix) format('embedded-opentype'),url(../font/iconfont.woff?t=1495283771116) format('woff'),url(../font/iconfont.ttf?t=1495283771116) format('truetype'),url(../font/iconfont.svg?t=1495283771116#iconfont) format('svg')
|
||||
} */
|
||||
.iconfont{
|
||||
background-color: #6f3;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.icon-check:before{content:"\2714"}
|
||||
.checkAll-check:before{content:"\2611"}
|
||||
.checkAll-cancel:before{content:"\2610"}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" style="margin-top:10px">
|
||||
<input type="hidden" id="picFilePath" name="picFilePath" value="${picFilePath }"/>
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button type="button" id="submitButton" class="btn btn-warning" style="margin-right:10px">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="ok"></spring:message></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<i class="checkAll checkAll-cancel" style="display:block;font-style:normal;margin:-5px 8px 0px 0px"></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="container" style="margin-top:30px">
|
||||
<%-- <table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||
<th><spring:message code="index"/></th>
|
||||
<th><spring:message code="thumbnail"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${fileList}" var="file" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" name="checkPic" ${file.checked } class="i-checks" id="${status.index+1}" value="${file.picName }"></td>
|
||||
<td>${status.index+1}</td>
|
||||
<td>
|
||||
<a href="${pageContext.request.contextPath}/${file.picUrl }" target="_blank">
|
||||
<img alt="" src="${pageContext.request.contextPath}/${file.picUrl }" width="100px" height="100px">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table> --%>
|
||||
<div class="selectImgDiv" id="selectItemDiv">
|
||||
<c:forEach items="${fileList}" var="file" varStatus="status" step="1">
|
||||
<div class="item i-checks" name="checkPic" id="checkPic${status.index }" ischecked="${file.checked }" value="${file.picName }">
|
||||
<div class="img_show">
|
||||
<img alt="" src="${pageContext.request.contextPath}/${file.picUrl }" width="120px" height="120px">
|
||||
</div>
|
||||
<div class="img_title">
|
||||
${file.picName }
|
||||
</div>
|
||||
<div class="img_isCheck">
|
||||
<i class="iconfont icon-check" style="<c:if test='${file.checked }'>display:block</c:if>"></i>
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<%-- <c:forEach items="${fileList}" var="file" varStatus="status" step="1">
|
||||
|
||||
<input type="checkbox" name="checkPic" ${file.checked } class="i-checks" id="${status.index+1}" value="${file.picName }">
|
||||
<a href="${pageContext.request.contextPath}/${file.picUrl }" target="_blank">
|
||||
<img alt="" src="${pageContext.request.contextPath}/${file.picUrl }" width="120px" height="120px">
|
||||
</a>
|
||||
|
||||
<c:if test="${(status.index+1) mod 8 eq 0 }">
|
||||
<br><br>
|
||||
</c:if>
|
||||
</c:forEach> --%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user