隐藏isLeaf字段,修复insert没加businessType字段

This commit is contained in:
wangxin
2018-08-23 15:10:21 +08:00
parent 190b90099b
commit ac21f74043
3 changed files with 67 additions and 75 deletions

View File

@@ -195,7 +195,7 @@ public class SpecificServiceCfgController extends BaseController {
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "treeData") @RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide, public List<Map<String, Object>> treeData(@RequestParam(required=false)Boolean specific,@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){ @RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList(); List<Map<String, Object>> mapList = Lists.newArrayList();
Map<String, Object> map2 = Maps.newHashMap(); Map<String, Object> map2 = Maps.newHashMap();
@@ -206,84 +206,76 @@ public class SpecificServiceCfgController extends BaseController {
map2.put("name","root_node"); map2.put("name","root_node");
//map2.put("placeholder","0"); //map2.put("placeholder","0");
mapList.add(map2); mapList.add(map2);
Properties props=this.getMsgProp(); if(specific==null||!specific) {
List<SysDataDictionaryItem> businessTypeList=Lists.newArrayList(); Properties props=this.getMsgProp();
if(cfgType==1) { List<SysDataDictionaryItem> businessTypeList=Lists.newArrayList();
businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE"); if(cfgType==1) {
}else if(cfgType==3) { businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE");
businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE"); }else if(cfgType==3) {
} businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE");
List<Map<String, Object>> businessList = Lists.newArrayList(); }
for(SysDataDictionaryItem dict:businessTypeList) { List<Map<String, Object>> businessList = Lists.newArrayList();
Map<String, Object> map = Maps.newHashMap(); for(SysDataDictionaryItem dict:businessTypeList) {
map.put("id", "businessType"+dict.getItemCode()); Map<String, Object> map = Maps.newHashMap();
map.put("pId", 0); map.put("id", "businessType"+dict.getItemCode());
map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue())); map.put("pId", 0);
map.put("serviceType",cfgType); map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue()));
map.put("businessType","-1"); map.put("serviceType",cfgType);
map.put("nodes", new ArrayList<Map<String, Object>>()); map.put("businessType","-1");
businessList.add(map); businessList.add(map);
} }
mapList.addAll(businessList); mapList.addAll(businessList);
List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),""); List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
for (int i=0; i<list.size(); i++){ for (int i=0; i<list.size(); i++){
SpecificServiceCfg specificServiceCfg = list.get(i); SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){ if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)|| if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))|| (!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
(cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){ (cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
continue; continue;
} }
if(businessTypeList.size()>0) { if(businessTypeList.size()>0) {
for(SysDataDictionaryItem business:businessTypeList) { for(SysDataDictionaryItem business:businessTypeList) {
if(String.valueOf(business.getItemCode()).equals(specificServiceCfg.getBusinessType())) { if(String.valueOf(business.getItemCode()).equals(specificServiceCfg.getBusinessType())) {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId()); map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", "businessType"+business.getItemCode()); map.put("pId", "businessType"+business.getItemCode());
map.put("name",specificServiceCfg.getSpecServiceName()); map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType()); map.put("serviceType",specificServiceCfg.getCfgType());
map.put("businessType",specificServiceCfg.getBusinessType()); map.put("businessType",specificServiceCfg.getBusinessType());
mapList.add(map); mapList.add(map);
break; 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);
}
}
}
}else {
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;
} }
}else {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId()); map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName()); map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType()); map.put("type",specificServiceCfg.getCfgType());
mapList.add(map); 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); // map2.put("nodes", businessList);
return mapList; return mapList;
} }

View File

@@ -164,8 +164,8 @@
<!-- 新增 --> <!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true"> <insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type) insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type,business_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType}) values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType},#{businessType})
</insert> </insert>
<!-- 修改 --> <!-- 修改 -->

View File

@@ -226,11 +226,11 @@
<div class="col-md-4"> <div class="col-md-4">
<c:if test="${empty specificServiceCfg.specServiceId}"> <c:if test="${empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${fatherName}" title="${dict.itemValue}" <sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${fatherName}" title="${dict.itemValue}"
url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/> url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}&specific=true" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if> </c:if>
<c:if test="${not empty specificServiceCfg.specServiceId}"> <c:if test="${not empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.cfgType eq dict.itemCode?specificServiceCfg.parent.specServiceId:0}" labelName="parent.specServiceName" labelValue="${(specificServiceCfg.cfgType eq dict.itemCode and specificServiceCfg.parent.specServiceId ne '0')?fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName:fatherName}" <sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.cfgType eq dict.itemCode?specificServiceCfg.parent.specServiceId:0}" labelName="parent.specServiceName" labelValue="${(specificServiceCfg.cfgType eq dict.itemCode and specificServiceCfg.parent.specServiceId ne '0')?fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName:fatherName}"
title="${dict.itemValue}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/> title="${dict.itemValue}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}&specific=true" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if> </c:if>
</div> </div>
<div for="parent.specServiceName"></div> <div for="parent.specServiceName"></div>
@@ -301,7 +301,7 @@
<div for="groupId"></div> <div for="groupId"></div>
</div> </div>
<div class="form-group"> <div class="form-group hidden">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label> <label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4"> <div class="col-md-4">
<form:select path="isLeaf" class="form-control leafChange"> <form:select path="isLeaf" class="form-control leafChange">