Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop
This commit is contained in:
@@ -140,7 +140,7 @@ public class MultipartFileIntercepter extends CommonsMultipartResolver{
|
|||||||
fileTypes=Constants.LOGO_FILE_TYPE;
|
fileTypes=Constants.LOGO_FILE_TYPE;
|
||||||
fileMaxSize=Constants.LOGO_SINGLE_FILE_MAX_SIZE;
|
fileMaxSize=Constants.LOGO_SINGLE_FILE_MAX_SIZE;
|
||||||
}else if(functionId.equals(632)){ //人脸识别
|
}else if(functionId.equals(632)){ //人脸识别
|
||||||
fileTypes=Constants.FACE_FILE_TYPE;
|
fileTypes=Constants.PICTURE_FILE_TYPE;//同图片类型
|
||||||
fileMaxSize=Constants.FACE_SINGLE_FILE_MAX_SIZE;
|
fileMaxSize=Constants.FACE_SINGLE_FILE_MAX_SIZE;
|
||||||
}else if(functionId.equals(570)){ //证书管理
|
}else if(functionId.equals(570)){ //证书管理
|
||||||
fileTypes=Constants.PUBLIC_FILE_TYPE;
|
fileTypes=Constants.PUBLIC_FILE_TYPE;
|
||||||
|
|||||||
@@ -224,7 +224,6 @@ public class AvController extends BaseController {
|
|||||||
||Constants.VIDEO_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.VOIP_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||||
||Constants.SPEAKER_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)){
|
if(!validateAvDuration(uploadSrcFile)){
|
||||||
addMessage(redirectAttributes,"exceeds_duration_limit");
|
addMessage(redirectAttributes,"exceeds_duration_limit");
|
||||||
@@ -616,7 +615,55 @@ public class AvController extends BaseController {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 上传图片文件,调用脚本压缩图片,返回图片保存路径
|
||||||
|
* @param cfg
|
||||||
|
* @param functionId
|
||||||
|
* @param redirectAttributes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping(value = {"/sample/faceToPicture"})
|
||||||
|
public Map faceToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile[] srcFile){
|
||||||
|
String sep = System.getProperty("file.separator");
|
||||||
|
String random = UUID.randomUUID()+"";
|
||||||
|
// String srcFilePath = Constants.AV_FILE_PATH+"face"+random+sep+"srcFile";//视频源文件保存路径
|
||||||
|
String srcFilePath = StringUtils.getUserfilesBaseDir()+"face"+sep+"picFile"+sep+random+sep;//视频生成的关键帧图片文件保存路径
|
||||||
|
|
||||||
|
FileUtils.createDirectory(srcFilePath);
|
||||||
|
//保存源文件
|
||||||
|
for (CommonsMultipartFile sinFile : srcFile) {
|
||||||
|
String srcFileAllPath = srcFilePath+sep+random+FileUtils.getSuffix(sinFile.getOriginalFilename(), true);//新的文件名
|
||||||
|
File uploadSrcFile = new File(srcFileAllPath);
|
||||||
|
try {
|
||||||
|
FileCopyUtils.copy(sinFile.getBytes(), uploadSrcFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("picFilePath", srcFilePath);
|
||||||
|
|
||||||
|
//获取图片列表
|
||||||
|
Collection<File> files = FileUtils.listFiles(new File(srcFilePath), null, true);
|
||||||
|
String srcPath = null;
|
||||||
|
for(File f:files){
|
||||||
|
if(srcPath==null){
|
||||||
|
srcPath = f.getName();
|
||||||
|
}else{
|
||||||
|
srcPath += "|"+f.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//将图片文件列表赋值给生成样例的源文件路径参数
|
||||||
|
map.put("srcPath", srcPath);
|
||||||
|
map.put("status", 1);
|
||||||
|
map.put("msg", "success");
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
@RequestMapping(value = {"/sample/selectVedioPicture"})
|
@RequestMapping(value = {"/sample/selectVedioPicture"})
|
||||||
public String selectVedioPicture(Model model,HttpServletRequest request,String picFilePath,String srcPath){
|
public String selectVedioPicture(Model model,HttpServletRequest request,String picFilePath,String srcPath){
|
||||||
Collection<File> files = FileUtils.listFiles(new File(picFilePath), null, true);
|
Collection<File> files = FileUtils.listFiles(new File(picFilePath), null, true);
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
|
var ifSubmit=true;
|
||||||
var sfd = $("#functionId").val();
|
var sfd = $("#functionId").val();
|
||||||
var fileType=[];
|
var fileType=[];
|
||||||
if(sfd==28||sfd==630){
|
if(sfd==28||sfd==630){
|
||||||
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv","wav","mp3"];
|
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv","wav","mp3"];
|
||||||
}
|
}
|
||||||
if(sfd==29||sfd==631){
|
if(sfd==29){
|
||||||
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv"];
|
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv"];
|
||||||
}
|
}
|
||||||
if(sfd==30||sfd==632){
|
if(sfd==30||sfd==632||sfd==631){
|
||||||
fileType=["bmp","jpg","tiff","raw","gif"];
|
fileType=["bmp","jpg","tiff","raw","gif"];
|
||||||
}
|
}
|
||||||
if(sfd==31){
|
if(sfd==31){
|
||||||
@@ -47,7 +47,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#srcFile").on('change',function(){
|
$("#srcFile").on('change',function(){
|
||||||
if(sampleFileValidate(fileType,$("#srcFile").val())){
|
if(sfd!=632&&sampleFileValidate(fileType,$("#srcFile").val())){
|
||||||
//样例文件类型正确进行后续处理
|
//样例文件类型正确进行后续处理
|
||||||
$("#srcFileInfo").val($("#srcFile").val());
|
$("#srcFileInfo").val($("#srcFile").val());
|
||||||
var videoToPicture = $("#videoToPicture").val();
|
var videoToPicture = $("#videoToPicture").val();
|
||||||
@@ -74,6 +74,65 @@ $(function(){
|
|||||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||||
//openPicWindow(url);
|
//openPicWindow(url);
|
||||||
}else{
|
}else{
|
||||||
|
// alert(data.msg);
|
||||||
|
top.$.jBox.tip(data.msg, "<spring:message code='info'/>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error:function(jqXHR, textStatus, errorThrown){
|
||||||
|
top.$.jBox.closeTip();
|
||||||
|
//alert(jqXHR.responseText);
|
||||||
|
top.$.jBox(jqXHR.responseText,{
|
||||||
|
width: $(document).width()*0.9,
|
||||||
|
height:$(document).height()*0.8,
|
||||||
|
top: '10%',
|
||||||
|
draggable:false,
|
||||||
|
title: "Error Info", buttons:{ "close":true}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 人脸识别
|
||||||
|
if(sfd==632){
|
||||||
|
var files = $(this)[0].files;
|
||||||
|
for(var i = 0;i < files.length;i ++) {
|
||||||
|
var file = files[i];
|
||||||
|
var faceName = file.name;
|
||||||
|
var vals=sampleFileValidate(fileType,faceName)
|
||||||
|
if (!vals){
|
||||||
|
ifSubmit=false;
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
ifSubmit=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ifSubmit){
|
||||||
|
$("#srcFileInfo").val($("#srcFile").val());
|
||||||
|
var srcFacePath =$("#srcPath").val();
|
||||||
|
var fd = new FormData($('#cfgFrom')[0]);
|
||||||
|
$.ajax({
|
||||||
|
url: "${ctx}/ntc/av/sample/faceToPicture",
|
||||||
|
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);
|
||||||
|
$("#srcPath").val(data.srcPath);
|
||||||
|
$("#showPicture").removeClass("hidden");
|
||||||
|
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||||
|
//openPicWindow(url);
|
||||||
|
}else{
|
||||||
alert(data.msg);
|
alert(data.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,9 +186,14 @@ $(function(){
|
|||||||
var srcFile = $("#srcFile").val();
|
var srcFile = $("#srcFile").val();
|
||||||
|
|
||||||
if(srcFile!=''){
|
if(srcFile!=''){
|
||||||
|
if(!ifSubmit){
|
||||||
|
$("#fileErrorNote").append("<label id='level-error' class='error'><spring:message code='file_in_wrong_format'/></label>");
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
if(!sampleFileValidate(fileType,srcFile)){
|
if(!sampleFileValidate(fileType,srcFile)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//var sampleFile = $("#sampleFile").val();
|
//var sampleFile = $("#sampleFile").val();
|
||||||
@@ -137,7 +201,7 @@ $(function(){
|
|||||||
var srcPath = $("#srcPath").val();
|
var srcPath = $("#srcPath").val();
|
||||||
//var sampleUrl = $("#sampleUrl").val();
|
//var sampleUrl = $("#sampleUrl").val();
|
||||||
var videoToPicture = $("#videoToPicture").val();
|
var videoToPicture = $("#videoToPicture").val();
|
||||||
if(videoToPicture=="true"){
|
if(videoToPicture=="true"&&sfd!=632){
|
||||||
if((srcUrl==null||srcUrl=="") && (srcPath==null || srcPath=="")){//srcUrl判断修改时未重新上传文件,srcPath判断修改时重新上传文件但未选择关键帧图片
|
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>");
|
$("div[for='srcFileInfo']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='keyframe_pic_required'></spring:message></label>");
|
||||||
return false;
|
return false;
|
||||||
@@ -204,7 +268,6 @@ function hiddenlevel(){
|
|||||||
|
|
||||||
// 校验文件后缀名
|
// 校验文件后缀名
|
||||||
function sampleFileValidate(fileType,fileName){
|
function sampleFileValidate(fileType,fileName){
|
||||||
|
|
||||||
var flag=false; //状态,检测文件后缀用
|
var flag=false; //状态,检测文件后缀用
|
||||||
var arr=fileType;//使用是什么格式的后缀
|
var arr=fileType;//使用是什么格式的后缀
|
||||||
var cFile=fileName;//文件的值
|
var cFile=fileName;//文件的值
|
||||||
@@ -306,12 +369,14 @@ function sampleFileValidate(fileType,fileName){
|
|||||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_file"/></label>
|
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_file"/></label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<%-- <input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }"> --%>
|
<%-- <input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }"> --%>
|
||||||
|
<c:if test="${_cfg.functionId != 632}">
|
||||||
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" />
|
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" />
|
||||||
|
</c:if>
|
||||||
<c:set var="videoToPicture" value="${fns:getDictLabel('VIDEO_TO_PICTURE', _cfg.functionId, 'false')}" />
|
<c:set var="videoToPicture" value="${fns:getDictLabel('VIDEO_TO_PICTURE', _cfg.functionId, 'false')}" />
|
||||||
<input type="hidden" name="videoToPicture" id="videoToPicture" value="${videoToPicture }">
|
<input type="hidden" name="videoToPicture" id="videoToPicture" value="${videoToPicture }">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
|
|
||||||
<c:when test="${videoToPicture}">
|
<c:when test="${videoToPicture and _cfg.functionId != 632}">
|
||||||
<input id="srcPath" name="srcPath" type="hidden" style="width: 330px;" />
|
<input id="srcPath" name="srcPath" type="hidden" style="width: 330px;" />
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||||
@@ -328,6 +393,26 @@ function sampleFileValidate(fileType,fileName){
|
|||||||
<i class="fa btn-search"></i>
|
<i class="fa btn-search"></i>
|
||||||
<spring:message code="show"></spring:message></button>
|
<spring:message code="show"></spring:message></button>
|
||||||
</c:when>
|
</c:when>
|
||||||
|
|
||||||
|
<c:when test="${_cfg.functionId eq 632}">
|
||||||
|
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" multiple/>
|
||||||
|
<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>
|
<c:otherwise>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||||
|
|||||||
Reference in New Issue
Block a user