diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java index 848286ace..a923432e3 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java @@ -54,9 +54,12 @@ public class AvContentController extends BaseController { //保存voip信息 @RequestMapping(value = {"/saveVoip"}) - public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){ + public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response, + @ModelAttribute("cfg")CfgIndexInfo cfg, + @ModelAttribute("voipIpIds")String voipIpIds, + @ModelAttribute("voipAccountIds")String voipAccountIds){ try{ - avContentCfgService.saveOrUpdateAvVoip(cfg); + avContentCfgService.saveOrUpdateAvVoip(cfg,voipIpIds,voipAccountIds); }catch(Exception e){ logger.error("voip信息保存失败",e); e.printStackTrace(); @@ -75,7 +78,7 @@ public class AvContentController extends BaseController { if(entity.getVoipAccount()== null){ entity.setVoipAccount(new AvVoipAccountCfg()); } - Page page = avContentCfgService.findPage(new Page(request, response,"a"), entity); + Page page = avContentCfgService.findPage(new Page(request, response,"r"), entity); model.addAttribute("page", page); initPageCondition(model); return "/cfg/av/voip/voipList"; @@ -83,9 +86,9 @@ public class AvContentController extends BaseController { //修改VOIP例配置状态 - @RequestMapping(value = {"/updateAvVoip"}) + @RequestMapping(value = {"/updateAvVoipValid"}) public String updateVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){ - //avCfgService.updateAvFileSampleValid(isAudit,isValid,ids); + avContentCfgService.updateAvVoipValid(isAudit,isValid,ids,functionId); return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+functionId; } //修改VOIP配置审核状态 diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java index 785da44e2..fd928a8e1 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java @@ -24,4 +24,7 @@ public interface AvContentCfgDao extends CrudDao{ public void insertCfgIndexInfo(@Param("cfg")CfgIndexInfo entity); public void insertAvVoipIp(@Param("cfg")CfgIndexInfo entity); public void insertAvVoipAccount(@Param("cfg")CfgIndexInfo entity); + public void updateCfgIndexInfo(@Param("cfg")CfgIndexInfo entity); + public void updateAvVoipIp(@Param("cfg")CfgIndexInfo entity); + public void updateAvVoipAccount(@Param("cfg")CfgIndexInfo entity); } diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml index 0b63bb9ce..4fc09c120 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -90,24 +90,24 @@ - a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, - a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, - a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, - a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id + r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, + r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, + r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, + r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id - a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port - ,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address - ,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id - ,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id, - a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable - ,a.area_effective_ids,a.function_id,a.cfg_region_code + r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port + ,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address + ,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id + ,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id, + r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable + ,r.area_effective_ids,r.function_id,r.cfg_region_code - a.cfg_id,a.cfg_desc,a.district,a.cfg_keywords,a.cfg_type, - a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id, - a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, - a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code + r.cfg_id,r.cfg_desc,r.district,r.cfg_keywords,r.cfg_type, + r.action,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time, r.auditor_id, + r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable, + r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code @@ -243,22 +243,24 @@ @@ -274,6 +276,7 @@ and a.compile_Id=#{cfg.compileId,jdbcType=INTEGER} + and a.is_valid != -1 @@ -455,4 +458,274 @@ #{cfg.voipAccount.isHexbin,jdbcType=INTEGER} ) + + + update cfg_index_info + + + + cfg_desc = #{cfg.cfgDesc,jdbcType=VARCHAR}, + + + action = #{cfg.action,jdbcType=INTEGER}, + + + is_valid = #{cfg.isValid,jdbcType=INTEGER}, + + + is_audit = #{cfg.isAudit,jdbcType=INTEGER}, + + + editor_id = #{cfg.editorId,jdbcType=INTEGER}, + + + edit_time = #{cfg.editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{cfg.auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{cfg.auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{cfg.compileId,jdbcType=TIMESTAMP}, + + + request_id = #{cfg.requestId,jdbcType=INTEGER}, + + + is_area_effective = #{cfg.isAreaEffective,jdbcType=INTEGER}, + + + classify = #{cfg.classify,jdbcType=VARCHAR}, + + + attribute = #{cfg.attribute,jdbcType=VARCHAR}, + + + lable = #{cfg.lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{cfg.functionId,jdbcType=INTEGER}, + + + service_id = #{cfg.serviceId,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfg.cfgId,jdbcType=INTEGER} + + + and compile_id = #{cfg.compileId,jdbcType=INTEGER} + + + and function_id = #{cfg.functionId,jdbcType=INTEGER} + + + + + + update av_voip_ip_cfg + + + + cfg_desc = #{cfg.cfgDesc,jdbcType=VARCHAR}, + + + action = #{cfg.action,jdbcType=INTEGER}, + + + is_valid = #{cfg.isValid,jdbcType=INTEGER}, + + + is_audit = #{cfg.isAudit,jdbcType=INTEGER}, + + + editor_id = #{cfg.editorId,jdbcType=INTEGER}, + + + edit_time = #{cfg.editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{cfg.auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{cfg.auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{cfg.compileId,jdbcType=TIMESTAMP}, + + + request_id = #{cfg.requestId,jdbcType=INTEGER}, + + + is_area_effective = #{cfg.isAreaEffective,jdbcType=INTEGER}, + + + classify = #{cfg.classify,jdbcType=VARCHAR}, + + + attribute = #{cfg.attribute,jdbcType=VARCHAR}, + + + lable = #{cfg.lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{cfg.functionId,jdbcType=INTEGER}, + + + service_id = #{cfg.serviceId,jdbcType=INTEGER}, + + + ip_type = #{cfg.voipIp.ipType,jdbcType=INTEGER}, + + + src_ip_address = #{cfg.voipIp.srcIpAddress,jdbcType=VARCHAR}, + + + ip_pattern = #{cfg.voipIp.ipPattern,jdbcType=INTEGER}, + + + port_pattern = #{cfg.voipIp.portPattern,jdbcType=INTEGER}, + + + src_port = #{cfg.voipIp.srcPort,jdbcType=VARCHAR}, + + + protocol = #{cfg.voipIp.protocol,jdbcType=INTEGER}, + + + protocol_id = #{cfg.voipIp.protocolId,jdbcType=INTEGER}, + + + direction = #{cfg.voipIp.direction,jdbcType=INTEGER}, + + + dest_port = #{cfg.voipIp.destPort,jdbcType=VARCHAR}, + + + dest_ip_address = #{cfg.voipIp.destIpAddress,jdbcType=VARCHAR}, + + + cfg_type = #{cfg.voipIp.cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{cfg.voipIp.cfgRegionCode,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfg.voipIp.cfgId,jdbcType=INTEGER} + + + and compile_id = #{cfg.compileId,jdbcType=INTEGER} + + + and function_id = #{cfg.functionId,jdbcType=INTEGER} + + + + + + update av_voip_account_cfg + + + + cfg_desc = #{cfg.cfgDesc,jdbcType=VARCHAR}, + + + action = #{cfg.action,jdbcType=INTEGER}, + + + is_valid = #{cfg.isValid,jdbcType=INTEGER}, + + + is_audit = #{cfg.isAudit,jdbcType=INTEGER}, + + + editor_id = #{cfg.editorId,jdbcType=INTEGER}, + + + edit_time = #{cfg.editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{cfg.auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{cfg.auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{cfg.compileId,jdbcType=TIMESTAMP}, + + + request_id = #{cfg.requestId,jdbcType=INTEGER}, + + + is_area_effective = #{cfg.isAreaEffective,jdbcType=INTEGER}, + + + classify = #{cfg.classify,jdbcType=VARCHAR}, + + + attribute = #{cfg.attribute,jdbcType=VARCHAR}, + + + lable = #{cfg.lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{cfg.functionId,jdbcType=INTEGER}, + + + service_id = #{cfg.serviceId,jdbcType=INTEGER}, + + + district = #{cfg.voipAccount.district,jdbcType=VARCHAR}, + + + cfg_keywords = #{cfg.voipAccount.cfgKeywords,jdbcType=VARCHAR}, + + + cfg_type = #{cfg.voipAccount.cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{cfg.voipAccount.cfgRegionCode,jdbcType=INTEGER}, + + + expr_type = #{cfg.voipAccount.exprType,jdbcType=INTEGER}, + + + match_method = #{cfg.voipAccount.matchMethod,jdbcType=INTEGER}, + + + is_hexbin = #{cfg.voipAccount.isHexbin,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfg.voipAccount.cfgId,jdbcType=INTEGER} + + + and compile_id = #{cfg.compileId,jdbcType=INTEGER} + + + and function_id = #{cfg.functionId,jdbcType=INTEGER} + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java index 5ea6c8196..b0710893c 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -16,12 +16,14 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.nis.domain.Page; import com.nis.domain.configuration.AvFileSampleCfg; +import com.nis.domain.configuration.AvSignSampleCfg; import com.nis.domain.configuration.AvVoipAccountCfg; import com.nis.domain.configuration.AvVoipIpCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.util.FileUtils; +import com.nis.util.StringUtil; import com.nis.web.dao.FunctionRegionDictDao; import com.nis.web.dao.FunctionServiceDictDao; import com.nis.web.dao.configuration.AvCfgDao; @@ -50,7 +52,7 @@ public class AvContentCfgService extends BaseService{ * @return */ public Page findPage(Page page, CfgIndexInfo entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); entity.setPage(page); List list=avContentCfgDao.findVoipList(entity); page.setList(list); @@ -155,12 +157,14 @@ public class AvContentCfgService extends BaseService{ } @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAvVoip(CfgIndexInfo entity){ + public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds){ Date createTime=new Date(); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); entity.setCreateTime(createTime); + entity.setIsValid(0); + entity.setIsAudit(0); //调用服务接口获取compileId List compileIds = new ArrayList(); try { @@ -196,12 +200,110 @@ public class AvContentCfgService extends BaseService{ //修改 }else{ - //entity.setEditorId(UserUtils.getUser().getId()); - //entity.setEditTime(new Date()); - //entity.setIsValid(0); - //entity.setIsAudit(0); - //avCfgDao.updateAvFileSample(entity); + Date editTime=new Date(); + entity.setIsValid(0); + entity.setIsAudit(0); + + voipIpIds=!StringUtil.isEmpty(voipIpIds)? voipIpIds+",":""; + voipAccountIds=!StringUtil.isEmpty(voipAccountIds)? voipAccountIds+",":""; + + //判断voip信息为新增还是修改,清楚voipIpIds修改的voipId记录,剩下即为需要删除的voipId + if(!StringUtil.isEmpty(entity.getVoipIps())){ + for (AvVoipIpCfg voipIp : entity.getVoipIps()) { + if(!StringUtil.isEmpty(voipIp.getCfgId())){ + if(voipIpIds.contains(","+voipIp.getCfgId()+",")){ + voipIpIds=voipIpIds.replace(voipIp.getCfgId()+",", ""); + } + //修改 + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + entity.setVoipIp(voipIp); + avContentCfgDao.updateAvVoipIp(entity); + }else{ + //新增 + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + entity.setVoipIp(voipIp); + avContentCfgDao.insertAvVoipIp(entity); + } + } + } + + if(!StringUtil.isEmpty(entity.getVoipAccounts())){ + for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) { + if(!StringUtil.isEmpty(voipAccount.getCfgId())){ + if(voipAccountIds.contains(","+voipAccount.getCfgId()+",")){ + voipAccountIds=voipAccountIds.replace(voipAccount.getCfgId()+",", ""); + } + //修改 + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + entity.setVoipAccount(voipAccount); + avContentCfgDao.updateAvVoipAccount(entity); + }else{ + //新增 + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + entity.setVoipAccount(voipAccount); + avContentCfgDao.insertAvVoipAccount(entity); + } + } + } + //将删除后的ACCOUNT置为删除,1,1,1, + if(!StringUtil.isEmpty(voipAccountIds.replaceAll(",", ""))){ + voipAccountIds=voipAccountIds.substring(1,voipAccountIds.length()); + for (String cfgId : voipAccountIds.split(",")) { + CfgIndexInfo cfg=new CfgIndexInfo(); + cfg.setEditorId(UserUtils.getUser().getId()); + cfg.setEditTime(editTime); + cfg.setIsValid(-1); + AvVoipAccountCfg voipAccountCfg=new AvVoipAccountCfg(); + voipAccountCfg.setCfgId(Long.parseLong(cfgId)); + cfg.setVoipAccount(voipAccountCfg); + avContentCfgDao.updateAvVoipAccount(cfg); + } + } + + //将删除后的IP置为删除 [is_valid=-1] + if(!StringUtil.isEmpty(voipIpIds.replaceAll(",", ""))){ + voipIpIds=voipIpIds.substring(1,voipIpIds.length()); + for (String cfgId : voipIpIds.split(",")) { + CfgIndexInfo cfg=new CfgIndexInfo(); + cfg.setEditorId(UserUtils.getUser().getId()); + cfg.setEditTime(editTime); + cfg.setIsValid(-1); + AvVoipIpCfg voipIpCfg=new AvVoipIpCfg(); + voipIpCfg.setCfgId(Long.parseLong(cfgId)); + cfg.setVoipIp(voipIpCfg); + avContentCfgDao.updateAvVoipIp(cfg); + } + } + //修改 + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + avContentCfgDao.updateCfgIndexInfo(entity); + } + } + /** + * + * @param isAudit + * @param isValid + * @param ids compileIds + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void updateAvVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){ + CfgIndexInfo entity = new CfgIndexInfo(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity.setCompileId(Integer.parseInt(id)); + entity.setFunctionId(functionId); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + avContentCfgDao.updateAvVoipIp(entity); + avContentCfgDao.updateAvVoipAccount(entity); + avContentCfgDao.updateCfgIndexInfo(entity); } } - } diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp index 3d3c6de08..79e419b4a 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp @@ -72,6 +72,11 @@ $(function(){ /* $("span[title='add']").on("click",function(){ $(".voipIp0").removeClass("hidden"); }); */ + $(".disabled").each(function(){ + $(this).find("input,select,div,button").each(function(){ + $(this).attr("disabled","true"); + }); + }); }); @@ -81,6 +86,9 @@ var addContent=function(obj,contentClassName){ $("."+contentClassName+"0").find("input,select").each(function(){ $(this).removeAttr("disabled"); }); + $("."+contentClassName+"0").find(".disabled").each(function(){ + $(this).removeClass("disabled"); + }); $(obj).addClass("hidden"); } @@ -90,6 +98,7 @@ var delContent=function(contentClassName,addBtnClassName){ $("."+contentClassName).find("input,select").each(function(){ $(this).attr("disabled","true"); }); + $("."+addBtnClassName).removeClass("hidden"); } @@ -116,6 +125,20 @@ var delContent=function(contentClassName,addBtnClassName){ + + + + + + + + + + + + + +
@@ -155,7 +178,8 @@ var delContent=function(contentClassName,addBtnClassName){ - + +