From abca1b273c4a78ff7bdc8ac2ebf92eb0e920ad5f Mon Sep 17 00:00:00 2001 From: wangxin Date: Wed, 22 Aug 2018 19:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E5=AE=9A=E6=9C=8D=E5=8A=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=9A=E5=8A=A1=E7=B1=BB=E5=88=AB=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E5=8D=8F=E8=AE=AE=EF=BC=8Capp=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E4=BB=A5=E5=8F=8Aapp=E7=89=B9=E5=BE=81=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=97=B6=E5=B1=95=E7=A4=BA=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=B1=BB=E5=88=AB=E7=9A=84=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/specific/SpecificServiceCfg.java | 7 ++ .../SpecificServiceCfgController.java | 79 +++++++++++++++-- .../dao/specific/SpecificServiceCfgDao.xml | 13 ++- .../specific/SpecificServiceCfgService.java | 4 - ...update_specific_service_cfg_add_column.sql | 1 + .../webapp/WEB-INF/tags/sys/treeselect.tag | 45 +++++----- .../views/cfg/app/appPolicyCfgList.jsp | 2 +- .../views/specific/specificServiceCfgForm.jsp | 86 ++++++++++++++++++- .../views/specific/specificServiceCfgList.jsp | 58 ++++++++++--- 9 files changed, 249 insertions(+), 46 deletions(-) create mode 100644 src/main/resources/sql/update_specific_service_cfg_add_column.sql diff --git a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java index 57c095820..703842e88 100644 --- a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java +++ b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java @@ -30,7 +30,14 @@ public class SpecificServiceCfg extends BaseEntity{ private Date beginDate; // 开始日期 private Date endDate; // 结束日期 private String showSequence; //显示序号 + private String businessType; + public String getBusinessType() { + return businessType; + } + public void setBusinessType(String businessType) { + this.businessType = businessType; + } public Integer getParentType() { return parentType; } diff --git a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java index 769e4390a..5c3d29c69 100644 --- a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java +++ b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java @@ -1,7 +1,9 @@ package com.nis.web.controller.specific; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -18,7 +20,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.nis.domain.Page; +import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.util.DictUtils; import com.nis.util.StringUtils; import com.nis.web.controller.BaseController; @@ -198,9 +202,29 @@ public class SpecificServiceCfgController extends BaseController { map2.put("id", 0); map2.put("pId", 0); map2.put("type",0); + map2.put("business",-2); map2.put("name","root_node"); //map2.put("placeholder","0"); mapList.add(map2); + Properties props=this.getMsgProp(); + List businessTypeList=Lists.newArrayList(); + if(cfgType==1) { + businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE"); + }else if(cfgType==3) { + businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE"); + } + List> businessList = Lists.newArrayList(); + for(SysDataDictionaryItem dict:businessTypeList) { + Map map = Maps.newHashMap(); + map.put("id", dict.getItemCode()); + map.put("pId", 0); + map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue())); + map.put("serviceType",cfgType); + map.put("businessType",-1); + map.put("nodes", new ArrayList>()); + businessList.add(map); + } + mapList.addAll(businessList); List list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),""); for (int i=0; i map = Maps.newHashMap(); - map.put("id", specificServiceCfg.getSpecServiceId()); - map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); - map.put("name",specificServiceCfg.getSpecServiceName()); - map.put("type",specificServiceCfg.getCfgType()); - mapList.add(map); + if(businessList.size()>0) { + for(Map business:businessList) { + if(String.valueOf(business.get("id")).equals(specificServiceCfg.getBusinessType())) { + Map map = Maps.newHashMap(); + map.put("id", specificServiceCfg.getSpecServiceId()); + map.put("pId", business.get("id")); + map.put("name",specificServiceCfg.getSpecServiceName()); + map.put("serviceType",specificServiceCfg.getCfgType()); + map.put("businessType",specificServiceCfg.getBusinessType()); + mapList.add(map); + break; + } + } + }else { + Map map = Maps.newHashMap(); + map.put("id", specificServiceCfg.getSpecServiceId()); + map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); + map.put("name",specificServiceCfg.getSpecServiceName()); + map.put("serviceType",specificServiceCfg.getCfgType()); + mapList.add(map); + } } } + +// List list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),""); +// +// for (int i=0; i business:businessList) { +// if(String.valueOf(business.get("id")).equals(specificServiceCfg.getBusinessType())) { +// Map map = Maps.newHashMap(); +// map.put("id", specificServiceCfg.getSpecServiceId()); +// map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); +// map.put("name",specificServiceCfg.getSpecServiceName()); +// map.put("type",specificServiceCfg.getCfgType()); +// map.put("business",specificServiceCfg.getBusinessType()); +// ((List>)business.get("nodes")).add(map); +// break; +// } +// } +// +// +// } +// } +// map2.put("nodes", businessList); return mapList; } /** diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml index a48e94fbd..2e4e61200 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml @@ -12,6 +12,7 @@ + @@ -28,7 +29,8 @@ s.parent_id AS "parent.specServiceId", s.is_leaf AS isLeaf, s.group_id AS groupId, - s.cfg_type AS cfgType + s.cfg_type AS cfgType, + s.business_type AS businessType @@ -73,6 +75,9 @@ AND cfg_type =#{cfgType,jdbcType=INTEGER} + + AND business_type =#{businessType,jdbcType=VARCHAR} + AND s.op_time >= #{beginDate,jdbcType=TIMESTAMP} @@ -138,6 +143,9 @@ AND is_leaf = #{specificServiceCfg.isLeaf} + + AND business_type =#{specificServiceCfg.businessType} + AND op_time > #{specificServiceCfg.beginDate} @@ -171,7 +179,8 @@ s.parent_id = #{parent.specServiceId}, s.is_leaf = #{isLeaf}, s.group_id = #{groupId}, - s.cfg_type = #{cfgType} + s.cfg_type = #{cfgType}, + s.business_type = #{businessType} WHERE s.spec_service_id = #{specServiceId} diff --git a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java index cc667f328..7d2815985 100644 --- a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java +++ b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java @@ -3,8 +3,6 @@ package com.nis.web.service.specific; import java.util.Date; import java.util.List; - - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -13,9 +11,7 @@ import com.beust.jcommander.internal.Lists; import com.nis.domain.Page; import com.nis.domain.specific.ConfigGroupInfo; import com.nis.domain.specific.SpecificServiceCfg; -import com.nis.main.ConvertTool; import com.nis.util.ConfigServiceUtil; -import com.nis.util.StringUtil; import com.nis.web.dao.specific.SpecificServiceCfgDao; import com.nis.web.service.BaseService; diff --git a/src/main/resources/sql/update_specific_service_cfg_add_column.sql b/src/main/resources/sql/update_specific_service_cfg_add_column.sql new file mode 100644 index 000000000..310e78991 --- /dev/null +++ b/src/main/resources/sql/update_specific_service_cfg_add_column.sql @@ -0,0 +1 @@ +ALTER TABLE specific_service_cfg ADD COLUMN business_type VARCHAR(10) NULL COMMENT '业务分类'; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/tags/sys/treeselect.tag b/src/main/webapp/WEB-INF/tags/sys/treeselect.tag index 294d2d9d5..81086544f 100644 --- a/src/main/webapp/WEB-INF/tags/sys/treeselect.tag +++ b/src/main/webapp/WEB-INF/tags/sys/treeselect.tag @@ -55,30 +55,43 @@ }else{ nodes = tree.getSelectedNodes(); } - for(var i=0; i + //wx提示,c:if标签前加了//注释,c:if标签的判断条件仍会生效 + for(var i=0; i if (nodes[i].isParent && "${checkedPS}"!=''){ continue; // 如果为复选框选择,并且父子节点有关联,则过滤掉父节点 - }// + }// + // if (nodes[i].level == 0){ top.$.jBox.tip("("+nodes[i].name+")"); return false; - }// + }// + // if (nodes[i].isParent){ top.$.jBox.tip("("+nodes[i].name+")"); return false; - }// + } + //wx: 带有business属性的节点特殊处理 + if(nodes[i].businessType&&nodes[i].businessType==-1){ + top.$.jBox.tip("("+nodes[i].name+")"); + return false; + } + // + // if (nodes[i].module == ""){ top.$.jBox.tip("("+nodes[i].name+")"); return false; }else if (nodes[i].module != "${module}"){ top.$.jBox.tip(""); return false; - }// + }// + // if (nodes[i].name=="" || nodes[i].name=="" ||nodes[i].name==""){ top.$.jBox.tip("("+nodes[i].name+")"); return false; }// - ids.push(nodes[i].id);// + ids.push(nodes[i].id); + // if (nodes[i].id != null ){ $.ajax({ type:"post", @@ -98,23 +111,16 @@ }); - }// + }// + // names.push(nodes[i].name); - //if(nodes[i].type){ - // types.push(nodes[i].type); - //} - // - break; // 如果为非复选框选择,则返回第一个选择 + // + // + break; // 如果为非复选框选择,则返回第一个选择 + // } - if((nodes.length==1)&&(nodes[0].level == 0)&&('true'=='${notAllowSelectRoot}')){ - top.$.jBox.tip("("+nodes[0].name+")"); - return false; - } $("#${id}Id").val(ids.join(",").replace(/u_/ig,"")); - //if(types.length>0){ - // $("#${id}Id").attr('cfgtype',types.join(",")); - //} $("#${id}Id").change();//手动触发change事件,使Id的值得变化可以被监听到 $("#${id}Name").val(names.join(",")); if(!$("#${id}Name").val()&&'${value}'){//如果值不存在,但是value却有值,将placeholder清空 @@ -122,7 +128,6 @@ } }else if (v == "clear"){ $("#${id}Id").val(""); - //$("#${id}Id").removeAttr('cfgtype'); $("#${id}Id").change();//手动触发change事件,使Id的值得变化可以被监听到 $("#${id}Name").val(""); $("#${id}Name").attr("placeholder",""); diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp index b2c42b9f4..e7d26b5c2 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp @@ -131,7 +131,7 @@
diff --git a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp index 1354a18e7..71e4b1bfe 100644 --- a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgForm.jsp @@ -81,6 +81,14 @@ $(this).addClass("hidden"); $(this).find("[name='parent.specServiceId']").removeAttr("name"); $(this).find("[name='parent.specServiceName']").removeAttr("name"); + $(this).find("[name='businessType']").removeAttr("name"); + }else{ + var cfgType=$(this).attr("cfgType"); + if("${specificServiceCfg.parent.specServiceId}"&& "${specificServiceCfg.parent.specServiceId}"!="0"){ + $("#businessType"+cfgType).parents(".businessType").addClass("hidden"); + }else{ + $("#businessType"+cfgType).parents(".businessType").removeClass("hidden"); + } } }); $(".protocol_code").html('*:'); @@ -92,6 +100,15 @@ $(this).addClass("hidden"); $(this).find("[name='parent.specServiceId']").removeAttr("name"); $(this).find("[name='parent.specServiceName']").removeAttr("name"); + $(this).find("[name='businessType']").removeAttr("name"); + }else{ + var cfgType=$(this).attr("cfgType"); + if("${specificServiceCfg.parent.specServiceId}"&& "${specificServiceCfg.parent.specServiceId}"!="0"){ + $("#businessType"+cfgType).parents(".businessType").addClass("hidden"); + }else{ + $("#businessType"+cfgType).parents(".businessType").removeClass("hidden"); + } + } }); if($("[name='cfgType']").val()==1){ @@ -113,13 +130,25 @@ $("[name=cfgType]").val(cfgType); $(".cfgType").each(function(){ if($(this).attr("cfgType")==cfgType){ - $(this).removeClass("hidden"); $("#specificServiceCfg"+cfgType+"Id").attr("name","parent.specServiceId"); $("#specificServiceCfg"+cfgType+"Name").attr("name","parent.specServiceName"); + $("#businessType"+cfgType).attr("name","businessType"); + if($(this).hasClass("businessType")){ + var parentId=$("#specificServiceCfg"+cfgType+"Id").val(); + if(parentId!=0){ + $(this).addClass("hidden"); + }else{ + $(this).removeClass("hidden"); + } + }else{ + $(this).removeClass("hidden"); + } + }else{ $(this).addClass("hidden"); $(this).find("[name='parent.specServiceId']").removeAttr("name"); $(this).find("[name='parent.specServiceName']").removeAttr("name"); + $(this).find("[name='businessType']").removeAttr("name"); } }); if(cfgType==1){ @@ -136,6 +165,15 @@ $(".protocol_desc").html(':'); } }); + $("#specificServiceCfg1Id,#specificServiceCfg2Id,#specificServiceCfg3Id").on("change",function(){ + var cfgType=$(this).parents(".cfgType").attr("cfgType"); + if($(this).val()==0){ + $("#businessType"+cfgType).parents(".businessType").removeClass("hidden"); + }else{ + $("#businessType"+cfgType).selectpicker("val",""); + $("#businessType"+cfgType).parents(".businessType").addClass("hidden"); + } + }); }); @@ -197,6 +235,49 @@
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+
+
@@ -219,6 +300,7 @@
+
@@ -248,7 +330,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp index 304fc1bef..ec8f6f129 100644 --- a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp @@ -213,32 +213,44 @@
- -
-
" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
-
-
-
" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> -
-
- +
+
+ + + + + + + + + + + + + + + + + + + +
+
- -
@@ -258,6 +270,7 @@ + @@ -272,6 +285,29 @@ <%-- ${specificServiceCfg.showSequence} --%> + + + + + + + + + + + + + + + + + + + + + + + <%----%>${specificServiceCfg.specServiceCode}<%----%> ${specificServiceCfg.specServiceName} ${fns:abbr(specificServiceCfg.specServiceDesc,15)}