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 59a73d7b5..848286ace 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 @@ -18,7 +18,6 @@ import com.nis.domain.Page; import com.nis.domain.configuration.AvVoipAccountCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.AvVoipIpCfg; - import com.nis.util.StringUtil; import com.nis.web.controller.BaseController; @@ -34,23 +33,39 @@ public class AvContentController extends BaseController { //音视频VOIP配置新增界面 @RequestMapping(value = {"/voipForm"}) - public String voipFrom(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity){ + public String voipFrom(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo cfg){ if(!StringUtil.isEmpty(ids)){ - entity.setCfgId(Long.parseLong(ids)); - entity = avContentCfgService.getCfgIndexInfo(entity); + cfg.setCompileId(Integer.parseInt(ids)); + cfg = avContentCfgService.getCfgIndexInfo(cfg); }else{ List avVoipAccountCfgs=new ArrayList(); avVoipAccountCfgs.add(new AvVoipAccountCfg()); - entity.setVoipAccounts(avVoipAccountCfgs); + cfg.setVoipAccounts(avVoipAccountCfgs); List avVoipIpCfgs=new ArrayList(); avVoipIpCfgs.add(new AvVoipIpCfg()); - entity.setVoipIps(avVoipIpCfgs); + cfg.setVoipIps(avVoipIpCfgs); } - initFormCondition(model,entity); - model.addAttribute("_cfg", entity); + initFormCondition(model,cfg); + model.addAttribute("_cfg", cfg); return "/cfg/av/voip/voipForm"; } + + + //保存voip信息 + @RequestMapping(value = {"/saveVoip"}) + public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){ + try{ + avContentCfgService.saveOrUpdateAvVoip(cfg); + }catch(Exception e){ + logger.error("voip信息保存失败",e); + e.printStackTrace(); + addMessage(model,"save_voip_failed"); + } + + return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+cfg.getFunctionId(); + } + //视频文本VOIP配置列表 @RequestMapping(value = {"/voipList"}) public String voipCfgList(@ModelAttribute("cfg")CfgIndexInfo entity,Model model,HttpServletRequest request,HttpServletResponse response){ 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 b0b3c2354..785da44e2 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java @@ -21,4 +21,7 @@ public interface AvContentCfgDao extends CrudDao{ public List findVoipIpCfgList(@Param("cfg")CfgIndexInfo entity); public List findVoipAccountCfgList(@Param("cfg")CfgIndexInfo entity); public CfgIndexInfo getCfgIndexInfo(@Param("cfg")CfgIndexInfo entity); + public void insertCfgIndexInfo(@Param("cfg")CfgIndexInfo entity); + public void insertAvVoipIp(@Param("cfg")CfgIndexInfo entity); + public void insertAvVoipAccount(@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 b1448f437..0b63bb9ce 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -109,6 +109,7 @@ 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 + - select from av_voip_ip_cfg a @@ -248,9 +250,8 @@ - - - select from av_voip_account_cfg a @@ -261,6 +262,7 @@ + - + + + + SELECT LAST_INSERT_ID() + + insert into cfg_index_info( + CFG_DESC, + ACTION, + IS_VALID, + IS_AUDIT, + CREATOR_ID, + CREATE_TIME, + EDITOR_ID, + EDIT_TIME, + AUDITOR_ID, + AUDIT_TIME, + SERVICE_ID, + REQUEST_ID, + COMPILE_ID, + IS_AREA_EFFECTIVE, + CLASSIFY, + ATTRIBUTE, + LABLE, + AREA_EFFECTIVE_IDS, + function_id + )values ( + #{cfg.cfgDesc,jdbcType=VARCHAR}, + #{cfg.action,jdbcType=INTEGER}, + 0, + 0, + #{cfg.creatorId,jdbcType=INTEGER}, + #{cfg.createTime,jdbcType=TIMESTAMP}, + #{cfg.editorId,jdbcType=INTEGER}, + #{cfg.editTime,jdbcType=TIMESTAMP}, + #{cfg.auditorId,jdbcType=INTEGER}, + #{cfg.auditTime,jdbcType=TIMESTAMP}, + #{cfg.serviceId,jdbcType=INTEGER}, + #{cfg.requestId,jdbcType=INTEGER}, + #{cfg.compileId,jdbcType=INTEGER}, + #{cfg.isAreaEffective,jdbcType=INTEGER}, + #{cfg.classify,jdbcType=VARCHAR}, + #{cfg.attribute,jdbcType=VARCHAR}, + #{cfg.lable,jdbcType=VARCHAR}, + #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + #{cfg.functionId,jdbcType=INTEGER} + ) + + + + + SELECT LAST_INSERT_ID() + + insert into av_voip_ip_cfg ( + CFG_DESC, + ACTION, + IS_VALID, + IS_AUDIT, + CREATOR_ID, + CREATE_TIME, + EDITOR_ID, + EDIT_TIME, + AUDITOR_ID, + AUDIT_TIME, + SERVICE_ID, + REQUEST_ID, + COMPILE_ID, + IS_AREA_EFFECTIVE, + CLASSIFY, + ATTRIBUTE, + LABLE, + AREA_EFFECTIVE_IDS, + function_id, + ip_type, + src_ip_address, + ip_pattern, + port_pattern, + src_port, + protocol, + protocol_id, + direction, + dest_port, + dest_ip_address, + cfg_type, + cfg_region_code + )values ( + #{cfg.cfgDesc,jdbcType=VARCHAR}, + #{cfg.action,jdbcType=INTEGER}, + 0, + 0, + #{cfg.creatorId,jdbcType=INTEGER}, + #{cfg.createTime,jdbcType=TIMESTAMP}, + #{cfg.editorId,jdbcType=INTEGER}, + #{cfg.editTime,jdbcType=TIMESTAMP}, + #{cfg.auditorId,jdbcType=INTEGER}, + #{cfg.auditTime,jdbcType=TIMESTAMP}, + #{cfg.serviceId,jdbcType=INTEGER}, + #{cfg.requestId,jdbcType=INTEGER}, + #{cfg.compileId,jdbcType=INTEGER}, + #{cfg.isAreaEffective,jdbcType=INTEGER}, + #{cfg.classify,jdbcType=VARCHAR}, + #{cfg.attribute,jdbcType=VARCHAR}, + #{cfg.lable,jdbcType=VARCHAR}, + #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + #{cfg.functionId,jdbcType=INTEGER}, + #{cfg.voipIp.ipType,jdbcType=INTEGER}, + #{cfg.voipIp.srcIpAddress,jdbcType=VARCHAR}, + #{cfg.voipIp.ipPattern,jdbcType=INTEGER}, + #{cfg.voipIp.portPattern,jdbcType=INTEGER}, + #{cfg.voipIp.srcPort,jdbcType=VARCHAR}, + #{cfg.voipIp.protocol,jdbcType=INTEGER}, + #{cfg.voipIp.protocolId,jdbcType=INTEGER}, + #{cfg.voipIp.direction,jdbcType=INTEGER}, + #{cfg.voipIp.destPort,jdbcType=VARCHAR}, + #{cfg.voipIp.destIpAddress,jdbcType=VARCHAR}, + #{cfg.voipIp.cfgType,jdbcType=VARCHAR}, + #{cfg.voipIp.cfgRegionCode,jdbcType=INTEGER} + ) + + + + + SELECT LAST_INSERT_ID() + + insert into av_voip_account_cfg ( + CFG_DESC, + ACTION, + IS_VALID, + IS_AUDIT, + CREATOR_ID, + CREATE_TIME, + EDITOR_ID, + EDIT_TIME, + AUDITOR_ID, + AUDIT_TIME, + SERVICE_ID, + REQUEST_ID, + COMPILE_ID, + IS_AREA_EFFECTIVE, + CLASSIFY, + ATTRIBUTE, + LABLE, + AREA_EFFECTIVE_IDS, + function_id, + district, + cfg_keywords, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin + )values ( + #{cfg.cfgDesc,jdbcType=VARCHAR}, + #{cfg.action,jdbcType=INTEGER}, + 0, + 0, + #{cfg.creatorId,jdbcType=INTEGER}, + #{cfg.createTime,jdbcType=TIMESTAMP}, + #{cfg.editorId,jdbcType=INTEGER}, + #{cfg.editTime,jdbcType=TIMESTAMP}, + #{cfg.auditorId,jdbcType=INTEGER}, + #{cfg.auditTime,jdbcType=TIMESTAMP}, + #{cfg.serviceId,jdbcType=INTEGER}, + #{cfg.requestId,jdbcType=INTEGER}, + #{cfg.compileId,jdbcType=INTEGER}, + #{cfg.isAreaEffective,jdbcType=INTEGER}, + #{cfg.classify,jdbcType=VARCHAR}, + #{cfg.attribute,jdbcType=VARCHAR}, + #{cfg.lable,jdbcType=VARCHAR}, + #{cfg.areaEffectiveIds,jdbcType=VARCHAR}, + #{cfg.functionId,jdbcType=INTEGER}, + #{cfg.voipAccount.district,jdbcType=VARCHAR}, + #{cfg.voipAccount.cfgKeywords,jdbcType=VARCHAR}, + #{cfg.voipAccount.cfgType,jdbcType=VARCHAR}, + #{cfg.voipAccount.cfgRegionCode,jdbcType=INTEGER}, + #{cfg.voipAccount.exprType,jdbcType=INTEGER}, + #{cfg.voipAccount.matchMethod,jdbcType=INTEGER}, + #{cfg.voipAccount.isHexbin,jdbcType=INTEGER} + ) + \ No newline at end of file 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 8b16a3e3a..098d64fc2 100644 --- a/src/main/java/com/nis/web/service/configuration/AvCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvCfgService.java @@ -73,7 +73,7 @@ public class AvCfgService extends BaseService{ //调用服务接口获取compileId String result = ""; try { - result = ConfigServiceUtil.getId(1,1); + result ="1";// ConfigServiceUtil.getId(1,1); } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); @@ -101,7 +101,7 @@ public class AvCfgService extends BaseService{ //调用服务接口获取compileId String result = ""; try { - result = ConfigServiceUtil.getId(1,1); + result ="1";// ConfigServiceUtil.getId(1,1); } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); 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 998ee8c71..4e9848fac 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -10,6 +10,7 @@ import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -78,8 +79,11 @@ public class AvContentCfgService extends BaseService{ */ public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) { CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity); - cfg.setVoipAccounts(getVoipAccountCfgList(entity)); - cfg.setVoipIps(getVoipIpCfgList(entity)); + List voipAccounts=getVoipAccountCfgList(entity); + List voipIps=getVoipIpCfgList(entity); + getVoipIpCfgList(entity); + cfg.setVoipAccounts(voipAccounts); + cfg.setVoipIps(voipIps); return cfg; } @@ -142,4 +146,54 @@ public class AvContentCfgService extends BaseService{ }*/ } + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveOrUpdateAvVoip(CfgIndexInfo entity){ + Date createTime=new Date(); + //新增 + if(entity.getCfgId()==null){ + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + //调用服务接口获取compileId + List compileIds = new ArrayList(); + try { + //TODO 后期修改为动态获取 + //compileIds = ConfigServiceUtil.getId(1,1); + compileIds.add((int)Math.floor(Math.random()*1000000+1)); + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){ + entity.setCompileId(compileIds.get(0)); + //保存avVoipIp + if(entity.getVoipIps() != null && entity.getVoipIps().size() > 0){ + for (AvVoipIpCfg voipIp : entity.getVoipIps()) { + entity.setVoipIp(voipIp); + avContentCfgDao.insertAvVoipIp(entity); + } + } + //保存avVoipAccount + if(entity.getVoipAccounts() != null && entity.getVoipAccounts().size() > 0){ + for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) { + entity.setVoipAccount(voipAccount); + avContentCfgDao.insertAvVoipAccount(entity); + } + } + //保存cfgIndexInfo + avContentCfgDao.insertCfgIndexInfo(entity); + }else{ + throw new MaatConvertException(""); + } + + //修改 + }else{ + //entity.setEditorId(UserUtils.getUser().getId()); + //entity.setEditTime(new Date()); + //entity.setIsValid(0); + //entity.setIsAudit(0); + //avCfgDao.updateAvFileSample(entity); + } + } + } diff --git a/src/main/java/com/nis/web/test/MaatCfgConverTest.java b/src/main/java/com/nis/web/test/MaatCfgConverTest.java index 7c4be0abc..b020e680d 100644 --- a/src/main/java/com/nis/web/test/MaatCfgConverTest.java +++ b/src/main/java/com/nis/web/test/MaatCfgConverTest.java @@ -124,12 +124,12 @@ public class MaatCfgConverTest { List list2 = new ArrayList(); complex.setAction(1); complex.setDistrict("UA"); - complex.setKeywords("测试1"); + complex.setCfgKeywords("测试1"); list2.add(complex); str = new BaseStringCfg(); complex.setAction(1); complex.setDistrict("cookie"); - complex.setKeywords("测试2"); + complex.setCfgKeywords("测试2"); list2.add(complex); if(list2.size()>0){ groupId++; diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 4b21cabba..278d64ddf 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -559,4 +559,7 @@ request_error=\u8BF7\u6C42\u9519\u8BEF av_voip_ip_title=VoIP IP av_voip_account_title=VoIP\u8D26\u53F7 ip_pattern=IP \u683C\u5F0F -port_pattern=\u7AEF\u53E3\u683C\u5F0F \ No newline at end of file +port_pattern=\u7AEF\u53E3\u683C\u5F0F +port_mask=port Mask +ip_range=IP Range +ip_subnet=Subnet \ No newline at end of file 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 b8e373a57..f5e7a82cd 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 @@ -54,6 +54,7 @@ $(function(){ $(".action").on("change",function(){ $("#serviceId").val($(this).attr("serviceId")); }); + $("#serviceId").val($(".action").attr("serviceId")); $("#cfgFrom").validate({ errorPlacement: function(error,element){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); @@ -68,19 +69,23 @@ $(function(){ $("span[title='add']").on("click",function(){ $(".voipIp0").removeClass("hidden"); }); - + $(".action").on("change",function(){ + $("#serviceId").val($(this).attr("serviceId")); + }); }); //业务窗口打开 var addContent=function(obj,contentClassName){ $("."+contentClassName+"0").removeClass("hidden").removeClass("disabled"); + $("."+contentClassName).find("input,select").attr("disabled",""); $(obj).addClass("hidden"); } //业务窗口关闭 var delContent=function(contentClassName,addBtnClassName){ - $("."+contentClassName).addClass("hidden").addClass("disabled");; + $("."+contentClassName).addClass("hidden"); + $("."+contentClassName).find("input,select").attr("disabled","true"); $("."+addBtnClassName).removeClass("hidden"); } @@ -90,10 +95,6 @@ var delContent=function(contentClassName,addBtnClassName){
- <%--

- -

--%> -
@@ -106,52 +107,55 @@ var delContent=function(contentClassName,addBtnClassName){
-
+ - - - - - - -
+
-
-
- -
- -
-
-
-
-
- -
- - - -
-
-
-
-
+
+
+ +
+ +
+
+
+
+
+ +
+ + + +
+
+
+
+
+ -

+

-
+
+ + + + + + + +
@@ -162,12 +166,12 @@ var delContent=function(contentClassName,addBtnClassName){
-
-
+
@@ -176,110 +180,141 @@ var delContent=function(contentClassName,addBtnClassName){
- + - +
-
+
- +
-
+
- "; @@ -147,13 +150,10 @@ html+=""; html+=""; html+="
"; @@ -639,7 +639,7 @@ - + ${indexCfg.cfgDesc }