From aa690069bdc72fb34f729310aeb49e24282e9c97 Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 17 Oct 2018 11:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=A4=E5=9B=BE=E7=89=87=E5=A4=96=E7=9A=84?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=9F=B3=E9=A2=91=E3=80=81=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=A0=B7=E4=BE=8B=E9=83=BD=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=97=B6=E9=95=BF=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangwei --- .../configuration/ntc/AvController.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java index f057d959e..c672e6ccd 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java @@ -29,6 +29,7 @@ import com.nis.domain.maat.ToMaatResult; import com.nis.domain.maat.ToMaatResult.ResponseData; import com.nis.exceptions.CallExternalProceduresException; import com.nis.exceptions.MaatConvertException; +import com.nis.exceptions.MultiPartNewException; import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; import com.nis.util.DictUtils; @@ -162,10 +163,16 @@ public class AvController extends BaseController { // entity.setSrcMd5(srcMd5); // entity.setSampleMd5(sampleMd5); - //验证音视频文件时长 - Encoder encoder = new Encoder(); - String length = ""; - try { + + //音频、视频、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); @@ -176,13 +183,10 @@ public class AvController extends BaseController { if(ls>0 && second>Constants.AV_DURATION_LIMIT){ addMessage(redirectAttributes,"exceeds_duration_limit"); logger.error("The duration of uploaded files exceeds the limit("+Constants.AV_DURATION_LIMIT+"s)."); - return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId(); + throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit")); } - } catch (Exception e) { - e.printStackTrace(); - addMessage(redirectAttributes,"save_failed"); - return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId(); } + } avCfgService.saveOrUpdateAvFileSample(entity, srcFile); @@ -195,7 +199,7 @@ public class AvController extends BaseController { if(e instanceof MaatConvertException||e instanceof CallExternalProceduresException) { addMessage(redirectAttributes,e.getMessage()); }else { - addMessage(redirectAttributes,"save_failed"); + addMessage(redirectAttributes,e.getMessage()); } }