diff --git a/src/main/java/com/nis/util/ConfigServiceUtil.java b/src/main/java/com/nis/util/ConfigServiceUtil.java index 1f1efdce3..4f8707f62 100644 --- a/src/main/java/com/nis/util/ConfigServiceUtil.java +++ b/src/main/java/com/nis/util/ConfigServiceUtil.java @@ -90,7 +90,7 @@ public class ConfigServiceUtil { * @param type 1是compileid,2是groupid,3是regionid * @return */ - public static List getId(int type,int num) throws Exception { + public static List getId(int type,int num) throws MaatConvertException { String result = null; String url = ""; List list = new ArrayList(); @@ -133,7 +133,7 @@ public class ConfigServiceUtil { * @return * @throws Exception */ - public static ToMaatResult postMaatCfg(String params) throws Exception{ + public static ToMaatResult postMaatCfg(String params) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL+Constants.MAAT_CFG; @@ -157,7 +157,7 @@ public class ConfigServiceUtil { * @return * @throws Exception */ - public static ToMaatResult postCallbackCfg(String params) throws Exception{ + public static ToMaatResult postCallbackCfg(String params) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL+Constants.CALLBACK_CFG; @@ -182,7 +182,7 @@ public class ConfigServiceUtil { * @return * @throws Exception */ - public static ToMaatResult postFileCfg(String params,File file,JSONObject fileDesc) throws Exception{ + public static ToMaatResult postFileCfg(String params,File file,JSONObject fileDesc) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL+Constants.FILE_UPLOAD_CFG; @@ -209,7 +209,7 @@ public class ConfigServiceUtil { * @param type,1表示maat配置取消,2表示回调配置取消 * @return */ - public static ToMaatResult delete(String params,Integer type){ + public static ToMaatResult delete(String params,Integer type) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL; @@ -239,7 +239,7 @@ public class ConfigServiceUtil { * @param type,1表示maat配置取消,2表示回调配置取消 * @return */ - public static ToMaatResult put(String params,Integer type){ + public static ToMaatResult put(String params,Integer type) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL; @@ -268,7 +268,7 @@ public class ConfigServiceUtil { * @return * @throws Exception */ - public static ToMaatResult getFileDigest(String params,File file,Map fileDesc) throws Exception{ + public static ToMaatResult getFileDigest(String params,File file,Map fileDesc) throws MaatConvertException{ String result = null; ToMaatResult bean = null; String url = Constants.SERVICE_URL+Constants.FILE_DIGEST_CFG; 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 23d6e4682..4f324e4db 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 @@ -19,6 +19,7 @@ import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -147,7 +148,7 @@ public class AvController extends BaseController { * @return */ @RequestMapping(value = {"/sample/auditAvFileSample"}) - public String auditAvFileSample(Integer isAudit,Integer isValid,String ids,Integer functionId){ + public String auditAvFileSample(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes){ // avCfgService.auditAvFileSample(isAudit,isValid,ids); AvFileSampleCfg entity = new AvFileSampleCfg(); String[] idArray = ids.split(","); @@ -159,9 +160,9 @@ public class AvController extends BaseController { entity.setAuditTime(new Date()); String oldSrcUrl = entity.getSrcPath(); String oldSampleUrl = entity.getSamplePath(); - if(isAudit==1){ - //音视频文件上传接口调用 - try { + try { + if(isAudit==1){ + //音视频文件上传接口调用 File srcFile = new File(oldSrcUrl); Map srcMap = new HashMap(); srcMap.put("filetype", FileUtils.getSuffix(srcFile.getName(), false)); @@ -178,7 +179,7 @@ public class AvController extends BaseController { ResponseData data = result1.getData(); srcAccessUrl=data.getAccessUrl(); entity.setSrcUrl(srcAccessUrl); -// entity.setSrcPath(""); +// entity.setSrcPath(""); } File sampleFile = new File(oldSampleUrl); Map sampleMap = new HashMap(); @@ -197,23 +198,22 @@ public class AvController extends BaseController { ResponseData data = result2.getData(); sampleAccessUrl = data.getAccessUrl(); entity.setSampleUrl(sampleAccessUrl); -// entity.setSamplePath(""); +// entity.setSamplePath(""); } - - } catch (Exception e) { - e.printStackTrace(); - logger.info("音视频文件样例配置下发失败"); - throw new MaatConvertException(":"+e.getMessage()); } - } - avCfgService.auditAvFileSample(entity,isAudit); - //删除本地源文件和样例文件 - if(!oldSrcUrl.equals(entity.getSrcUrl())){ - FileUtils.deleteFile(oldSrcUrl); - } - if(!oldSampleUrl.equals(entity.getSampleUrl())){ - FileUtils.deleteFile(oldSampleUrl); + avCfgService.auditAvFileSample(entity,isAudit); + //删除本地源文件和样例文件 + if(!oldSrcUrl.equals(entity.getSrcUrl())){ + FileUtils.deleteFile(oldSrcUrl); + } + if(!oldSampleUrl.equals(entity.getSampleUrl())){ + FileUtils.deleteFile(oldSampleUrl); + } + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("音视频文件样例配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); } } return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId; @@ -234,7 +234,7 @@ public class AvController extends BaseController { * @return */ @RequestMapping(value = {"/sample/auditAvSignSample"}) - public String auditAvSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId){ + public String auditAvSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes){ // avCfgService.auditAvSignSample(isAudit,isValid,ids); AvSignSampleCfg entity = new AvSignSampleCfg(); String[] idArray = ids.split(","); @@ -244,7 +244,13 @@ public class AvController extends BaseController { entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); - avCfgService.auditAvSignSample(entity,isAudit); + try { + avCfgService.auditAvSignSample(entity,isAudit); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("音视频标识样例配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } } return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; } diff --git a/src/main/java/com/nis/web/service/configuration/AvCfgService.java b/src/main/java/com/nis/web/service/configuration/AvCfgService.java index cda1b8dc1..6ab10bcae 100644 --- a/src/main/java/com/nis/web/service/configuration/AvCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvCfgService.java @@ -141,7 +141,7 @@ public class AvCfgService extends BaseService{ } - public void auditAvFileSample(AvFileSampleCfg entity,Integer isAudit){ + public void auditAvFileSample(AvFileSampleCfg entity,Integer isAudit) throws MaatConvertException{ //修改数据库审核状态信息 avCfgDao.auditAvFileSample(entity); List list = new ArrayList(); @@ -152,27 +152,16 @@ public class AvCfgService extends BaseService{ String json=gsonToJson(list); logger.info("音视频文件样例下发配置参数:"+json); //调用服务接口下发配置 - try { - ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); - logger.info("音视频文件样例配置下发响应信息:"+result.getMsg()); - } catch (Exception e) { - e.printStackTrace(); - logger.info("音视频文件样例配置下发失败"); - throw new MaatConvertException(":"+e.getMessage()); - } + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + logger.info("音视频文件样例配置下发响应信息:"+result.getMsg()); + }else if(isAudit==3){ //调用服务接口取消配置 String json=gsonToJson(list); logger.info("音视频文件样例下发配置参数:"+json); //调用服务接口下发配置 - try { - ToMaatResult result = ConfigServiceUtil.put(json,2); - logger.info("音视频文件样例取消配置响应信息:"+result.getMsg()); - } catch (Exception e) { - e.printStackTrace(); - logger.info("音视频文件样取消配置失败"); - throw new MaatConvertException(":"+e.getMessage()); - } + ToMaatResult result = ConfigServiceUtil.put(json,2); + logger.info("音视频文件样例取消配置响应信息:"+result.getMsg()); } } public void updateAvSignSampleValid(Integer isAudit,Integer isValid,String ids){ @@ -187,7 +176,7 @@ public class AvCfgService extends BaseService{ avCfgDao.updateAvSignSampleValid(entity); } } - public void auditAvSignSample(AvSignSampleCfg entity,Integer isAudit){ + public void auditAvSignSample(AvSignSampleCfg entity,Integer isAudit) throws MaatConvertException{ avCfgDao.auditAvSignSample(entity); List list = new ArrayList(); list.add(entity); @@ -209,14 +198,8 @@ public class AvCfgService extends BaseService{ String json=gsonToJson(list); logger.info("标志样例下发配置参数:"+json); //调用服务接口取消配置 - try { - ToMaatResult result = ConfigServiceUtil.put(json, 2); - logger.info("音视频标志样例配置取消配置响应信息:"+result.getMsg()); - } catch (Exception e) { - e.printStackTrace(); - logger.info("音视频标志样例取消配置失败"); - throw new MaatConvertException(":"+e.getMessage()); - } + ToMaatResult result = ConfigServiceUtil.put(json, 2); + logger.info("音视频标志样例配置取消配置响应信息:"+result.getMsg()); } } diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 9dfbe19ab..49a3ac9ce 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -219,14 +219,14 @@ clusterBStartTime=1503504000725 isCommit=true ############################################################################################################################################ ############################################################################################################################################ -httpUrl=http://10.0.6.201:8090/galaxy/service/cfg/v1/ +httpUrl=http://10.0.6.249:8080/galaxy/service/cfg/v1/ maatCfg=configSources fileUploadCfg=fileUploadSources callbackCfg=commonSources fileDigestCfg=fileDigestSources configIdSources=configPzIdSources -client_connect_timeout=1000 -client_read_timeout=1000 +client_connect_timeout=300000 +client_read_timeout=300000 #use elasticsearch or not# isUseES=false diff --git a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp index 55bcc7a80..2c639110e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp @@ -264,6 +264,7 @@
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp index 2d1d57c43..e691dc824 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/signSampleList.jsp @@ -268,6 +268,7 @@
+
@@ -374,7 +375,7 @@ class="tooltips" data-flag="false" data-html="true" data-placement="top"> ${fns:abbr(lableInfo,20)} - + <%-- --%>
${cfg.areaEffectiveIds }