|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
@ -30,78 +29,90 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
TerminalsDao terminalsDao;
|
|
|
|
TerminalsDao terminalsDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Cacheable(value = "permission_byuser", key = "#userId")
|
|
|
|
|
|
|
|
public PermissionDetail getIncludeDetail(Integer userId) {
|
|
|
|
|
|
|
|
PermissionDetail detail = permissionService.getPermissionDetail(userId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Cacheable(value = "permissionfull", key = "#userId")
|
|
|
|
|
|
|
|
public PermissionDetail getPermissionDetailFull(Integer userId) {
|
|
|
|
// 全量
|
|
|
|
// 全量
|
|
|
|
List<DyLevel> dyList = dyLevelDao.selectByExample(new DyLevelExample());
|
|
|
|
List<DyLevel> dyList = dyLevelDao.selectByExample(new DyLevelExample());
|
|
|
|
List<Lines> lineList = linesDao.selectByExample(new LinesExample());
|
|
|
|
List<Lines> lineList = linesDao.selectByExample(new LinesExample());
|
|
|
|
List<Towers> towerList = towerDao.selectByExample(new TowersExample());
|
|
|
|
List<Towers> towerList = towerDao.selectByExample(new TowersExample());
|
|
|
|
List<Terminals> terminalList = terminalsDao.selectByExample(new TerminalsExample());
|
|
|
|
List<Terminals> terminalList = terminalsDao.selectByExample(new TerminalsExample());
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<Integer, DyLevel> dyMap = new HashMap<>();
|
|
|
|
this.mountList(dyList, lineList, towerList, terminalList);
|
|
|
|
HashMap<Integer, Lines> lineMap = new HashMap<>();
|
|
|
|
|
|
|
|
HashMap<Integer, Towers> towerMap = new HashMap<>();
|
|
|
|
this.setCheck(dyList, lineList, towerList, terminalList, userId);
|
|
|
|
HashMap<Integer, Terminals> terminalMap = new HashMap<>();
|
|
|
|
|
|
|
|
// 做map
|
|
|
|
// 构造结果
|
|
|
|
|
|
|
|
PermissionDetail detail = new PermissionDetail();
|
|
|
|
|
|
|
|
detail.setUid(userId);
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
if (detail.hasDyId(dy.getId())) {
|
|
|
|
if (dy.isChecked()) {
|
|
|
|
dy.setInclude(true);
|
|
|
|
detail.getDypList().add(dy.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dyMap.put(dy.getId(), dy);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Lines line : lineList) {
|
|
|
|
for (Lines line : lineList) {
|
|
|
|
if (detail.hasLineId(line.getId())) {
|
|
|
|
if (line.isChecked()) {
|
|
|
|
line.setInclude(true);
|
|
|
|
detail.getLinepList().add(line.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lineMap.put(line.getId(), line);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
if (detail.hasTowerId(tower.getId())) {
|
|
|
|
if (tower.isChecked()) {
|
|
|
|
tower.setInclude(true);
|
|
|
|
detail.getTowerpList().add(tower.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
towerMap.put(tower.getId(), tower);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
if (detail.hasTermId(terminal.getId())) {
|
|
|
|
if (terminal.isChecked()) {
|
|
|
|
terminal.setInclude(true);
|
|
|
|
detail.getTermpList().add(terminal.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
terminalMap.put(terminal.getId(), terminal);
|
|
|
|
}
|
|
|
|
|
|
|
|
return detail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 一层挂上一层
|
|
|
|
private void setCheck(List<DyLevel> dyList, List<Lines> lineList,
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
List<Towers> towerList, List<Terminals> terminalList,
|
|
|
|
Integer towerId = terminal.getTowerId();
|
|
|
|
Integer userId) {
|
|
|
|
if (towerId != null) {
|
|
|
|
PermissionDetail detail = permissionService.getPermissionDetail(userId);
|
|
|
|
Towers tower = towerMap.get(towerId);
|
|
|
|
|
|
|
|
if (tower != null) {
|
|
|
|
// 勾选选中的
|
|
|
|
tower.getList().add(terminal);
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
|
|
|
|
if (detail.hasDyId(dy.getId())) {
|
|
|
|
|
|
|
|
dy.setCheck(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Lines line : lineList) {
|
|
|
|
|
|
|
|
if (detail.hasLineId(line.getId())) {
|
|
|
|
|
|
|
|
line.setCheck(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
|
|
|
|
Integer lineId = tower.getLineid();
|
|
|
|
|
|
|
|
if (lineId != null) {
|
|
|
|
|
|
|
|
Lines line = lineMap.get(lineId);
|
|
|
|
|
|
|
|
if (line != null) {
|
|
|
|
|
|
|
|
line.getList().add(tower);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
|
|
|
|
if (detail.hasTowerId(tower.getId())) {
|
|
|
|
|
|
|
|
tower.setCheck(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Lines line : lineList) {
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
Integer dyLevelId = line.getDyLevelId();
|
|
|
|
if (detail.hasTermId(terminal.getId())) {
|
|
|
|
if (dyLevelId != null) {
|
|
|
|
terminal.setChecked(true);
|
|
|
|
DyLevel dyLevel = dyMap.get(dyLevelId);
|
|
|
|
|
|
|
|
if (dyLevel != null) {
|
|
|
|
|
|
|
|
dyLevel.getList().add(line);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 找出相关的
|
|
|
|
@Override
|
|
|
|
detail = new PermissionDetail();
|
|
|
|
@Cacheable(value = "permissionover", key = "#userId")
|
|
|
|
|
|
|
|
public PermissionDetail getPermissionDetailOver(Integer userId) {
|
|
|
|
|
|
|
|
// 全量
|
|
|
|
|
|
|
|
List<DyLevel> dyList = dyLevelDao.selectByExample(new DyLevelExample());
|
|
|
|
|
|
|
|
List<Lines> lineList = linesDao.selectByExample(new LinesExample());
|
|
|
|
|
|
|
|
List<Towers> towerList = towerDao.selectByExample(new TowersExample());
|
|
|
|
|
|
|
|
List<Terminals> terminalList = terminalsDao.selectByExample(new TerminalsExample());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.mountList(dyList, lineList, towerList, terminalList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setCheck(dyList, lineList, towerList, terminalList, userId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构造结果
|
|
|
|
|
|
|
|
PermissionDetail detail = new PermissionDetail();
|
|
|
|
|
|
|
|
detail.setUid(userId);
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
if (dy.checkInclude()) {
|
|
|
|
if (dy.checkInclude()) {
|
|
|
|
detail.getDypList().add(dy.getId());
|
|
|
|
detail.getDypList().add(dy.getId());
|
|
|
@ -133,11 +144,18 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
List<Lines> lineList = linesDao.selectByExample(new LinesExample());
|
|
|
|
List<Lines> lineList = linesDao.selectByExample(new LinesExample());
|
|
|
|
List<Towers> towerList = towerDao.selectByExample(new TowersExample());
|
|
|
|
List<Towers> towerList = towerDao.selectByExample(new TowersExample());
|
|
|
|
List<Terminals> terminalList = terminalsDao.selectByExample(new TerminalsExample());
|
|
|
|
List<Terminals> terminalList = terminalsDao.selectByExample(new TerminalsExample());
|
|
|
|
if (CollectionUtil.isNotEmpty(dyList)) {
|
|
|
|
|
|
|
|
|
|
|
|
this.mountList(dyList, lineList, towerList, terminalList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dyList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 一层挂上一层
|
|
|
|
|
|
|
|
private void mountList(List<DyLevel> dyList, List<Lines> lineList,
|
|
|
|
|
|
|
|
List<Towers> towerList, List<Terminals> terminalList) {
|
|
|
|
HashMap<Integer, DyLevel> dyMap = new HashMap<>();
|
|
|
|
HashMap<Integer, DyLevel> dyMap = new HashMap<>();
|
|
|
|
HashMap<Integer, Lines> lineMap = new HashMap<>();
|
|
|
|
HashMap<Integer, Lines> lineMap = new HashMap<>();
|
|
|
|
HashMap<Integer, Towers> towerMap = new HashMap<>();
|
|
|
|
HashMap<Integer, Towers> towerMap = new HashMap<>();
|
|
|
|
HashMap<Integer, Terminals> terminalMap = new HashMap<>();
|
|
|
|
|
|
|
|
// 做map
|
|
|
|
// 做map
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
for (DyLevel dy : dyList) {
|
|
|
|
dyMap.put(dy.getId(), dy);
|
|
|
|
dyMap.put(dy.getId(), dy);
|
|
|
@ -148,9 +166,6 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
for (Towers tower : towerList) {
|
|
|
|
towerMap.put(tower.getId(), tower);
|
|
|
|
towerMap.put(tower.getId(), tower);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
|
|
|
|
terminalMap.put(terminal.getId(), terminal);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 一层挂上一层
|
|
|
|
// 一层挂上一层
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
|
for (Terminals terminal : terminalList) {
|
|
|
@ -181,7 +196,4 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dyList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|