Browse Source

添加防止死循环逻辑

master
Jackwang 4 years ago
parent
commit
d4cf387bf2
  1. 8
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/ModuleTypeServiceImpl.java

8
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/ModuleTypeServiceImpl.java

@ -291,8 +291,10 @@ public class ModuleTypeServiceImpl extends BaseServiceImpl<ModuleTypeDao, Module
JSONObject childNode; JSONObject childNode;
// 存放其余未处理的类别(节点) // 存放其余未处理的类别(节点)
List<ModuleOptionDTO> others = this.getOtherDept(deptList, parent); List<ModuleOptionDTO> others = this.getOtherDept(deptList, parent);
int startSize = 0;
while (!others.isEmpty()) { int endSize = others.size();
while (!others.isEmpty() && startSize != endSize) {
startSize = endSize;
for (int i = 0; i < parent.size(); i++) { for (int i = 0; i < parent.size(); i++) {
node = parent.getJSONObject(i); node = parent.getJSONObject(i);
children = new JSONArray(); children = new JSONArray();
@ -312,7 +314,7 @@ public class ModuleTypeServiceImpl extends BaseServiceImpl<ModuleTypeDao, Module
parent = allChildren; parent = allChildren;
others = this.getOtherDept(others, parent); others = this.getOtherDept(others, parent);
endSize = others.size();
} }
//存放到redis中 //存放到redis中
ModuleOption option = new ModuleOption(); ModuleOption option = new ModuleOption();

Loading…
Cancel
Save