特定服务增加业务类别

基础协议,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;