特定服务增加业务类别

基础协议,app策略以及app特征点击选择时展示业务类别的树
This commit is contained in:
wangxin
2018-08-22 19:48:20 +08:00
parent 03f78fc535
commit abca1b273c
9 changed files with 249 additions and 46 deletions

View File

@@ -30,7 +30,14 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
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;
}

View File

@@ -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<SysDataDictionaryItem> businessTypeList=Lists.newArrayList();
if(cfgType==1) {
businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE");
}else if(cfgType==3) {
businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE");
}
List<Map<String, Object>> businessList = Lists.newArrayList();
for(SysDataDictionaryItem dict:businessTypeList) {
Map<String, Object> 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<Map<String, Object>>());
businessList.add(map);
}
mapList.addAll(businessList);
List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
for (int i=0; i<list.size(); i++){
SpecificServiceCfg specificServiceCfg = list.get(i);
@@ -210,14 +234,57 @@ public class SpecificServiceCfgController extends BaseController {
(cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
continue;
}
Map<String, Object> 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<String, Object> business:businessList) {
if(String.valueOf(business.get("id")).equals(specificServiceCfg.getBusinessType())) {
Map<String, Object> 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<String, Object> 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<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
//
// for (int i=0; i<list.size(); i++){
// SpecificServiceCfg specificServiceCfg = list.get(i);
// if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
// if(specificServiceCfg.getIsValid().equals(0)||
// (!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
// (cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
// continue;
// }
// for(Map<String, Object> business:businessList) {
// if(String.valueOf(business.get("id")).equals(specificServiceCfg.getBusinessType())) {
// Map<String, Object> 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<Map<String, Object>>)business.get("nodes")).add(map);
// break;
// }
// }
//
//
// }
// }
// map2.put("nodes", businessList);
return mapList;
}
/**

View File

@@ -12,6 +12,7 @@
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="INTEGER" />
<result column="business_type" property="businessType" jdbcType="VARCHAR" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.specific.SpecificServiceCfg">
<id column="parent_id" property="specServiceId" jdbcType="INTEGER" />
@@ -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
</sql>
@@ -73,6 +75,9 @@
<if test="cfgType != null and cfgType != '' ">
AND cfg_type =#{cfgType,jdbcType=INTEGER}
</if>
<if test="businessType != null and businessType != '' ">
AND business_type =#{businessType,jdbcType=VARCHAR}
</if>
<if test="beginDate != null" >
AND s.op_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
@@ -138,6 +143,9 @@
<if test="specificServiceCfg.isLeaf != null and specificServiceCfg.isLeaf != '' ">
AND is_leaf = #{specificServiceCfg.isLeaf}
</if>
<if test="specificServiceCfg.businessType != null and specificServiceCfg.businessType != '' ">
AND business_type =#{specificServiceCfg.businessType}
</if>
<if test="specificServiceCfg.beginDate != null">
AND op_time &gt; #{specificServiceCfg.beginDate}
</if>
@@ -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}
</update>

View File

@@ -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;

View File

@@ -0,0 +1 @@
ALTER TABLE specific_service_cfg ADD COLUMN business_type VARCHAR(10) NULL COMMENT '业务分类';

View File

@@ -55,30 +55,43 @@
}else{
nodes = tree.getSelectedNodes();
}
for(var i=0; i<nodes.length; i++) {//<c:if test="${checked && notAllowSelectParent}">
//wx提示c:if标签前加了//注释,c:if标签的判断条件仍会生效
for(var i=0; i<nodes.length; i++) {
//<c:if test="${checked && notAllowSelectParent}">
if (nodes[i].isParent && "${checkedPS}"!=''){
continue; // 如果为复选框选择,并且父子节点有关联,则过滤掉父节点
}//</c:if><c:if test="${notAllowSelectRoot}">
}//</c:if>
//<c:if test="${notAllowSelectRoot}">
if (nodes[i].level == 0){
top.$.jBox.tip("<spring:message code='no_root'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}//</c:if><c:if test="${notAllowSelectParent}">
}//</c:if>
//<c:if test="${notAllowSelectParent}">
if (nodes[i].isParent){
top.$.jBox.tip("<spring:message code='no_parent'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}//</c:if><c:if test="${not empty module && selectScopeModule}">
}
//wx: 带有business属性的节点特殊处理
if(nodes[i].businessType&&nodes[i].businessType==-1){
top.$.jBox.tip("<spring:message code='no_parent'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}
//</c:if>
//<c:if test="${not empty module && selectScopeModule}">
if (nodes[i].module == ""){
top.$.jBox.tip("<spring:message code='no_public_model'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}else if (nodes[i].module != "${module}"){
top.$.jBox.tip("<spring:message code='no_outside_column'/><spring:message code='reselect'/>");
return false;
}//</c:if><c:if test="${selectDepartment}">
}//</c:if>
//<c:if test="${selectDepartment}">
if (nodes[i].name=="<spring:message code='send_org'/>" || nodes[i].name=="<spring:message code='department'/>" ||nodes[i].name=="<spring:message code='sendind_org'/>"){
top.$.jBox.tip("<spring:message code='no_node'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}//</c:if>
ids.push(nodes[i].id);//<c:if test="${showParentName}">
ids.push(nodes[i].id);
//<c:if test="${showParentName}">
if (nodes[i].id != null ){
$.ajax({
type:"post",
@@ -98,23 +111,16 @@
});
}//</c:if><c:if test="${!showParentName}">
}//</c:if>
//<c:if test="${!showParentName}">
names.push(nodes[i].name);
//if(nodes[i].type){
// types.push(nodes[i].type);
//}
//</c:if><c:if test="${!checked}">
break; // 如果为非复选框选择,则返回第一个选择 </c:if>
//</c:if>
//<c:if test="${!checked}">
break; // 如果为非复选框选择,则返回第一个选择
//</c:if>
}
if((nodes.length==1)&&(nodes[0].level == 0)&&('true'=='${notAllowSelectRoot}')){
top.$.jBox.tip("<spring:message code='no_root'/>"+nodes[0].name+"<spring:message code='reselect'/>");
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","");

View File

@@ -131,7 +131,7 @@
<div class="pull-left">
<c:set var="spec_service_id"><spring:message code="social_app"/></c:set>
<sys:treeselect id="specServiceId" name="specServiceId" value="${cfg.specServiceId}"
labelName="parent.specServiceName"
labelName="parent.specServiceName" notAllowSelectRoot="true" notAllowSelectParent="true"
labelValue="${empty cfg.specServiceId?spec_service_id:fns:getBySpecServiceId(cfg.specServiceId).specServiceName}"
title="${spec_service_id}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${app}" extId=""
cssClass="form-control input-small"/>

View File

@@ -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('<font color="red">*</font><spring:message code="app_code"/>:');
@@ -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('<spring:message code="protocol_desc"/>:');
}
});
$("#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");
}
});
});
</script>
</head>
@@ -197,6 +235,49 @@
</div>
<div for="parent.specServiceName"></div>
</div>
<div class="form-group cfgType businessType
<c:if test='${specificServiceCfg.parent.specServiceId ne null or specificServiceCfg.parent.specServiceId ne 0}'>hidden</c:if>" cfgType="${dict.itemCode}">
<c:if test="${dict.itemCode==1}">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="app_business_type"/>:</label>
<div class="col-md-4">
<select id="businessType1" name="businessType" class="form-control required">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('APP_BUSINESS_TYPE')}" var="dict">
<option value="${dict.itemCode}"
<c:if test="${dict.itemCode==specificServiceCfg.businessType}">selected</c:if>
><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
</c:if>
<c:if test="${dict.itemCode==3}">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="basic_protocol_business_type"/>:</label>
<div class="col-md-4">
<select id="businessType3" name="businessType" class="form-control required">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('BASIC_PROTOCOL_BUSINESS_TYPE')}" var="dict">
<option value="${dict.itemCode}"
<c:if test="${dict.itemCode==specificServiceCfg.businessType}">selected</c:if>
><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
</c:if>
<c:if test="${dict.itemCode==2}">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="tunnel_behavior_business_type"/>:</label>
<div class="col-md-4">
<select id="businessType2" name="businessType" class="form-control required">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('TUNNEL_BEHAV_BUSINESS_TYPE')}" var="dict">
<option value="${dict.itemCode}"
<c:if test="${dict.itemCode==specificServiceCfg.businessType or (specificServiceCfg.parent.specServiceId eq null or specificServiceCfg.parent.specServiceId eq 0)}">selected</c:if>
><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
</c:if>
<div for="businessType"></div>
</div>
</c:forEach>
<div class="form-group">
<label class="col-md-3 control-label protocol_code"><font color="red">*</font><spring:message code="protocol_code"/>:</label>
@@ -219,6 +300,7 @@
</div>
<div for="groupId"></div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">
@@ -248,7 +330,7 @@
<div class="row">
<div class="col-md-offset-3 col-md-9">
<shiro:hasPermission name="specific:service:edit"><button type="submit" class="btn btn-circle blue"><spring:message code="submit"/></button></shiro:hasPermission>
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)"><spring:message code="cancel"/></button>
<button type="button" class="btn btn-circle grey-salsa btn-outline" id="cancel" ><spring:message code="cancel"/></button>
</div>
</div>
</div>

View File

@@ -213,32 +213,44 @@
<!-- 筛选搜索内容栏默认隐藏-->
<div class="col-md-12 filter-action-select-panle hide" >
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="operate_time"/></label>
<input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${specificServiceCfg.beginDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>&nbsp;</label>
<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${specificServiceCfg.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="business_type"/></label>
<form:select path="businessType" class="selectpicker select2 input-middle" >
<form:option value=""><spring:message code='business_type'/></form:option>
<c:if test="${specificServiceCfg.cfgType==1}">
<c:forEach items="${fns:getDictList('APP_BUSINESS_TYPE') }" var="dict">
<form:option value="${dict.itemCode}"><spring:message code='${dict.itemValue}'/></form:option>
</c:forEach>
</c:if>
<c:if test="${specificServiceCfg.cfgType==2}">
<c:forEach items="${fns:getDictList('TUNNEL_BEHAV_BUSINESS_TYPE') }" var="dict">
<form:option value="${dict.itemCode}"><spring:message code='${dict.itemValue}'/></form:option>
</c:forEach>
</c:if>
<c:if test="${specificServiceCfg.cfgType==3}">
<c:forEach items="${fns:getDictList('BASIC_PROTOCOL_BUSINESS_TYPE') }" var="dict">
<form:option value="${dict.itemCode}"><spring:message code='${dict.itemValue}'/></form:option>
</c:forEach>
</c:if>
</form:select>
</div>
</div>
</div>
</div>
<!-- /筛选搜索内容栏 结束-->
@@ -258,6 +270,7 @@
<tr>
<th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th>
<!-- <th>序号</th> -->
<th><spring:message code="business_type"/></th>
<th><spring:message code="protocol_code"/></th>
<th><spring:message code="protocol_name"/></th>
<th><spring:message code="protocol_desc"/></th>
@@ -272,6 +285,29 @@
<tr id="${specificServiceCfg.specServiceId}" pId="${specificServiceCfg.parent.specServiceId ne 0?specificServiceCfg.parent.specServiceId:0}">
<td><input type="checkbox" class="ckbox" name="check" value="${specificServiceCfg.specServiceId}"></td>
<%-- <td>${specificServiceCfg.showSequence}</td> --%>
<td title="${specificServiceCfg.businessType}">
<c:if test="${specificServiceCfg.cfgType==1}">
<c:forEach items="${fns:getDictList('APP_BUSINESS_TYPE') }" var="dict">
<c:if test="${specificServiceCfg.businessType==dict.itemCode}">
<spring:message code="${dict.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
<c:if test="${specificServiceCfg.cfgType==2}">
<c:forEach items="${fns:getDictList('TUNNEL_BEHAV_BUSINESS_TYPE') }" var="dict">
<c:if test="${specificServiceCfg.businessType==dict.itemCode}">
<spring:message code="${dict.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
<c:if test="${specificServiceCfg.cfgType==3}">
<c:forEach items="${fns:getDictList('BASIC_PROTOCOL_BUSINESS_TYPE') }" var="dict">
<c:if test="${specificServiceCfg.businessType==dict.itemCode}">
<spring:message code="${dict.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<td nowrap><i class="icon-icon-tablet"></i><%--<a href="${ctx}/specific/specificServiceCfg/form?specServiceId=${specificServiceCfg.specServiceId}&doAction=0">--%>${specificServiceCfg.specServiceCode}<%--</a>--%></td>
<td title="${specificServiceCfg.specServiceName}">${specificServiceCfg.specServiceName}</td>
<td title="${specificServiceCfg.specServiceDesc}">${fns:abbr(specificServiceCfg.specServiceDesc,15)}</td>