修改音视频文件样例配置功能,表单界面删除样例文件的上传,改由后台调用外部程序生成样例文件。
Signed-off-by: zhangwei <zhangwei@intranet.com>
This commit is contained in:
@@ -27,6 +27,8 @@ public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
|
|||||||
private Integer compileId;
|
private Integer compileId;
|
||||||
private String srcPath;
|
private String srcPath;
|
||||||
private String samplePath;
|
private String samplePath;
|
||||||
|
private Integer isSampleCreated;
|
||||||
|
private String resultPath;
|
||||||
|
|
||||||
public String getSrcPath() {
|
public String getSrcPath() {
|
||||||
return srcPath;
|
return srcPath;
|
||||||
@@ -76,4 +78,17 @@ public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
|
|||||||
public void setLevel(Integer level) {
|
public void setLevel(Integer level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
public Integer getIsSampleCreated() {
|
||||||
|
return isSampleCreated;
|
||||||
|
}
|
||||||
|
public void setIsSampleCreated(Integer isSampleCreated) {
|
||||||
|
this.isSampleCreated = isSampleCreated;
|
||||||
|
}
|
||||||
|
public String getResultPath() {
|
||||||
|
return resultPath;
|
||||||
|
}
|
||||||
|
public void setResultPath(String resultPath) {
|
||||||
|
this.resultPath = resultPath;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,11 +434,18 @@ public final class Constants {
|
|||||||
public static final String AV_FILE_PATH = Configurations.getStringProperty("av_file_path", "/home/ysp/");
|
public static final String AV_FILE_PATH = Configurations.getStringProperty("av_file_path", "/home/ysp/");
|
||||||
public static final String AV_SAMPLE_AUDIO_REGION = Configurations.getStringProperty("av_sample_audio_region", "av_sample_audio");
|
public static final String AV_SAMPLE_AUDIO_REGION = Configurations.getStringProperty("av_sample_audio_region", "av_sample_audio");
|
||||||
public static final String AV_SAMPLE_VEDIO_REGION = Configurations.getStringProperty("av_sample_vedio_region", "av_sample_vedio");
|
public static final String AV_SAMPLE_VEDIO_REGION = Configurations.getStringProperty("av_sample_vedio_region", "av_sample_vedio");
|
||||||
public static final String AV_SAMPLE_PITURE_REGION = Configurations.getStringProperty("av_sample_pitrue_region", "av_sample_pitrue");
|
public static final String AV_SAMPLE_PICTURE_REGION = Configurations.getStringProperty("av_sample_picture_region", "av_sample_picture");
|
||||||
public static final String AV_SAMPLE_VOIP_REGION = Configurations.getStringProperty("av_sample_voip_region", "av_sample_voip");
|
public static final String AV_SAMPLE_VOIP_REGION = Configurations.getStringProperty("av_sample_voip_region", "av_sample_voip");
|
||||||
public static final String AUDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("audio_sample_create_proc", "./audio_convert_proc");
|
public static final String AUDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("audio_sample_create_proc", "./audio_convert_proc");
|
||||||
public static final String VEDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("vedio_sample_create_proc", "./vedio_convert_proc");
|
public static final String VEDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("vedio_sample_create_proc", "./vedio_convert_proc");
|
||||||
public static final String PICTURE_SAMPLE_CREATE_PROC = Configurations.getStringProperty("picture_sample_create_proc", "./picture_convert_proc");
|
public static final String PICTURE_SAMPLE_CREATE_PROC = Configurations.getStringProperty("picture_sample_create_proc", "./picture_convert_proc");
|
||||||
|
public static final boolean AUDIO_SAMPLE_PROC_PARAM_IS_QUOTATION = Configurations.getBooleanProperty("audio_sample_proc_param_is_quotation", true);
|
||||||
|
public static final boolean VEDIO_SAMPLE_PROC_PARAM_IS_QUOTATION = Configurations.getBooleanProperty("vedio_sample_proc_param_is_quotation", true);
|
||||||
|
public static final boolean PICTURE_SAMPLE_PROC_PARAM_IS_QUOTATION = Configurations.getBooleanProperty("picture_sample_proc_param_is_quotation", true);
|
||||||
|
public static final boolean AUDIO_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("audio_sample_proc_param_is_translation", false);
|
||||||
|
public static final boolean VEDIO_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("vedio_sample_proc_param_is_translation", false);
|
||||||
|
public static final boolean PICTURE_SAMPLE_PROC_PARAM_IS_TRANSLATION = Configurations.getBooleanProperty("picture_sample_proc_param_is_translation", false);
|
||||||
|
|
||||||
//HTTP自定义域相关参数
|
//HTTP自定义域相关参数
|
||||||
public static String HTTP_HEADER_USER_REGION_KEY=Configurations.getStringProperty("http_header_user_region_key", "HTTP_HEADER");
|
public static String HTTP_HEADER_USER_REGION_KEY=Configurations.getStringProperty("http_header_user_region_key", "HTTP_HEADER");
|
||||||
public static String HTTP_HEADER_DICT_MODULE=Configurations.getStringProperty("http_header_dict_module", "REQUEST_HEADER_DISTRICT");
|
public static String HTTP_HEADER_DICT_MODULE=Configurations.getStringProperty("http_header_dict_module", "REQUEST_HEADER_DISTRICT");
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.nis.web.controller.configuration.ntc;
|
package com.nis.web.controller.configuration.ntc;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -39,6 +42,7 @@ import com.nis.domain.maat.ToMaatResult;
|
|||||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.ConfigServiceUtil;
|
import com.nis.util.ConfigServiceUtil;
|
||||||
|
import com.nis.util.Constants;
|
||||||
import com.nis.util.DictUtils;
|
import com.nis.util.DictUtils;
|
||||||
import com.nis.util.FileUtils;
|
import com.nis.util.FileUtils;
|
||||||
import com.nis.util.JsonMapper;
|
import com.nis.util.JsonMapper;
|
||||||
@@ -107,33 +111,45 @@ public class AvController extends BaseController {
|
|||||||
public String saveFileSample(Model model,HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes,
|
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){
|
||||||
try{
|
try{
|
||||||
if(srcFile!=null && sampleFile!=null &&
|
// if(srcFile!=null && sampleFile!=null &&
|
||||||
srcFile.getSize()>0 && sampleFile.getSize()>0){
|
// srcFile.getSize()>0 && sampleFile.getSize()>0){
|
||||||
|
if(srcFile!=null && srcFile.getSize()>0){
|
||||||
String sep = System.getProperty("file.separator");
|
String sep = System.getProperty("file.separator");
|
||||||
String srcFilePath = request.getRealPath("/")+"srcFile";
|
String srcFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"srcFile";//源文件保存路径
|
||||||
String sampleFilePath = request.getRealPath("/")+"sampleFile";
|
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(srcFilePath);
|
||||||
FileUtils.createDirectory(sampleFilePath);
|
FileUtils.createDirectory(sampleFilePath);
|
||||||
String srcFileName = UUID.randomUUID()+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);
|
|
||||||
String sampleFileName = UUID.randomUUID()+FileUtils.getSuffix(sampleFile.getOriginalFilename(), true);
|
String fileName = UUID.randomUUID()+"";
|
||||||
File uploadSrcFile = new File(srcFilePath+sep+srcFileName);
|
String srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);
|
||||||
File uploadSampleFile = new File(sampleFilePath+sep+sampleFileName);
|
String sampleFileAllPath = sampleFilePath+sep+fileName+".sample";
|
||||||
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
|
String resultFileAllPath = resultFilePath+sep+fileName+".result";
|
||||||
FileCopyUtils.copy(sampleFile.getBytes(),uploadSampleFile);
|
entity.setSrcPath(srcFileAllPath);
|
||||||
|
entity.setSamplePath(sampleFileAllPath);
|
||||||
|
entity.setResultPath(resultFileAllPath);
|
||||||
|
|
||||||
|
File uploadSrcFile = new File(srcFileAllPath);
|
||||||
|
File uploadSampleFile = new File(sampleFileAllPath);
|
||||||
|
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
|
||||||
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
|
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
|
||||||
String srcUrl = host+"/srcFile/"+uploadSrcFile.getName();
|
String srcUrl = host+srcFilePath.substring(srcFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSrcFile.getName();
|
||||||
String sampleUrl = host+"/sampleFile/"+uploadSampleFile.getName();
|
String sampleUrl = host+sampleFilePath.substring(sampleFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSampleFile.getName();
|
||||||
|
srcUrl = srcUrl.replace("\\", "/");
|
||||||
|
sampleUrl = sampleUrl.replace("\\", "/");
|
||||||
logger.info("srcUrl:"+srcUrl);
|
logger.info("srcUrl:"+srcUrl);
|
||||||
logger.info("sampleUrl:"+sampleUrl);
|
logger.info("sampleUrl:"+sampleUrl);
|
||||||
String srcMd5 = FileUtils.getFileMD5(uploadSrcFile);
|
|
||||||
String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
|
|
||||||
entity.setSrcUrl(srcUrl);
|
entity.setSrcUrl(srcUrl);
|
||||||
entity.setSrcPath(uploadSrcFile.getPath());
|
|
||||||
entity.setSampleUrl(sampleUrl);
|
entity.setSampleUrl(sampleUrl);
|
||||||
entity.setSamplePath(uploadSampleFile.getPath());
|
|
||||||
entity.setSrcMd5(srcMd5);
|
// File uploadSrcFile = new File(srcFilePath);
|
||||||
entity.setSampleMd5(sampleMd5);
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
avCfgService.saveOrUpdateAvFileSample(entity);
|
avCfgService.saveOrUpdateAvFileSample(entity);
|
||||||
|
|||||||
@@ -297,7 +297,8 @@
|
|||||||
SRC_URL,SAMPLE_URL, SRC_MD5,SAMPLE_MD5,LEVEL,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
SRC_URL,SAMPLE_URL, SRC_MD5,SAMPLE_MD5,LEVEL,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code,src_path,sample_path
|
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code,src_path,sample_path,
|
||||||
|
is_sample_created
|
||||||
)values (
|
)values (
|
||||||
#{srcUrl,jdbcType=VARCHAR},#{sampleUrl,jdbcType=VARCHAR},#{srcMd5,jdbcType=VARCHAR},
|
#{srcUrl,jdbcType=VARCHAR},#{sampleUrl,jdbcType=VARCHAR},#{srcMd5,jdbcType=VARCHAR},
|
||||||
#{sampleMd5,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
#{sampleMd5,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||||
@@ -307,7 +308,8 @@
|
|||||||
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||||
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
|
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
|
||||||
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{srcPath,jdbcType=VARCHAR},#{samplePath,jdbcType=VARCHAR}
|
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{srcPath,jdbcType=VARCHAR},#{samplePath,jdbcType=VARCHAR},
|
||||||
|
#{isSampleCreated,jdbcType=INTEGER}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -403,6 +405,9 @@
|
|||||||
<if test="samplePath != null and samplePath != ''">
|
<if test="samplePath != null and samplePath != ''">
|
||||||
sample_path = #{samplePath,jdbcType=VARCHAR},
|
sample_path = #{samplePath,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="isSampleCreated != null" >
|
||||||
|
is_sample_created = #{isSampleCreated,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="srcMd5 != null and srcMd5 != ''">
|
<if test="srcMd5 != null and srcMd5 != ''">
|
||||||
src_md5 = #{srcMd5,jdbcType=VARCHAR},
|
src_md5 = #{srcMd5,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -2,15 +2,20 @@ package com.nis.web.service.configuration;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -23,6 +28,7 @@ import com.nis.domain.maat.ToMaatResult;
|
|||||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.ConfigServiceUtil;
|
import com.nis.util.ConfigServiceUtil;
|
||||||
|
import com.nis.util.Constants;
|
||||||
import com.nis.util.FileUtils;
|
import com.nis.util.FileUtils;
|
||||||
import com.nis.util.StringUtil;
|
import com.nis.util.StringUtil;
|
||||||
import com.nis.web.dao.configuration.AvCfgDao;
|
import com.nis.web.dao.configuration.AvCfgDao;
|
||||||
@@ -86,7 +92,77 @@ public class AvCfgService extends BaseService{
|
|||||||
}
|
}
|
||||||
if(compileId!=0){
|
if(compileId!=0){
|
||||||
entity.setCompileId(compileId);
|
entity.setCompileId(compileId);
|
||||||
|
entity.setIsSampleCreated(0);
|
||||||
|
File uploadSrcFile = new File(entity.getSrcPath());
|
||||||
|
String srcMd5 = FileUtils.getFileMD5(uploadSrcFile);
|
||||||
|
entity.setSrcMd5(srcMd5);
|
||||||
avCfgDao.insertAvFileSample(entity);
|
avCfgDao.insertAvFileSample(entity);
|
||||||
|
|
||||||
|
//调用外部脚本,生成样例文件
|
||||||
|
List list = new ArrayList();
|
||||||
|
Map<String,Object> map = new HashMap();
|
||||||
|
map.put("srcFile", entity.getSrcPath());
|
||||||
|
map.put("dstFile", entity.getSamplePath());
|
||||||
|
map.put("resultFile", entity.getResultPath());
|
||||||
|
map.put("fileId", entity.getCfgId());
|
||||||
|
list.add(map);
|
||||||
|
String param = gsonToJson(list);
|
||||||
|
String sampleCreatelProc = "";
|
||||||
|
if(entity.getCfgType().equals(Constants.AV_SAMPLE_AUDIO_REGION)||
|
||||||
|
entity.getCfgType().equals(Constants.AV_SAMPLE_VOIP_REGION)){//音频样例配置或VOIP样例配置
|
||||||
|
sampleCreatelProc = Constants.AUDIO_SAMPLE_CREATE_PROC;
|
||||||
|
if(Constants.AUDIO_SAMPLE_PROC_PARAM_IS_TRANSLATION){
|
||||||
|
param = StringEscapeUtils.escapeJava(param);
|
||||||
|
}
|
||||||
|
if(Constants.AUDIO_SAMPLE_PROC_PARAM_IS_QUOTATION){//json参数是否需要前后单引号处理
|
||||||
|
param = "'"+param+"'";
|
||||||
|
}
|
||||||
|
}else if(entity.getCfgType().equals(Constants.AV_SAMPLE_VEDIO_REGION)){//视频样例配置
|
||||||
|
sampleCreatelProc = Constants.VEDIO_SAMPLE_CREATE_PROC;
|
||||||
|
if(Constants.VEDIO_SAMPLE_PROC_PARAM_IS_TRANSLATION){
|
||||||
|
param = StringEscapeUtils.escapeJava(param);
|
||||||
|
}
|
||||||
|
if(Constants.VEDIO_SAMPLE_PROC_PARAM_IS_QUOTATION){//json参数是否需要前后单引号处理
|
||||||
|
param = "'"+param+"'";
|
||||||
|
}
|
||||||
|
}else if(entity.getCfgType().equals(Constants.AV_SAMPLE_PICTURE_REGION)){//图片样例配置
|
||||||
|
sampleCreatelProc = Constants.PICTURE_SAMPLE_CREATE_PROC;
|
||||||
|
if(Constants.PICTURE_SAMPLE_PROC_PARAM_IS_TRANSLATION){
|
||||||
|
param = StringEscapeUtils.escapeJava(param);
|
||||||
|
}
|
||||||
|
if(Constants.PICTURE_SAMPLE_PROC_PARAM_IS_QUOTATION){//json参数是否需要前后单引号处理
|
||||||
|
param = "'"+param+"'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("调用外部程序输入参数:"+param);
|
||||||
|
Map resultMap = execShell(sampleCreatelProc,param);
|
||||||
|
logger.info("调用外部程序结果:"+resultMap);
|
||||||
|
|
||||||
|
if(resultMap.get("exitStatus").equals(0)){//调用外部程序成功
|
||||||
|
String out = resultMap.get("out").toString();//输出参数
|
||||||
|
JSONArray resArray =JSONArray.fromObject(out);
|
||||||
|
JSONObject resObject = resArray.getJSONObject(0);
|
||||||
|
logger.info("调用外部程序输出参数:"+resObject);
|
||||||
|
int state = resObject.getInt("state");
|
||||||
|
int fileSize = resObject.getInt("fileSize");
|
||||||
|
Integer fileId = resObject.getInt("fileId");
|
||||||
|
if(state==1 && fileSize>0){//成功
|
||||||
|
entity.setIsSampleCreated(1);//样例文件创建成功
|
||||||
|
}else{
|
||||||
|
entity.setIsSampleCreated(-1);//样例文件创建失败
|
||||||
|
}
|
||||||
|
if(fileId.equals(entity.getCfgId().intValue())){
|
||||||
|
File uploadSampleFile = new File(entity.getSamplePath());
|
||||||
|
String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
|
||||||
|
entity.setSampleMd5(sampleMd5);
|
||||||
|
avCfgDao.updateAvFileSample(entity);
|
||||||
|
}else{
|
||||||
|
logger.info("调用外部程序返回fileId错误,输入的fileId为:"+entity.getCfgId()+",输出的fileId为:"+fileId);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new MaatConvertException(resultMap.get("error")!=null?resultMap.get("error").toString():resultMap.get("message").toString());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
@@ -212,4 +288,73 @@ public class AvCfgService extends BaseService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 调用shell脚本 返回运行结果
|
||||||
|
*
|
||||||
|
* @param shellName
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> execShell(String shellName,
|
||||||
|
String... params) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(shellName);
|
||||||
|
for (String temp : params) {
|
||||||
|
sb.append(" " + temp);
|
||||||
|
}
|
||||||
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
|
String cmd1 = "";
|
||||||
|
String cmd2 = "";
|
||||||
|
if(os.contains("windows")){
|
||||||
|
cmd1 = "cmd.exe";
|
||||||
|
cmd2 = "/c";
|
||||||
|
}else{
|
||||||
|
cmd1 = "/bin/sh";
|
||||||
|
cmd2 = "-c";
|
||||||
|
}
|
||||||
|
logger.info("调用脚本信息,cmd1:"+cmd1+",cmd2:"+cmd2);
|
||||||
|
String cmdarray[] = new String[] {cmd1, cmd2 ,sb.toString() };
|
||||||
|
BufferedReader br = null;
|
||||||
|
BufferedReader bre = null;
|
||||||
|
try {
|
||||||
|
Process exec = Runtime.getRuntime().exec(cmdarray);
|
||||||
|
exec.getInputStream();
|
||||||
|
br = new BufferedReader(
|
||||||
|
new InputStreamReader(exec.getInputStream()));
|
||||||
|
bre = new BufferedReader(new InputStreamReader(
|
||||||
|
exec.getErrorStream()));
|
||||||
|
String s = null;
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
while ((s = br.readLine()) != null) {
|
||||||
|
out.append(s);
|
||||||
|
}
|
||||||
|
result.put("out", out.toString());//输出参数
|
||||||
|
out.setLength(0);//清空
|
||||||
|
while ((s = bre.readLine()) != null) {
|
||||||
|
out.append(s);
|
||||||
|
}
|
||||||
|
result.put("error", out.toString());//错误信息
|
||||||
|
int waitFor = exec.waitFor();
|
||||||
|
logger.info("调用脚本:"+shellName+",执行返回状态值:"+waitFor);
|
||||||
|
result.put("exitStatus", waitFor);//执行状态
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("调用 " + shellName + " 脚本异常", e);
|
||||||
|
} finally {
|
||||||
|
if (br != null)
|
||||||
|
try {
|
||||||
|
br.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (bre != null)
|
||||||
|
try {
|
||||||
|
bre.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -772,7 +772,7 @@ not_number=%s must be a number
|
|||||||
#=============region_value,config form title=================
|
#=============region_value,config form title=================
|
||||||
av_sample_audio=Audio Sample
|
av_sample_audio=Audio Sample
|
||||||
av_sample_vedio=Vedio Sample
|
av_sample_vedio=Vedio Sample
|
||||||
av_sample_pitrue=Picture Sample
|
av_sample_picture=Picture Sample
|
||||||
av_sample_voip=voipSample
|
av_sample_voip=voipSample
|
||||||
av_sample_audio_porn=Audio Porn Sign Sample
|
av_sample_audio_porn=Audio Porn Sign Sample
|
||||||
av_sample_vedio_porn=Vedio Porn Sgin Sample
|
av_sample_vedio_porn=Vedio Porn Sgin Sample
|
||||||
|
|||||||
@@ -772,7 +772,7 @@ not_number=%s\u5FC5\u987B\u4E3A\u6570\u5B57
|
|||||||
#=============region_value,config form title=================
|
#=============region_value,config form title=================
|
||||||
av_sample_audio=\u97F3\u9891\u6837\u4F8B
|
av_sample_audio=\u97F3\u9891\u6837\u4F8B
|
||||||
av_sample_vedio=\u89C6\u9891\u6837\u4F8B
|
av_sample_vedio=\u89C6\u9891\u6837\u4F8B
|
||||||
av_sample_pitrue=\u56FE\u7247\u6837\u4F8B
|
av_sample_picture=\u56FE\u7247\u6837\u4F8B
|
||||||
av_sample_voip=voip\u6837\u4F8B
|
av_sample_voip=voip\u6837\u4F8B
|
||||||
av_sample_audio_porn=\u97F3\u9891\u8272\u60C5\u573A\u666F\u6837\u4F8B
|
av_sample_audio_porn=\u97F3\u9891\u8272\u60C5\u573A\u666F\u6837\u4F8B
|
||||||
av_sample_vedio_porn=\u89C6\u9891\u8272\u60C5\u573A\u666F\u6837\u4F8B
|
av_sample_vedio_porn=\u89C6\u9891\u8272\u60C5\u573A\u666F\u6837\u4F8B
|
||||||
|
|||||||
@@ -331,16 +331,32 @@ digest_single_file_max_size=10485760
|
|||||||
#12M12582912
|
#12M12582912
|
||||||
digest_total_file_max_size=12582912
|
digest_total_file_max_size=12582912
|
||||||
#YSP文件保存路径
|
#YSP文件保存路径
|
||||||
av_file_path=d:\\ysp\\
|
av_file_path=/home/ysp/
|
||||||
|
#av_file_path=D:\\ysp\\
|
||||||
#YSP文件特征类型
|
#YSP文件特征类型
|
||||||
av_sample_audio_region=av_sample_audio
|
av_sample_audio_region=av_sample_audio
|
||||||
av_sample_vedio_region=av_sample_vedio
|
av_sample_vedio_region=av_sample_vedio
|
||||||
av_sample_pitrue_region=av_sample_pitrue
|
av_sample_picture_region=av_sample_picture
|
||||||
av_sample_voip_region=av_sample_voip
|
av_sample_voip_region=av_sample_voip
|
||||||
#样例文件生成程序
|
#样例文件生成程序
|
||||||
audio_sample_create_proc=java -jar d:\\sampleTest.jar
|
audio_sample_create_proc=java -jar /home/sampleTest.jar
|
||||||
vedio_sample_create_proc=java -jar d:\\sampleTest.jar
|
vedio_sample_create_proc=java -jar /home/sampleTest.jar
|
||||||
picture_sample_create_proc=java -jar d:\\sampleTest.jar
|
picture_sample_create_proc=java -jar /home/sampleTest.jar
|
||||||
|
audio_sample_proc_param_is_quotation=true
|
||||||
|
vedio_sample_proc_param_is_quotation=true
|
||||||
|
picture_sample_proc_param_is_quotation=true
|
||||||
|
audio_sample_proc_param_is_translation=false
|
||||||
|
vedio_sample_proc_param_is_translation=false
|
||||||
|
picture_sample_proc_param_is_translation=false
|
||||||
|
#audio_sample_create_proc=java -jar D:\\sampleTest.jar
|
||||||
|
#vedio_sample_create_proc=java -jar D:\\sampleTest.jar
|
||||||
|
#picture_sample_create_proc=java -jar D:\\sampleTest.jar
|
||||||
|
#audio_sample_proc_param_is_quotation=false
|
||||||
|
#vedio_sample_proc_param_is_quotation=false
|
||||||
|
#picture_sample_proc_param_is_quotation=false
|
||||||
|
#audio_sample_proc_param_is_translation=true
|
||||||
|
#vedio_sample_proc_param_is_translation=true
|
||||||
|
#picture_sample_proc_param_is_translation=true
|
||||||
#http自定义域相关参数
|
#http自定义域相关参数
|
||||||
http_header_user_region_key=HTTP_HEADER
|
http_header_user_region_key=HTTP_HEADER
|
||||||
http_header_dict_module=REQUEST_HEADER_DISTRICT
|
http_header_dict_module=REQUEST_HEADER_DISTRICT
|
||||||
|
|||||||
@@ -34,10 +34,10 @@
|
|||||||
cache-period="31536000" />
|
cache-period="31536000" />
|
||||||
<mvc:resources mapping="/upload/**" location="/upload/"
|
<mvc:resources mapping="/upload/**" location="/upload/"
|
||||||
cache-period="31536000" />
|
cache-period="31536000" />
|
||||||
<mvc:resources mapping="/sampleFile/**" location="/sampleFile/"
|
<!-- <mvc:resources mapping="/sampleFile/**" location="/sampleFile/"
|
||||||
cache-period="31536000" />
|
cache-period="31536000" />
|
||||||
<mvc:resources mapping="/srcFile/**" location="/srcFile/"
|
<mvc:resources mapping="/srcFile/**" location="/srcFile/"
|
||||||
cache-period="31536000" />
|
cache-period="31536000" /> -->
|
||||||
<!-- <mvc:resources mapping="/swagger/**" location="/swagger/"
|
<!-- <mvc:resources mapping="/swagger/**" location="/swagger/"
|
||||||
cache-period="31536000" /> -->
|
cache-period="31536000" /> -->
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ $(function(){
|
|||||||
$("#srcFile").on('change',function(){
|
$("#srcFile").on('change',function(){
|
||||||
$("#srcFileInfo").val($("#srcFile").val());
|
$("#srcFileInfo").val($("#srcFile").val());
|
||||||
});
|
});
|
||||||
$("#uploadSample,#sampleFileInfo").on('click',function(){
|
/* $("#uploadSample,#sampleFileInfo").on('click',function(){
|
||||||
$("#sampleFile").trigger("click");
|
$("#sampleFile").trigger("click");
|
||||||
});
|
});
|
||||||
$("#sampleFile").on('change',function(){
|
$("#sampleFile").on('change',function(){
|
||||||
$("#sampleFileInfo").val($("#sampleFile").val());
|
$("#sampleFileInfo").val($("#sampleFile").val());
|
||||||
});
|
}); */
|
||||||
$("input[name='areaType']").on('change',function(){
|
$("input[name='areaType']").on('change',function(){
|
||||||
var val=$(this).val();
|
var val=$(this).val();
|
||||||
if($(this).is(":visible")){
|
if($(this).is(":visible")){
|
||||||
@@ -62,16 +62,16 @@ $(function(){
|
|||||||
$("#cfgFrom").validate({
|
$("#cfgFrom").validate({
|
||||||
submitHandler: function(form){
|
submitHandler: function(form){
|
||||||
var srcFile = $("#srcFile").val();
|
var srcFile = $("#srcFile").val();
|
||||||
var sampleFile = $("#sampleFile").val();
|
//var sampleFile = $("#sampleFile").val();
|
||||||
var srcUrl = $("#srcUrl").val();
|
var srcUrl = $("#srcUrl").val();
|
||||||
var sampleUrl = $("#sampleUrl").val();
|
//var sampleUrl = $("#sampleUrl").val();
|
||||||
if((srcUrl==null||srcUrl=="") && (srcFile==null || srcFile=="")){
|
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>");
|
$("div[for='srcFile']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='required'></spring:message></label>");
|
||||||
return false;
|
return false;
|
||||||
}else if((sampleUrl==null || sampleUrl=="") && (sampleFile==null || sampleFile=="")){
|
}/* 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>");
|
$("div[for='sampleFile']").append("<label id='level-error' class='error' for='sampleFile'><spring:message code='required'></spring:message></label>");
|
||||||
return false;
|
return false;
|
||||||
}else{
|
} */else{
|
||||||
loading('onloading...');
|
loading('onloading...');
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
@@ -164,11 +164,11 @@ $(function(){
|
|||||||
<div for="srcFileInfo"></div>
|
<div for="srcFileInfo"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<%-- <div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="sample_file"/></label>
|
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="sample_file"/></label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<%-- <input class="form-control required" type="text" name="sampleUrl" value="${_cfg.sampleUrl}"> --%>
|
<input class="form-control required" type="text" name="sampleUrl" value="${_cfg.sampleUrl}">
|
||||||
<input id="sampleFile" name="sampleFile" type="file"style="width: 330px;display:none" />
|
<input id="sampleFile" name="sampleFile" type="file"style="width: 330px;display:none" />
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="sampleFileInfo" name="sampleFileInfo" readonly="readonly" data-msg-required=""
|
<input id="sampleFileInfo" name="sampleFileInfo" readonly="readonly" data-msg-required=""
|
||||||
@@ -178,18 +178,15 @@ $(function(){
|
|||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<a id="uploadSample" class="btn btn-default btn-search" href="javascript:" style=""><i class="fa fa-search"></i></a>
|
<a id="uploadSample" class="btn btn-default btn-search" href="javascript:" style=""><i class="fa fa-search"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<%-- <span id="srcFileInfo" style="margin-top:20px;margin-left:10px;">${_cfg.srcUrl }</span> --%>
|
<span id="srcFileInfo" style="margin-top:20px;margin-left:10px;">${_cfg.srcUrl }</span>
|
||||||
</div>
|
</div>
|
||||||
<%-- <button id="uploadSample" type="button" class="btn btn-default btn-search"><spring:message code="select_file"/></button>
|
<button id="uploadSample" type="button" class="btn btn-default btn-search"><spring:message code="select_file"/></button>
|
||||||
<span id="sampleFileInfo">${_cfg.sampleUrl }</span> --%>
|
<span id="sampleFileInfo">${_cfg.sampleUrl }</span>
|
||||||
<input id="sampleUrl" name="sampleUrl" type="hidden" value="${_cfg.sampleUrl }" />
|
<input id="sampleUrl" name="sampleUrl" type="hidden" value="${_cfg.sampleUrl }" />
|
||||||
</div>
|
</div>
|
||||||
<div for="sampleFileInfo"></div>
|
<div for="sampleFileInfo"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> --%>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="action"/></label>
|
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="action"/></label>
|
||||||
@@ -212,6 +209,29 @@ $(function(){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<%-- <div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="action"/></label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<c:forEach items="${serviceList}" var="service">
|
||||||
|
<label class="radio-inline">
|
||||||
|
<c:if test="${_cfg.functionId eq service.functionId}">
|
||||||
|
<input type="radio" name="action" serviceId="${service.serviceId }" value="${service.action }" class="required action"
|
||||||
|
<c:if test="${_cfg.action==service.action || _cfg.action==null}">checked</c:if>>
|
||||||
|
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||||
|
<c:if test="${dict.itemCode eq service.action }">
|
||||||
|
<spring:message code="${dict.itemValue }"/>
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
</c:if>
|
||||||
|
</label>
|
||||||
|
</c:forEach>
|
||||||
|
</div>
|
||||||
|
<div for="action"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> --%>
|
||||||
<%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%>
|
<%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%>
|
||||||
<input type="hidden" name="isAreaEffective" value="0">
|
<input type="hidden" name="isAreaEffective" value="0">
|
||||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
||||||
|
|||||||
Reference in New Issue
Block a user