|
|
|
@ -1,18 +1,15 @@
|
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
import com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.LineAndTerminalWithHeartDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.TerminalsWithHeart;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.enums.CommonStatus;
|
|
|
|
|
import com.shxy.xymanager_common.enums.PermissionDetailEnum;
|
|
|
|
|
import com.shxy.xymanager_common.exception.ApiException;
|
|
|
|
|
import com.shxy.xymanager_common.exception.Asserts;
|
|
|
|
|
import com.shxy.xymanager_common.model.PermissionDyLineTreeListModel;
|
|
|
|
|
import com.shxy.xymanager_common.util.XyNumberUtils;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
|
import com.shxy.xymanager_service.service.RoleService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -21,9 +18,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static com.shxy.xymanager_common.constant.Constants.SUPER_ADMIN;
|
|
|
|
@ -172,7 +169,6 @@ public class RoleServiceImpl implements RoleService {
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<PermissionDyLineTreeListModel> getPermissionTree() {
|
|
|
|
|
PermissionDyLineTreeListModel model = new PermissionDyLineTreeListModel();
|
|
|
|
|
List<DyLineAndTerminalWithHeartDto> list = dyLevelDao.selectPermissionListTreeList();
|
|
|
|
|
List<DyLevel> dyLevels = dyLevelDao.selectByExample(new DyLevelExample());
|
|
|
|
|
List<Lines> lines = linesDao.selectByExample(new LinesExample());
|
|
|
|
|
List<Towers> towers = towerDao.selectByExample(new TowersExample());
|
|
|
|
@ -183,29 +179,56 @@ public class RoleServiceImpl implements RoleService {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
model.setList(dyLevels);
|
|
|
|
|
for (DyLevel dyLevel : dyLevels) {
|
|
|
|
|
Integer dyid = dyLevel.getId();
|
|
|
|
|
for (Lines line : lines) {
|
|
|
|
|
Integer linedyLevelId = line.getDyLevelId();
|
|
|
|
|
if (XyNumberUtils.compare(dyid, linedyLevelId) == 0) {
|
|
|
|
|
dyLevel.getList().add(line);
|
|
|
|
|
HashMap<Integer, DyLevel> dymap = new HashMap<>();
|
|
|
|
|
HashMap<Integer, Lines> linemap = new HashMap<>();
|
|
|
|
|
HashMap<Integer, Towers> towermap = new HashMap<>();
|
|
|
|
|
HashMap<Integer, Terminals> termmap = new HashMap<>();
|
|
|
|
|
for (DyLevel ditem : dyLevels) {
|
|
|
|
|
dymap.put(ditem.getId(), ditem);
|
|
|
|
|
}
|
|
|
|
|
for (Lines litem : lines) {
|
|
|
|
|
linemap.put(litem.getId(), litem);
|
|
|
|
|
}
|
|
|
|
|
for (Towers titem : towers) {
|
|
|
|
|
towermap.put(titem.getId(), titem);
|
|
|
|
|
}
|
|
|
|
|
for (Terminals termitem : terminals) {
|
|
|
|
|
termmap.put(termitem.getId(), termitem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Terminals termitem : terminals) {
|
|
|
|
|
Integer towerid = termitem.getTowerid();
|
|
|
|
|
if (towerid != null) {
|
|
|
|
|
Towers towers1 = towermap.get(towerid);
|
|
|
|
|
if (BeanUtil.isNotEmpty(towers1)) {
|
|
|
|
|
towers1.getList().add(termitem);
|
|
|
|
|
}
|
|
|
|
|
for (Towers tower : towers) {
|
|
|
|
|
Integer towerlineId = tower.getLineId();
|
|
|
|
|
Integer towerId = tower.getId();
|
|
|
|
|
if (XyNumberUtils.compare(towerlineId, towerId) == 0) {
|
|
|
|
|
line.getList().add(tower);
|
|
|
|
|
}
|
|
|
|
|
for (Terminals term : terminals) {
|
|
|
|
|
Integer termtowerid = term.getTowerid();
|
|
|
|
|
if (XyNumberUtils.compare(termtowerid, towerId) == 0) {
|
|
|
|
|
tower.getList().add(term);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Towers titem : towers) {
|
|
|
|
|
Integer lineId = titem.getLineId();
|
|
|
|
|
if (lineId != null) {
|
|
|
|
|
Lines lines1 = linemap.get(lineId);
|
|
|
|
|
if (BeanUtil.isNotEmpty(lines1)) {
|
|
|
|
|
lines1.getList().add(titem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Lines litem : lines) {
|
|
|
|
|
Integer dyLevelId = litem.getDyLevelId();
|
|
|
|
|
if (dyLevelId != null) {
|
|
|
|
|
DyLevel dyLevel = dymap.get(dyLevelId);
|
|
|
|
|
if (BeanUtil.isNotEmpty(dyLevel)) {
|
|
|
|
|
dyLevel.getList().add(litem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<DyLevel> dyLevellist = new ArrayList<>(dymap.values());
|
|
|
|
|
model.setList(dyLevellist);
|
|
|
|
|
}
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
|
|
|
|
|