人脸识别修改调用脚本路径,页面增加查看时可新增

This commit is contained in:
zhanghongqing
2018-11-27 17:56:01 +08:00
parent 80e6bbb53d
commit 204a1d5c93
4 changed files with 33 additions and 9 deletions

View File

@@ -624,13 +624,18 @@ public class AvController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = {"/sample/faceToPicture"})
public Map faceToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile[] srcFile){
public Map faceToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile[] srcFile,@RequestParam("faceFilePath")String faceFilePath){
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);
String srcFilePath="";
if(StringUtil.isBlank(faceFilePath)){
srcFilePath = StringUtils.getUserfilesBaseDir()+"face"+sep+"picFile"+sep+random+sep;//视频生成的关键帧图片文件保存路径
faceFilePath=srcFilePath;
FileUtils.createDirectory(srcFilePath);
}else{
srcFilePath=faceFilePath;
}
//保存源文件
for (CommonsMultipartFile sinFile : srcFile) {
String r = UUID.randomUUID()+"";
@@ -647,6 +652,7 @@ public class AvController extends BaseController {
Map map = new HashMap();
map.put("picFilePath", srcFilePath);
map.put("faceFilePath", faceFilePath);
//获取图片列表
Collection<File> files = FileUtils.listFiles(new File(srcFilePath), null, true);

View File

@@ -449,7 +449,7 @@ video_sample_create_proc=/home/ceiec/av_feature_gen/video_convert_proc
picture_sample_create_proc=/home/ceiec/av_feature_gen/picture_convert_proc
speaker_sample_create_proc=java -jar /home/sampleTest.jar
logo_sample_create_proc=java -jar /home/sampleTest.jar
face_sample_create_proc=java -jar /home/sampleTest.jar
face_sample_create_proc=/home/ceiec/av_feature_gen/face_convert_proc
audio_sample_proc_param_is_quotation=true
video_sample_proc_param_is_quotation=true
picture_sample_proc_param_is_quotation=true
@@ -558,5 +558,5 @@ http_max_connection=1000
default_max_perroute=100
poolcm_socket_timeout=3000
app_vignore_user_region_key=VIGNORE
#policies菜单的菜单ID
#policies\u83DC\u5355\u7684\u83DC\u5355ID
policies_menu_id=86

View File

@@ -112,9 +112,10 @@ $(function(){
if(ifSubmit){
$("#srcFileInfo").val($("#srcFile").val());
var srcFacePath =$("#srcPath").val();
var faceFilePath =$("#faceFilePath").val();
var fd = new FormData($('#cfgFrom')[0]);
$.ajax({
url: "${ctx}/ntc/av/sample/faceToPicture",
url: "${ctx}/ntc/av/sample/faceToPicture?faceFilePath="+encodeURIComponent(faceFilePath),
type: "POST",
processData: false,
contentType: false,
@@ -126,12 +127,17 @@ $(function(){
},
success: function(data) {
top.$.jBox.closeTip();
$.jBox.close();
if(data.status==1){
$("#picPath").val(data.picFilePath);
$("#srcPath").val(data.srcPath);
$("#faceFilePath").val(data.faceFilePath);
$("#showPicture").removeClass("hidden");
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
//openPicWindow(url);
if($.jBox.getBox().length>0){
openPicWindow(url);
}
}else{
top.$.jBox.tip(data.msg, "<spring:message code='info'/>");
return;
@@ -140,6 +146,7 @@ $(function(){
},
error:function(jqXHR, textStatus, errorThrown){
top.$.jBox.closeTip();
$.jBox.close();
//alert(jqXHR.responseText);
top.$.jBox(jqXHR.responseText,{
width: $(document).width()*0.9,
@@ -287,6 +294,7 @@ function sampleFileValidate(fileType,fileName){
if(!flag){
// ("文件名不合法");
$("#fileErrorNote").append("<label id='level-error' class='error'><spring:message code='file_in_wrong_format'/></label>");
$.jBox.close();
return false;
}
return true;
@@ -398,6 +406,7 @@ function sampleFileValidate(fileType,fileName){
<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;"/>
<input id="faceFilePath" name="faceFilePath" type="hidden" value="${faceFilePath}"/>
<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"

View File

@@ -5,6 +5,11 @@
<title><spring:message code="${cfgName}"></spring:message></title>
<script>
$(document).ready(function() {
if($("#functionId",parent.document).val()==632){
$("#fileAdd").show();
}else{
$("#fileAdd").hide();
}
$("#submitButton").on('click',function(){
var selectPic = "";
$("div[name='checkPic']").each(function(){
@@ -47,7 +52,9 @@
})
});
function addFile(){
$("#srcFile" , parent.document).trigger("click");
}
</script>
<style type="text/css">
.selectImgDiv .item{width:150px;height:150px;border:solid thin #aaa;float:left;margin:10px;cursor:pointer;overflow:hidden}
@@ -87,7 +94,9 @@
<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">
<button type="button" id="fileReload" class="btn btn-default" style="margin-right:10px" onClick="window.location.reload()" value="111"><i class="fa fa-refresh"></i> <spring:message code="refresh"/></button>
<button type="button" id="fileAdd" onClick="addFile()" class="btn btn-primary" style="margin-right:10px"><i class="fa fa-plus"></i> <spring:message code="add"/></button>
<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>