融合代码 提交本地

This commit is contained in:
zhangshilin
2018-03-28 13:05:56 +08:00
parent 7f1cbee49b
commit 6e533fca41
10 changed files with 79 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
package com.nis.web.controller.basics;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -396,14 +397,42 @@ public class ServiceDictInfoController extends BaseController {
}
}else{
ServiceDictInfo c = serviceDictInfoService.getDictById(currentId);
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
return true;
if(p.getLevelNo()<max){
//查出该类所有下级的层级数之和
List<ServiceDictInfo> list = serviceDictInfoService.getDictByParentId(currentId);
if(list==null||list.size()==0){
return true;
}
List<ServiceDictInfo> resultList = Lists.newArrayList();
List<Integer> intList = Lists.newArrayList();
allTreeNode(1,list,resultList);
for(ServiceDictInfo se:resultList){
intList.add(se.getLevelNo());
}
int x = Collections.max(intList);
if((p.getLevelNo()+x)<(max+1)){
return true;
}
}
}
}
return false;
}
/**
* 查出所该节点下有树形子节点
*/
void allTreeNode(Integer levelNo, List<ServiceDictInfo> list,List<ServiceDictInfo> resultList){
if(list!=null&&list.size()>0){
for(ServiceDictInfo se:list){
se.setLevelNo(levelNo+1);
resultList.add(se);
List<ServiceDictInfo> newList = serviceDictInfoService.getDictByParentId(se.getServiceDictId());
allTreeNode(se.getLevelNo(),newList,resultList);
}
}
}
}