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 3e864cf23..eb17e8c24 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 @@ -293,40 +293,40 @@ public class AvController extends BaseController { } //修改标志样例配置审核状态 - /** - * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 - * @param isAudit - * @param isValid - * @param ids - * @param functionId - * @return - */ - @RequestMapping(value = {"/sample/auditAvAudioSignSample"}) - public String auditAvAudioSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes){ + /** + * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 + * @param isAudit + * @param isValid + * @param ids + * @param functionId + * @return + */ + @RequestMapping(value = {"/sample/auditAvAudioSignSample"}) + public String auditAvAudioSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes){ // avCfgService.auditAvSignSample(isAudit,isValid,ids); - AvSignSampleCfg entity = new AvSignSampleCfg(); - String[] idArray = ids.split(","); - for(String id :idArray){ - entity = avCfgService.getAvSignSampleById(Long.parseLong(id)); - entity.setIsAudit(isAudit); - entity.setIsValid(isValid); - entity.setAuditorId(UserUtils.getUser().getId()); - entity.setAuditTime(new Date()); - try { - avCfgService.audioAuditAvSignSample(entity,isAudit); - }catch(Exception e){ - e.printStackTrace(); - if(e instanceof MaatConvertException) { - logger.info("音视频标识样例配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,e.getMessage()); - }else { - logger.error("auditAvAudioSignSample failed",e); - addMessage(redirectAttributes,"audit_failed"); - } + AvSignSampleCfg entity = new AvSignSampleCfg(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = avCfgService.getAvSignSampleById(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + try { + avCfgService.audioAuditAvSignSample(entity,isAudit,false); + }catch(Exception e){ + e.printStackTrace(); + if(e instanceof MaatConvertException) { + logger.info("音视频标识样例配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes,e.getMessage()); + }else { + logger.error("auditAvAudioSignSample failed",e); + addMessage(redirectAttributes,"audit_failed"); } } - return "redirect:" + adminPath +"/ntc/av/sample/audioSignSampleList?functionId="+functionId; } + return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; + } //修改标志样例配置审核状态 /** * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 @@ -340,9 +340,11 @@ public class AvController extends BaseController { public String auditAvSignSample(Integer preset,AvSignSampleCfgModel cfg,Integer functionId,RedirectAttributes redirectAttributes){ //预置配置 try { - if(preset!=null&&1==preset){ - avCfgService.auditAvSignSample(); - addMessage(redirectAttributes,"audit_success"); + if(preset!=null&&1==preset){//预置信息需要在数据库中插入一条记录 + for (AvSignSampleCfg avSignSampleCfg : cfg.getCfgs()) { + avCfgService.saveOrUpdateAvSignSample(avSignSampleCfg); + } + addMessage(redirectAttributes,"save_success"); return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; } } catch (Exception e1) { @@ -352,15 +354,15 @@ public class AvController extends BaseController { addMessage(redirectAttributes,"request_service_failed"); }else { logger.error("auditAvSignSample failed",e1); - addMessage(redirectAttributes,"audit_failed"); + addMessage(redirectAttributes,"save_failed"); } } //修改下发配置 if(cfg != null && cfg.getCfgs() != null ){ for (AvSignSampleCfg avSignSampleCfg : cfg.getCfgs()) { - if(StringUtil.isEmpty(avSignSampleCfg.getIsValid())){ + /*if(StringUtil.isEmpty(avSignSampleCfg.getIsValid())){ avSignSampleCfg.setIsValid(0); - } + }*/ if(cfg.getAction()!=null){ avSignSampleCfg.setAction(cfg.getAction()); } @@ -368,7 +370,7 @@ public class AvController extends BaseController { // if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){ try { avCfgService.auditAvSignSample(avSignSampleCfg); - addMessage(redirectAttributes,"audit_success"); + addMessage(redirectAttributes,"save_success"); }catch(Exception e){ e.printStackTrace(); if(e instanceof MaatConvertException) { @@ -376,7 +378,7 @@ public class AvController extends BaseController { addMessage(redirectAttributes,"request_service_failed"); }else { logger.error("auditAvSignSample failed",e); - addMessage(redirectAttributes,"audit_failed"); + addMessage(redirectAttributes,"save_failed"); } } } diff --git a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml index 8ab908b38..061d500e6 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml @@ -516,6 +516,9 @@ update av_sign_sample_cfg is_valid = #{isValid,jdbcType=INTEGER}, + + is_audit = #{isAudit,jdbcType=INTEGER}, + service_id=#{serviceId,jdbcType=INTEGER}, 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 819d30360..c8028a891 100644 --- a/src/main/java/com/nis/web/service/configuration/AvCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvCfgService.java @@ -291,7 +291,7 @@ public class AvCfgService extends BaseService{ entity.setCreateTime(new Date()); //调用服务接口获取compileId Integer compileId = 0; - try { + /*try { List compileIds = ConfigServiceUtil.getId(1,1); if(!StringUtil.isEmpty(compileIds)){ compileId = compileIds.get(0); @@ -300,13 +300,13 @@ public class AvCfgService extends BaseService{ e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(":"+e.getMessage()); - } - if(compileId!=0){ + }*/ +// if(compileId!=0){ entity.setCompileId(compileId); avCfgDao.insertAvSignSample(entity); - }else{ + /*}else{ throw new MaatConvertException(""); - } + }*/ }else{ entity.setEditorId(UserUtils.getUser().getId()); @@ -318,7 +318,7 @@ public class AvCfgService extends BaseService{ //添加即时生效 entity.setIsValid(1); entity.setIsAudit(1); - audioAuditAvSignSample(entity,1); + audioAuditAvSignSample(entity,1,true); } public void updateAvFileSampleValid(Integer isAudit,Integer isValid,String ids){ String[] idArray = ids.split(","); @@ -375,18 +375,28 @@ public class AvCfgService extends BaseService{ } } - public void audioAuditAvSignSample(AvSignSampleCfg entity,Integer isAudit) throws MaatConvertException{ + public void audioAuditAvSignSample(AvSignSampleCfg entity,Integer isAudit,boolean init) throws MaatConvertException{ + entity.setAuditTime(new Date()); + entity.setAuditorId(UserUtils.getUser().getId()); avCfgDao.auditAvSignSample(entity); List list = new ArrayList(); if(isAudit==1){ - list.add(entity); - //调用服务接口下发配置数据 - String json=gsonToJson(list); - logger.info("文件样例下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); - logger.info("音视频标志样例配置下发响应信息:"+result.getMsg()); - + if(init){//预置配置时初始下发配置 + list.add(entity); + //调用服务接口下发配置数据 + String json=gsonToJson(list); + logger.info("文件样例下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + logger.info("音视频标志样例配置下发响应信息:"+result.getMsg()); + }else{ + list.add(entity); + String json=gsonToJson(list); + logger.info("标志状态变更:"+json); + //调用服务接口修改配置内容 + String result = ConfigServiceUtil.patch(json, 2); + logger.info("视频标志样状态变更响应信息:"+result); + } }else if(isAudit==3){ AvSignSampleCfg cfg = new AvSignSampleCfg(); cfg.setIsValid(0); @@ -399,78 +409,57 @@ public class AvCfgService extends BaseService{ //调用服务接口取消配置 ToMaatResult result = ConfigServiceUtil.put(json, 2); logger.info("音视频标志样例配置取消配置响应信息:"+result.getMsg()); - } - + } } //预置配置下发 - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void auditAvSignSample() throws MaatConvertException{ - try { - AvSignSampleCfg entity = new AvSignSampleCfg(); - List avSignSampleList = avCfgDao.getAvSignSampleList(entity); - if(avSignSampleList!=null&&avSignSampleList.size()>0){ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void auditAvSignSample() throws MaatConvertException{ + try { + AvSignSampleCfg entity = new AvSignSampleCfg(); + List avSignSampleList = avCfgDao.getAvSignSampleList(entity); + if(avSignSampleList!=null&&avSignSampleList.size()>0){ // avCfgDao.updateAvSignSampleValid(entity); // avCfgDao.auditAvSignSample(entity); // List list = new ArrayList(); // avSignSampleList.add(entity); - for (AvSignSampleCfg av : avSignSampleList) { - av.setAuditTime(new Date()); - av.setAuditorId(UserUtils.getUser().getId()); - if(av.getIsValid()!=null&&av.getIsValid()!=1){ - av.setIsValid(1); - } - avCfgDao.updateAvSignSampleValid(av); + for (AvSignSampleCfg av : avSignSampleList) { + av.setAuditTime(new Date()); + av.setAuditorId(UserUtils.getUser().getId()); + if(av.getIsValid()!=null&&av.getIsValid()!=1){ + av.setIsValid(1); } - //调用服务接口取消配置 - String json=gsonToJson(avSignSampleList); - logger.info("标志状态变更:"+json); - //调用服务接口取消配置 - ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); - logger.info("音视频标志样状态变更响应信息:"+result.getMsg()); - }else{ - logger.info("视频场景预置失败,数据为空"); - throw new MaatConvertException(""); + avCfgDao.updateAvSignSampleValid(av); } - } catch (Exception e) { - e.printStackTrace(); + //调用服务接口取消配置 + String json=gsonToJson(avSignSampleList); + logger.info("标志状态变更:"+json); + //调用服务接口取消配置 + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + logger.info("音视频标志样状态变更响应信息:"+result.getMsg()); + }else{ logger.info("视频场景预置失败,数据为空"); throw new MaatConvertException(""); } - + } catch (Exception e) { + e.printStackTrace(); + logger.info("视频场景预置失败,数据为空"); + throw new MaatConvertException(""); } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void auditAvSignSample(AvSignSampleCfg entity) throws Exception{ - List list = new ArrayList(); - entity.setAuditTime(new Date()); - entity.setDescription("0"); - list.add(entity); - try { + + } + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void auditAvSignSample(AvSignSampleCfg entity) throws Exception{ + List list = new ArrayList(); + entity.setEditTime(new Date()); + entity.setDescription("0"); + list.add(entity); + try { avCfgDao.updateAvSignSampleValid(entity); - -// avCfgDao.auditAvSignSample(entity); - //更新配置 - - if(entity.getIsValid()!=null&&entity.getIsValid()==Constants.VALID_YES){ - //调用服务接口取消配置 - String json=gsonToJson(list); - logger.info("标志状态变更:"+json); - //调用服务接口取消配置 - String result = ConfigServiceUtil.patch(json, 2); - logger.info("视频标志样状态变更响应信息:"+result); - } - if(entity.getIsValid()!=null&&entity.getIsValid()==Constants.VALID_NO){ - //调用服务接口取消配置 - String json=gsonToJson(list); - logger.info("标志状态变更:"+json); - //调用服务接口取消配置 - ToMaatResult result = ConfigServiceUtil.put(json, 2); - logger.info("视频标志样状态变更响应信息:"+result.getMsg()); - } - } catch (Exception e) { - e.printStackTrace(); - } - + } catch (Exception e) { + e.printStackTrace(); } + + } /*public void auditAvSignSample(AvSignSampleCfg entity,Integer isAudit) throws MaatConvertException{ avCfgDao.auditAvSignSample(entity); List list = new ArrayList(); diff --git a/src/main/webapp/WEB-INF/views/cfg/av/switchSignSample.jsp b/src/main/webapp/WEB-INF/views/cfg/av/switchSignSample.jsp index 2608e1f59..f2e12c7c3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/switchSignSample.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/switchSignSample.jsp @@ -60,10 +60,9 @@ $(function(){ -
-

- +

+

@@ -73,108 +72,148 @@ $(function(){
-
- - -
-
+
+ + + + + + + + + -
-
-
-
-
- -
-
-
-
-
- -
+ + + +
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ + + +
- +
-
- -
-
- <%-- --%> - + + + + + + - - <%--
-
- " - data-off-label="" - name="cfgs[${status.index }].isValid" - value="${_cfg.isValid }" - - checked - - /> -
-
--%> -
- - + +
+
+ + + +
+
+
+ +
+
+
+
+
+ + + + + + + +
- - + + + + +
+ + +
+
+ <%-- --%>