|
@@ -17,6 +17,7 @@ import com.ruoyi.ems.service.IMeterDeviceService;
|
|
|
import com.ruoyi.ems.util.AreaUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -119,9 +120,11 @@ public class MeterDeviceController extends BaseController {
|
|
|
.collect(Collectors.groupingBy(MeterDevice::getLocationRef, Collectors.toList()));
|
|
|
|
|
|
for (Area area : areas) {
|
|
|
+ boolean flag = false;
|
|
|
List<TreeEntity> childList = new ArrayList<>();
|
|
|
|
|
|
if (groupMap.containsKey(area.getAreaCode())) {
|
|
|
+ flag = true;
|
|
|
TreeEntity local = new TreeEntity();
|
|
|
local.setLabel("本级");
|
|
|
local.setChildren(convertToTreeEntity(groupMap.get(area.getAreaCode())));
|
|
@@ -134,21 +137,23 @@ public class MeterDeviceController extends BaseController {
|
|
|
for (Object obj : childAreas) {
|
|
|
Area child = (Area) obj;
|
|
|
String childCode = child.getAreaCode();
|
|
|
- TreeEntity local = new TreeEntity();
|
|
|
- local.setLabel(child.getAreaName());
|
|
|
|
|
|
if (null != groupMap.get(childCode)) {
|
|
|
+ flag = true;
|
|
|
+ TreeEntity local = new TreeEntity();
|
|
|
+ local.setLabel(child.getAreaName());
|
|
|
local.setChildren(convertToTreeEntity(groupMap.get(childCode)));
|
|
|
+ childList.add(local);
|
|
|
}
|
|
|
-
|
|
|
- childList.add(local);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- TreeEntity treeNode = new TreeEntity();
|
|
|
- treeNode.setLabel(area.getAreaName());
|
|
|
- treeNode.setChildren(childList);
|
|
|
- retList.add(treeNode);
|
|
|
+ if (flag) {
|
|
|
+ TreeEntity treeNode = new TreeEntity();
|
|
|
+ treeNode.setLabel(area.getAreaName());
|
|
|
+ treeNode.setChildren(childList);
|
|
|
+ retList.add(treeNode);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return success(retList);
|